[Orxonox-commit 3713] r8393 - in code/trunk/src/external/bullet: . BulletCollision BulletCollision/BroadphaseCollision BulletCollision/CollisionDispatch BulletCollision/CollisionShapes BulletCollision/NarrowPhaseCollision BulletDynamics/Character BulletDynamics/ConstraintSolver BulletDynamics/Dynamics BulletDynamics/Vehicle LinearMath
rgrieder at orxonox.net
rgrieder at orxonox.net
Tue May 3 05:07:44 CEST 2011
Author: rgrieder
Date: 2011-05-03 05:07:42 +0200 (Tue, 03 May 2011)
New Revision: 8393
Added:
code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btConvexPolyhedron.cpp
code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btConvexPolyhedron.h
code/trunk/src/external/bullet/BulletCollision/NarrowPhaseCollision/btPolyhedralContactClipping.cpp
code/trunk/src/external/bullet/BulletCollision/NarrowPhaseCollision/btPolyhedralContactClipping.h
code/trunk/src/external/bullet/LinearMath/btConvexHullComputer.cpp
code/trunk/src/external/bullet/LinearMath/btConvexHullComputer.h
Modified:
code/trunk/src/external/bullet/Bullet-C-Api.h
code/trunk/src/external/bullet/BulletCollision/BroadphaseCollision/btAxisSweep3.h
code/trunk/src/external/bullet/BulletCollision/BroadphaseCollision/btBroadphaseInterface.h
code/trunk/src/external/bullet/BulletCollision/BroadphaseCollision/btBroadphaseProxy.h
code/trunk/src/external/bullet/BulletCollision/BroadphaseCollision/btCollisionAlgorithm.h
code/trunk/src/external/bullet/BulletCollision/BroadphaseCollision/btDispatcher.h
code/trunk/src/external/bullet/BulletCollision/BroadphaseCollision/btOverlappingPairCache.h
code/trunk/src/external/bullet/BulletCollision/BroadphaseCollision/btQuantizedBvh.h
code/trunk/src/external/bullet/BulletCollision/BroadphaseCollision/btSimpleBroadphase.h
code/trunk/src/external/bullet/BulletCollision/CMakeLists.txt
code/trunk/src/external/bullet/BulletCollision/CollisionDispatch/SphereTriangleDetector.cpp
code/trunk/src/external/bullet/BulletCollision/CollisionDispatch/SphereTriangleDetector.h
code/trunk/src/external/bullet/BulletCollision/CollisionDispatch/btBox2dBox2dCollisionAlgorithm.h
code/trunk/src/external/bullet/BulletCollision/CollisionDispatch/btBoxBoxCollisionAlgorithm.h
code/trunk/src/external/bullet/BulletCollision/CollisionDispatch/btBoxBoxDetector.h
code/trunk/src/external/bullet/BulletCollision/CollisionDispatch/btCollisionConfiguration.h
code/trunk/src/external/bullet/BulletCollision/CollisionDispatch/btCollisionCreateFunc.h
code/trunk/src/external/bullet/BulletCollision/CollisionDispatch/btCollisionDispatcher.cpp
code/trunk/src/external/bullet/BulletCollision/CollisionDispatch/btCollisionDispatcher.h
code/trunk/src/external/bullet/BulletCollision/CollisionDispatch/btCollisionObject.h
code/trunk/src/external/bullet/BulletCollision/CollisionDispatch/btCollisionWorld.cpp
code/trunk/src/external/bullet/BulletCollision/CollisionDispatch/btCollisionWorld.h
code/trunk/src/external/bullet/BulletCollision/CollisionDispatch/btCompoundCollisionAlgorithm.cpp
code/trunk/src/external/bullet/BulletCollision/CollisionDispatch/btCompoundCollisionAlgorithm.h
code/trunk/src/external/bullet/BulletCollision/CollisionDispatch/btConvex2dConvex2dAlgorithm.h
code/trunk/src/external/bullet/BulletCollision/CollisionDispatch/btConvexConcaveCollisionAlgorithm.cpp
code/trunk/src/external/bullet/BulletCollision/CollisionDispatch/btConvexConcaveCollisionAlgorithm.h
code/trunk/src/external/bullet/BulletCollision/CollisionDispatch/btConvexConvexAlgorithm.cpp
code/trunk/src/external/bullet/BulletCollision/CollisionDispatch/btConvexConvexAlgorithm.h
code/trunk/src/external/bullet/BulletCollision/CollisionDispatch/btConvexPlaneCollisionAlgorithm.h
code/trunk/src/external/bullet/BulletCollision/CollisionDispatch/btEmptyCollisionAlgorithm.h
code/trunk/src/external/bullet/BulletCollision/CollisionDispatch/btInternalEdgeUtility.cpp
code/trunk/src/external/bullet/BulletCollision/CollisionDispatch/btManifoldResult.cpp
code/trunk/src/external/bullet/BulletCollision/CollisionDispatch/btManifoldResult.h
code/trunk/src/external/bullet/BulletCollision/CollisionDispatch/btSimulationIslandManager.cpp
code/trunk/src/external/bullet/BulletCollision/CollisionDispatch/btSimulationIslandManager.h
code/trunk/src/external/bullet/BulletCollision/CollisionDispatch/btSphereBoxCollisionAlgorithm.h
code/trunk/src/external/bullet/BulletCollision/CollisionDispatch/btSphereSphereCollisionAlgorithm.h
code/trunk/src/external/bullet/BulletCollision/CollisionDispatch/btSphereTriangleCollisionAlgorithm.h
code/trunk/src/external/bullet/BulletCollision/CollisionDispatch/btUnionFind.h
code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btBox2dShape.h
code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btBoxShape.h
code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btBvhTriangleMeshShape.cpp
code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btBvhTriangleMeshShape.h
code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btCollisionMargin.h
code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btCollisionShape.h
code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btCompoundShape.cpp
code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btCompoundShape.h
code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btConcaveShape.h
code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btConeShape.cpp
code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btConeShape.h
code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btConvex2dShape.h
code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btConvexHullShape.h
code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btConvexShape.h
code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btConvexTriangleMeshShape.h
code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btCylinderShape.cpp
code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btCylinderShape.h
code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btEmptyShape.h
code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btHeightfieldTerrainShape.h
code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btMaterial.h
code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btMinkowskiSumShape.h
code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btMultiSphereShape.h
code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btMultimaterialTriangleMeshShape.h
code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btOptimizedBvh.h
code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btPolyhedralConvexShape.cpp
code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btPolyhedralConvexShape.h
code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btScaledBvhTriangleMeshShape.cpp
code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btScaledBvhTriangleMeshShape.h
code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btShapeHull.h
code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btSphereShape.h
code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btStaticPlaneShape.h
code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btStridingMeshInterface.cpp
code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btStridingMeshInterface.h
code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btTetrahedronShape.h
code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btTriangleCallback.h
code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btTriangleInfoMap.h
code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btTriangleMesh.h
code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btTriangleMeshShape.h
code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btTriangleShape.h
code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btUniformScalingShape.cpp
code/trunk/src/external/bullet/BulletCollision/NarrowPhaseCollision/btContinuousConvexCollision.cpp
code/trunk/src/external/bullet/BulletCollision/NarrowPhaseCollision/btContinuousConvexCollision.h
code/trunk/src/external/bullet/BulletCollision/NarrowPhaseCollision/btConvexCast.h
code/trunk/src/external/bullet/BulletCollision/NarrowPhaseCollision/btConvexPenetrationDepthSolver.h
code/trunk/src/external/bullet/BulletCollision/NarrowPhaseCollision/btDiscreteCollisionDetectorInterface.h
code/trunk/src/external/bullet/BulletCollision/NarrowPhaseCollision/btGjkConvexCast.h
code/trunk/src/external/bullet/BulletCollision/NarrowPhaseCollision/btGjkEpa2.h
code/trunk/src/external/bullet/BulletCollision/NarrowPhaseCollision/btGjkPairDetector.cpp
code/trunk/src/external/bullet/BulletCollision/NarrowPhaseCollision/btGjkPairDetector.h
code/trunk/src/external/bullet/BulletCollision/NarrowPhaseCollision/btManifoldPoint.h
code/trunk/src/external/bullet/BulletCollision/NarrowPhaseCollision/btMinkowskiPenetrationDepthSolver.h
code/trunk/src/external/bullet/BulletCollision/NarrowPhaseCollision/btPersistentManifold.h
code/trunk/src/external/bullet/BulletCollision/NarrowPhaseCollision/btPointCollector.h
code/trunk/src/external/bullet/BulletCollision/NarrowPhaseCollision/btRaycastCallback.cpp
code/trunk/src/external/bullet/BulletCollision/NarrowPhaseCollision/btRaycastCallback.h
code/trunk/src/external/bullet/BulletCollision/NarrowPhaseCollision/btSimplexSolverInterface.h
code/trunk/src/external/bullet/BulletCollision/NarrowPhaseCollision/btSubSimplexConvexCast.h
code/trunk/src/external/bullet/BulletCollision/NarrowPhaseCollision/btVoronoiSimplexSolver.h
code/trunk/src/external/bullet/BulletDynamics/Character/btCharacterControllerInterface.h
code/trunk/src/external/bullet/BulletDynamics/Character/btKinematicCharacterController.cpp
code/trunk/src/external/bullet/BulletDynamics/Character/btKinematicCharacterController.h
code/trunk/src/external/bullet/BulletDynamics/ConstraintSolver/btConeTwistConstraint.cpp
code/trunk/src/external/bullet/BulletDynamics/ConstraintSolver/btConeTwistConstraint.h
code/trunk/src/external/bullet/BulletDynamics/ConstraintSolver/btConstraintSolver.h
code/trunk/src/external/bullet/BulletDynamics/ConstraintSolver/btContactConstraint.cpp
code/trunk/src/external/bullet/BulletDynamics/ConstraintSolver/btContactConstraint.h
code/trunk/src/external/bullet/BulletDynamics/ConstraintSolver/btContactSolverInfo.h
code/trunk/src/external/bullet/BulletDynamics/ConstraintSolver/btGeneric6DofConstraint.cpp
code/trunk/src/external/bullet/BulletDynamics/ConstraintSolver/btGeneric6DofConstraint.h
code/trunk/src/external/bullet/BulletDynamics/ConstraintSolver/btGeneric6DofSpringConstraint.cpp
code/trunk/src/external/bullet/BulletDynamics/ConstraintSolver/btGeneric6DofSpringConstraint.h
code/trunk/src/external/bullet/BulletDynamics/ConstraintSolver/btHinge2Constraint.h
code/trunk/src/external/bullet/BulletDynamics/ConstraintSolver/btHingeConstraint.cpp
code/trunk/src/external/bullet/BulletDynamics/ConstraintSolver/btHingeConstraint.h
code/trunk/src/external/bullet/BulletDynamics/ConstraintSolver/btJacobianEntry.h
code/trunk/src/external/bullet/BulletDynamics/ConstraintSolver/btPoint2PointConstraint.h
code/trunk/src/external/bullet/BulletDynamics/ConstraintSolver/btSequentialImpulseConstraintSolver.cpp
code/trunk/src/external/bullet/BulletDynamics/ConstraintSolver/btSequentialImpulseConstraintSolver.h
code/trunk/src/external/bullet/BulletDynamics/ConstraintSolver/btSliderConstraint.h
code/trunk/src/external/bullet/BulletDynamics/ConstraintSolver/btSolve2LinearConstraint.h
code/trunk/src/external/bullet/BulletDynamics/ConstraintSolver/btTypedConstraint.cpp
code/trunk/src/external/bullet/BulletDynamics/ConstraintSolver/btTypedConstraint.h
code/trunk/src/external/bullet/BulletDynamics/ConstraintSolver/btUniversalConstraint.cpp
code/trunk/src/external/bullet/BulletDynamics/ConstraintSolver/btUniversalConstraint.h
code/trunk/src/external/bullet/BulletDynamics/Dynamics/btDiscreteDynamicsWorld.cpp
code/trunk/src/external/bullet/BulletDynamics/Dynamics/btDiscreteDynamicsWorld.h
code/trunk/src/external/bullet/BulletDynamics/Dynamics/btDynamicsWorld.h
code/trunk/src/external/bullet/BulletDynamics/Dynamics/btRigidBody.cpp
code/trunk/src/external/bullet/BulletDynamics/Dynamics/btRigidBody.h
code/trunk/src/external/bullet/BulletDynamics/Dynamics/btSimpleDynamicsWorld.cpp
code/trunk/src/external/bullet/BulletDynamics/Dynamics/btSimpleDynamicsWorld.h
code/trunk/src/external/bullet/BulletDynamics/Vehicle/btRaycastVehicle.cpp
code/trunk/src/external/bullet/BulletDynamics/Vehicle/btRaycastVehicle.h
code/trunk/src/external/bullet/BulletDynamics/Vehicle/btVehicleRaycaster.h
code/trunk/src/external/bullet/BulletDynamics/Vehicle/btWheelInfo.h
code/trunk/src/external/bullet/CMakeLists.txt
code/trunk/src/external/bullet/ChangeLog
code/trunk/src/external/bullet/LinearMath/CMakeLists.txt
code/trunk/src/external/bullet/LinearMath/btAabbUtil2.h
code/trunk/src/external/bullet/LinearMath/btAlignedObjectArray.h
code/trunk/src/external/bullet/LinearMath/btConvexHull.h
code/trunk/src/external/bullet/LinearMath/btDefaultMotionState.h
code/trunk/src/external/bullet/LinearMath/btHashMap.h
code/trunk/src/external/bullet/LinearMath/btIDebugDraw.h
code/trunk/src/external/bullet/LinearMath/btList.h
code/trunk/src/external/bullet/LinearMath/btMatrix3x3.h
code/trunk/src/external/bullet/LinearMath/btMinMax.h
code/trunk/src/external/bullet/LinearMath/btPoolAllocator.h
code/trunk/src/external/bullet/LinearMath/btQuadWord.h
code/trunk/src/external/bullet/LinearMath/btQuaternion.h
code/trunk/src/external/bullet/LinearMath/btQuickprof.h
code/trunk/src/external/bullet/LinearMath/btRandom.h
code/trunk/src/external/bullet/LinearMath/btScalar.h
code/trunk/src/external/bullet/LinearMath/btSerializer.cpp
code/trunk/src/external/bullet/LinearMath/btSerializer.h
code/trunk/src/external/bullet/LinearMath/btTransform.h
code/trunk/src/external/bullet/LinearMath/btTransformUtil.h
code/trunk/src/external/bullet/LinearMath/btVector3.h
code/trunk/src/external/bullet/VERSION
code/trunk/src/external/bullet/btBulletCollisionCommon.h
code/trunk/src/external/bullet/changes_orxonox.diff
Log:
Updated Bullet from v2.77 to v2.78.
(I'm not going to make a branch for that since the update from 2.74 to 2.77 hasn't been tested that much either).
You will HAVE to do a complete RECOMPILE! I tested with MSVC and MinGW and they both threw linker errors at me.
Modified: code/trunk/src/external/bullet/Bullet-C-Api.h
===================================================================
--- code/trunk/src/external/bullet/Bullet-C-Api.h 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/Bullet-C-Api.h 2011-05-03 03:07:42 UTC (rev 8393)
@@ -65,7 +65,7 @@
Create and Delete a Physics SDK
*/
- extern plPhysicsSdkHandle plNewBulletSdk(); //this could be also another sdk, like ODE, PhysX etc.
+ extern plPhysicsSdkHandle plNewBulletSdk(void); //this could be also another sdk, like ODE, PhysX etc.
extern void plDeletePhysicsSdk(plPhysicsSdkHandle physicsSdk);
/** Collision World, not strictly necessary, you can also just create a Dynamics World with Rigid Bodies which internally manages the Collision World with Collision Objects */
@@ -116,16 +116,16 @@
extern plCollisionShapeHandle plNewCapsuleShape(plReal radius, plReal height);
extern plCollisionShapeHandle plNewConeShape(plReal radius, plReal height);
extern plCollisionShapeHandle plNewCylinderShape(plReal radius, plReal height);
- extern plCollisionShapeHandle plNewCompoundShape();
+ extern plCollisionShapeHandle plNewCompoundShape(void);
extern void plAddChildShape(plCollisionShapeHandle compoundShape,plCollisionShapeHandle childShape, plVector3 childPos,plQuaternion childOrn);
extern void plDeleteShape(plCollisionShapeHandle shape);
/* Convex Meshes */
- extern plCollisionShapeHandle plNewConvexHullShape();
+ extern plCollisionShapeHandle plNewConvexHullShape(void);
extern void plAddVertex(plCollisionShapeHandle convexHull, plReal x,plReal y,plReal z);
/* Concave static triangle meshes */
- extern plMeshInterfaceHandle plNewMeshInterface();
+ extern plMeshInterfaceHandle plNewMeshInterface(void);
extern void plAddTriangle(plMeshInterfaceHandle meshHandle, plVector3 v0,plVector3 v1,plVector3 v2);
extern plCollisionShapeHandle plNewStaticTriangleMeshShape(plMeshInterfaceHandle);
Modified: code/trunk/src/external/bullet/BulletCollision/BroadphaseCollision/btAxisSweep3.h
===================================================================
--- code/trunk/src/external/bullet/BulletCollision/BroadphaseCollision/btAxisSweep3.h 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletCollision/BroadphaseCollision/btAxisSweep3.h 2011-05-03 03:07:42 UTC (rev 8393)
@@ -16,8 +16,8 @@
//
// 3. This notice may not be removed or altered from any source distribution.
-#ifndef AXIS_SWEEP_3_H
-#define AXIS_SWEEP_3_H
+#ifndef BT_AXIS_SWEEP_3_H
+#define BT_AXIS_SWEEP_3_H
#include "LinearMath/btVector3.h"
#include "btOverlappingPairCache.h"
Modified: code/trunk/src/external/bullet/BulletCollision/BroadphaseCollision/btBroadphaseInterface.h
===================================================================
--- code/trunk/src/external/bullet/BulletCollision/BroadphaseCollision/btBroadphaseInterface.h 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletCollision/BroadphaseCollision/btBroadphaseInterface.h 2011-05-03 03:07:42 UTC (rev 8393)
@@ -13,8 +13,8 @@
3. This notice may not be removed or altered from any source distribution.
*/
-#ifndef BROADPHASE_INTERFACE_H
-#define BROADPHASE_INTERFACE_H
+#ifndef BT_BROADPHASE_INTERFACE_H
+#define BT_BROADPHASE_INTERFACE_H
@@ -79,4 +79,4 @@
};
-#endif //BROADPHASE_INTERFACE_H
+#endif //BT_BROADPHASE_INTERFACE_H
Modified: code/trunk/src/external/bullet/BulletCollision/BroadphaseCollision/btBroadphaseProxy.h
===================================================================
--- code/trunk/src/external/bullet/BulletCollision/BroadphaseCollision/btBroadphaseProxy.h 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletCollision/BroadphaseCollision/btBroadphaseProxy.h 2011-05-03 03:07:42 UTC (rev 8393)
@@ -13,8 +13,8 @@
3. This notice may not be removed or altered from any source distribution.
*/
-#ifndef BROADPHASE_PROXY_H
-#define BROADPHASE_PROXY_H
+#ifndef BT_BROADPHASE_PROXY_H
+#define BT_BROADPHASE_PROXY_H
#include "LinearMath/btScalar.h" //for SIMD_FORCE_INLINE
#include "LinearMath/btVector3.h"
@@ -266,5 +266,5 @@
}
-#endif //BROADPHASE_PROXY_H
+#endif //BT_BROADPHASE_PROXY_H
Modified: code/trunk/src/external/bullet/BulletCollision/BroadphaseCollision/btCollisionAlgorithm.h
===================================================================
--- code/trunk/src/external/bullet/BulletCollision/BroadphaseCollision/btCollisionAlgorithm.h 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletCollision/BroadphaseCollision/btCollisionAlgorithm.h 2011-05-03 03:07:42 UTC (rev 8393)
@@ -13,8 +13,8 @@
3. This notice may not be removed or altered from any source distribution.
*/
-#ifndef COLLISION_ALGORITHM_H
-#define COLLISION_ALGORITHM_H
+#ifndef BT_COLLISION_ALGORITHM_H
+#define BT_COLLISION_ALGORITHM_H
#include "LinearMath/btScalar.h"
#include "LinearMath/btAlignedObjectArray.h"
@@ -44,7 +44,7 @@
btDispatcher* m_dispatcher1;
btPersistentManifold* m_manifold;
- int getDispatcherId();
+// int getDispatcherId();
};
@@ -59,7 +59,7 @@
btDispatcher* m_dispatcher;
protected:
- int getDispatcherId();
+// int getDispatcherId();
public:
@@ -77,4 +77,4 @@
};
-#endif //COLLISION_ALGORITHM_H
+#endif //BT_COLLISION_ALGORITHM_H
Modified: code/trunk/src/external/bullet/BulletCollision/BroadphaseCollision/btDispatcher.h
===================================================================
--- code/trunk/src/external/bullet/BulletCollision/BroadphaseCollision/btDispatcher.h 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletCollision/BroadphaseCollision/btDispatcher.h 2011-05-03 03:07:42 UTC (rev 8393)
@@ -13,9 +13,8 @@
3. This notice may not be removed or altered from any source distribution.
*/
-#ifndef _DISPATCHER_H
-#define _DISPATCHER_H
-
+#ifndef BT_DISPATCHER_H
+#define BT_DISPATCHER_H
#include "LinearMath/btScalar.h"
class btCollisionAlgorithm;
@@ -27,6 +26,7 @@
class btPersistentManifold;
class btStackAlloc;
+class btPoolAllocator;
struct btDispatcherInfo
{
@@ -40,7 +40,7 @@
m_stepCount(0),
m_dispatchFunc(DISPATCH_DISCRETE),
m_timeOfImpact(btScalar(1.)),
- m_useContinuous(false),
+ m_useContinuous(true),
m_debugDraw(0),
m_enableSatConvex(false),
m_enableSPU(true),
@@ -48,7 +48,6 @@
m_allowedCcdPenetration(btScalar(0.04)),
m_useConvexConservativeDistanceUtil(false),
m_convexConservativeDistanceThreshold(0.0f),
- m_convexMaxDistanceUseCPT(false),
m_stackAllocator(0)
{
@@ -65,7 +64,6 @@
btScalar m_allowedCcdPenetration;
bool m_useConvexConservativeDistanceUtil;
btScalar m_convexConservativeDistanceThreshold;
- bool m_convexMaxDistanceUseCPT;
btStackAlloc* m_stackAllocator;
};
@@ -98,6 +96,10 @@
virtual btPersistentManifold** getInternalManifoldPointer() = 0;
+ virtual btPoolAllocator* getInternalManifoldPool() = 0;
+
+ virtual const btPoolAllocator* getInternalManifoldPool() const = 0;
+
virtual void* allocateCollisionAlgorithm(int size) = 0;
virtual void freeCollisionAlgorithm(void* ptr) = 0;
@@ -105,4 +107,4 @@
};
-#endif //_DISPATCHER_H
+#endif //BT_DISPATCHER_H
Modified: code/trunk/src/external/bullet/BulletCollision/BroadphaseCollision/btOverlappingPairCache.h
===================================================================
--- code/trunk/src/external/bullet/BulletCollision/BroadphaseCollision/btOverlappingPairCache.h 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletCollision/BroadphaseCollision/btOverlappingPairCache.h 2011-05-03 03:07:42 UTC (rev 8393)
@@ -13,8 +13,8 @@
3. This notice may not be removed or altered from any source distribution.
*/
-#ifndef OVERLAPPING_PAIR_CACHE_H
-#define OVERLAPPING_PAIR_CACHE_H
+#ifndef BT_OVERLAPPING_PAIR_CACHE_H
+#define BT_OVERLAPPING_PAIR_CACHE_H
#include "btBroadphaseInterface.h"
@@ -464,6 +464,6 @@
};
-#endif //OVERLAPPING_PAIR_CACHE_H
+#endif //BT_OVERLAPPING_PAIR_CACHE_H
Modified: code/trunk/src/external/bullet/BulletCollision/BroadphaseCollision/btQuantizedBvh.h
===================================================================
--- code/trunk/src/external/bullet/BulletCollision/BroadphaseCollision/btQuantizedBvh.h 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletCollision/BroadphaseCollision/btQuantizedBvh.h 2011-05-03 03:07:42 UTC (rev 8393)
@@ -13,8 +13,8 @@
3. This notice may not be removed or altered from any source distribution.
*/
-#ifndef QUANTIZED_BVH_H
-#define QUANTIZED_BVH_H
+#ifndef BT_QUANTIZED_BVH_H
+#define BT_QUANTIZED_BVH_H
class btSerializer;
@@ -576,4 +576,4 @@
-#endif //QUANTIZED_BVH_H
+#endif //BT_QUANTIZED_BVH_H
Modified: code/trunk/src/external/bullet/BulletCollision/BroadphaseCollision/btSimpleBroadphase.h
===================================================================
--- code/trunk/src/external/bullet/BulletCollision/BroadphaseCollision/btSimpleBroadphase.h 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletCollision/BroadphaseCollision/btSimpleBroadphase.h 2011-05-03 03:07:42 UTC (rev 8393)
@@ -13,8 +13,8 @@
3. This notice may not be removed or altered from any source distribution.
*/
-#ifndef SIMPLE_BROADPHASE_H
-#define SIMPLE_BROADPHASE_H
+#ifndef BT_SIMPLE_BROADPHASE_H
+#define BT_SIMPLE_BROADPHASE_H
#include "btOverlappingPairCache.h"
@@ -167,5 +167,5 @@
-#endif //SIMPLE_BROADPHASE_H
+#endif //BT_SIMPLE_BROADPHASE_H
Modified: code/trunk/src/external/bullet/BulletCollision/CMakeLists.txt
===================================================================
--- code/trunk/src/external/bullet/BulletCollision/CMakeLists.txt 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletCollision/CMakeLists.txt 2011-05-03 03:07:42 UTC (rev 8393)
@@ -49,6 +49,7 @@
CollisionShapes/btConvexHullShape.cpp
CollisionShapes/btConvexInternalShape.cpp
CollisionShapes/btConvexPointCloudShape.cpp
+ CollisionShapes/btConvexPolyhedron.cpp
CollisionShapes/btConvexShape.cpp
CollisionShapes/btConvex2dShape.cpp
CollisionShapes/btConvexTriangleMeshShape.cpp
@@ -88,6 +89,9 @@
COMPILATION_END
+ # Raises compiler errors when compiled inside the compilation
+ NarrowPhaseCollision/btPolyhedralContactClipping.cpp
+
# Headers
BroadphaseCollision/btAxisSweep3.h
BroadphaseCollision/btBroadphaseInterface.h
@@ -139,6 +143,7 @@
CollisionShapes/btConvexHullShape.h
CollisionShapes/btConvexInternalShape.h
CollisionShapes/btConvexPointCloudShape.h
+ CollisionShapes/btConvexPolyhedron.h
CollisionShapes/btConvexShape.h
CollisionShapes/btConvex2dShape.h
CollisionShapes/btConvexTriangleMeshShape.h
@@ -183,4 +188,5 @@
NarrowPhaseCollision/btSimplexSolverInterface.h
NarrowPhaseCollision/btSubSimplexConvexCast.h
NarrowPhaseCollision/btVoronoiSimplexSolver.h
+ NarrowPhaseCollision/btPolyhedralContactClipping.h
)
Modified: code/trunk/src/external/bullet/BulletCollision/CollisionDispatch/SphereTriangleDetector.cpp
===================================================================
--- code/trunk/src/external/bullet/BulletCollision/CollisionDispatch/SphereTriangleDetector.cpp 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletCollision/CollisionDispatch/SphereTriangleDetector.cpp 2011-05-03 03:07:42 UTC (rev 8393)
@@ -57,10 +57,8 @@
}
-#define MAX_OVERLAP btScalar(0.)
-
// See also geometrictools.com
// Basic idea: D = |p - (lo + t0*lv)| where t0 = lv . (p - lo) / lv . lv
btScalar SegmentSqrDistance(const btVector3& from, const btVector3& to,const btVector3 &p, btVector3 &nearest);
@@ -93,48 +91,39 @@
return pointInTriangle(vertices, lnormal, &lp);
}
-///combined discrete/continuous sphere-triangle
bool SphereTriangleDetector::collide(const btVector3& sphereCenter,btVector3 &point, btVector3& resultNormal, btScalar& depth, btScalar &timeOfImpact, btScalar contactBreakingThreshold)
{
const btVector3* vertices = &m_triangle->getVertexPtr(0);
- const btVector3& c = sphereCenter;
- btScalar r = m_sphere->getRadius();
+
+ btScalar radius = m_sphere->getRadius();
+ btScalar radiusWithThreshold = radius + contactBreakingThreshold;
- btVector3 delta (0,0,0);
-
btVector3 normal = (vertices[1]-vertices[0]).cross(vertices[2]-vertices[0]);
normal.normalize();
- btVector3 p1ToCentre = c - vertices[0];
+ btVector3 p1ToCentre = sphereCenter - vertices[0];
btScalar distanceFromPlane = p1ToCentre.dot(normal);
if (distanceFromPlane < btScalar(0.))
{
//triangle facing the other way
-
distanceFromPlane *= btScalar(-1.);
normal *= btScalar(-1.);
}
- btScalar contactMargin = contactBreakingThreshold;
- bool isInsideContactPlane = distanceFromPlane < r + contactMargin;
- bool isInsideShellPlane = distanceFromPlane < r;
+ bool isInsideContactPlane = distanceFromPlane < radiusWithThreshold;
- btScalar deltaDotNormal = delta.dot(normal);
- if (!isInsideShellPlane && deltaDotNormal >= btScalar(0.0))
- return false;
-
// Check for contact / intersection
bool hasContact = false;
btVector3 contactPoint;
if (isInsideContactPlane) {
- if (facecontains(c,vertices,normal)) {
+ if (facecontains(sphereCenter,vertices,normal)) {
// Inside the contact wedge - touches a point on the shell plane
hasContact = true;
- contactPoint = c - normal*distanceFromPlane;
+ contactPoint = sphereCenter - normal*distanceFromPlane;
} else {
// Could be inside one of the contact capsules
- btScalar contactCapsuleRadiusSqr = (r + contactMargin) * (r + contactMargin);
+ btScalar contactCapsuleRadiusSqr = radiusWithThreshold*radiusWithThreshold;
btVector3 nearestOnEdge;
for (int i = 0; i < m_triangle->getNumEdges(); i++) {
@@ -143,7 +132,7 @@
m_triangle->getEdge(i,pa,pb);
- btScalar distanceSqr = SegmentSqrDistance(pa,pb,c, nearestOnEdge);
+ btScalar distanceSqr = SegmentSqrDistance(pa,pb,sphereCenter, nearestOnEdge);
if (distanceSqr < contactCapsuleRadiusSqr) {
// Yep, we're inside a capsule
hasContact = true;
@@ -155,24 +144,27 @@
}
if (hasContact) {
- btVector3 contactToCentre = c - contactPoint;
+ btVector3 contactToCentre = sphereCenter - contactPoint;
btScalar distanceSqr = contactToCentre.length2();
- if (distanceSqr < (r - MAX_OVERLAP)*(r - MAX_OVERLAP)) {
- btScalar distance = btSqrt(distanceSqr);
- resultNormal = contactToCentre;
- resultNormal.normalize();
- point = contactPoint;
- depth = -(r-distance);
+
+ if (distanceSqr < radiusWithThreshold*radiusWithThreshold)
+ {
+ if (distanceSqr>SIMD_EPSILON)
+ {
+ btScalar distance = btSqrt(distanceSqr);
+ resultNormal = contactToCentre;
+ resultNormal.normalize();
+ point = contactPoint;
+ depth = -(radius-distance);
+ } else
+ {
+ btScalar distance = 0.f;
+ resultNormal = normal;
+ point = contactPoint;
+ depth = -radius;
+ }
return true;
}
-
- if (delta.dot(contactToCentre) >= btScalar(0.0))
- return false;
-
- // Moving towards the contact point -> collision
- point = contactPoint;
- timeOfImpact = btScalar(0.0);
- return true;
}
return false;
Modified: code/trunk/src/external/bullet/BulletCollision/CollisionDispatch/SphereTriangleDetector.h
===================================================================
--- code/trunk/src/external/bullet/BulletCollision/CollisionDispatch/SphereTriangleDetector.h 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletCollision/CollisionDispatch/SphereTriangleDetector.h 2011-05-03 03:07:42 UTC (rev 8393)
@@ -13,8 +13,8 @@
3. This notice may not be removed or altered from any source distribution.
*/
-#ifndef SPHERE_TRIANGLE_DETECTOR_H
-#define SPHERE_TRIANGLE_DETECTOR_H
+#ifndef BT_SPHERE_TRIANGLE_DETECTOR_H
+#define BT_SPHERE_TRIANGLE_DETECTOR_H
#include "BulletCollision/NarrowPhaseCollision/btDiscreteCollisionDetectorInterface.h"
@@ -47,5 +47,5 @@
btScalar m_contactBreakingThreshold;
};
-#endif //SPHERE_TRIANGLE_DETECTOR_H
+#endif //BT_SPHERE_TRIANGLE_DETECTOR_H
Modified: code/trunk/src/external/bullet/BulletCollision/CollisionDispatch/btBox2dBox2dCollisionAlgorithm.h
===================================================================
--- code/trunk/src/external/bullet/BulletCollision/CollisionDispatch/btBox2dBox2dCollisionAlgorithm.h 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletCollision/CollisionDispatch/btBox2dBox2dCollisionAlgorithm.h 2011-05-03 03:07:42 UTC (rev 8393)
@@ -13,8 +13,8 @@
3. This notice may not be removed or altered from any source distribution.
*/
-#ifndef BOX_2D_BOX_2D__COLLISION_ALGORITHM_H
-#define BOX_2D_BOX_2D__COLLISION_ALGORITHM_H
+#ifndef BT_BOX_2D_BOX_2D__COLLISION_ALGORITHM_H
+#define BT_BOX_2D_BOX_2D__COLLISION_ALGORITHM_H
#include "BulletCollision/CollisionDispatch/btActivatingCollisionAlgorithm.h"
#include "BulletCollision/BroadphaseCollision/btBroadphaseProxy.h"
@@ -62,5 +62,5 @@
};
-#endif //BOX_2D_BOX_2D__COLLISION_ALGORITHM_H
+#endif //BT_BOX_2D_BOX_2D__COLLISION_ALGORITHM_H
Modified: code/trunk/src/external/bullet/BulletCollision/CollisionDispatch/btBoxBoxCollisionAlgorithm.h
===================================================================
--- code/trunk/src/external/bullet/BulletCollision/CollisionDispatch/btBoxBoxCollisionAlgorithm.h 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletCollision/CollisionDispatch/btBoxBoxCollisionAlgorithm.h 2011-05-03 03:07:42 UTC (rev 8393)
@@ -13,8 +13,8 @@
3. This notice may not be removed or altered from any source distribution.
*/
-#ifndef BOX_BOX__COLLISION_ALGORITHM_H
-#define BOX_BOX__COLLISION_ALGORITHM_H
+#ifndef BT_BOX_BOX__COLLISION_ALGORITHM_H
+#define BT_BOX_BOX__COLLISION_ALGORITHM_H
#include "btActivatingCollisionAlgorithm.h"
#include "BulletCollision/BroadphaseCollision/btBroadphaseProxy.h"
@@ -62,5 +62,5 @@
};
-#endif //BOX_BOX__COLLISION_ALGORITHM_H
+#endif //BT_BOX_BOX__COLLISION_ALGORITHM_H
Modified: code/trunk/src/external/bullet/BulletCollision/CollisionDispatch/btBoxBoxDetector.h
===================================================================
--- code/trunk/src/external/bullet/BulletCollision/CollisionDispatch/btBoxBoxDetector.h 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletCollision/CollisionDispatch/btBoxBoxDetector.h 2011-05-03 03:07:42 UTC (rev 8393)
@@ -16,8 +16,8 @@
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
-#ifndef BOX_BOX_DETECTOR_H
-#define BOX_BOX_DETECTOR_H
+#ifndef BT_BOX_BOX_DETECTOR_H
+#define BT_BOX_BOX_DETECTOR_H
class btBoxShape;
Modified: code/trunk/src/external/bullet/BulletCollision/CollisionDispatch/btCollisionConfiguration.h
===================================================================
--- code/trunk/src/external/bullet/BulletCollision/CollisionDispatch/btCollisionConfiguration.h 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletCollision/CollisionDispatch/btCollisionConfiguration.h 2011-05-03 03:07:42 UTC (rev 8393)
@@ -15,6 +15,7 @@
#ifndef BT_COLLISION_CONFIGURATION
#define BT_COLLISION_CONFIGURATION
+
struct btCollisionAlgorithmCreateFunc;
class btStackAlloc;
Modified: code/trunk/src/external/bullet/BulletCollision/CollisionDispatch/btCollisionCreateFunc.h
===================================================================
--- code/trunk/src/external/bullet/BulletCollision/CollisionDispatch/btCollisionCreateFunc.h 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletCollision/CollisionDispatch/btCollisionCreateFunc.h 2011-05-03 03:07:42 UTC (rev 8393)
@@ -13,8 +13,8 @@
3. This notice may not be removed or altered from any source distribution.
*/
-#ifndef COLLISION_CREATE_FUNC
-#define COLLISION_CREATE_FUNC
+#ifndef BT_COLLISION_CREATE_FUNC
+#define BT_COLLISION_CREATE_FUNC
#include "LinearMath/btAlignedObjectArray.h"
class btCollisionAlgorithm;
@@ -41,5 +41,5 @@
return 0;
}
};
-#endif //COLLISION_CREATE_FUNC
+#endif //BT_COLLISION_CREATE_FUNC
Modified: code/trunk/src/external/bullet/BulletCollision/CollisionDispatch/btCollisionDispatcher.cpp
===================================================================
--- code/trunk/src/external/bullet/BulletCollision/CollisionDispatch/btCollisionDispatcher.cpp 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletCollision/CollisionDispatch/btCollisionDispatcher.cpp 2011-05-03 03:07:42 UTC (rev 8393)
@@ -92,8 +92,16 @@
mem = m_persistentManifoldPoolAllocator->allocate(sizeof(btPersistentManifold));
} else
{
- mem = btAlignedAlloc(sizeof(btPersistentManifold),16);
-
+ //we got a pool memory overflow, by default we fallback to dynamically allocate memory. If we require a contiguous contact pool then assert.
+ if ((m_dispatcherFlags&CD_DISABLE_CONTACTPOOL_DYNAMIC_ALLOCATION)==0)
+ {
+ mem = btAlignedAlloc(sizeof(btPersistentManifold),16);
+ } else
+ {
+ btAssert(0);
+ //make sure to increase the m_defaultMaxPersistentManifoldPoolSize in the btDefaultCollisionConstructionInfo/btDefaultCollisionConfiguration
+ return 0;
+ }
}
btPersistentManifold* manifold = new(mem) btPersistentManifold (body0,body1,0,contactBreakingThreshold,contactProcessingThreshold);
manifold->m_index1a = m_manifoldsPtr.size();
@@ -172,8 +180,7 @@
if (!(m_dispatcherFlags & btCollisionDispatcher::CD_STATIC_STATIC_REPORTED))
{
//broadphase filtering already deals with this
- if ((body0->isStaticObject() || body0->isKinematicObject()) &&
- (body1->isStaticObject() || body1->isKinematicObject()))
+ if (body0->isStaticOrKinematicObject() && body1->isStaticOrKinematicObject())
{
m_dispatcherFlags |= btCollisionDispatcher::CD_STATIC_STATIC_REPORTED;
printf("warning btCollisionDispatcher::needsCollision: static-static collision!\n");
Modified: code/trunk/src/external/bullet/BulletCollision/CollisionDispatch/btCollisionDispatcher.h
===================================================================
--- code/trunk/src/external/bullet/BulletCollision/CollisionDispatch/btCollisionDispatcher.h 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletCollision/CollisionDispatch/btCollisionDispatcher.h 2011-05-03 03:07:42 UTC (rev 8393)
@@ -13,8 +13,8 @@
3. This notice may not be removed or altered from any source distribution.
*/
-#ifndef COLLISION__DISPATCHER_H
-#define COLLISION__DISPATCHER_H
+#ifndef BT_COLLISION__DISPATCHER_H
+#define BT_COLLISION__DISPATCHER_H
#include "BulletCollision/BroadphaseCollision/btDispatcher.h"
#include "BulletCollision/NarrowPhaseCollision/btPersistentManifold.h"
@@ -42,8 +42,11 @@
///Time of Impact, Closest Points and Penetration Depth.
class btCollisionDispatcher : public btDispatcher
{
+
+protected:
+
int m_dispatcherFlags;
-
+
btAlignedObjectArray<btPersistentManifold*> m_manifoldsPtr;
btManifoldResult m_defaultManifoldResult;
@@ -64,7 +67,8 @@
enum DispatcherFlags
{
CD_STATIC_STATIC_REPORTED = 1,
- CD_USE_RELATIVE_CONTACT_BREAKING_THRESHOLD = 2
+ CD_USE_RELATIVE_CONTACT_BREAKING_THRESHOLD = 2,
+ CD_DISABLE_CONTACTPOOL_DYNAMIC_ALLOCATION = 4
};
int getDispatcherFlags() const
@@ -74,8 +78,7 @@
void setDispatcherFlags(int flags)
{
- (void) flags;
- m_dispatcherFlags = 0;
+ m_dispatcherFlags = flags;
}
///registerCollisionCreateFunc allows registration of custom/alternative collision create functions
@@ -153,7 +156,17 @@
m_collisionConfiguration = config;
}
+ virtual btPoolAllocator* getInternalManifoldPool()
+ {
+ return m_persistentManifoldPoolAllocator;
+ }
+
+ virtual const btPoolAllocator* getInternalManifoldPool() const
+ {
+ return m_persistentManifoldPoolAllocator;
+ }
+
};
-#endif //COLLISION__DISPATCHER_H
+#endif //BT_COLLISION__DISPATCHER_H
Modified: code/trunk/src/external/bullet/BulletCollision/CollisionDispatch/btCollisionObject.h
===================================================================
--- code/trunk/src/external/bullet/BulletCollision/CollisionDispatch/btCollisionObject.h 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletCollision/CollisionDispatch/btCollisionObject.h 2011-05-03 03:07:42 UTC (rev 8393)
@@ -13,8 +13,8 @@
3. This notice may not be removed or altered from any source distribution.
*/
-#ifndef COLLISION_OBJECT_H
-#define COLLISION_OBJECT_H
+#ifndef BT_COLLISION_OBJECT_H
+#define BT_COLLISION_OBJECT_H
#include "LinearMath/btTransform.h"
@@ -521,4 +521,4 @@
-#endif //COLLISION_OBJECT_H
+#endif //BT_COLLISION_OBJECT_H
Modified: code/trunk/src/external/bullet/BulletCollision/CollisionDispatch/btCollisionWorld.cpp
===================================================================
--- code/trunk/src/external/bullet/BulletCollision/CollisionDispatch/btCollisionWorld.cpp 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletCollision/CollisionDispatch/btCollisionWorld.cpp 2011-05-03 03:07:42 UTC (rev 8393)
@@ -28,11 +28,16 @@
#include "BulletCollision/NarrowPhaseCollision/btContinuousConvexCollision.h"
#include "BulletCollision/BroadphaseCollision/btCollisionAlgorithm.h"
#include "BulletCollision/BroadphaseCollision/btBroadphaseInterface.h"
+#include "BulletCollision/BroadphaseCollision/btDbvt.h"
#include "LinearMath/btAabbUtil2.h"
#include "LinearMath/btQuickprof.h"
#include "LinearMath/btStackAlloc.h"
#include "LinearMath/btSerializer.h"
+#include "BulletCollision/CollisionShapes/btConvexPolyhedron.h"
+//#define DISABLE_DBVT_COMPOUNDSHAPE_RAYCAST_ACCELERATION
+
+
//#define USE_BRUTEFORCE_RAYBROADPHASE 1
//RECALCULATE_AABB is slower, but benefit is that you don't need to call 'stepSimulation' or 'updateAabbs' before using a rayTest
//#define RECALCULATE_AABB_RAYCAST 1
@@ -150,6 +155,16 @@
minAabb -= contactThreshold;
maxAabb += contactThreshold;
+ if(getDispatchInfo().m_useContinuous && colObj->getInternalType()==btCollisionObject::CO_RIGID_BODY)
+ {
+ btVector3 minAabb2,maxAabb2;
+ colObj->getCollisionShape()->getAabb(colObj->getInterpolationWorldTransform(),minAabb2,maxAabb2);
+ minAabb2 -= contactThreshold;
+ maxAabb2 += contactThreshold;
+ minAabb.setMin(minAabb2);
+ maxAabb.setMax(maxAabb2);
+ }
+
btBroadphaseInterface* bp = (btBroadphaseInterface*)m_broadphasePairCache;
//moving objects should be moderately sized, probably something wrong if not
@@ -420,52 +435,118 @@
}
} else {
// BT_PROFILE("rayTestCompound");
- ///@todo: use AABB tree or other BVH acceleration structure, see btDbvt
if (collisionShape->isCompound())
{
- const btCompoundShape* compoundShape = static_cast<const btCompoundShape*>(collisionShape);
- int i=0;
- for (i=0;i<compoundShape->getNumChildShapes();i++)
+ struct LocalInfoAdder2 : public RayResultCallback
{
- btTransform childTrans = compoundShape->getChildTransform(i);
- const btCollisionShape* childCollisionShape = compoundShape->getChildShape(i);
- btTransform childWorldTrans = colObjWorldTransform * childTrans;
- // replace collision shape so that callback can determine the triangle
- btCollisionShape* saveCollisionShape = collisionObject->getCollisionShape();
- collisionObject->internalSetTemporaryCollisionShape((btCollisionShape*)childCollisionShape);
- struct LocalInfoAdder2 : public RayResultCallback {
- RayResultCallback* m_userCallback;
- int m_i;
- LocalInfoAdder2 (int i, RayResultCallback *user)
- : m_userCallback(user),
- m_i(i)
- {
- m_closestHitFraction = m_userCallback->m_closestHitFraction;
- }
- virtual btScalar addSingleResult (btCollisionWorld::LocalRayResult &r, bool b)
- {
- btCollisionWorld::LocalShapeInfo shapeInfo;
- shapeInfo.m_shapePart = -1;
- shapeInfo.m_triangleIndex = m_i;
- if (r.m_localShapeInfo == NULL)
- r.m_localShapeInfo = &shapeInfo;
+ RayResultCallback* m_userCallback;
+ int m_i;
+
+ LocalInfoAdder2 (int i, RayResultCallback *user)
+ : m_userCallback(user), m_i(i)
+ {
+ m_closestHitFraction = m_userCallback->m_closestHitFraction;
+ }
+ virtual bool needsCollision(btBroadphaseProxy* p) const
+ {
+ return m_userCallback->needsCollision(p);
+ }
- const btScalar result = m_userCallback->addSingleResult(r, b);
- m_closestHitFraction = m_userCallback->m_closestHitFraction;
- return result;
- }
- };
+ virtual btScalar addSingleResult (btCollisionWorld::LocalRayResult &r, bool b)
+ {
+ btCollisionWorld::LocalShapeInfo shapeInfo;
+ shapeInfo.m_shapePart = -1;
+ shapeInfo.m_triangleIndex = m_i;
+ if (r.m_localShapeInfo == NULL)
+ r.m_localShapeInfo = &shapeInfo;
- LocalInfoAdder2 my_cb(i, &resultCallback);
+ const btScalar result = m_userCallback->addSingleResult(r, b);
+ m_closestHitFraction = m_userCallback->m_closestHitFraction;
+ return result;
+ }
+ };
+
+ struct RayTester : btDbvt::ICollide
+ {
+ btCollisionObject* m_collisionObject;
+ const btCompoundShape* m_compoundShape;
+ const btTransform& m_colObjWorldTransform;
+ const btTransform& m_rayFromTrans;
+ const btTransform& m_rayToTrans;
+ RayResultCallback& m_resultCallback;
+
+ RayTester(btCollisionObject* collisionObject,
+ const btCompoundShape* compoundShape,
+ const btTransform& colObjWorldTransform,
+ const btTransform& rayFromTrans,
+ const btTransform& rayToTrans,
+ RayResultCallback& resultCallback):
+ m_collisionObject(collisionObject),
+ m_compoundShape(compoundShape),
+ m_colObjWorldTransform(colObjWorldTransform),
+ m_rayFromTrans(rayFromTrans),
+ m_rayToTrans(rayToTrans),
+ m_resultCallback(resultCallback)
+ {
+
+ }
+
+ void Process(int i)
+ {
+ const btCollisionShape* childCollisionShape = m_compoundShape->getChildShape(i);
+ const btTransform& childTrans = m_compoundShape->getChildTransform(i);
+ btTransform childWorldTrans = m_colObjWorldTransform * childTrans;
+
+ // replace collision shape so that callback can determine the triangle
+ btCollisionShape* saveCollisionShape = m_collisionObject->getCollisionShape();
+ m_collisionObject->internalSetTemporaryCollisionShape((btCollisionShape*)childCollisionShape);
- rayTestSingle(rayFromTrans,rayToTrans,
- collisionObject,
- childCollisionShape,
- childWorldTrans,
- my_cb);
- // restore
- collisionObject->internalSetTemporaryCollisionShape(saveCollisionShape);
+ LocalInfoAdder2 my_cb(i, &m_resultCallback);
+
+ rayTestSingle(
+ m_rayFromTrans,
+ m_rayToTrans,
+ m_collisionObject,
+ childCollisionShape,
+ childWorldTrans,
+ my_cb);
+
+ // restore
+ m_collisionObject->internalSetTemporaryCollisionShape(saveCollisionShape);
+ }
+
+ void Process(const btDbvtNode* leaf)
+ {
+ Process(leaf->dataAsInt);
+ }
+ };
+
+ const btCompoundShape* compoundShape = static_cast<const btCompoundShape*>(collisionShape);
+ const btDbvt* dbvt = compoundShape->getDynamicAabbTree();
+
+
+ RayTester rayCB(
+ collisionObject,
+ compoundShape,
+ colObjWorldTransform,
+ rayFromTrans,
+ rayToTrans,
+ resultCallback);
+#ifndef DISABLE_DBVT_COMPOUNDSHAPE_RAYCAST_ACCELERATION
+ if (dbvt)
+ {
+ btVector3 localRayFrom = colObjWorldTransform.inverseTimes(rayFromTrans).getOrigin();
+ btVector3 localRayTo = colObjWorldTransform.inverseTimes(rayToTrans).getOrigin();
+ btDbvt::rayTest(dbvt->m_root, localRayFrom , localRayTo, rayCB);
}
+ else
+#endif //DISABLE_DBVT_COMPOUNDSHAPE_RAYCAST_ACCELERATION
+ {
+ for (int i = 0, n = compoundShape->getNumChildShapes(); i < n; ++i)
+ {
+ rayCB.Process(i);
+ }
+ }
}
}
}
@@ -576,72 +657,109 @@
BridgeTriangleConvexcastCallback tccb(castShape, convexFromTrans,convexToTrans,&resultCallback,collisionObject,triangleMesh, colObjWorldTransform);
tccb.m_hitFraction = resultCallback.m_closestHitFraction;
+ tccb.m_allowedPenetration = allowedPenetration;
btVector3 boxMinLocal, boxMaxLocal;
castShape->getAabb(rotationXform, boxMinLocal, boxMaxLocal);
triangleMesh->performConvexcast(&tccb,convexFromLocal,convexToLocal,boxMinLocal, boxMaxLocal);
} else
{
- //BT_PROFILE("convexSweepConcave");
- btConcaveShape* concaveShape = (btConcaveShape*)collisionShape;
- btTransform worldTocollisionObject = colObjWorldTransform.inverse();
- btVector3 convexFromLocal = worldTocollisionObject * convexFromTrans.getOrigin();
- btVector3 convexToLocal = worldTocollisionObject * convexToTrans.getOrigin();
- // rotation of box in local mesh space = MeshRotation^-1 * ConvexToRotation
- btTransform rotationXform = btTransform(worldTocollisionObject.getBasis() * convexToTrans.getBasis());
-
- //ConvexCast::CastResult
- struct BridgeTriangleConvexcastCallback : public btTriangleConvexcastCallback
+ if (collisionShape->getShapeType()==STATIC_PLANE_PROXYTYPE)
{
- btCollisionWorld::ConvexResultCallback* m_resultCallback;
- btCollisionObject* m_collisionObject;
- btConcaveShape* m_triangleMesh;
+ btConvexCast::CastResult castResult;
+ castResult.m_allowedPenetration = allowedPenetration;
+ castResult.m_fraction = resultCallback.m_closestHitFraction;
+ btStaticPlaneShape* planeShape = (btStaticPlaneShape*) collisionShape;
+ btContinuousConvexCollision convexCaster1(castShape,planeShape);
+ btConvexCast* castPtr = &convexCaster1;
- BridgeTriangleConvexcastCallback(const btConvexShape* castShape, const btTransform& from,const btTransform& to,
- btCollisionWorld::ConvexResultCallback* resultCallback, btCollisionObject* collisionObject,btConcaveShape* triangleMesh, const btTransform& triangleToWorld):
- btTriangleConvexcastCallback(castShape, from,to, triangleToWorld, triangleMesh->getMargin()),
- m_resultCallback(resultCallback),
- m_collisionObject(collisionObject),
- m_triangleMesh(triangleMesh)
+ if (castPtr->calcTimeOfImpact(convexFromTrans,convexToTrans,colObjWorldTransform,colObjWorldTransform,castResult))
{
+ //add hit
+ if (castResult.m_normal.length2() > btScalar(0.0001))
+ {
+ if (castResult.m_fraction < resultCallback.m_closestHitFraction)
+ {
+ castResult.m_normal.normalize();
+ btCollisionWorld::LocalConvexResult localConvexResult
+ (
+ collisionObject,
+ 0,
+ castResult.m_normal,
+ castResult.m_hitPoint,
+ castResult.m_fraction
+ );
+
+ bool normalInWorldSpace = true;
+ resultCallback.addSingleResult(localConvexResult, normalInWorldSpace);
+ }
+ }
}
+ } else
+ {
+ //BT_PROFILE("convexSweepConcave");
+ btConcaveShape* concaveShape = (btConcaveShape*)collisionShape;
+ btTransform worldTocollisionObject = colObjWorldTransform.inverse();
+ btVector3 convexFromLocal = worldTocollisionObject * convexFromTrans.getOrigin();
+ btVector3 convexToLocal = worldTocollisionObject * convexToTrans.getOrigin();
+ // rotation of box in local mesh space = MeshRotation^-1 * ConvexToRotation
+ btTransform rotationXform = btTransform(worldTocollisionObject.getBasis() * convexToTrans.getBasis());
- virtual btScalar reportHit(const btVector3& hitNormalLocal, const btVector3& hitPointLocal, btScalar hitFraction, int partId, int triangleIndex )
+ //ConvexCast::CastResult
+ struct BridgeTriangleConvexcastCallback : public btTriangleConvexcastCallback
{
- btCollisionWorld::LocalShapeInfo shapeInfo;
- shapeInfo.m_shapePart = partId;
- shapeInfo.m_triangleIndex = triangleIndex;
- if (hitFraction <= m_resultCallback->m_closestHitFraction)
+ btCollisionWorld::ConvexResultCallback* m_resultCallback;
+ btCollisionObject* m_collisionObject;
+ btConcaveShape* m_triangleMesh;
+
+ BridgeTriangleConvexcastCallback(const btConvexShape* castShape, const btTransform& from,const btTransform& to,
+ btCollisionWorld::ConvexResultCallback* resultCallback, btCollisionObject* collisionObject,btConcaveShape* triangleMesh, const btTransform& triangleToWorld):
+ btTriangleConvexcastCallback(castShape, from,to, triangleToWorld, triangleMesh->getMargin()),
+ m_resultCallback(resultCallback),
+ m_collisionObject(collisionObject),
+ m_triangleMesh(triangleMesh)
{
+ }
- btCollisionWorld::LocalConvexResult convexResult
- (m_collisionObject,
- &shapeInfo,
- hitNormalLocal,
- hitPointLocal,
- hitFraction);
- bool normalInWorldSpace = false;
+ virtual btScalar reportHit(const btVector3& hitNormalLocal, const btVector3& hitPointLocal, btScalar hitFraction, int partId, int triangleIndex )
+ {
+ btCollisionWorld::LocalShapeInfo shapeInfo;
+ shapeInfo.m_shapePart = partId;
+ shapeInfo.m_triangleIndex = triangleIndex;
+ if (hitFraction <= m_resultCallback->m_closestHitFraction)
+ {
- return m_resultCallback->addSingleResult(convexResult,normalInWorldSpace);
+ btCollisionWorld::LocalConvexResult convexResult
+ (m_collisionObject,
+ &shapeInfo,
+ hitNormalLocal,
+ hitPointLocal,
+ hitFraction);
+
+ bool normalInWorldSpace = false;
+
+ return m_resultCallback->addSingleResult(convexResult,normalInWorldSpace);
+ }
+ return hitFraction;
}
- return hitFraction;
- }
- };
+ };
- BridgeTriangleConvexcastCallback tccb(castShape, convexFromTrans,convexToTrans,&resultCallback,collisionObject,concaveShape, colObjWorldTransform);
- tccb.m_hitFraction = resultCallback.m_closestHitFraction;
- btVector3 boxMinLocal, boxMaxLocal;
- castShape->getAabb(rotationXform, boxMinLocal, boxMaxLocal);
+ BridgeTriangleConvexcastCallback tccb(castShape, convexFromTrans,convexToTrans,&resultCallback,collisionObject,concaveShape, colObjWorldTransform);
+ tccb.m_hitFraction = resultCallback.m_closestHitFraction;
+ tccb.m_allowedPenetration = allowedPenetration;
+ btVector3 boxMinLocal, boxMaxLocal;
+ castShape->getAabb(rotationXform, boxMinLocal, boxMaxLocal);
- btVector3 rayAabbMinLocal = convexFromLocal;
- rayAabbMinLocal.setMin(convexToLocal);
- btVector3 rayAabbMaxLocal = convexFromLocal;
- rayAabbMaxLocal.setMax(convexToLocal);
- rayAabbMinLocal += boxMinLocal;
- rayAabbMaxLocal += boxMaxLocal;
- concaveShape->processAllTriangles(&tccb,rayAabbMinLocal,rayAabbMaxLocal);
+ btVector3 rayAabbMinLocal = convexFromLocal;
+ rayAabbMinLocal.setMin(convexToLocal);
+ btVector3 rayAabbMaxLocal = convexFromLocal;
+ rayAabbMaxLocal.setMax(convexToLocal);
+ rayAabbMinLocal += boxMinLocal;
+ rayAabbMaxLocal += boxMaxLocal;
+ concaveShape->processAllTriangles(&tccb,rayAabbMinLocal,rayAabbMaxLocal);
+ }
}
} else {
///@todo : use AABB tree or other BVH acceleration structure!
@@ -667,6 +785,10 @@
{
m_closestHitFraction = m_userCallback->m_closestHitFraction;
}
+ virtual bool needsCollision(btBroadphaseProxy* p) const
+ {
+ return m_userCallback->needsCollision(p);
+ }
virtual btScalar addSingleResult (btCollisionWorld::LocalConvexResult& r, bool b)
{
btCollisionWorld::LocalShapeInfo shapeInfo;
@@ -1151,50 +1273,7 @@
btScalar halfHeight = capsuleShape->getHalfHeight();
int upAxis = capsuleShape->getUpAxis();
-
-
- btVector3 capStart(0.f,0.f,0.f);
- capStart[upAxis] = -halfHeight;
-
- btVector3 capEnd(0.f,0.f,0.f);
- capEnd[upAxis] = halfHeight;
-
- // Draw the ends
- {
-
- btTransform childTransform = worldTransform;
- childTransform.getOrigin() = worldTransform * capStart;
- getDebugDrawer()->drawSphere(radius, childTransform, color);
- }
-
- {
- btTransform childTransform = worldTransform;
- childTransform.getOrigin() = worldTransform * capEnd;
- getDebugDrawer()->drawSphere(radius, childTransform, color);
- }
-
- // Draw some additional lines
- btVector3 start = worldTransform.getOrigin();
-
-
- capStart[(upAxis+1)%3] = radius;
- capEnd[(upAxis+1)%3] = radius;
- getDebugDrawer()->drawLine(start+worldTransform.getBasis() * capStart,start+worldTransform.getBasis() * capEnd, color);
- capStart[(upAxis+1)%3] = -radius;
- capEnd[(upAxis+1)%3] = -radius;
- getDebugDrawer()->drawLine(start+worldTransform.getBasis() * capStart,start+worldTransform.getBasis() * capEnd, color);
-
- capStart[(upAxis+1)%3] = 0.f;
- capEnd[(upAxis+1)%3] = 0.f;
-
- capStart[(upAxis+2)%3] = radius;
- capEnd[(upAxis+2)%3] = radius;
- getDebugDrawer()->drawLine(start+worldTransform.getBasis() * capStart,start+worldTransform.getBasis() * capEnd, color);
- capStart[(upAxis+2)%3] = -radius;
- capEnd[(upAxis+2)%3] = -radius;
- getDebugDrawer()->drawLine(start+worldTransform.getBasis() * capStart,start+worldTransform.getBasis() * capEnd, color);
-
-
+ getDebugDrawer()->drawCapsule(radius, halfHeight, upAxis, worldTransform, color);
break;
}
case CONE_SHAPE_PROXYTYPE:
@@ -1202,31 +1281,11 @@
const btConeShape* coneShape = static_cast<const btConeShape*>(shape);
btScalar radius = coneShape->getRadius();//+coneShape->getMargin();
btScalar height = coneShape->getHeight();//+coneShape->getMargin();
- btVector3 start = worldTransform.getOrigin();
int upAxis= coneShape->getConeUpIndex();
+ getDebugDrawer()->drawCone(radius, height, upAxis, worldTransform, color);
+ break;
-
- btVector3 offsetHeight(0,0,0);
- offsetHeight[upAxis] = height * btScalar(0.5);
- btVector3 offsetRadius(0,0,0);
- offsetRadius[(upAxis+1)%3] = radius;
- btVector3 offset2Radius(0,0,0);
- offset2Radius[(upAxis+2)%3] = radius;
-
- getDebugDrawer()->drawLine(start+worldTransform.getBasis() * (offsetHeight),start+worldTransform.getBasis() * (-offsetHeight+offsetRadius),color);
- getDebugDrawer()->drawLine(start+worldTransform.getBasis() * (offsetHeight),start+worldTransform.getBasis() * (-offsetHeight-offsetRadius),color);
- getDebugDrawer()->drawLine(start+worldTransform.getBasis() * (offsetHeight),start+worldTransform.getBasis() * (-offsetHeight+offset2Radius),color);
- getDebugDrawer()->drawLine(start+worldTransform.getBasis() * (offsetHeight),start+worldTransform.getBasis() * (-offsetHeight-offset2Radius),color);
-
- // Drawing the base of the cone
- btVector3 yaxis(0,0,0);
- yaxis[upAxis] = btScalar(1.0);
- btVector3 xaxis(0,0,0);
- xaxis[(upAxis+1)%3] = btScalar(1.0);
- getDebugDrawer()->drawArc(start-worldTransform.getBasis()*(offsetHeight),worldTransform.getBasis()*yaxis,worldTransform.getBasis()*xaxis,radius,radius,0,SIMD_2_PI,color,false,10.0);
- break;
-
}
case CYLINDER_SHAPE_PROXYTYPE:
{
@@ -1234,21 +1293,7 @@
int upAxis = cylinder->getUpAxis();
btScalar radius = cylinder->getRadius();
btScalar halfHeight = cylinder->getHalfExtentsWithMargin()[upAxis];
- btVector3 start = worldTransform.getOrigin();
- btVector3 offsetHeight(0,0,0);
- offsetHeight[upAxis] = halfHeight;
- btVector3 offsetRadius(0,0,0);
- offsetRadius[(upAxis+1)%3] = radius;
- getDebugDrawer()->drawLine(start+worldTransform.getBasis() * (offsetHeight+offsetRadius),start+worldTransform.getBasis() * (-offsetHeight+offsetRadius),color);
- getDebugDrawer()->drawLine(start+worldTransform.getBasis() * (offsetHeight-offsetRadius),start+worldTransform.getBasis() * (-offsetHeight-offsetRadius),color);
-
- // Drawing top and bottom caps of the cylinder
- btVector3 yaxis(0,0,0);
- yaxis[upAxis] = btScalar(1.0);
- btVector3 xaxis(0,0,0);
- xaxis[(upAxis+1)%3] = btScalar(1.0);
- getDebugDrawer()->drawArc(start-worldTransform.getBasis()*(offsetHeight),worldTransform.getBasis()*yaxis,worldTransform.getBasis()*xaxis,radius,radius,0,SIMD_2_PI,color,false,btScalar(10.0));
- getDebugDrawer()->drawArc(start+worldTransform.getBasis()*(offsetHeight),worldTransform.getBasis()*yaxis,worldTransform.getBasis()*xaxis,radius,radius,0,SIMD_2_PI,color,false,btScalar(10.0));
+ getDebugDrawer()->drawCylinder(radius, halfHeight, upAxis, worldTransform, color);
break;
}
@@ -1257,16 +1302,7 @@
const btStaticPlaneShape* staticPlaneShape = static_cast<const btStaticPlaneShape*>(shape);
btScalar planeConst = staticPlaneShape->getPlaneConstant();
const btVector3& planeNormal = staticPlaneShape->getPlaneNormal();
- btVector3 planeOrigin = planeNormal * planeConst;
- btVector3 vec0,vec1;
- btPlaneSpace1(planeNormal,vec0,vec1);
- btScalar vecLen = 100.f;
- btVector3 pt0 = planeOrigin + vec0*vecLen;
- btVector3 pt1 = planeOrigin - vec0*vecLen;
- btVector3 pt2 = planeOrigin + vec1*vecLen;
- btVector3 pt3 = planeOrigin - vec1*vecLen;
- getDebugDrawer()->drawLine(worldTransform*pt0,worldTransform*pt1,color);
- getDebugDrawer()->drawLine(worldTransform*pt2,worldTransform*pt3,color);
+ getDebugDrawer()->drawPlane(planeNormal, planeConst,worldTransform, color);
break;
}
@@ -1304,14 +1340,44 @@
btPolyhedralConvexShape* polyshape = (btPolyhedralConvexShape*) shape;
int i;
- for (i=0;i<polyshape->getNumEdges();i++)
+ if (polyshape->getConvexPolyhedron())
{
- btVector3 a,b;
- polyshape->getEdge(i,a,b);
- btVector3 wa = worldTransform * a;
- btVector3 wb = worldTransform * b;
- getDebugDrawer()->drawLine(wa,wb,color);
+ const btConvexPolyhedron* poly = polyshape->getConvexPolyhedron();
+ for (i=0;i<poly->m_faces.size();i++)
+ {
+ btVector3 centroid(0,0,0);
+ int numVerts = poly->m_faces[i].m_indices.size();
+ if (numVerts)
+ {
+ int lastV = poly->m_faces[i].m_indices[numVerts-1];
+ for (int v=0;v<poly->m_faces[i].m_indices.size();v++)
+ {
+ int curVert = poly->m_faces[i].m_indices[v];
+ centroid+=poly->m_vertices[curVert];
+ getDebugDrawer()->drawLine(worldTransform*poly->m_vertices[lastV],worldTransform*poly->m_vertices[curVert],color);
+ lastV = curVert;
+ }
+ }
+ centroid*= 1./btScalar(numVerts);
+ btVector3 normalColor(1,1,0);
+ btVector3 faceNormal(poly->m_faces[i].m_plane[0],poly->m_faces[i].m_plane[1],poly->m_faces[i].m_plane[2]);
+ getDebugDrawer()->drawLine(worldTransform*centroid,worldTransform*(centroid+faceNormal),normalColor);
+
+
+ }
+
+
+ } else
+ {
+ for (i=0;i<polyshape->getNumEdges();i++)
+ {
+ btVector3 a,b;
+ polyshape->getEdge(i,a,b);
+ btVector3 wa = worldTransform * a;
+ btVector3 wb = worldTransform * b;
+ getDebugDrawer()->drawLine(wa,wb,color);
+ }
}
@@ -1380,6 +1446,21 @@
btVector3 minAabb,maxAabb;
btVector3 colorvec(1,0,0);
colObj->getCollisionShape()->getAabb(colObj->getWorldTransform(), minAabb,maxAabb);
+ btVector3 contactThreshold(gContactBreakingThreshold,gContactBreakingThreshold,gContactBreakingThreshold);
+ minAabb -= contactThreshold;
+ maxAabb += contactThreshold;
+
+ btVector3 minAabb2,maxAabb2;
+
+ if(colObj->getInternalType()==btCollisionObject::CO_RIGID_BODY)
+ {
+ colObj->getCollisionShape()->getAabb(colObj->getInterpolationWorldTransform(),minAabb2,maxAabb2);
+ minAabb2 -= contactThreshold;
+ maxAabb2 += contactThreshold;
+ minAabb.setMin(minAabb2);
+ maxAabb.setMax(maxAabb2);
+ }
+
m_debugDrawer->drawAabb(minAabb,maxAabb,colorvec);
}
}
Modified: code/trunk/src/external/bullet/BulletCollision/CollisionDispatch/btCollisionWorld.h
===================================================================
--- code/trunk/src/external/bullet/BulletCollision/CollisionDispatch/btCollisionWorld.h 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletCollision/CollisionDispatch/btCollisionWorld.h 2011-05-03 03:07:42 UTC (rev 8393)
@@ -62,8 +62,8 @@
-#ifndef COLLISION_WORLD_H
-#define COLLISION_WORLD_H
+#ifndef BT_COLLISION_WORLD_H
+#define BT_COLLISION_WORLD_H
class btStackAlloc;
class btCollisionShape;
@@ -506,4 +506,4 @@
};
-#endif //COLLISION_WORLD_H
+#endif //BT_COLLISION_WORLD_H
Modified: code/trunk/src/external/bullet/BulletCollision/CollisionDispatch/btCompoundCollisionAlgorithm.cpp
===================================================================
--- code/trunk/src/external/bullet/BulletCollision/CollisionDispatch/btCompoundCollisionAlgorithm.cpp 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletCollision/CollisionDispatch/btCompoundCollisionAlgorithm.cpp 2011-05-03 03:07:42 UTC (rev 8393)
@@ -234,7 +234,7 @@
resultOut->setPersistentManifold(0);//??necessary?
}
}
- manifoldArray.clear();
+ manifoldArray.resize(0);
}
}
}
Modified: code/trunk/src/external/bullet/BulletCollision/CollisionDispatch/btCompoundCollisionAlgorithm.h
===================================================================
--- code/trunk/src/external/bullet/BulletCollision/CollisionDispatch/btCompoundCollisionAlgorithm.h 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletCollision/CollisionDispatch/btCompoundCollisionAlgorithm.h 2011-05-03 03:07:42 UTC (rev 8393)
@@ -13,8 +13,8 @@
3. This notice may not be removed or altered from any source distribution.
*/
-#ifndef COMPOUND_COLLISION_ALGORITHM_H
-#define COMPOUND_COLLISION_ALGORITHM_H
+#ifndef BT_COMPOUND_COLLISION_ALGORITHM_H
+#define BT_COMPOUND_COLLISION_ALGORITHM_H
#include "btActivatingCollisionAlgorithm.h"
#include "BulletCollision/BroadphaseCollision/btDispatcher.h"
@@ -83,4 +83,4 @@
};
-#endif //COMPOUND_COLLISION_ALGORITHM_H
+#endif //BT_COMPOUND_COLLISION_ALGORITHM_H
Modified: code/trunk/src/external/bullet/BulletCollision/CollisionDispatch/btConvex2dConvex2dAlgorithm.h
===================================================================
--- code/trunk/src/external/bullet/BulletCollision/CollisionDispatch/btConvex2dConvex2dAlgorithm.h 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletCollision/CollisionDispatch/btConvex2dConvex2dAlgorithm.h 2011-05-03 03:07:42 UTC (rev 8393)
@@ -13,8 +13,8 @@
3. This notice may not be removed or altered from any source distribution.
*/
-#ifndef CONVEX_2D_CONVEX_2D_ALGORITHM_H
-#define CONVEX_2D_CONVEX_2D_ALGORITHM_H
+#ifndef BT_CONVEX_2D_CONVEX_2D_ALGORITHM_H
+#define BT_CONVEX_2D_CONVEX_2D_ALGORITHM_H
#include "BulletCollision/CollisionDispatch/btActivatingCollisionAlgorithm.h"
#include "BulletCollision/NarrowPhaseCollision/btGjkPairDetector.h"
@@ -92,4 +92,4 @@
};
-#endif //CONVEX_2D_CONVEX_2D_ALGORITHM_H
+#endif //BT_CONVEX_2D_CONVEX_2D_ALGORITHM_H
Modified: code/trunk/src/external/bullet/BulletCollision/CollisionDispatch/btConvexConcaveCollisionAlgorithm.cpp
===================================================================
--- code/trunk/src/external/bullet/BulletCollision/CollisionDispatch/btConvexConcaveCollisionAlgorithm.cpp 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletCollision/CollisionDispatch/btConvexConcaveCollisionAlgorithm.cpp 2011-05-03 03:07:42 UTC (rev 8393)
@@ -91,7 +91,7 @@
btCollisionObject* ob = static_cast<btCollisionObject*>(m_triBody);
-
+#if 0
///debug drawing of the overlapping triangles
if (m_dispatchInfoPtr && m_dispatchInfoPtr->m_debugDraw && (m_dispatchInfoPtr->m_debugDraw->getDebugMode() &btIDebugDraw::DBG_DrawWireframe ))
{
@@ -100,17 +100,8 @@
m_dispatchInfoPtr->m_debugDraw->drawLine(tr(triangle[0]),tr(triangle[1]),color);
m_dispatchInfoPtr->m_debugDraw->drawLine(tr(triangle[1]),tr(triangle[2]),color);
m_dispatchInfoPtr->m_debugDraw->drawLine(tr(triangle[2]),tr(triangle[0]),color);
-
- //btVector3 center = triangle[0] + triangle[1]+triangle[2];
- //center *= btScalar(0.333333);
- //m_dispatchInfoPtr->m_debugDraw->drawLine(tr(triangle[0]),tr(center),color);
- //m_dispatchInfoPtr->m_debugDraw->drawLine(tr(triangle[1]),tr(center),color);
- //m_dispatchInfoPtr->m_debugDraw->drawLine(tr(triangle[2]),tr(center),color);
-
}
-
-
- //btCollisionObject* colObj = static_cast<btCollisionObject*>(m_convexProxy->m_clientObject);
+#endif
if (m_convexBody->getCollisionShape()->isConvex())
{
@@ -119,7 +110,7 @@
btCollisionShape* tmpShape = ob->getCollisionShape();
ob->internalSetTemporaryCollisionShape( &tm );
-
+
btCollisionAlgorithm* colAlgo = ci.m_dispatcher1->findAlgorithm(m_convexBody,m_triBody,m_manifoldPtr);
if (m_resultOut->getBody0Internal() == m_triBody)
Modified: code/trunk/src/external/bullet/BulletCollision/CollisionDispatch/btConvexConcaveCollisionAlgorithm.h
===================================================================
--- code/trunk/src/external/bullet/BulletCollision/CollisionDispatch/btConvexConcaveCollisionAlgorithm.h 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletCollision/CollisionDispatch/btConvexConcaveCollisionAlgorithm.h 2011-05-03 03:07:42 UTC (rev 8393)
@@ -13,8 +13,8 @@
3. This notice may not be removed or altered from any source distribution.
*/
-#ifndef CONVEX_CONCAVE_COLLISION_ALGORITHM_H
-#define CONVEX_CONCAVE_COLLISION_ALGORITHM_H
+#ifndef BT_CONVEX_CONCAVE_COLLISION_ALGORITHM_H
+#define BT_CONVEX_CONCAVE_COLLISION_ALGORITHM_H
#include "btActivatingCollisionAlgorithm.h"
#include "BulletCollision/BroadphaseCollision/btDispatcher.h"
@@ -113,4 +113,4 @@
};
-#endif //CONVEX_CONCAVE_COLLISION_ALGORITHM_H
+#endif //BT_CONVEX_CONCAVE_COLLISION_ALGORITHM_H
Modified: code/trunk/src/external/bullet/BulletCollision/CollisionDispatch/btConvexConvexAlgorithm.cpp
===================================================================
--- code/trunk/src/external/bullet/BulletCollision/CollisionDispatch/btConvexConvexAlgorithm.cpp 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletCollision/CollisionDispatch/btConvexConvexAlgorithm.cpp 2011-05-03 03:07:42 UTC (rev 8393)
@@ -26,8 +26,10 @@
#include "BulletCollision/CollisionDispatch/btCollisionObject.h"
#include "BulletCollision/CollisionShapes/btConvexShape.h"
#include "BulletCollision/CollisionShapes/btCapsuleShape.h"
+#include "BulletCollision/CollisionShapes/btTriangleShape.h"
+
#include "BulletCollision/NarrowPhaseCollision/btGjkPairDetector.h"
#include "BulletCollision/BroadphaseCollision/btBroadphaseProxy.h"
#include "BulletCollision/CollisionDispatch/btCollisionDispatcher.h"
@@ -48,9 +50,9 @@
#include "BulletCollision/NarrowPhaseCollision/btGjkEpa2.h"
#include "BulletCollision/NarrowPhaseCollision/btGjkEpaPenetrationDepthSolver.h"
+#include "BulletCollision/NarrowPhaseCollision/btPolyhedralContactClipping.h"
-
///////////
@@ -331,6 +333,8 @@
#endif //BT_DISABLE_CAPSULE_CAPSULE_COLLIDER
+
+
#ifdef USE_SEPDISTANCE_UTIL2
if (dispatchInfo.m_useConvexConservativeDistanceUtil)
{
@@ -357,13 +361,14 @@
} else
#endif //USE_SEPDISTANCE_UTIL2
{
- if (dispatchInfo.m_convexMaxDistanceUseCPT)
- {
- input.m_maximumDistanceSquared = min0->getMargin() + min1->getMargin() + m_manifoldPtr->getContactProcessingThreshold();
- } else
- {
- input.m_maximumDistanceSquared = min0->getMargin() + min1->getMargin() + m_manifoldPtr->getContactBreakingThreshold();
- }
+ //if (dispatchInfo.m_convexMaxDistanceUseCPT)
+ //{
+ // input.m_maximumDistanceSquared = min0->getMargin() + min1->getMargin() + m_manifoldPtr->getContactProcessingThreshold();
+ //} else
+ //{
+ input.m_maximumDistanceSquared = min0->getMargin() + min1->getMargin() + m_manifoldPtr->getContactBreakingThreshold();
+// }
+
input.m_maximumDistanceSquared*= input.m_maximumDistanceSquared;
}
@@ -371,8 +376,8 @@
input.m_transformA = body0->getWorldTransform();
input.m_transformB = body1->getWorldTransform();
- gjkPairDetector.getClosestPoints(input,*resultOut,dispatchInfo.m_debugDraw);
+
#ifdef USE_SEPDISTANCE_UTIL2
@@ -389,6 +394,100 @@
}
#endif //USE_SEPDISTANCE_UTIL2
+ if (min0->isPolyhedral() && min1->isPolyhedral())
+ {
+
+
+ struct btDummyResult : public btDiscreteCollisionDetectorInterface::Result
+ {
+ virtual void setShapeIdentifiersA(int partId0,int index0){}
+ virtual void setShapeIdentifiersB(int partId1,int index1){}
+ virtual void addContactPoint(const btVector3& normalOnBInWorld,const btVector3& pointInWorld,btScalar depth)
+ {
+ }
+ };
+
+ btDummyResult dummy;
+
+
+ btPolyhedralConvexShape* polyhedronA = (btPolyhedralConvexShape*) min0;
+ btPolyhedralConvexShape* polyhedronB = (btPolyhedralConvexShape*) min1;
+ if (polyhedronA->getConvexPolyhedron() && polyhedronB->getConvexPolyhedron())
+ {
+
+
+ gjkPairDetector.getClosestPoints(input,dummy,dispatchInfo.m_debugDraw);
+
+
+ btScalar threshold = m_manifoldPtr->getContactBreakingThreshold();
+
+ btScalar minDist = 0.f;
+ btVector3 sepNormalWorldSpace;
+ bool foundSepAxis = true;
+
+ if (dispatchInfo.m_enableSatConvex)
+ {
+ foundSepAxis = btPolyhedralContactClipping::findSeparatingAxis(
+ *polyhedronA->getConvexPolyhedron(), *polyhedronB->getConvexPolyhedron(),
+ body0->getWorldTransform(),
+ body1->getWorldTransform(),
+ sepNormalWorldSpace);
+ } else
+ {
+ sepNormalWorldSpace = gjkPairDetector.getCachedSeparatingAxis().normalized();
+ minDist = gjkPairDetector.getCachedSeparatingDistance();
+ }
+ if (foundSepAxis)
+ {
+// printf("sepNormalWorldSpace=%f,%f,%f\n",sepNormalWorldSpace.getX(),sepNormalWorldSpace.getY(),sepNormalWorldSpace.getZ());
+
+ btPolyhedralContactClipping::clipHullAgainstHull(sepNormalWorldSpace, *polyhedronA->getConvexPolyhedron(), *polyhedronB->getConvexPolyhedron(),
+ body0->getWorldTransform(),
+ body1->getWorldTransform(), minDist-threshold, threshold, *resultOut);
+
+ }
+ if (m_ownManifold)
+ {
+ resultOut->refreshContactPoints();
+ }
+ return;
+
+ } else
+ {
+ //we can also deal with convex versus triangle (without connectivity data)
+ if (polyhedronA->getConvexPolyhedron() && polyhedronB->getShapeType()==TRIANGLE_SHAPE_PROXYTYPE)
+ {
+ gjkPairDetector.getClosestPoints(input,dummy,dispatchInfo.m_debugDraw);
+
+ btVector3 sepNormalWorldSpace = gjkPairDetector.getCachedSeparatingAxis().normalized();
+
+ btVertexArray vertices;
+ btTriangleShape* tri = (btTriangleShape*)polyhedronB;
+ vertices.push_back( body1->getWorldTransform()*tri->m_vertices1[0]);
+ vertices.push_back( body1->getWorldTransform()*tri->m_vertices1[1]);
+ vertices.push_back( body1->getWorldTransform()*tri->m_vertices1[2]);
+
+ btScalar threshold = m_manifoldPtr->getContactBreakingThreshold();
+ btScalar minDist = gjkPairDetector.getCachedSeparatingDistance();
+ btPolyhedralContactClipping::clipFaceAgainstHull(sepNormalWorldSpace, *polyhedronA->getConvexPolyhedron(),
+ body0->getWorldTransform(), vertices, minDist-threshold, threshold, *resultOut);
+
+
+ if (m_ownManifold)
+ {
+ resultOut->refreshContactPoints();
+ }
+
+ return;
+ }
+
+ }
+
+
+ }
+
+ gjkPairDetector.getClosestPoints(input,*resultOut,dispatchInfo.m_debugDraw);
+
//now perform 'm_numPerturbationIterations' collision queries with the perturbated collision objects
//perform perturbation when more then 'm_minimumPointsPerturbationThreshold' points
Modified: code/trunk/src/external/bullet/BulletCollision/CollisionDispatch/btConvexConvexAlgorithm.h
===================================================================
--- code/trunk/src/external/bullet/BulletCollision/CollisionDispatch/btConvexConvexAlgorithm.h 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletCollision/CollisionDispatch/btConvexConvexAlgorithm.h 2011-05-03 03:07:42 UTC (rev 8393)
@@ -13,8 +13,8 @@
3. This notice may not be removed or altered from any source distribution.
*/
-#ifndef CONVEX_CONVEX_ALGORITHM_H
-#define CONVEX_CONVEX_ALGORITHM_H
+#ifndef BT_CONVEX_CONVEX_ALGORITHM_H
+#define BT_CONVEX_CONVEX_ALGORITHM_H
#include "btActivatingCollisionAlgorithm.h"
#include "BulletCollision/NarrowPhaseCollision/btGjkPairDetector.h"
@@ -106,4 +106,4 @@
};
-#endif //CONVEX_CONVEX_ALGORITHM_H
+#endif //BT_CONVEX_CONVEX_ALGORITHM_H
Modified: code/trunk/src/external/bullet/BulletCollision/CollisionDispatch/btConvexPlaneCollisionAlgorithm.h
===================================================================
--- code/trunk/src/external/bullet/BulletCollision/CollisionDispatch/btConvexPlaneCollisionAlgorithm.h 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletCollision/CollisionDispatch/btConvexPlaneCollisionAlgorithm.h 2011-05-03 03:07:42 UTC (rev 8393)
@@ -13,8 +13,8 @@
3. This notice may not be removed or altered from any source distribution.
*/
-#ifndef CONVEX_PLANE_COLLISION_ALGORITHM_H
-#define CONVEX_PLANE_COLLISION_ALGORITHM_H
+#ifndef BT_CONVEX_PLANE_COLLISION_ALGORITHM_H
+#define BT_CONVEX_PLANE_COLLISION_ALGORITHM_H
#include "BulletCollision/BroadphaseCollision/btCollisionAlgorithm.h"
#include "BulletCollision/BroadphaseCollision/btBroadphaseProxy.h"
@@ -80,5 +80,5 @@
};
-#endif //CONVEX_PLANE_COLLISION_ALGORITHM_H
+#endif //BT_CONVEX_PLANE_COLLISION_ALGORITHM_H
Modified: code/trunk/src/external/bullet/BulletCollision/CollisionDispatch/btEmptyCollisionAlgorithm.h
===================================================================
--- code/trunk/src/external/bullet/BulletCollision/CollisionDispatch/btEmptyCollisionAlgorithm.h 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletCollision/CollisionDispatch/btEmptyCollisionAlgorithm.h 2011-05-03 03:07:42 UTC (rev 8393)
@@ -13,8 +13,8 @@
3. This notice may not be removed or altered from any source distribution.
*/
-#ifndef EMPTY_ALGORITH
-#define EMPTY_ALGORITH
+#ifndef BT_EMPTY_ALGORITH
+#define BT_EMPTY_ALGORITH
#include "BulletCollision/BroadphaseCollision/btCollisionAlgorithm.h"
#include "btCollisionCreateFunc.h"
#include "btCollisionDispatcher.h"
@@ -51,4 +51,4 @@
} ATTRIBUTE_ALIGNED(16);
-#endif //EMPTY_ALGORITH
+#endif //BT_EMPTY_ALGORITH
Modified: code/trunk/src/external/bullet/BulletCollision/CollisionDispatch/btInternalEdgeUtility.cpp
===================================================================
--- code/trunk/src/external/bullet/BulletCollision/CollisionDispatch/btInternalEdgeUtility.cpp 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletCollision/CollisionDispatch/btInternalEdgeUtility.cpp 2011-05-03 03:07:42 UTC (rev 8393)
@@ -1,6 +1,7 @@
#include "btInternalEdgeUtility.h"
#include "BulletCollision/CollisionShapes/btBvhTriangleMeshShape.h"
+#include "BulletCollision/CollisionShapes/btScaledBvhTriangleMeshShape.h"
#include "BulletCollision/CollisionShapes/btTriangleShape.h"
#include "BulletCollision/CollisionDispatch/btCollisionObject.h"
#include "BulletCollision/NarrowPhaseCollision/btManifoldPoint.h"
@@ -9,7 +10,6 @@
//#define DEBUG_INTERNAL_EDGE
-
#ifdef DEBUG_INTERNAL_EDGE
#include <stdio.h>
#endif //DEBUG_INTERNAL_EDGE
@@ -456,8 +456,14 @@
if (colObj0->getCollisionShape()->getShapeType() != TRIANGLE_SHAPE_PROXYTYPE)
return;
- btBvhTriangleMeshShape* trimesh = (btBvhTriangleMeshShape*)colObj0->getRootCollisionShape();
- btTriangleInfoMap* triangleInfoMapPtr = (btTriangleInfoMap*) trimesh->getTriangleInfoMap();
+ btBvhTriangleMeshShape* trimesh = 0;
+
+ if( colObj0->getRootCollisionShape()->getShapeType() == SCALED_TRIANGLE_MESH_SHAPE_PROXYTYPE )
+ trimesh = ((btScaledBvhTriangleMeshShape*)colObj0->getRootCollisionShape())->getChildShape();
+ else
+ trimesh = (btBvhTriangleMeshShape*)colObj0->getRootCollisionShape();
+
+ btTriangleInfoMap* triangleInfoMapPtr = (btTriangleInfoMap*) trimesh->getTriangleInfoMap();
if (!triangleInfoMapPtr)
return;
@@ -501,14 +507,63 @@
btVector3 localContactNormalOnB = colObj0->getWorldTransform().getBasis().transpose() * cp.m_normalWorldOnB;
localContactNormalOnB.normalize();//is this necessary?
-
- if ((info->m_edgeV0V1Angle)< SIMD_2_PI)
+
+ // Get closest edge
+ int bestedge=-1;
+ float disttobestedge=BT_LARGE_FLOAT;
+ //
+ // Edge 0 -> 1
+ if (btFabs(info->m_edgeV0V1Angle)< triangleInfoMapPtr->m_maxEdgeAngleThreshold)
+ {
+ btVector3 nearest;
+ btNearestPointInLineSegment( cp.m_localPointB, v0, v1, nearest );
+ float len=(contact-nearest).length();
+ //
+ if( len < disttobestedge )
+ {
+ bestedge=0;
+ disttobestedge=len;
+ }
+ }
+ // Edge 1 -> 2
+ if (btFabs(info->m_edgeV1V2Angle)< triangleInfoMapPtr->m_maxEdgeAngleThreshold)
+ {
+ btVector3 nearest;
+ btNearestPointInLineSegment( cp.m_localPointB, v1, v2, nearest );
+ float len=(contact-nearest).length();
+ //
+ if( len < disttobestedge )
+ {
+ bestedge=1;
+ disttobestedge=len;
+ }
+ }
+ // Edge 2 -> 0
+ if (btFabs(info->m_edgeV2V0Angle)< triangleInfoMapPtr->m_maxEdgeAngleThreshold)
+ {
+ btVector3 nearest;
+ btNearestPointInLineSegment( cp.m_localPointB, v2, v0, nearest );
+ float len=(contact-nearest).length();
+ //
+ if( len < disttobestedge )
+ {
+ bestedge=2;
+ disttobestedge=len;
+ }
+ }
+
+#ifdef BT_INTERNAL_EDGE_DEBUG_DRAW
+ btVector3 upfix=tri_normal * btVector3(0.1f,0.1f,0.1f);
+ btDebugDrawLine(tr * v0 + upfix, tr * v1 + upfix, red );
+#endif
+ if (btFabs(info->m_edgeV0V1Angle)< triangleInfoMapPtr->m_maxEdgeAngleThreshold)
{
#ifdef BT_INTERNAL_EDGE_DEBUG_DRAW
btDebugDrawLine(tr*contact,tr*(contact+cp.m_normalWorldOnB*10),black);
#endif
btScalar len = (contact-nearest).length();
if(len<triangleInfoMapPtr->m_edgeDistanceThreshold)
+ if( bestedge==0 )
{
btVector3 edge(v0-v1);
isNearEdge = true;
@@ -577,7 +632,11 @@
btDebugDrawLine(tr*nearest,tr*cp.m_localPointB,green);
#endif //BT_INTERNAL_EDGE_DEBUG_DRAW
- if ((info->m_edgeV1V2Angle)< SIMD_2_PI)
+#ifdef BT_INTERNAL_EDGE_DEBUG_DRAW
+ btDebugDrawLine(tr * v1 + upfix, tr * v2 + upfix , green );
+#endif
+
+ if (btFabs(info->m_edgeV1V2Angle)< triangleInfoMapPtr->m_maxEdgeAngleThreshold)
{
#ifdef BT_INTERNAL_EDGE_DEBUG_DRAW
btDebugDrawLine(tr*contact,tr*(contact+cp.m_normalWorldOnB*10),black);
@@ -587,6 +646,7 @@
btScalar len = (contact-nearest).length();
if(len<triangleInfoMapPtr->m_edgeDistanceThreshold)
+ if( bestedge==1 )
{
isNearEdge = true;
#ifdef BT_INTERNAL_EDGE_DEBUG_DRAW
@@ -658,8 +718,11 @@
#ifdef BT_INTERNAL_EDGE_DEBUG_DRAW
btDebugDrawLine(tr*nearest,tr*cp.m_localPointB,blue);
#endif //BT_INTERNAL_EDGE_DEBUG_DRAW
+#ifdef BT_INTERNAL_EDGE_DEBUG_DRAW
+ btDebugDrawLine(tr * v2 + upfix, tr * v0 + upfix , blue );
+#endif
- if ((info->m_edgeV2V0Angle)< SIMD_2_PI)
+ if (btFabs(info->m_edgeV2V0Angle)< triangleInfoMapPtr->m_maxEdgeAngleThreshold)
{
#ifdef BT_INTERNAL_EDGE_DEBUG_DRAW
@@ -668,6 +731,7 @@
btScalar len = (contact-nearest).length();
if(len<triangleInfoMapPtr->m_edgeDistanceThreshold)
+ if( bestedge==2 )
{
isNearEdge = true;
#ifdef BT_INTERNAL_EDGE_DEBUG_DRAW
@@ -759,11 +823,17 @@
cp.m_normalWorldOnB = colObj0->getWorldTransform().getBasis()*tri_normal;
} else
{
+ btVector3 newNormal = tri_normal *frontFacing;
+ //if the tri_normal is pointing opposite direction as the current local contact normal, skip it
+ btScalar d = newNormal.dot(localContactNormalOnB) ;
+ if (d< 0)
+ {
+ return;
+ }
//modify the normal to be the triangle normal (or backfacing normal)
- cp.m_normalWorldOnB = colObj0->getWorldTransform().getBasis() *(tri_normal *frontFacing);
+ cp.m_normalWorldOnB = colObj0->getWorldTransform().getBasis() *newNormal;
}
-
-
+
// Reproject collision point along normal.
cp.m_positionWorldOnB = cp.m_positionWorldOnA - cp.m_normalWorldOnB * cp.m_distance1;
cp.m_localPointB = colObj0->getWorldTransform().invXform(cp.m_positionWorldOnB);
Modified: code/trunk/src/external/bullet/BulletCollision/CollisionDispatch/btManifoldResult.cpp
===================================================================
--- code/trunk/src/external/bullet/BulletCollision/CollisionDispatch/btManifoldResult.cpp 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletCollision/CollisionDispatch/btManifoldResult.cpp 2011-05-03 03:07:42 UTC (rev 8393)
@@ -63,8 +63,9 @@
{
btAssert(m_manifoldPtr);
//order in manifold needs to match
-
- if (depth > m_manifoldPtr->getContactBreakingThreshold())
+
+// if (depth > m_manifoldPtr->getContactBreakingThreshold())
+ if (depth > m_manifoldPtr->getContactProcessingThreshold())
return;
bool isSwapped = m_manifoldPtr->getBody0() != m_body0;
Modified: code/trunk/src/external/bullet/BulletCollision/CollisionDispatch/btManifoldResult.h
===================================================================
--- code/trunk/src/external/bullet/BulletCollision/CollisionDispatch/btManifoldResult.h 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletCollision/CollisionDispatch/btManifoldResult.h 2011-05-03 03:07:42 UTC (rev 8393)
@@ -14,8 +14,8 @@
*/
-#ifndef MANIFOLD_RESULT_H
-#define MANIFOLD_RESULT_H
+#ifndef BT_MANIFOLD_RESULT_H
+#define BT_MANIFOLD_RESULT_H
class btCollisionObject;
#include "BulletCollision/NarrowPhaseCollision/btPersistentManifold.h"
@@ -125,4 +125,4 @@
};
-#endif //MANIFOLD_RESULT_H
+#endif //BT_MANIFOLD_RESULT_H
Modified: code/trunk/src/external/bullet/BulletCollision/CollisionDispatch/btSimulationIslandManager.cpp
===================================================================
--- code/trunk/src/external/bullet/BulletCollision/CollisionDispatch/btSimulationIslandManager.cpp 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletCollision/CollisionDispatch/btSimulationIslandManager.cpp 2011-05-03 03:07:42 UTC (rev 8393)
@@ -392,15 +392,15 @@
int islandId = getUnionFind().getElement(startIslandIndex).m_id;
- bool islandSleeping = false;
+ bool islandSleeping = true;
for (endIslandIndex = startIslandIndex;(endIslandIndex<numElem) && (getUnionFind().getElement(endIslandIndex).m_id == islandId);endIslandIndex++)
{
int i = getUnionFind().getElement(endIslandIndex).m_sz;
btCollisionObject* colObj0 = collisionObjects[i];
m_islandBodies.push_back(colObj0);
- if (!colObj0->isActive())
- islandSleeping = true;
+ if (colObj0->isActive())
+ islandSleeping = false;
}
Modified: code/trunk/src/external/bullet/BulletCollision/CollisionDispatch/btSimulationIslandManager.h
===================================================================
--- code/trunk/src/external/bullet/BulletCollision/CollisionDispatch/btSimulationIslandManager.h 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletCollision/CollisionDispatch/btSimulationIslandManager.h 2011-05-03 03:07:42 UTC (rev 8393)
@@ -13,8 +13,8 @@
3. This notice may not be removed or altered from any source distribution.
*/
-#ifndef SIMULATION_ISLAND_MANAGER_H
-#define SIMULATION_ISLAND_MANAGER_H
+#ifndef BT_SIMULATION_ISLAND_MANAGER_H
+#define BT_SIMULATION_ISLAND_MANAGER_H
#include "BulletCollision/CollisionDispatch/btUnionFind.h"
#include "btCollisionCreateFunc.h"
@@ -77,5 +77,5 @@
};
-#endif //SIMULATION_ISLAND_MANAGER_H
+#endif //BT_SIMULATION_ISLAND_MANAGER_H
Modified: code/trunk/src/external/bullet/BulletCollision/CollisionDispatch/btSphereBoxCollisionAlgorithm.h
===================================================================
--- code/trunk/src/external/bullet/BulletCollision/CollisionDispatch/btSphereBoxCollisionAlgorithm.h 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletCollision/CollisionDispatch/btSphereBoxCollisionAlgorithm.h 2011-05-03 03:07:42 UTC (rev 8393)
@@ -13,8 +13,8 @@
3. This notice may not be removed or altered from any source distribution.
*/
-#ifndef SPHERE_BOX_COLLISION_ALGORITHM_H
-#define SPHERE_BOX_COLLISION_ALGORITHM_H
+#ifndef BT_SPHERE_BOX_COLLISION_ALGORITHM_H
+#define BT_SPHERE_BOX_COLLISION_ALGORITHM_H
#include "btActivatingCollisionAlgorithm.h"
#include "BulletCollision/BroadphaseCollision/btBroadphaseProxy.h"
@@ -71,5 +71,5 @@
};
-#endif //SPHERE_BOX_COLLISION_ALGORITHM_H
+#endif //BT_SPHERE_BOX_COLLISION_ALGORITHM_H
Modified: code/trunk/src/external/bullet/BulletCollision/CollisionDispatch/btSphereSphereCollisionAlgorithm.h
===================================================================
--- code/trunk/src/external/bullet/BulletCollision/CollisionDispatch/btSphereSphereCollisionAlgorithm.h 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletCollision/CollisionDispatch/btSphereSphereCollisionAlgorithm.h 2011-05-03 03:07:42 UTC (rev 8393)
@@ -13,8 +13,8 @@
3. This notice may not be removed or altered from any source distribution.
*/
-#ifndef SPHERE_SPHERE_COLLISION_ALGORITHM_H
-#define SPHERE_SPHERE_COLLISION_ALGORITHM_H
+#ifndef BT_SPHERE_SPHERE_COLLISION_ALGORITHM_H
+#define BT_SPHERE_SPHERE_COLLISION_ALGORITHM_H
#include "btActivatingCollisionAlgorithm.h"
#include "BulletCollision/BroadphaseCollision/btBroadphaseProxy.h"
@@ -62,5 +62,5 @@
};
-#endif //SPHERE_SPHERE_COLLISION_ALGORITHM_H
+#endif //BT_SPHERE_SPHERE_COLLISION_ALGORITHM_H
Modified: code/trunk/src/external/bullet/BulletCollision/CollisionDispatch/btSphereTriangleCollisionAlgorithm.h
===================================================================
--- code/trunk/src/external/bullet/BulletCollision/CollisionDispatch/btSphereTriangleCollisionAlgorithm.h 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletCollision/CollisionDispatch/btSphereTriangleCollisionAlgorithm.h 2011-05-03 03:07:42 UTC (rev 8393)
@@ -13,8 +13,8 @@
3. This notice may not be removed or altered from any source distribution.
*/
-#ifndef SPHERE_TRIANGLE_COLLISION_ALGORITHM_H
-#define SPHERE_TRIANGLE_COLLISION_ALGORITHM_H
+#ifndef BT_SPHERE_TRIANGLE_COLLISION_ALGORITHM_H
+#define BT_SPHERE_TRIANGLE_COLLISION_ALGORITHM_H
#include "btActivatingCollisionAlgorithm.h"
#include "BulletCollision/BroadphaseCollision/btBroadphaseProxy.h"
@@ -65,5 +65,5 @@
};
-#endif //SPHERE_TRIANGLE_COLLISION_ALGORITHM_H
+#endif //BT_SPHERE_TRIANGLE_COLLISION_ALGORITHM_H
Modified: code/trunk/src/external/bullet/BulletCollision/CollisionDispatch/btUnionFind.h
===================================================================
--- code/trunk/src/external/bullet/BulletCollision/CollisionDispatch/btUnionFind.h 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletCollision/CollisionDispatch/btUnionFind.h 2011-05-03 03:07:42 UTC (rev 8393)
@@ -13,8 +13,8 @@
3. This notice may not be removed or altered from any source distribution.
*/
-#ifndef UNION_FIND_H
-#define UNION_FIND_H
+#ifndef BT_UNION_FIND_H
+#define BT_UNION_FIND_H
#include "LinearMath/btAlignedObjectArray.h"
@@ -126,4 +126,4 @@
};
-#endif //UNION_FIND_H
+#endif //BT_UNION_FIND_H
Modified: code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btBox2dShape.h
===================================================================
--- code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btBox2dShape.h 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btBox2dShape.h 2011-05-03 03:07:42 UTC (rev 8393)
@@ -13,8 +13,8 @@
3. This notice may not be removed or altered from any source distribution.
*/
-#ifndef OBB_BOX_2D_SHAPE_H
-#define OBB_BOX_2D_SHAPE_H
+#ifndef BT_OBB_BOX_2D_SHAPE_H
+#define BT_OBB_BOX_2D_SHAPE_H
#include "BulletCollision/CollisionShapes/btPolyhedralConvexShape.h"
#include "BulletCollision/CollisionShapes/btCollisionMargin.h"
@@ -358,6 +358,6 @@
};
-#endif //OBB_BOX_2D_SHAPE_H
+#endif //BT_OBB_BOX_2D_SHAPE_H
Modified: code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btBoxShape.h
===================================================================
--- code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btBoxShape.h 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btBoxShape.h 2011-05-03 03:07:42 UTC (rev 8393)
@@ -13,8 +13,8 @@
3. This notice may not be removed or altered from any source distribution.
*/
-#ifndef OBB_BOX_MINKOWSKI_H
-#define OBB_BOX_MINKOWSKI_H
+#ifndef BT_OBB_BOX_MINKOWSKI_H
+#define BT_OBB_BOX_MINKOWSKI_H
#include "btPolyhedralConvexShape.h"
#include "btCollisionMargin.h"
@@ -145,7 +145,7 @@
virtual void getVertex(int i,btVector3& vtx) const
{
- btVector3 halfExtents = getHalfExtentsWithoutMargin();
+ btVector3 halfExtents = getHalfExtentsWithMargin();
vtx = btVector3(
halfExtents.x() * (1-(i&1)) - halfExtents.x() * (i&1),
@@ -313,6 +313,6 @@
};
-#endif //OBB_BOX_MINKOWSKI_H
+#endif //BT_OBB_BOX_MINKOWSKI_H
Modified: code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btBvhTriangleMeshShape.cpp
===================================================================
--- code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btBvhTriangleMeshShape.cpp 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btBvhTriangleMeshShape.cpp 2011-05-03 03:07:42 UTC (rev 8393)
@@ -277,13 +277,13 @@
nodeSubPart);
unsigned int* gfxbase = (unsigned int*)(indexbase+nodeTriangleIndex*indexstride);
- btAssert(indicestype==PHY_INTEGER||indicestype==PHY_SHORT);
+ btAssert(indicestype==PHY_INTEGER||indicestype==PHY_SHORT||indicestype==PHY_UCHAR);
const btVector3& meshScaling = m_meshInterface->getScaling();
for (int j=2;j>=0;j--)
{
- int graphicsindex = indicestype==PHY_SHORT?((unsigned short*)gfxbase)[j]:gfxbase[j];
+ int graphicsindex = indicestype==PHY_SHORT?((unsigned short*)gfxbase)[j]:indicestype==PHY_INTEGER?gfxbase[j]:((unsigned char*)gfxbase)[j];
#ifdef DEBUG_TRIANGLE_MESH
Modified: code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btBvhTriangleMeshShape.h
===================================================================
--- code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btBvhTriangleMeshShape.h 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btBvhTriangleMeshShape.h 2011-05-03 03:07:42 UTC (rev 8393)
@@ -13,8 +13,8 @@
3. This notice may not be removed or altered from any source distribution.
*/
-#ifndef BVH_TRIANGLE_MESH_SHAPE_H
-#define BVH_TRIANGLE_MESH_SHAPE_H
+#ifndef BT_BVH_TRIANGLE_MESH_SHAPE_H
+#define BT_BVH_TRIANGLE_MESH_SHAPE_H
#include "btTriangleMeshShape.h"
#include "btOptimizedBvh.h"
@@ -39,7 +39,7 @@
BT_DECLARE_ALIGNED_ALLOCATOR();
- btBvhTriangleMeshShape() : btTriangleMeshShape(0),m_bvh(0),m_triangleInfoMap(0),m_ownsBvh(false) {m_shapeType = TRIANGLE_MESH_SHAPE_PROXYTYPE;};
+
btBvhTriangleMeshShape(btStridingMeshInterface* meshInterface, bool useQuantizedAabbCompression, bool buildBvh = true);
///optionally pass in a larger bvh aabb, used for quantization. This allows for deformations within this aabb
@@ -136,4 +136,4 @@
-#endif //BVH_TRIANGLE_MESH_SHAPE_H
+#endif //BT_BVH_TRIANGLE_MESH_SHAPE_H
Modified: code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btCollisionMargin.h
===================================================================
--- code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btCollisionMargin.h 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btCollisionMargin.h 2011-05-03 03:07:42 UTC (rev 8393)
@@ -13,8 +13,8 @@
3. This notice may not be removed or altered from any source distribution.
*/
-#ifndef COLLISION_MARGIN_H
-#define COLLISION_MARGIN_H
+#ifndef BT_COLLISION_MARGIN_H
+#define BT_COLLISION_MARGIN_H
//used by Gjk and some other algorithms
@@ -22,5 +22,5 @@
-#endif //COLLISION_MARGIN_H
+#endif //BT_COLLISION_MARGIN_H
Modified: code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btCollisionShape.h
===================================================================
--- code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btCollisionShape.h 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btCollisionShape.h 2011-05-03 03:07:42 UTC (rev 8393)
@@ -13,8 +13,8 @@
3. This notice may not be removed or altered from any source distribution.
*/
-#ifndef COLLISION_SHAPE_H
-#define COLLISION_SHAPE_H
+#ifndef BT_COLLISION_SHAPE_H
+#define BT_COLLISION_SHAPE_H
#include "LinearMath/btTransform.h"
#include "LinearMath/btVector3.h"
@@ -146,5 +146,5 @@
-#endif //COLLISION_SHAPE_H
+#endif //BT_COLLISION_SHAPE_H
Modified: code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btCompoundShape.cpp
===================================================================
--- code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btCompoundShape.cpp 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btCompoundShape.cpp 2011-05-03 03:07:42 UTC (rev 8393)
@@ -85,7 +85,7 @@
}
-void btCompoundShape::updateChildTransform(int childIndex, const btTransform& newChildTransform)
+void btCompoundShape::updateChildTransform(int childIndex, const btTransform& newChildTransform,bool shouldRecalculateLocalAabb)
{
m_children[childIndex].m_transform = newChildTransform;
@@ -99,7 +99,10 @@
m_dynamicAabbTree->update(m_children[childIndex].m_node,bounds);
}
- recalculateLocalAabb();
+ if (shouldRecalculateLocalAabb)
+ {
+ recalculateLocalAabb();
+ }
}
void btCompoundShape::removeChildShapeByIndex(int childShapeIndex)
@@ -283,10 +286,12 @@
childScale = childScale * scaling / m_localScaling;
m_children[i].m_childShape->setLocalScaling(childScale);
childTrans.setOrigin((childTrans.getOrigin())*scaling);
- updateChildTransform(i, childTrans);
- recalculateLocalAabb();
+ updateChildTransform(i, childTrans,false);
}
+
m_localScaling = scaling;
+ recalculateLocalAabb();
+
}
Modified: code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btCompoundShape.h
===================================================================
--- code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btCompoundShape.h 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btCompoundShape.h 2011-05-03 03:07:42 UTC (rev 8393)
@@ -13,8 +13,8 @@
3. This notice may not be removed or altered from any source distribution.
*/
-#ifndef COMPOUND_SHAPE_H
-#define COMPOUND_SHAPE_H
+#ifndef BT_COMPOUND_SHAPE_H
+#define BT_COMPOUND_SHAPE_H
#include "btCollisionShape.h"
@@ -106,7 +106,7 @@
}
///set a new transform for a child, and update internal data structures (local aabb and dynamic tree)
- void updateChildTransform(int childIndex, const btTransform& newChildTransform);
+ void updateChildTransform(int childIndex, const btTransform& newChildTransform, bool shouldRecalculateLocalAabb = true);
btCompoundShapeChild* getChildList()
@@ -143,11 +143,15 @@
return "Compound";
}
-
- btDbvt* getDynamicAabbTree()
+ const btDbvt* getDynamicAabbTree() const
{
return m_dynamicAabbTree;
}
+
+ btDbvt* getDynamicAabbTree()
+ {
+ return m_dynamicAabbTree;
+ }
void createAabbTreeFromChildren();
@@ -205,4 +209,4 @@
-#endif //COMPOUND_SHAPE_H
+#endif //BT_COMPOUND_SHAPE_H
Modified: code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btConcaveShape.h
===================================================================
--- code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btConcaveShape.h 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btConcaveShape.h 2011-05-03 03:07:42 UTC (rev 8393)
@@ -13,8 +13,8 @@
3. This notice may not be removed or altered from any source distribution.
*/
-#ifndef CONCAVE_SHAPE_H
-#define CONCAVE_SHAPE_H
+#ifndef BT_CONCAVE_SHAPE_H
+#define BT_CONCAVE_SHAPE_H
#include "btCollisionShape.h"
#include "BulletCollision/BroadphaseCollision/btBroadphaseProxy.h" // for the types
@@ -57,4 +57,4 @@
};
-#endif //CONCAVE_SHAPE_H
+#endif //BT_CONCAVE_SHAPE_H
Modified: code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btConeShape.cpp
===================================================================
--- code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btConeShape.cpp 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btConeShape.cpp 2011-05-03 03:07:42 UTC (rev 8393)
@@ -131,3 +131,13 @@
}
+void btConeShape::setLocalScaling(const btVector3& scaling)
+{
+ int axis = m_coneIndices[1];
+ int r1 = m_coneIndices[0];
+ int r2 = m_coneIndices[2];
+ m_height *= scaling[axis] / m_localScaling[axis];
+ m_radius *= (scaling[r1] / m_localScaling[r1] + scaling[r2] / m_localScaling[r2]) / 2;
+ m_sinAngle = (m_radius / btSqrt(m_radius * m_radius + m_height * m_height));
+ btConvexInternalShape::setLocalScaling(scaling);
+}
\ No newline at end of file
Modified: code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btConeShape.h
===================================================================
--- code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btConeShape.h 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btConeShape.h 2011-05-03 03:07:42 UTC (rev 8393)
@@ -13,8 +13,8 @@
3. This notice may not be removed or altered from any source distribution.
*/
-#ifndef CONE_MINKOWSKI_H
-#define CONE_MINKOWSKI_H
+#ifndef BT_CONE_MINKOWSKI_H
+#define BT_CONE_MINKOWSKI_H
#include "btConvexInternalShape.h"
#include "BulletCollision/BroadphaseCollision/btBroadphaseProxy.h" // for the types
@@ -81,6 +81,9 @@
{
return m_coneIndices[1];
}
+
+ virtual void setLocalScaling(const btVector3& scaling);
+
};
///btConeShape implements a Cone shape, around the X axis
@@ -96,5 +99,5 @@
public:
btConeShapeZ(btScalar radius,btScalar height);
};
-#endif //CONE_MINKOWSKI_H
+#endif //BT_CONE_MINKOWSKI_H
Modified: code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btConvex2dShape.h
===================================================================
--- code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btConvex2dShape.h 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btConvex2dShape.h 2011-05-03 03:07:42 UTC (rev 8393)
@@ -19,7 +19,7 @@
#include "BulletCollision/CollisionShapes/btConvexShape.h"
#include "BulletCollision/BroadphaseCollision/btBroadphaseProxy.h" // for the types
-///The btConvex2dShape allows to use arbitrary convex shapes are 2d convex shapes, with the Z component assumed to be 0.
+///The btConvex2dShape allows to use arbitrary convex shapes as 2d convex shapes, with the Z component assumed to be 0.
///For 2d boxes, the btBox2dShape is recommended.
class btConvex2dShape : public btConvexShape
{
Modified: code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btConvexHullShape.h
===================================================================
--- code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btConvexHullShape.h 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btConvexHullShape.h 2011-05-03 03:07:42 UTC (rev 8393)
@@ -13,8 +13,8 @@
3. This notice may not be removed or altered from any source distribution.
*/
-#ifndef CONVEX_HULL_SHAPE_H
-#define CONVEX_HULL_SHAPE_H
+#ifndef BT_CONVEX_HULL_SHAPE_H
+#define BT_CONVEX_HULL_SHAPE_H
#include "btPolyhedralConvexShape.h"
#include "BulletCollision/BroadphaseCollision/btBroadphaseProxy.h" // for the types
@@ -116,5 +116,5 @@
}
-#endif //CONVEX_HULL_SHAPE_H
+#endif //BT_CONVEX_HULL_SHAPE_H
Added: code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btConvexPolyhedron.cpp
===================================================================
--- code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btConvexPolyhedron.cpp (rev 0)
+++ code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btConvexPolyhedron.cpp 2011-05-03 03:07:42 UTC (rev 8393)
@@ -0,0 +1,185 @@
+/*
+Bullet Continuous Collision Detection and Physics Library
+Copyright (c) 2011 Advanced Micro Devices, Inc. http://bulletphysics.org
+
+This software is provided 'as-is', without any express or implied warranty.
+In no event will the authors be held liable for any damages arising from the use of this software.
+Permission is granted to anyone to use this software for any purpose,
+including commercial applications, and to alter it and redistribute it freely,
+subject to the following restrictions:
+
+1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
+2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
+3. This notice may not be removed or altered from any source distribution.
+*/
+
+
+///This file was written by Erwin Coumans
+///Separating axis rest based on work from Pierre Terdiman, see
+///And contact clipping based on work from Simon Hobbs
+
+
+#include "btConvexPolyhedron.h"
+#include "LinearMath/btHashMap.h"
+
+btConvexPolyhedron::btConvexPolyhedron()
+{
+
+}
+btConvexPolyhedron::~btConvexPolyhedron()
+{
+
+}
+
+
+inline bool IsAlmostZero(const btVector3& v)
+{
+ if(fabsf(v.x())>1e-6 || fabsf(v.y())>1e-6 || fabsf(v.z())>1e-6) return false;
+ return true;
+}
+
+struct btInternalVertexPair
+{
+ btInternalVertexPair(short int v0,short int v1)
+ :m_v0(v0),
+ m_v1(v1)
+ {
+ if (m_v1>m_v0)
+ btSwap(m_v0,m_v1);
+ }
+ short int m_v0;
+ short int m_v1;
+ int getHash() const
+ {
+ return m_v0+(m_v1<<16);
+ }
+ bool equals(const btInternalVertexPair& other) const
+ {
+ return m_v0==other.m_v0 && m_v1==other.m_v1;
+ }
+};
+
+struct btInternalEdge
+{
+ btInternalEdge()
+ :m_face0(-1),
+ m_face1(-1)
+ {
+ }
+ short int m_face0;
+ short int m_face1;
+};
+
+//
+
+void btConvexPolyhedron::initialize()
+{
+ btHashMap<btInternalVertexPair,btInternalEdge> edges;
+
+ float TotalArea = 0.0f;
+
+ m_localCenter.setValue(0, 0, 0);
+ for(int i=0;i<m_faces.size();i++)
+ {
+ int numVertices = m_faces[i].m_indices.size();
+ int NbTris = numVertices;
+ for(int j=0;j<NbTris;j++)
+ {
+ int k = (j+1)%numVertices;
+ btInternalVertexPair vp(m_faces[i].m_indices[j],m_faces[i].m_indices[k]);
+ btInternalEdge* edptr = edges.find(vp);
+ btVector3 edge = m_vertices[vp.m_v1]-m_vertices[vp.m_v0];
+ edge.normalize();
+
+ bool found = false;
+
+ for (int p=0;p<m_uniqueEdges.size();p++)
+ {
+
+ if (IsAlmostZero(m_uniqueEdges[p]-edge) ||
+ IsAlmostZero(m_uniqueEdges[p]+edge))
+ {
+ found = true;
+ break;
+ }
+ }
+
+ if (!found)
+ {
+ m_uniqueEdges.push_back(edge);
+ }
+
+ if (edptr)
+ {
+ btAssert(edptr->m_face0>=0);
+ btAssert(edptr->m_face1<0);
+ edptr->m_face1 = i;
+ } else
+ {
+ btInternalEdge ed;
+ ed.m_face0 = i;
+ edges.insert(vp,ed);
+ }
+ }
+ }
+
+ for(int i=0;i<m_faces.size();i++)
+ {
+ int numVertices = m_faces[i].m_indices.size();
+ m_faces[i].m_connectedFaces.resize(numVertices);
+
+ for(int j=0;j<numVertices;j++)
+ {
+ int k = (j+1)%numVertices;
+ btInternalVertexPair vp(m_faces[i].m_indices[j],m_faces[i].m_indices[k]);
+ btInternalEdge* edptr = edges.find(vp);
+ btAssert(edptr);
+ btAssert(edptr->m_face0>=0);
+ btAssert(edptr->m_face1>=0);
+
+ int connectedFace = (edptr->m_face0==i)?edptr->m_face1:edptr->m_face0;
+ m_faces[i].m_connectedFaces[j] = connectedFace;
+ }
+ }
+
+ for(int i=0;i<m_faces.size();i++)
+ {
+ int numVertices = m_faces[i].m_indices.size();
+ int NbTris = numVertices-2;
+
+ const btVector3& p0 = m_vertices[m_faces[i].m_indices[0]];
+ for(int j=1;j<=NbTris;j++)
+ {
+ int k = (j+1)%numVertices;
+ const btVector3& p1 = m_vertices[m_faces[i].m_indices[j]];
+ const btVector3& p2 = m_vertices[m_faces[i].m_indices[k]];
+ float Area = ((p0 - p1).cross(p0 - p2)).length() * 0.5f;
+ btVector3 Center = (p0+p1+p2)/3.0f;
+ m_localCenter += Area * Center;
+ TotalArea += Area;
+ }
+ }
+ m_localCenter /= TotalArea;
+
+}
+
+
+void btConvexPolyhedron::project(const btTransform& trans, const btVector3& dir, float& min, float& max) const
+{
+ min = FLT_MAX;
+ max = -FLT_MAX;
+ int numVerts = m_vertices.size();
+ for(int i=0;i<numVerts;i++)
+ {
+ btVector3 pt = trans * m_vertices[i];
+ float dp = pt.dot(dir);
+ if(dp < min) min = dp;
+ if(dp > max) max = dp;
+ }
+ if(min>max)
+ {
+ float tmp = min;
+ min = max;
+ max = tmp;
+ }
+}
\ No newline at end of file
Property changes on: code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btConvexPolyhedron.cpp
___________________________________________________________________
Added: svn:eol-style
+ native
Added: code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btConvexPolyhedron.h
===================================================================
--- code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btConvexPolyhedron.h (rev 0)
+++ code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btConvexPolyhedron.h 2011-05-03 03:07:42 UTC (rev 8393)
@@ -0,0 +1,54 @@
+/*
+Bullet Continuous Collision Detection and Physics Library
+Copyright (c) 2011 Advanced Micro Devices, Inc. http://bulletphysics.org
+
+This software is provided 'as-is', without any express or implied warranty.
+In no event will the authors be held liable for any damages arising from the use of this software.
+Permission is granted to anyone to use this software for any purpose,
+including commercial applications, and to alter it and redistribute it freely,
+subject to the following restrictions:
+
+1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
+2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
+3. This notice may not be removed or altered from any source distribution.
+*/
+
+
+///This file was written by Erwin Coumans
+
+
+#ifndef _BT_POLYHEDRAL_FEATURES_H
+#define _BT_POLYHEDRAL_FEATURES_H
+
+#include "LinearMath/btTransform.h"
+#include "LinearMath/btAlignedObjectArray.h"
+
+
+struct btFace
+{
+ btAlignedObjectArray<int> m_indices;
+ btAlignedObjectArray<int> m_connectedFaces;
+ float m_plane[4];
+};
+
+
+class btConvexPolyhedron
+{
+ public:
+ btConvexPolyhedron();
+ virtual ~btConvexPolyhedron();
+
+ btAlignedObjectArray<btVector3> m_vertices;
+ btAlignedObjectArray<btFace> m_faces;
+ btAlignedObjectArray<btVector3> m_uniqueEdges;
+ btVector3 m_localCenter;
+
+ void initialize();
+
+ void project(const btTransform& trans, const btVector3& dir, float& min, float& max) const;
+};
+
+
+#endif //_BT_POLYHEDRAL_FEATURES_H
+
+
Property changes on: code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btConvexPolyhedron.h
___________________________________________________________________
Added: svn:eol-style
+ native
Modified: code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btConvexShape.h
===================================================================
--- code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btConvexShape.h 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btConvexShape.h 2011-05-03 03:07:42 UTC (rev 8393)
@@ -13,8 +13,8 @@
3. This notice may not be removed or altered from any source distribution.
*/
-#ifndef CONVEX_SHAPE_INTERFACE1
-#define CONVEX_SHAPE_INTERFACE1
+#ifndef BT_CONVEX_SHAPE_INTERFACE1
+#define BT_CONVEX_SHAPE_INTERFACE1
#include "btCollisionShape.h"
@@ -79,4 +79,4 @@
-#endif //CONVEX_SHAPE_INTERFACE1
+#endif //BT_CONVEX_SHAPE_INTERFACE1
Modified: code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btConvexTriangleMeshShape.h
===================================================================
--- code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btConvexTriangleMeshShape.h 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btConvexTriangleMeshShape.h 2011-05-03 03:07:42 UTC (rev 8393)
@@ -12,8 +12,8 @@
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
-#ifndef CONVEX_TRIANGLEMESH_SHAPE_H
-#define CONVEX_TRIANGLEMESH_SHAPE_H
+#ifndef BT_CONVEX_TRIANGLEMESH_SHAPE_H
+#define BT_CONVEX_TRIANGLEMESH_SHAPE_H
#include "btPolyhedralConvexShape.h"
@@ -69,7 +69,7 @@
-#endif //CONVEX_TRIANGLEMESH_SHAPE_H
+#endif //BT_CONVEX_TRIANGLEMESH_SHAPE_H
Modified: code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btCylinderShape.cpp
===================================================================
--- code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btCylinderShape.cpp 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btCylinderShape.cpp 2011-05-03 03:07:42 UTC (rev 8393)
@@ -47,7 +47,64 @@
void btCylinderShape::calculateLocalInertia(btScalar mass,btVector3& inertia) const
{
- //approximation of box shape, todo: implement cylinder shape inertia before people notice ;-)
+
+//Until Bullet 2.77 a box approximation was used, so uncomment this if you need backwards compatibility
+//#define USE_BOX_INERTIA_APPROXIMATION 1
+#ifndef USE_BOX_INERTIA_APPROXIMATION
+
+ /*
+ cylinder is defined as following:
+ *
+ * - principle axis aligned along y by default, radius in x, z-value not used
+ * - for btCylinderShapeX: principle axis aligned along x, radius in y direction, z-value not used
+ * - for btCylinderShapeZ: principle axis aligned along z, radius in x direction, y-value not used
+ *
+ */
+
+ btScalar radius2; // square of cylinder radius
+ btScalar height2; // square of cylinder height
+ btVector3 halfExtents = getHalfExtentsWithMargin(); // get cylinder dimension
+ btScalar div12 = mass / 12.f;
+ btScalar div4 = mass / 4.f;
+ btScalar div2 = mass / 2.f;
+ int idxRadius, idxHeight;
+
+ switch (m_upAxis) // get indices of radius and height of cylinder
+ {
+ case 0: // cylinder is aligned along x
+ idxRadius = 1;
+ idxHeight = 0;
+ break;
+ case 2: // cylinder is aligned along z
+ idxRadius = 0;
+ idxHeight = 2;
+ break;
+ default: // cylinder is aligned along y
+ idxRadius = 0;
+ idxHeight = 1;
+ }
+
+ // calculate squares
+ radius2 = halfExtents[idxRadius] * halfExtents[idxRadius];
+ height2 = btScalar(4.) * halfExtents[idxHeight] * halfExtents[idxHeight];
+
+ // calculate tensor terms
+ btScalar t1 = div12 * height2 + div4 * radius2;
+ btScalar t2 = div2 * radius2;
+
+ switch (m_upAxis) // set diagonal elements of inertia tensor
+ {
+ case 0: // cylinder is aligned along x
+ inertia.setValue(t2,t1,t1);
+ break;
+ case 2: // cylinder is aligned along z
+ inertia.setValue(t1,t1,t2);
+ break;
+ default: // cylinder is aligned along y
+ inertia.setValue(t1,t2,t1);
+ }
+#else //USE_BOX_INERTIA_APPROXIMATION
+ //approximation of box shape
btVector3 halfExtents = getHalfExtentsWithMargin();
btScalar lx=btScalar(2.)*(halfExtents.x());
@@ -57,7 +114,7 @@
inertia.setValue(mass/(btScalar(12.0)) * (ly*ly + lz*lz),
mass/(btScalar(12.0)) * (lx*lx + lz*lz),
mass/(btScalar(12.0)) * (lx*lx + ly*ly));
-
+#endif //USE_BOX_INERTIA_APPROXIMATION
}
Modified: code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btCylinderShape.h
===================================================================
--- code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btCylinderShape.h 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btCylinderShape.h 2011-05-03 03:07:42 UTC (rev 8393)
@@ -13,8 +13,8 @@
3. This notice may not be removed or altered from any source distribution.
*/
-#ifndef CYLINDER_MINKOWSKI_H
-#define CYLINDER_MINKOWSKI_H
+#ifndef BT_CYLINDER_MINKOWSKI_H
+#define BT_CYLINDER_MINKOWSKI_H
#include "btBoxShape.h"
#include "BulletCollision/BroadphaseCollision/btBroadphaseProxy.h" // for the types
@@ -196,5 +196,5 @@
-#endif //CYLINDER_MINKOWSKI_H
+#endif //BT_CYLINDER_MINKOWSKI_H
Modified: code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btEmptyShape.h
===================================================================
--- code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btEmptyShape.h 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btEmptyShape.h 2011-05-03 03:07:42 UTC (rev 8393)
@@ -13,8 +13,8 @@
3. This notice may not be removed or altered from any source distribution.
*/
-#ifndef EMPTY_SHAPE_H
-#define EMPTY_SHAPE_H
+#ifndef BT_EMPTY_SHAPE_H
+#define BT_EMPTY_SHAPE_H
#include "btConcaveShape.h"
@@ -67,4 +67,4 @@
-#endif //EMPTY_SHAPE_H
+#endif //BT_EMPTY_SHAPE_H
Modified: code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btHeightfieldTerrainShape.h
===================================================================
--- code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btHeightfieldTerrainShape.h 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btHeightfieldTerrainShape.h 2011-05-03 03:07:42 UTC (rev 8393)
@@ -13,8 +13,8 @@
3. This notice may not be removed or altered from any source distribution.
*/
-#ifndef HEIGHTFIELD_TERRAIN_SHAPE_H
-#define HEIGHTFIELD_TERRAIN_SHAPE_H
+#ifndef BT_HEIGHTFIELD_TERRAIN_SHAPE_H
+#define BT_HEIGHTFIELD_TERRAIN_SHAPE_H
#include "btConcaveShape.h"
@@ -158,4 +158,4 @@
};
-#endif //HEIGHTFIELD_TERRAIN_SHAPE_H
+#endif //BT_HEIGHTFIELD_TERRAIN_SHAPE_H
Modified: code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btMaterial.h
===================================================================
--- code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btMaterial.h 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btMaterial.h 2011-05-03 03:07:42 UTC (rev 8393)
@@ -15,8 +15,8 @@
/// This file was created by Alex Silverman
-#ifndef MATERIAL_H
-#define MATERIAL_H
+#ifndef BT_MATERIAL_H
+#define BT_MATERIAL_H
// Material class to be used by btMultimaterialTriangleMeshShape to store triangle properties
class btMaterial
@@ -31,5 +31,5 @@
btMaterial(btScalar fric, btScalar rest) { m_friction = fric; m_restitution = rest; }
};
-#endif // MATERIAL_H
+#endif // BT_MATERIAL_H
Modified: code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btMinkowskiSumShape.h
===================================================================
--- code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btMinkowskiSumShape.h 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btMinkowskiSumShape.h 2011-05-03 03:07:42 UTC (rev 8393)
@@ -13,8 +13,8 @@
3. This notice may not be removed or altered from any source distribution.
*/
-#ifndef MINKOWSKI_SUM_SHAPE_H
-#define MINKOWSKI_SUM_SHAPE_H
+#ifndef BT_MINKOWSKI_SUM_SHAPE_H
+#define BT_MINKOWSKI_SUM_SHAPE_H
#include "btConvexInternalShape.h"
#include "BulletCollision/BroadphaseCollision/btBroadphaseProxy.h" // for the types
@@ -57,4 +57,4 @@
}
};
-#endif //MINKOWSKI_SUM_SHAPE_H
+#endif //BT_MINKOWSKI_SUM_SHAPE_H
Modified: code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btMultiSphereShape.h
===================================================================
--- code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btMultiSphereShape.h 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btMultiSphereShape.h 2011-05-03 03:07:42 UTC (rev 8393)
@@ -13,8 +13,8 @@
3. This notice may not be removed or altered from any source distribution.
*/
-#ifndef MULTI_SPHERE_MINKOWSKI_H
-#define MULTI_SPHERE_MINKOWSKI_H
+#ifndef BT_MULTI_SPHERE_MINKOWSKI_H
+#define BT_MULTI_SPHERE_MINKOWSKI_H
#include "btConvexInternalShape.h"
#include "BulletCollision/BroadphaseCollision/btBroadphaseProxy.h" // for the types
@@ -96,4 +96,4 @@
-#endif //MULTI_SPHERE_MINKOWSKI_H
+#endif //BT_MULTI_SPHERE_MINKOWSKI_H
Modified: code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btMultimaterialTriangleMeshShape.h
===================================================================
--- code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btMultimaterialTriangleMeshShape.h 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btMultimaterialTriangleMeshShape.h 2011-05-03 03:07:42 UTC (rev 8393)
@@ -15,8 +15,8 @@
/// This file was created by Alex Silverman
-#ifndef BVH_TRIANGLE_MATERIAL_MESH_SHAPE_H
-#define BVH_TRIANGLE_MATERIAL_MESH_SHAPE_H
+#ifndef BT_BVH_TRIANGLE_MATERIAL_MESH_SHAPE_H
+#define BT_BVH_TRIANGLE_MATERIAL_MESH_SHAPE_H
#include "btBvhTriangleMeshShape.h"
#include "btMaterial.h"
@@ -31,7 +31,6 @@
BT_DECLARE_ALIGNED_ALLOCATOR();
- btMultimaterialTriangleMeshShape(): btBvhTriangleMeshShape() {m_shapeType = MULTIMATERIAL_TRIANGLE_MESH_PROXYTYPE;}
btMultimaterialTriangleMeshShape(btStridingMeshInterface* meshInterface, bool useQuantizedAabbCompression, bool buildBvh = true):
btBvhTriangleMeshShape(meshInterface, useQuantizedAabbCompression, buildBvh)
{
@@ -118,4 +117,4 @@
}
;
-#endif //BVH_TRIANGLE_MATERIAL_MESH_SHAPE_H
+#endif //BT_BVH_TRIANGLE_MATERIAL_MESH_SHAPE_H
Modified: code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btOptimizedBvh.h
===================================================================
--- code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btOptimizedBvh.h 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btOptimizedBvh.h 2011-05-03 03:07:42 UTC (rev 8393)
@@ -15,8 +15,8 @@
///Contains contributions from Disney Studio's
-#ifndef OPTIMIZED_BVH_H
-#define OPTIMIZED_BVH_H
+#ifndef BT_OPTIMIZED_BVH_H
+#define BT_OPTIMIZED_BVH_H
#include "BulletCollision/BroadphaseCollision/btQuantizedBvh.h"
@@ -60,6 +60,6 @@
};
-#endif //OPTIMIZED_BVH_H
+#endif //BT_OPTIMIZED_BVH_H
Modified: code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btPolyhedralConvexShape.cpp
===================================================================
--- code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btPolyhedralConvexShape.cpp 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btPolyhedralConvexShape.cpp 2011-05-03 03:07:42 UTC (rev 8393)
@@ -14,13 +14,155 @@
*/
#include "BulletCollision/CollisionShapes/btPolyhedralConvexShape.h"
+#include "btConvexPolyhedron.h"
+#include "LinearMath/btConvexHullComputer.h"
+#include <new>
-btPolyhedralConvexShape::btPolyhedralConvexShape() :btConvexInternalShape()
+btPolyhedralConvexShape::btPolyhedralConvexShape() :btConvexInternalShape(),
+m_polyhedron(0)
{
}
+btPolyhedralConvexShape::~btPolyhedralConvexShape()
+{
+ if (m_polyhedron)
+ {
+ btAlignedFree(m_polyhedron);
+ }
+}
+bool btPolyhedralConvexShape::initializePolyhedralFeatures()
+{
+ if (m_polyhedron)
+ btAlignedFree(m_polyhedron);
+
+ void* mem = btAlignedAlloc(sizeof(btConvexPolyhedron),16);
+ m_polyhedron = new (mem) btConvexPolyhedron;
+
+ btAlignedObjectArray<btVector3> tmpVertices;
+ for (int i=0;i<getNumVertices();i++)
+ {
+ btVector3& newVertex = tmpVertices.expand();
+ getVertex(i,newVertex);
+ }
+
+ btConvexHullComputer conv;
+ conv.compute(&tmpVertices[0].getX(), sizeof(btVector3),tmpVertices.size(),0.f,0.f);
+
+
+
+ btAlignedObjectArray<btVector3> faceNormals;
+ int numFaces = conv.faces.size();
+ faceNormals.resize(numFaces);
+ btConvexHullComputer* convexUtil = &conv;
+
+
+
+ m_polyhedron->m_faces.resize(numFaces);
+ int numVertices = convexUtil->vertices.size();
+ m_polyhedron->m_vertices.resize(numVertices);
+ for (int p=0;p<numVertices;p++)
+ {
+ m_polyhedron->m_vertices[p] = convexUtil->vertices[p];
+ }
+
+ for (int i=0;i<numFaces;i++)
+ {
+ int face = convexUtil->faces[i];
+ //printf("face=%d\n",face);
+ const btConvexHullComputer::Edge* firstEdge = &convexUtil->edges[face];
+ const btConvexHullComputer::Edge* edge = firstEdge;
+
+ btVector3 edges[3];
+ int numEdges = 0;
+ //compute face normals
+
+ btScalar maxCross2 = 0.f;
+ int chosenEdge = -1;
+
+ do
+ {
+
+ int src = edge->getSourceVertex();
+ m_polyhedron->m_faces[i].m_indices.push_back(src);
+ int targ = edge->getTargetVertex();
+ btVector3 wa = convexUtil->vertices[src];
+
+ btVector3 wb = convexUtil->vertices[targ];
+ btVector3 newEdge = wb-wa;
+ newEdge.normalize();
+ if (numEdges<2)
+ edges[numEdges++] = newEdge;
+
+ edge = edge->getNextEdgeOfFace();
+ } while (edge!=firstEdge);
+
+ btScalar planeEq = 1e30f;
+
+
+ if (numEdges==2)
+ {
+ faceNormals[i] = edges[0].cross(edges[1]);
+ faceNormals[i].normalize();
+ m_polyhedron->m_faces[i].m_plane[0] = -faceNormals[i].getX();
+ m_polyhedron->m_faces[i].m_plane[1] = -faceNormals[i].getY();
+ m_polyhedron->m_faces[i].m_plane[2] = -faceNormals[i].getZ();
+ m_polyhedron->m_faces[i].m_plane[3] = planeEq;
+
+ }
+ else
+ {
+ btAssert(0);//degenerate?
+ faceNormals[i].setZero();
+ }
+
+ for (int v=0;v<m_polyhedron->m_faces[i].m_indices.size();v++)
+ {
+ btScalar eq = m_polyhedron->m_vertices[m_polyhedron->m_faces[i].m_indices[v]].dot(faceNormals[i]);
+ if (planeEq>eq)
+ {
+ planeEq=eq;
+ }
+ }
+ m_polyhedron->m_faces[i].m_plane[3] = planeEq;
+ }
+
+
+ if (m_polyhedron->m_faces.size() && conv.vertices.size())
+ {
+
+ for (int f=0;f<m_polyhedron->m_faces.size();f++)
+ {
+
+ btVector3 planeNormal(m_polyhedron->m_faces[f].m_plane[0],m_polyhedron->m_faces[f].m_plane[1],m_polyhedron->m_faces[f].m_plane[2]);
+ btScalar planeEq = m_polyhedron->m_faces[f].m_plane[3];
+
+ btVector3 supVec = localGetSupportingVertex(-planeNormal);
+
+ if (supVec.dot(planeNormal)<planeEq)
+ {
+ m_polyhedron->m_faces[f].m_plane[0] *= -1;
+ m_polyhedron->m_faces[f].m_plane[1] *= -1;
+ m_polyhedron->m_faces[f].m_plane[2] *= -1;
+ m_polyhedron->m_faces[f].m_plane[3] *= -1;
+ int numVerts = m_polyhedron->m_faces[f].m_indices.size();
+ for (int v=0;v<numVerts/2;v++)
+ {
+ btSwap(m_polyhedron->m_faces[f].m_indices[v],m_polyhedron->m_faces[f].m_indices[numVerts-1-v]);
+ }
+ }
+ }
+ }
+
+
+
+ m_polyhedron->initialize();
+
+ return true;
+}
+
+
btVector3 btPolyhedralConvexShape::localGetSupportingVertexWithoutMargin(const btVector3& vec0)const
{
@@ -191,3 +333,6 @@
#endif
}
+
+
+
Modified: code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btPolyhedralConvexShape.h
===================================================================
--- code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btPolyhedralConvexShape.h 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btPolyhedralConvexShape.h 2011-05-03 03:07:42 UTC (rev 8393)
@@ -13,23 +13,37 @@
3. This notice may not be removed or altered from any source distribution.
*/
-#ifndef BU_SHAPE
-#define BU_SHAPE
+#ifndef BT_POLYHEDRAL_CONVEX_SHAPE_H
+#define BT_POLYHEDRAL_CONVEX_SHAPE_H
#include "LinearMath/btMatrix3x3.h"
#include "btConvexInternalShape.h"
+class btConvexPolyhedron;
///The btPolyhedralConvexShape is an internal interface class for polyhedral convex shapes.
class btPolyhedralConvexShape : public btConvexInternalShape
{
+
protected:
+ btConvexPolyhedron* m_polyhedron;
+
public:
btPolyhedralConvexShape();
+ virtual ~btPolyhedralConvexShape();
+
+ ///optional method mainly used to generate multiple contact points by clipping polyhedral features (faces/edges)
+ virtual bool initializePolyhedralFeatures();
+
+ const btConvexPolyhedron* getConvexPolyhedron() const
+ {
+ return m_polyhedron;
+ }
+
//brute force implementations
virtual btVector3 localGetSupportingVertexWithoutMargin(const btVector3& vec)const;
@@ -95,4 +109,4 @@
};
-#endif //BU_SHAPE
+#endif //BT_POLYHEDRAL_CONVEX_SHAPE_H
Modified: code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btScaledBvhTriangleMeshShape.cpp
===================================================================
--- code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btScaledBvhTriangleMeshShape.cpp 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btScaledBvhTriangleMeshShape.cpp 2011-05-03 03:07:42 UTC (rev 8393)
@@ -62,10 +62,12 @@
scaledAabbMin[0] = m_localScaling.getX() >= 0. ? aabbMin[0] * invLocalScaling[0] : aabbMax[0] * invLocalScaling[0];
scaledAabbMin[1] = m_localScaling.getY() >= 0. ? aabbMin[1] * invLocalScaling[1] : aabbMax[1] * invLocalScaling[1];
scaledAabbMin[2] = m_localScaling.getZ() >= 0. ? aabbMin[2] * invLocalScaling[2] : aabbMax[2] * invLocalScaling[2];
+ scaledAabbMin[3] = 0.f;
scaledAabbMax[0] = m_localScaling.getX() <= 0. ? aabbMin[0] * invLocalScaling[0] : aabbMax[0] * invLocalScaling[0];
scaledAabbMax[1] = m_localScaling.getY() <= 0. ? aabbMin[1] * invLocalScaling[1] : aabbMax[1] * invLocalScaling[1];
scaledAabbMax[2] = m_localScaling.getZ() <= 0. ? aabbMin[2] * invLocalScaling[2] : aabbMax[2] * invLocalScaling[2];
+ scaledAabbMax[3] = 0.f;
m_bvhTriMeshShape->processAllTriangles(&scaledCallback,scaledAabbMin,scaledAabbMax);
Modified: code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btScaledBvhTriangleMeshShape.h
===================================================================
--- code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btScaledBvhTriangleMeshShape.h 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btScaledBvhTriangleMeshShape.h 2011-05-03 03:07:42 UTC (rev 8393)
@@ -13,8 +13,8 @@
3. This notice may not be removed or altered from any source distribution.
*/
-#ifndef SCALED_BVH_TRIANGLE_MESH_SHAPE_H
-#define SCALED_BVH_TRIANGLE_MESH_SHAPE_H
+#ifndef BT_SCALED_BVH_TRIANGLE_MESH_SHAPE_H
+#define BT_SCALED_BVH_TRIANGLE_MESH_SHAPE_H
#include "BulletCollision/CollisionShapes/btBvhTriangleMeshShape.h"
@@ -57,6 +57,37 @@
//debugging
virtual const char* getName()const {return "SCALEDBVHTRIANGLEMESH";}
+ virtual int calculateSerializeBufferSize() const;
+
+ ///fills the dataBuffer and returns the struct name (and 0 on failure)
+ virtual const char* serialize(void* dataBuffer, btSerializer* serializer) const;
+
};
-#endif //BVH_TRIANGLE_MESH_SHAPE_H
+///do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64
+struct btScaledTriangleMeshShapeData
+{
+ btTriangleMeshShapeData m_trimeshShapeData;
+
+ btVector3FloatData m_localScaling;
+};
+
+
+SIMD_FORCE_INLINE int btScaledBvhTriangleMeshShape::calculateSerializeBufferSize() const
+{
+ return sizeof(btScaledTriangleMeshShapeData);
+}
+
+
+///fills the dataBuffer and returns the struct name (and 0 on failure)
+SIMD_FORCE_INLINE const char* btScaledBvhTriangleMeshShape::serialize(void* dataBuffer, btSerializer* serializer) const
+{
+ btScaledTriangleMeshShapeData* scaledMeshData = (btScaledTriangleMeshShapeData*) dataBuffer;
+ m_bvhTriMeshShape->serialize(&scaledMeshData->m_trimeshShapeData,serializer);
+ scaledMeshData->m_trimeshShapeData.m_collisionShapeData.m_shapeType = SCALED_TRIANGLE_MESH_SHAPE_PROXYTYPE;
+ m_localScaling.serializeFloat(scaledMeshData->m_localScaling);
+ return "btScaledTriangleMeshShapeData";
+}
+
+
+#endif //BT_SCALED_BVH_TRIANGLE_MESH_SHAPE_H
Modified: code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btShapeHull.h
===================================================================
--- code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btShapeHull.h 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btShapeHull.h 2011-05-03 03:07:42 UTC (rev 8393)
@@ -15,8 +15,8 @@
///btShapeHull implemented by John McCutchan.
-#ifndef _SHAPE_HULL_H
-#define _SHAPE_HULL_H
+#ifndef BT_SHAPE_HULL_H
+#define BT_SHAPE_HULL_H
#include "LinearMath/btAlignedObjectArray.h"
#include "BulletCollision/CollisionShapes/btConvexShape.h"
@@ -56,4 +56,4 @@
}
};
-#endif //_SHAPE_HULL_H
+#endif //BT_SHAPE_HULL_H
Modified: code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btSphereShape.h
===================================================================
--- code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btSphereShape.h 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btSphereShape.h 2011-05-03 03:07:42 UTC (rev 8393)
@@ -12,8 +12,8 @@
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
-#ifndef SPHERE_MINKOWSKI_H
-#define SPHERE_MINKOWSKI_H
+#ifndef BT_SPHERE_MINKOWSKI_H
+#define BT_SPHERE_MINKOWSKI_H
#include "btConvexInternalShape.h"
#include "BulletCollision/BroadphaseCollision/btBroadphaseProxy.h" // for the types
@@ -70,4 +70,4 @@
};
-#endif //SPHERE_MINKOWSKI_H
+#endif //BT_SPHERE_MINKOWSKI_H
Modified: code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btStaticPlaneShape.h
===================================================================
--- code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btStaticPlaneShape.h 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btStaticPlaneShape.h 2011-05-03 03:07:42 UTC (rev 8393)
@@ -13,8 +13,8 @@
3. This notice may not be removed or altered from any source distribution.
*/
-#ifndef STATIC_PLANE_SHAPE_H
-#define STATIC_PLANE_SHAPE_H
+#ifndef BT_STATIC_PLANE_SHAPE_H
+#define BT_STATIC_PLANE_SHAPE_H
#include "btConcaveShape.h"
@@ -97,7 +97,7 @@
}
-#endif //STATIC_PLANE_SHAPE_H
+#endif //BT_STATIC_PLANE_SHAPE_H
Modified: code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btStridingMeshInterface.cpp
===================================================================
--- code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btStridingMeshInterface.cpp 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btStridingMeshInterface.cpp 2011-05-03 03:07:42 UTC (rev 8393)
@@ -88,6 +88,21 @@
}
break;
}
+ case PHY_UCHAR:
+ {
+ for (gfxindex=0;gfxindex<numtriangles;gfxindex++)
+ {
+ unsigned char* tri_indices= (unsigned char*)(indexbase+gfxindex*indexstride);
+ graphicsbase = (float*)(vertexbase+tri_indices[0]*stride);
+ triangle[0].setValue(graphicsbase[0]*meshScaling.getX(),graphicsbase[1]*meshScaling.getY(),graphicsbase[2]*meshScaling.getZ());
+ graphicsbase = (float*)(vertexbase+tri_indices[1]*stride);
+ triangle[1].setValue(graphicsbase[0]*meshScaling.getX(),graphicsbase[1]*meshScaling.getY(), graphicsbase[2]*meshScaling.getZ());
+ graphicsbase = (float*)(vertexbase+tri_indices[2]*stride);
+ triangle[2].setValue(graphicsbase[0]*meshScaling.getX(),graphicsbase[1]*meshScaling.getY(), graphicsbase[2]*meshScaling.getZ());
+ callback->internalProcessTriangleIndex(triangle,part,gfxindex);
+ }
+ break;
+ }
default:
btAssert((gfxindextype == PHY_INTEGER) || (gfxindextype == PHY_SHORT));
}
@@ -130,6 +145,21 @@
}
break;
}
+ case PHY_UCHAR:
+ {
+ for (gfxindex=0;gfxindex<numtriangles;gfxindex++)
+ {
+ unsigned char* tri_indices= (unsigned char*)(indexbase+gfxindex*indexstride);
+ graphicsbase = (double*)(vertexbase+tri_indices[0]*stride);
+ triangle[0].setValue((btScalar)graphicsbase[0]*meshScaling.getX(),(btScalar)graphicsbase[1]*meshScaling.getY(),(btScalar)graphicsbase[2]*meshScaling.getZ());
+ graphicsbase = (double*)(vertexbase+tri_indices[1]*stride);
+ triangle[1].setValue((btScalar)graphicsbase[0]*meshScaling.getX(),(btScalar)graphicsbase[1]*meshScaling.getY(), (btScalar)graphicsbase[2]*meshScaling.getZ());
+ graphicsbase = (double*)(vertexbase+tri_indices[2]*stride);
+ triangle[2].setValue((btScalar)graphicsbase[0]*meshScaling.getX(),(btScalar)graphicsbase[1]*meshScaling.getY(), (btScalar)graphicsbase[2]*meshScaling.getZ());
+ callback->internalProcessTriangleIndex(triangle,part,gfxindex);
+ }
+ break;
+ }
default:
btAssert((gfxindextype == PHY_INTEGER) || (gfxindextype == PHY_SHORT));
}
@@ -266,6 +296,24 @@
}
break;
}
+ case PHY_UCHAR:
+ {
+ if (numtriangles)
+ {
+ btChunk* chunk = serializer->allocate(sizeof(btCharIndexTripletData),numtriangles);
+ btCharIndexTripletData* tmpIndices = (btCharIndexTripletData*)chunk->m_oldPtr;
+ memPtr->m_3indices8 = (btCharIndexTripletData*) serializer->getUniquePointer(tmpIndices);
+ for (gfxindex=0;gfxindex<numtriangles;gfxindex++)
+ {
+ unsigned char* tri_indices= (unsigned char*)(indexbase+gfxindex*indexstride);
+ tmpIndices[gfxindex].m_values[0] = tri_indices[0];
+ tmpIndices[gfxindex].m_values[1] = tri_indices[1];
+ tmpIndices[gfxindex].m_values[2] = tri_indices[2];
+ }
+ serializer->finalizeChunk(chunk,"btCharIndexTripletData",BT_ARRAY_CODE,(void*)chunk->m_oldPtr);
+ }
+ break;
+ }
default:
{
btAssert(0);
Modified: code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btStridingMeshInterface.h
===================================================================
--- code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btStridingMeshInterface.h 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btStridingMeshInterface.h 2011-05-03 03:07:42 UTC (rev 8393)
@@ -13,8 +13,8 @@
3. This notice may not be removed or altered from any source distribution.
*/
-#ifndef STRIDING_MESHINTERFACE_H
-#define STRIDING_MESHINTERFACE_H
+#ifndef BT_STRIDING_MESHINTERFACE_H
+#define BT_STRIDING_MESHINTERFACE_H
#include "LinearMath/btVector3.h"
#include "btTriangleCallback.h"
@@ -116,6 +116,13 @@
char m_pad[2];
};
+struct btCharIndexTripletData
+{
+ unsigned char m_values[3];
+ char m_pad;
+};
+
+
///do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64
struct btMeshPartData
{
@@ -124,6 +131,7 @@
btIntIndexData *m_indices32;
btShortIntIndexTripletData *m_3indices16;
+ btCharIndexTripletData *m_3indices8;
btShortIntIndexData *m_indices16;//backwards compatibility
@@ -151,4 +159,4 @@
-#endif //STRIDING_MESHINTERFACE_H
+#endif //BT_STRIDING_MESHINTERFACE_H
Modified: code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btTetrahedronShape.h
===================================================================
--- code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btTetrahedronShape.h 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btTetrahedronShape.h 2011-05-03 03:07:42 UTC (rev 8393)
@@ -13,8 +13,8 @@
3. This notice may not be removed or altered from any source distribution.
*/
-#ifndef BU_SIMPLEX_1TO4_SHAPE
-#define BU_SIMPLEX_1TO4_SHAPE
+#ifndef BT_SIMPLEX_1TO4_SHAPE
+#define BT_SIMPLEX_1TO4_SHAPE
#include "btPolyhedralConvexShape.h"
@@ -71,4 +71,4 @@
};
-#endif //BU_SIMPLEX_1TO4_SHAPE
+#endif //BT_SIMPLEX_1TO4_SHAPE
Modified: code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btTriangleCallback.h
===================================================================
--- code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btTriangleCallback.h 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btTriangleCallback.h 2011-05-03 03:07:42 UTC (rev 8393)
@@ -13,8 +13,8 @@
3. This notice may not be removed or altered from any source distribution.
*/
-#ifndef TRIANGLE_CALLBACK_H
-#define TRIANGLE_CALLBACK_H
+#ifndef BT_TRIANGLE_CALLBACK_H
+#define BT_TRIANGLE_CALLBACK_H
#include "LinearMath/btVector3.h"
@@ -39,4 +39,4 @@
-#endif //TRIANGLE_CALLBACK_H
+#endif //BT_TRIANGLE_CALLBACK_H
Modified: code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btTriangleInfoMap.h
===================================================================
--- code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btTriangleInfoMap.h 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btTriangleInfoMap.h 2011-05-03 03:07:42 UTC (rev 8393)
@@ -61,6 +61,7 @@
btScalar m_planarEpsilon; ///used to determine if a triangle edge is planar with zero angle
btScalar m_equalVertexThreshold; ///used to compute connectivity: if the distance between two vertices is smaller than m_equalVertexThreshold, they are considered to be 'shared'
btScalar m_edgeDistanceThreshold; ///used to determine edge contacts: if the closest distance between a contact point and an edge is smaller than this distance threshold it is considered to "hit the edge"
+ btScalar m_maxEdgeAngleThreshold; //ignore edges that connect triangles at an angle larger than this m_maxEdgeAngleThreshold
btScalar m_zeroAreaThreshold; ///used to determine if a triangle is degenerate (length squared of cross product of 2 triangle edges < threshold)
@@ -71,6 +72,7 @@
m_equalVertexThreshold = btScalar(0.0001)*btScalar(0.0001);
m_edgeDistanceThreshold = btScalar(0.1);
m_zeroAreaThreshold = btScalar(0.0001)*btScalar(0.0001);
+ m_maxEdgeAngleThreshold = SIMD_2_PI;
}
virtual ~btTriangleInfoMap() {}
Modified: code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btTriangleMesh.h
===================================================================
--- code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btTriangleMesh.h 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btTriangleMesh.h 2011-05-03 03:07:42 UTC (rev 8393)
@@ -13,8 +13,8 @@
3. This notice may not be removed or altered from any source distribution.
*/
-#ifndef TRIANGLE_MESH_H
-#define TRIANGLE_MESH_H
+#ifndef BT_TRIANGLE_MESH_H
+#define BT_TRIANGLE_MESH_H
#include "btTriangleIndexVertexArray.h"
#include "LinearMath/btVector3.h"
@@ -65,5 +65,5 @@
};
-#endif //TRIANGLE_MESH_H
+#endif //BT_TRIANGLE_MESH_H
Modified: code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btTriangleMeshShape.h
===================================================================
--- code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btTriangleMeshShape.h 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btTriangleMeshShape.h 2011-05-03 03:07:42 UTC (rev 8393)
@@ -13,8 +13,8 @@
3. This notice may not be removed or altered from any source distribution.
*/
-#ifndef TRIANGLE_MESH_SHAPE_H
-#define TRIANGLE_MESH_SHAPE_H
+#ifndef BT_TRIANGLE_MESH_SHAPE_H
+#define BT_TRIANGLE_MESH_SHAPE_H
#include "btConcaveShape.h"
#include "btStridingMeshInterface.h"
@@ -86,4 +86,4 @@
-#endif //TRIANGLE_MESH_SHAPE_H
+#endif //BT_TRIANGLE_MESH_SHAPE_H
Modified: code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btTriangleShape.h
===================================================================
--- code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btTriangleShape.h 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btTriangleShape.h 2011-05-03 03:07:42 UTC (rev 8393)
@@ -13,8 +13,8 @@
3. This notice may not be removed or altered from any source distribution.
*/
-#ifndef OBB_TRIANGLE_MINKOWSKI_H
-#define OBB_TRIANGLE_MINKOWSKI_H
+#ifndef BT_OBB_TRIANGLE_MINKOWSKI_H
+#define BT_OBB_TRIANGLE_MINKOWSKI_H
#include "btConvexShape.h"
#include "btBoxShape.h"
@@ -178,5 +178,5 @@
};
-#endif //OBB_TRIANGLE_MINKOWSKI_H
+#endif //BT_OBB_TRIANGLE_MINKOWSKI_H
Modified: code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btUniformScalingShape.cpp
===================================================================
--- code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btUniformScalingShape.cpp 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btUniformScalingShape.cpp 2011-05-03 03:07:42 UTC (rev 8393)
@@ -64,25 +64,70 @@
///getAabb's default implementation is brute force, expected derived classes to implement a fast dedicated version
-void btUniformScalingShape::getAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const
+void btUniformScalingShape::getAabb(const btTransform& trans,btVector3& aabbMin,btVector3& aabbMax) const
{
- m_childConvexShape->getAabb(t,aabbMin,aabbMax);
- btVector3 aabbCenter = (aabbMax+aabbMin)*btScalar(0.5);
- btVector3 scaledAabbHalfExtends = (aabbMax-aabbMin)*btScalar(0.5)*m_uniformScalingFactor;
+ getAabbSlow(trans,aabbMin,aabbMax);
- aabbMin = aabbCenter - scaledAabbHalfExtends;
- aabbMax = aabbCenter + scaledAabbHalfExtends;
-
}
void btUniformScalingShape::getAabbSlow(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const
{
- m_childConvexShape->getAabbSlow(t,aabbMin,aabbMax);
- btVector3 aabbCenter = (aabbMax+aabbMin)*btScalar(0.5);
- btVector3 scaledAabbHalfExtends = (aabbMax-aabbMin)*btScalar(0.5)*m_uniformScalingFactor;
+#if 1
+ btVector3 _directions[] =
+ {
+ btVector3( 1., 0., 0.),
+ btVector3( 0., 1., 0.),
+ btVector3( 0., 0., 1.),
+ btVector3( -1., 0., 0.),
+ btVector3( 0., -1., 0.),
+ btVector3( 0., 0., -1.)
+ };
+
+ btVector3 _supporting[] =
+ {
+ btVector3( 0., 0., 0.),
+ btVector3( 0., 0., 0.),
+ btVector3( 0., 0., 0.),
+ btVector3( 0., 0., 0.),
+ btVector3( 0., 0., 0.),
+ btVector3( 0., 0., 0.)
+ };
- aabbMin = aabbCenter - scaledAabbHalfExtends;
- aabbMax = aabbCenter + scaledAabbHalfExtends;
+ for (int i=0;i<6;i++)
+ {
+ _directions[i] = _directions[i]*t.getBasis();
+ }
+
+ batchedUnitVectorGetSupportingVertexWithoutMargin(_directions, _supporting, 6);
+
+ btVector3 aabbMin1(0,0,0),aabbMax1(0,0,0);
+
+ for ( int i = 0; i < 3; ++i )
+ {
+ aabbMax1[i] = t(_supporting[i])[i];
+ aabbMin1[i] = t(_supporting[i + 3])[i];
+ }
+ btVector3 marginVec(getMargin(),getMargin(),getMargin());
+ aabbMin = aabbMin1-marginVec;
+ aabbMax = aabbMax1+marginVec;
+
+#else
+
+ btScalar margin = getMargin();
+ for (int i=0;i<3;i++)
+ {
+ btVector3 vec(btScalar(0.),btScalar(0.),btScalar(0.));
+ vec[i] = btScalar(1.);
+ btVector3 sv = localGetSupportingVertex(vec*t.getBasis());
+ btVector3 tmp = t(sv);
+ aabbMax[i] = tmp[i]+margin;
+ vec[i] = btScalar(-1.);
+ sv = localGetSupportingVertex(vec*t.getBasis());
+ tmp = t(sv);
+ aabbMin[i] = tmp[i]-margin;
+ }
+
+#endif
}
void btUniformScalingShape::setLocalScaling(const btVector3& scaling)
Modified: code/trunk/src/external/bullet/BulletCollision/NarrowPhaseCollision/btContinuousConvexCollision.cpp
===================================================================
--- code/trunk/src/external/bullet/BulletCollision/NarrowPhaseCollision/btContinuousConvexCollision.cpp 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletCollision/NarrowPhaseCollision/btContinuousConvexCollision.cpp 2011-05-03 03:07:42 UTC (rev 8393)
@@ -22,20 +22,72 @@
#include "btGjkPairDetector.h"
#include "btPointCollector.h"
+#include "BulletCollision/CollisionShapes/btStaticPlaneShape.h"
btContinuousConvexCollision::btContinuousConvexCollision ( const btConvexShape* convexA,const btConvexShape* convexB,btSimplexSolverInterface* simplexSolver, btConvexPenetrationDepthSolver* penetrationDepthSolver)
:m_simplexSolver(simplexSolver),
m_penetrationDepthSolver(penetrationDepthSolver),
-m_convexA(convexA),m_convexB(convexB)
+m_convexA(convexA),m_convexB1(convexB),m_planeShape(0)
{
}
+
+btContinuousConvexCollision::btContinuousConvexCollision( const btConvexShape* convexA,const btStaticPlaneShape* plane)
+:m_simplexSolver(0),
+m_penetrationDepthSolver(0),
+m_convexA(convexA),m_convexB1(0),m_planeShape(plane)
+{
+}
+
+
/// This maximum should not be necessary. It allows for untested/degenerate cases in production code.
/// You don't want your game ever to lock-up.
#define MAX_ITERATIONS 64
+void btContinuousConvexCollision::computeClosestPoints( const btTransform& transA, const btTransform& transB,btPointCollector& pointCollector)
+{
+ if (m_convexB1)
+ {
+ m_simplexSolver->reset();
+ btGjkPairDetector gjk(m_convexA,m_convexB1,m_convexA->getShapeType(),m_convexB1->getShapeType(),m_convexA->getMargin(),m_convexB1->getMargin(),m_simplexSolver,m_penetrationDepthSolver);
+ btGjkPairDetector::ClosestPointInput input;
+ input.m_transformA = transA;
+ input.m_transformB = transB;
+ gjk.getClosestPoints(input,pointCollector,0);
+ } else
+ {
+ //convex versus plane
+ const btConvexShape* convexShape = m_convexA;
+ const btStaticPlaneShape* planeShape = m_planeShape;
+
+ bool hasCollision = false;
+ const btVector3& planeNormal = planeShape->getPlaneNormal();
+ const btScalar& planeConstant = planeShape->getPlaneConstant();
+
+ btTransform convexWorldTransform = transA;
+ btTransform convexInPlaneTrans;
+ convexInPlaneTrans= transB.inverse() * convexWorldTransform;
+ btTransform planeInConvex;
+ planeInConvex= convexWorldTransform.inverse() * transB;
+
+ btVector3 vtx = convexShape->localGetSupportingVertex(planeInConvex.getBasis()*-planeNormal);
+
+ btVector3 vtxInPlane = convexInPlaneTrans(vtx);
+ btScalar distance = (planeNormal.dot(vtxInPlane) - planeConstant);
+
+ btVector3 vtxInPlaneProjected = vtxInPlane - distance*planeNormal;
+ btVector3 vtxInPlaneWorld = transB * vtxInPlaneProjected;
+ btVector3 normalOnSurfaceB = transB.getBasis() * planeNormal;
+
+ pointCollector.addContactPoint(
+ normalOnSurfaceB,
+ vtxInPlaneWorld,
+ distance);
+ }
+}
+
bool btContinuousConvexCollision::calcTimeOfImpact(
const btTransform& fromA,
const btTransform& toA,
@@ -44,7 +96,6 @@
CastResult& result)
{
- m_simplexSolver->reset();
/// compute linear and angular velocity for this interval, to interpolate
btVector3 linVelA,angVelA,linVelB,angVelB;
@@ -53,7 +104,7 @@
btScalar boundingRadiusA = m_convexA->getAngularMotionDisc();
- btScalar boundingRadiusB = m_convexB->getAngularMotionDisc();
+ btScalar boundingRadiusB = m_convexB1?m_convexB1->getAngularMotionDisc():0.f;
btScalar maxAngularProjectedVelocity = angVelA.length() * boundingRadiusA + angVelB.length() * boundingRadiusB;
btVector3 relLinVel = (linVelB-linVelA);
@@ -64,7 +115,6 @@
return false;
- btScalar radius = btScalar(0.001);
btScalar lambda = btScalar(0.);
btVector3 v(1,0,0);
@@ -83,29 +133,15 @@
//first solution, using GJK
- btTransform identityTrans;
- identityTrans.setIdentity();
-
- btSphereShape raySphere(btScalar(0.0));
- raySphere.setMargin(btScalar(0.));
-
-
+ btScalar radius = 0.001f;
// result.drawCoordSystem(sphereTr);
btPointCollector pointCollector1;
{
-
- btGjkPairDetector gjk(m_convexA,m_convexB,m_convexA->getShapeType(),m_convexB->getShapeType(),m_convexA->getMargin(),m_convexB->getMargin(),m_simplexSolver,m_penetrationDepthSolver);
- btGjkPairDetector::ClosestPointInput input;
- //we don't use margins during CCD
- // gjk.setIgnoreMargin(true);
+ computeClosestPoints(fromA,fromB,pointCollector1);
- input.m_transformA = fromA;
- input.m_transformB = fromB;
- gjk.getClosestPoints(input,pointCollector1,0);
-
hasResult = pointCollector1.m_hasResult;
c = pointCollector1.m_pointInWorld;
}
@@ -113,11 +149,12 @@
if (hasResult)
{
btScalar dist;
- dist = pointCollector1.m_distance;
+ dist = pointCollector1.m_distance + result.m_allowedPenetration;
n = pointCollector1.m_normalOnBInWorld;
+ btScalar projectedLinearVelocity = relLinVel.dot(n);
+ if ((projectedLinearVelocity+ maxAngularProjectedVelocity)<=SIMD_EPSILON)
+ return false;
- btScalar projectedLinearVelocity = relLinVel.dot(n);
-
//not close enough
while (dist > radius)
{
@@ -125,20 +162,11 @@
{
result.m_debugDrawer->drawSphere(c,0.2f,btVector3(1,1,1));
}
- numIter++;
- if (numIter > maxIter)
- {
- return false; //todo: report a failure
- }
btScalar dLambda = btScalar(0.);
projectedLinearVelocity = relLinVel.dot(n);
- //calculate safe moving fraction from distance / (linear+rotational velocity)
- //btScalar clippedDist = GEN_min(angularConservativeRadius,dist);
- //btScalar clippedDist = dist;
-
//don't report time of impact for motion away from the contact normal (or causes minor penetration)
if ((projectedLinearVelocity+ maxAngularProjectedVelocity)<=SIMD_EPSILON)
return false;
@@ -182,37 +210,27 @@
result.DebugDraw( lambda );
btPointCollector pointCollector;
- btGjkPairDetector gjk(m_convexA,m_convexB,m_simplexSolver,m_penetrationDepthSolver);
- btGjkPairDetector::ClosestPointInput input;
- input.m_transformA = interpolatedTransA;
- input.m_transformB = interpolatedTransB;
- gjk.getClosestPoints(input,pointCollector,0);
+ computeClosestPoints(interpolatedTransA,interpolatedTransB,pointCollector);
+
if (pointCollector.m_hasResult)
{
- if (pointCollector.m_distance < btScalar(0.))
- {
- //degenerate ?!
- result.m_fraction = lastLambda;
- n = pointCollector.m_normalOnBInWorld;
- result.m_normal=n;//.setValue(1,1,1);// = n;
- result.m_hitPoint = pointCollector.m_pointInWorld;
- return true;
- }
+ dist = pointCollector.m_distance+result.m_allowedPenetration;
c = pointCollector.m_pointInWorld;
n = pointCollector.m_normalOnBInWorld;
- dist = pointCollector.m_distance;
} else
{
- //??
+ result.reportFailure(-1, numIter);
return false;
}
-
+ numIter++;
+ if (numIter > maxIter)
+ {
+ result.reportFailure(-2, numIter);
+ return false;
+ }
}
- if ((projectedLinearVelocity+ maxAngularProjectedVelocity)<=result.m_allowedPenetration)//SIMD_EPSILON)
- return false;
-
result.m_fraction = lambda;
result.m_normal = n;
result.m_hitPoint = c;
@@ -221,16 +239,5 @@
return false;
-/*
-//todo:
- //if movement away from normal, discard result
- btVector3 move = transBLocalTo.getOrigin() - transBLocalFrom.getOrigin();
- if (result.m_fraction < btScalar(1.))
- {
- if (move.dot(result.m_normal) <= btScalar(0.))
- {
- }
- }
-*/
+}
-}
Modified: code/trunk/src/external/bullet/BulletCollision/NarrowPhaseCollision/btContinuousConvexCollision.h
===================================================================
--- code/trunk/src/external/bullet/BulletCollision/NarrowPhaseCollision/btContinuousConvexCollision.h 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletCollision/NarrowPhaseCollision/btContinuousConvexCollision.h 2011-05-03 03:07:42 UTC (rev 8393)
@@ -14,13 +14,14 @@
*/
-#ifndef CONTINUOUS_COLLISION_CONVEX_CAST_H
-#define CONTINUOUS_COLLISION_CONVEX_CAST_H
+#ifndef BT_CONTINUOUS_COLLISION_CONVEX_CAST_H
+#define BT_CONTINUOUS_COLLISION_CONVEX_CAST_H
#include "btConvexCast.h"
#include "btSimplexSolverInterface.h"
class btConvexPenetrationDepthSolver;
class btConvexShape;
+class btStaticPlaneShape;
/// btContinuousConvexCollision implements angular and linear time of impact for convex objects.
/// Based on Brian Mirtich's Conservative Advancement idea (PhD thesis).
@@ -31,13 +32,18 @@
btSimplexSolverInterface* m_simplexSolver;
btConvexPenetrationDepthSolver* m_penetrationDepthSolver;
const btConvexShape* m_convexA;
- const btConvexShape* m_convexB;
+ //second object is either a convex or a plane (code sharing)
+ const btConvexShape* m_convexB1;
+ const btStaticPlaneShape* m_planeShape;
+ void computeClosestPoints( const btTransform& transA, const btTransform& transB,struct btPointCollector& pointCollector);
public:
btContinuousConvexCollision (const btConvexShape* shapeA,const btConvexShape* shapeB ,btSimplexSolverInterface* simplexSolver,btConvexPenetrationDepthSolver* penetrationDepthSolver);
+ btContinuousConvexCollision(const btConvexShape* shapeA,const btStaticPlaneShape* plane );
+
virtual bool calcTimeOfImpact(
const btTransform& fromA,
const btTransform& toA,
@@ -48,5 +54,6 @@
};
-#endif //CONTINUOUS_COLLISION_CONVEX_CAST_H
+#endif //BT_CONTINUOUS_COLLISION_CONVEX_CAST_H
+
Modified: code/trunk/src/external/bullet/BulletCollision/NarrowPhaseCollision/btConvexCast.h
===================================================================
--- code/trunk/src/external/bullet/BulletCollision/NarrowPhaseCollision/btConvexCast.h 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletCollision/NarrowPhaseCollision/btConvexCast.h 2011-05-03 03:07:42 UTC (rev 8393)
@@ -14,8 +14,8 @@
*/
-#ifndef CONVEX_CAST_H
-#define CONVEX_CAST_H
+#ifndef BT_CONVEX_CAST_H
+#define BT_CONVEX_CAST_H
#include "LinearMath/btTransform.h"
#include "LinearMath/btVector3.h"
@@ -39,7 +39,7 @@
virtual void DebugDraw(btScalar fraction) {(void)fraction;}
virtual void drawCoordSystem(const btTransform& trans) {(void)trans;}
-
+ virtual void reportFailure(int errNo, int numIterations) {(void)errNo;(void)numIterations;}
CastResult()
:m_fraction(btScalar(BT_LARGE_FLOAT)),
m_debugDrawer(0),
@@ -70,4 +70,4 @@
CastResult& result) = 0;
};
-#endif //CONVEX_CAST_H
+#endif //BT_CONVEX_CAST_H
Modified: code/trunk/src/external/bullet/BulletCollision/NarrowPhaseCollision/btConvexPenetrationDepthSolver.h
===================================================================
--- code/trunk/src/external/bullet/BulletCollision/NarrowPhaseCollision/btConvexPenetrationDepthSolver.h 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletCollision/NarrowPhaseCollision/btConvexPenetrationDepthSolver.h 2011-05-03 03:07:42 UTC (rev 8393)
@@ -14,8 +14,8 @@
*/
-#ifndef __CONVEX_PENETRATION_DEPTH_H
-#define __CONVEX_PENETRATION_DEPTH_H
+#ifndef BT_CONVEX_PENETRATION_DEPTH_H
+#define BT_CONVEX_PENETRATION_DEPTH_H
class btStackAlloc;
class btVector3;
@@ -38,5 +38,5 @@
};
-#endif //CONVEX_PENETRATION_DEPTH_H
+#endif //BT_CONVEX_PENETRATION_DEPTH_H
Modified: code/trunk/src/external/bullet/BulletCollision/NarrowPhaseCollision/btDiscreteCollisionDetectorInterface.h
===================================================================
--- code/trunk/src/external/bullet/BulletCollision/NarrowPhaseCollision/btDiscreteCollisionDetectorInterface.h 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletCollision/NarrowPhaseCollision/btDiscreteCollisionDetectorInterface.h 2011-05-03 03:07:42 UTC (rev 8393)
@@ -14,8 +14,9 @@
*/
-#ifndef DISCRETE_COLLISION_DETECTOR1_INTERFACE_H
-#define DISCRETE_COLLISION_DETECTOR1_INTERFACE_H
+#ifndef BT_DISCRETE_COLLISION_DETECTOR1_INTERFACE_H
+#define BT_DISCRETE_COLLISION_DETECTOR1_INTERFACE_H
+
#include "LinearMath/btTransform.h"
#include "LinearMath/btVector3.h"
class btStackAlloc;
@@ -86,4 +87,5 @@
}
};
-#endif //DISCRETE_COLLISION_DETECTOR_INTERFACE1_H
+#endif //BT_DISCRETE_COLLISION_DETECTOR1_INTERFACE_H
+
Modified: code/trunk/src/external/bullet/BulletCollision/NarrowPhaseCollision/btGjkConvexCast.h
===================================================================
--- code/trunk/src/external/bullet/BulletCollision/NarrowPhaseCollision/btGjkConvexCast.h 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletCollision/NarrowPhaseCollision/btGjkConvexCast.h 2011-05-03 03:07:42 UTC (rev 8393)
@@ -15,8 +15,8 @@
-#ifndef GJK_CONVEX_CAST_H
-#define GJK_CONVEX_CAST_H
+#ifndef BT_GJK_CONVEX_CAST_H
+#define BT_GJK_CONVEX_CAST_H
#include "BulletCollision/CollisionShapes/btCollisionMargin.h"
@@ -47,4 +47,4 @@
};
-#endif //GJK_CONVEX_CAST_H
+#endif //BT_GJK_CONVEX_CAST_H
Modified: code/trunk/src/external/bullet/BulletCollision/NarrowPhaseCollision/btGjkEpa2.h
===================================================================
--- code/trunk/src/external/bullet/BulletCollision/NarrowPhaseCollision/btGjkEpa2.h 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletCollision/NarrowPhaseCollision/btGjkEpa2.h 2011-05-03 03:07:42 UTC (rev 8393)
@@ -22,8 +22,9 @@
/*
GJK-EPA collision solver by Nathanael Presson, 2008
*/
-#ifndef _68DA1F85_90B7_4bb0_A705_83B4040A75C6_
-#define _68DA1F85_90B7_4bb0_A705_83B4040A75C6_
+#ifndef BT_GJK_EPA2_H
+#define BT_GJK_EPA2_H
+
#include "BulletCollision/CollisionShapes/btConvexShape.h"
///btGjkEpaSolver contributed under zlib by Nathanael Presson
@@ -70,4 +71,5 @@
};
-#endif
+#endif //BT_GJK_EPA2_H
+
Modified: code/trunk/src/external/bullet/BulletCollision/NarrowPhaseCollision/btGjkPairDetector.cpp
===================================================================
--- code/trunk/src/external/bullet/BulletCollision/NarrowPhaseCollision/btGjkPairDetector.cpp 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletCollision/NarrowPhaseCollision/btGjkPairDetector.cpp 2011-05-03 03:07:42 UTC (rev 8393)
@@ -254,20 +254,21 @@
}
#endif //
- m_cachedSeparatingAxis = newCachedSeparatingAxis;
//redundant m_simplexSolver->compute_points(pointOnA, pointOnB);
//are we getting any closer ?
if (previousSquaredDistance - squaredDistance <= SIMD_EPSILON * previousSquaredDistance)
{
- m_simplexSolver->backup_closest(m_cachedSeparatingAxis);
+// m_simplexSolver->backup_closest(m_cachedSeparatingAxis);
checkSimplex = true;
m_degenerateSimplex = 12;
break;
}
+ m_cachedSeparatingAxis = newCachedSeparatingAxis;
+
//degeneracy, this is typically due to invalid/uninitialized worldtransforms for a btCollisionObject
if (m_curIter++ > gGjkMaxIter)
{
@@ -294,7 +295,7 @@
if (!check)
{
//do we need this backup_closest here ?
- m_simplexSolver->backup_closest(m_cachedSeparatingAxis);
+// m_simplexSolver->backup_closest(m_cachedSeparatingAxis);
m_degenerateSimplex = 13;
break;
}
@@ -303,7 +304,7 @@
if (checkSimplex)
{
m_simplexSolver->compute_points(pointOnA, pointOnB);
- normalInB = pointOnA-pointOnB;
+ normalInB = m_cachedSeparatingAxis;
btScalar lenSqr =m_cachedSeparatingAxis.length2();
//valid normal
Modified: code/trunk/src/external/bullet/BulletCollision/NarrowPhaseCollision/btGjkPairDetector.h
===================================================================
--- code/trunk/src/external/bullet/BulletCollision/NarrowPhaseCollision/btGjkPairDetector.h 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletCollision/NarrowPhaseCollision/btGjkPairDetector.h 2011-05-03 03:07:42 UTC (rev 8393)
@@ -16,8 +16,8 @@
-#ifndef GJK_PAIR_DETECTOR_H
-#define GJK_PAIR_DETECTOR_H
+#ifndef BT_GJK_PAIR_DETECTOR_H
+#define BT_GJK_PAIR_DETECTOR_H
#include "btDiscreteCollisionDetectorInterface.h"
#include "BulletCollision/CollisionShapes/btCollisionMargin.h"
@@ -100,4 +100,4 @@
};
-#endif //GJK_PAIR_DETECTOR_H
+#endif //BT_GJK_PAIR_DETECTOR_H
Modified: code/trunk/src/external/bullet/BulletCollision/NarrowPhaseCollision/btManifoldPoint.h
===================================================================
--- code/trunk/src/external/bullet/BulletCollision/NarrowPhaseCollision/btManifoldPoint.h 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletCollision/NarrowPhaseCollision/btManifoldPoint.h 2011-05-03 03:07:42 UTC (rev 8393)
@@ -13,25 +13,30 @@
3. This notice may not be removed or altered from any source distribution.
*/
-#ifndef MANIFOLD_CONTACT_POINT_H
-#define MANIFOLD_CONTACT_POINT_H
+#ifndef BT_MANIFOLD_CONTACT_POINT_H
+#define BT_MANIFOLD_CONTACT_POINT_H
#include "LinearMath/btVector3.h"
#include "LinearMath/btTransformUtil.h"
-// Don't change following order of parameters
-ATTRIBUTE_ALIGNED16(struct) PfxConstraintRow {
- btScalar mNormal[3];
- btScalar mRhs;
- btScalar mJacDiagInv;
- btScalar mLowerLimit;
- btScalar mUpperLimit;
- btScalar mAccumImpulse;
-};
+#ifdef PFX_USE_FREE_VECTORMATH
+ #include "physics_effects/base_level/solver/pfx_constraint_row.h"
+typedef sce::PhysicsEffects::PfxConstraintRow btConstraintRow;
+#else
+ // Don't change following order of parameters
+ ATTRIBUTE_ALIGNED16(struct) btConstraintRow {
+ btScalar m_normal[3];
+ btScalar m_rhs;
+ btScalar m_jacDiagInv;
+ btScalar m_lowerLimit;
+ btScalar m_upperLimit;
+ btScalar m_accumImpulse;
+ };
+ typedef btConstraintRow PfxConstraintRow;
+#endif //PFX_USE_FREE_VECTORMATH
-
/// ManifoldContactPoint collects and maintains persistent contactpoints.
/// used to improve stability and performance of rigidbody dynamics response.
class btManifoldPoint
@@ -71,9 +76,9 @@
m_contactCFM2(0.f),
m_lifeTime(0)
{
- mConstraintRow[0].mAccumImpulse = 0.f;
- mConstraintRow[1].mAccumImpulse = 0.f;
- mConstraintRow[2].mAccumImpulse = 0.f;
+ mConstraintRow[0].m_accumImpulse = 0.f;
+ mConstraintRow[1].m_accumImpulse = 0.f;
+ mConstraintRow[2].m_accumImpulse = 0.f;
}
@@ -113,7 +118,7 @@
- PfxConstraintRow mConstraintRow[3];
+ btConstraintRow mConstraintRow[3];
btScalar getDistance() const
@@ -150,4 +155,4 @@
};
-#endif //MANIFOLD_CONTACT_POINT_H
+#endif //BT_MANIFOLD_CONTACT_POINT_H
Modified: code/trunk/src/external/bullet/BulletCollision/NarrowPhaseCollision/btMinkowskiPenetrationDepthSolver.h
===================================================================
--- code/trunk/src/external/bullet/BulletCollision/NarrowPhaseCollision/btMinkowskiPenetrationDepthSolver.h 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletCollision/NarrowPhaseCollision/btMinkowskiPenetrationDepthSolver.h 2011-05-03 03:07:42 UTC (rev 8393)
@@ -13,8 +13,8 @@
3. This notice may not be removed or altered from any source distribution.
*/
-#ifndef MINKOWSKI_PENETRATION_DEPTH_SOLVER_H
-#define MINKOWSKI_PENETRATION_DEPTH_SOLVER_H
+#ifndef BT_MINKOWSKI_PENETRATION_DEPTH_SOLVER_H
+#define BT_MINKOWSKI_PENETRATION_DEPTH_SOLVER_H
#include "btConvexPenetrationDepthSolver.h"
@@ -36,5 +36,5 @@
);
};
-#endif //MINKOWSKI_PENETRATION_DEPTH_SOLVER_H
+#endif //BT_MINKOWSKI_PENETRATION_DEPTH_SOLVER_H
Modified: code/trunk/src/external/bullet/BulletCollision/NarrowPhaseCollision/btPersistentManifold.h
===================================================================
--- code/trunk/src/external/bullet/BulletCollision/NarrowPhaseCollision/btPersistentManifold.h 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletCollision/NarrowPhaseCollision/btPersistentManifold.h 2011-05-03 03:07:42 UTC (rev 8393)
@@ -13,8 +13,8 @@
3. This notice may not be removed or altered from any source distribution.
*/
-#ifndef PERSISTENT_MANIFOLD_H
-#define PERSISTENT_MANIFOLD_H
+#ifndef BT_PERSISTENT_MANIFOLD_H
+#define BT_PERSISTENT_MANIFOLD_H
#include "LinearMath/btVector3.h"
@@ -32,11 +32,11 @@
extern ContactDestroyedCallback gContactDestroyedCallback;
extern ContactProcessedCallback gContactProcessedCallback;
-
+//the enum starts at 1024 to avoid type conflicts with btTypedConstraint
enum btContactManifoldTypes
{
- BT_PERSISTENT_MANIFOLD_TYPE = 1,
- MAX_CONTACT_MANIFOLD_TYPE
+ MIN_CONTACT_MANIFOLD_TYPE = 1024,
+ BT_PERSISTENT_MANIFOLD_TYPE
};
#define MANIFOLD_CACHE_SIZE 4
@@ -146,9 +146,9 @@
m_pointCache[index] = m_pointCache[lastUsedIndex];
//get rid of duplicated userPersistentData pointer
m_pointCache[lastUsedIndex].m_userPersistentData = 0;
- m_pointCache[lastUsedIndex].mConstraintRow[0].mAccumImpulse = 0.f;
- m_pointCache[lastUsedIndex].mConstraintRow[1].mAccumImpulse = 0.f;
- m_pointCache[lastUsedIndex].mConstraintRow[2].mAccumImpulse = 0.f;
+ m_pointCache[lastUsedIndex].mConstraintRow[0].m_accumImpulse = 0.f;
+ m_pointCache[lastUsedIndex].mConstraintRow[1].m_accumImpulse = 0.f;
+ m_pointCache[lastUsedIndex].mConstraintRow[2].m_accumImpulse = 0.f;
m_pointCache[lastUsedIndex].m_appliedImpulse = 0.f;
m_pointCache[lastUsedIndex].m_lateralFrictionInitialized = false;
@@ -167,9 +167,9 @@
#define MAINTAIN_PERSISTENCY 1
#ifdef MAINTAIN_PERSISTENCY
int lifeTime = m_pointCache[insertIndex].getLifeTime();
- btScalar appliedImpulse = m_pointCache[insertIndex].mConstraintRow[0].mAccumImpulse;
- btScalar appliedLateralImpulse1 = m_pointCache[insertIndex].mConstraintRow[1].mAccumImpulse;
- btScalar appliedLateralImpulse2 = m_pointCache[insertIndex].mConstraintRow[2].mAccumImpulse;
+ btScalar appliedImpulse = m_pointCache[insertIndex].mConstraintRow[0].m_accumImpulse;
+ btScalar appliedLateralImpulse1 = m_pointCache[insertIndex].mConstraintRow[1].m_accumImpulse;
+ btScalar appliedLateralImpulse2 = m_pointCache[insertIndex].mConstraintRow[2].m_accumImpulse;
// bool isLateralFrictionInitialized = m_pointCache[insertIndex].m_lateralFrictionInitialized;
@@ -184,9 +184,9 @@
m_pointCache[insertIndex].m_appliedImpulseLateral1 = appliedLateralImpulse1;
m_pointCache[insertIndex].m_appliedImpulseLateral2 = appliedLateralImpulse2;
- m_pointCache[insertIndex].mConstraintRow[0].mAccumImpulse = appliedImpulse;
- m_pointCache[insertIndex].mConstraintRow[1].mAccumImpulse = appliedLateralImpulse1;
- m_pointCache[insertIndex].mConstraintRow[2].mAccumImpulse = appliedLateralImpulse2;
+ m_pointCache[insertIndex].mConstraintRow[0].m_accumImpulse = appliedImpulse;
+ m_pointCache[insertIndex].mConstraintRow[1].m_accumImpulse = appliedLateralImpulse1;
+ m_pointCache[insertIndex].mConstraintRow[2].m_accumImpulse = appliedLateralImpulse2;
m_pointCache[insertIndex].m_lifeTime = lifeTime;
@@ -199,7 +199,12 @@
bool validContactDistance(const btManifoldPoint& pt) const
{
- return pt.m_distance1 <= getContactBreakingThreshold();
+ if (pt.m_lifeTime >1)
+ {
+ return pt.m_distance1 <= getContactBreakingThreshold();
+ }
+ return pt.m_distance1 <= getContactProcessingThreshold();
+
}
/// calculated new worldspace coordinates and depth, and reject points that exceed the collision margin
void refreshContactPoints( const btTransform& trA,const btTransform& trB);
@@ -224,4 +229,4 @@
-#endif //PERSISTENT_MANIFOLD_H
+#endif //BT_PERSISTENT_MANIFOLD_H
Modified: code/trunk/src/external/bullet/BulletCollision/NarrowPhaseCollision/btPointCollector.h
===================================================================
--- code/trunk/src/external/bullet/BulletCollision/NarrowPhaseCollision/btPointCollector.h 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletCollision/NarrowPhaseCollision/btPointCollector.h 2011-05-03 03:07:42 UTC (rev 8393)
@@ -13,8 +13,8 @@
3. This notice may not be removed or altered from any source distribution.
*/
-#ifndef POINT_COLLECTOR_H
-#define POINT_COLLECTOR_H
+#ifndef BT_POINT_COLLECTOR_H
+#define BT_POINT_COLLECTOR_H
#include "btDiscreteCollisionDetectorInterface.h"
@@ -60,5 +60,5 @@
}
};
-#endif //POINT_COLLECTOR_H
+#endif //BT_POINT_COLLECTOR_H
Added: code/trunk/src/external/bullet/BulletCollision/NarrowPhaseCollision/btPolyhedralContactClipping.cpp
===================================================================
--- code/trunk/src/external/bullet/BulletCollision/NarrowPhaseCollision/btPolyhedralContactClipping.cpp (rev 0)
+++ code/trunk/src/external/bullet/BulletCollision/NarrowPhaseCollision/btPolyhedralContactClipping.cpp 2011-05-03 03:07:42 UTC (rev 8393)
@@ -0,0 +1,360 @@
+/*
+Bullet Continuous Collision Detection and Physics Library
+Copyright (c) 2011 Advanced Micro Devices, Inc. http://bulletphysics.org
+
+This software is provided 'as-is', without any express or implied warranty.
+In no event will the authors be held liable for any damages arising from the use of this software.
+Permission is granted to anyone to use this software for any purpose,
+including commercial applications, and to alter it and redistribute it freely,
+subject to the following restrictions:
+
+1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
+2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
+3. This notice may not be removed or altered from any source distribution.
+*/
+
+
+///This file was written by Erwin Coumans
+///Separating axis rest based on work from Pierre Terdiman, see
+///And contact clipping based on work from Simon Hobbs
+
+
+#include "btPolyhedralContactClipping.h"
+#include "BulletCollision/CollisionShapes/btConvexPolyhedron.h"
+
+#include <float.h> //for FLT_MAX
+
+
+// Clips a face to the back of a plane
+void btPolyhedralContactClipping::clipFace(const btVertexArray& pVtxIn, btVertexArray& ppVtxOut, const btVector3& planeNormalWS,btScalar planeEqWS)
+{
+
+ int ve;
+ btScalar ds, de;
+ int numVerts = pVtxIn.size();
+ if (numVerts < 2)
+ return;
+
+ btVector3 firstVertex=pVtxIn[pVtxIn.size()-1];
+ btVector3 endVertex = pVtxIn[0];
+
+ ds = planeNormalWS.dot(firstVertex)+planeEqWS;
+
+ for (ve = 0; ve < numVerts; ve++)
+ {
+ endVertex=pVtxIn[ve];
+
+ de = planeNormalWS.dot(endVertex)+planeEqWS;
+
+ if (ds<0)
+ {
+ if (de<0)
+ {
+ // Start < 0, end < 0, so output endVertex
+ ppVtxOut.push_back(endVertex);
+ }
+ else
+ {
+ // Start < 0, end >= 0, so output intersection
+ ppVtxOut.push_back( firstVertex.lerp(endVertex,btScalar(ds * 1.f/(ds - de))));
+ }
+ }
+ else
+ {
+ if (de<0)
+ {
+ // Start >= 0, end < 0 so output intersection and end
+ ppVtxOut.push_back(firstVertex.lerp(endVertex,btScalar(ds * 1.f/(ds - de))));
+ ppVtxOut.push_back(endVertex);
+ }
+ }
+ firstVertex = endVertex;
+ ds = de;
+ }
+}
+#include <stdio.h>
+
+
+static bool TestSepAxis(const btConvexPolyhedron& hullA, const btConvexPolyhedron& hullB, const btTransform& transA,const btTransform& transB, const btVector3& sep_axis, float& depth)
+{
+ float Min0,Max0;
+ float Min1,Max1;
+ hullA.project(transA,sep_axis, Min0, Max0);
+ hullB.project(transB, sep_axis, Min1, Max1);
+
+ if(Max0<Min1 || Max1<Min0)
+ return false;
+
+ float d0 = Max0 - Min1;
+ assert(d0>=0.0f);
+ float d1 = Max1 - Min0;
+ assert(d1>=0.0f);
+ depth = d0<d1 ? d0:d1;
+ return true;
+}
+
+
+
+static int gActualSATPairTests=0;
+
+inline bool IsAlmostZero(const btVector3& v)
+{
+ if(fabsf(v.x())>1e-6 || fabsf(v.y())>1e-6 || fabsf(v.z())>1e-6) return false;
+ return true;
+}
+
+
+bool btPolyhedralContactClipping::findSeparatingAxis( const btConvexPolyhedron& hullA, const btConvexPolyhedron& hullB, const btTransform& transA,const btTransform& transB, btVector3& sep)
+{
+ gActualSATPairTests++;
+
+#ifdef TEST_INTERNAL_OBJECTS
+ const btVector3 c0 = transA * hullA.mLocalCenter;
+ const btVector3 c1 = transB * hullB.mLocalCenter;
+ const btVector3 DeltaC2 = c0 - c1;
+#endif
+
+ float dmin = FLT_MAX;
+ int curPlaneTests=0;
+
+ int numFacesA = hullA.m_faces.size();
+ // Test normals from hullA
+ for(int i=0;i<numFacesA;i++)
+ {
+ const btVector3 Normal(hullA.m_faces[i].m_plane[0], hullA.m_faces[i].m_plane[1], hullA.m_faces[i].m_plane[2]);
+ const btVector3 faceANormalWS = transA.getBasis() * Normal;
+
+ curPlaneTests++;
+#ifdef TEST_INTERNAL_OBJECTS
+ gExpectedNbTests++;
+ if(gUseInternalObject && !TestInternalObjects(transA,transB,DeltaC2, faceANormalWS, hullA, hullB, dmin))
+ continue;
+ gActualNbTests++;
+#endif
+
+ float d;
+ if(!TestSepAxis( hullA, hullB, transA,transB, faceANormalWS, d))
+ return false;
+
+ if(d<dmin)
+ {
+ dmin = d;
+ sep = faceANormalWS;
+ }
+ }
+
+ int numFacesB = hullB.m_faces.size();
+ // Test normals from hullB
+ for(int i=0;i<numFacesB;i++)
+ {
+ const btVector3 Normal(hullB.m_faces[i].m_plane[0], hullB.m_faces[i].m_plane[1], hullB.m_faces[i].m_plane[2]);
+ const btVector3 WorldNormal = transB.getBasis() * Normal;
+
+ curPlaneTests++;
+#ifdef TEST_INTERNAL_OBJECTS
+ gExpectedNbTests++;
+ if(gUseInternalObject && !TestInternalObjects(transA,transB,DeltaC2, WorldNormal, hullA, hullB, dmin))
+ continue;
+ gActualNbTests++;
+#endif
+
+ float d;
+ if(!TestSepAxis(hullA, hullB,transA,transB, WorldNormal,d))
+ return false;
+
+ if(d<dmin)
+ {
+ dmin = d;
+ sep = WorldNormal;
+ }
+ }
+
+ btVector3 edgeAstart,edgeAend,edgeBstart,edgeBend;
+
+ int curEdgeEdge = 0;
+ // Test edges
+ for(int e0=0;e0<hullA.m_uniqueEdges.size();e0++)
+ {
+ const btVector3 edge0 = hullA.m_uniqueEdges[e0];
+ const btVector3 WorldEdge0 = transA.getBasis() * edge0;
+ for(int e1=0;e1<hullB.m_uniqueEdges.size();e1++)
+ {
+ const btVector3 edge1 = hullB.m_uniqueEdges[e1];
+ const btVector3 WorldEdge1 = transB.getBasis() * edge1;
+
+ btVector3 Cross = WorldEdge0.cross(WorldEdge1);
+ curEdgeEdge++;
+ if(!IsAlmostZero(Cross))
+ {
+ Cross = Cross.normalize();
+
+#ifdef TEST_INTERNAL_OBJECTS
+ gExpectedNbTests++;
+ if(gUseInternalObject && !TestInternalObjects(transA,transB,DeltaC2, Cross, hullA, hullB, dmin))
+ continue;
+ gActualNbTests++;
+#endif
+
+ float dist;
+ if(!TestSepAxis( hullA, hullB, transA,transB, Cross, dist))
+ return false;
+
+ if(dist<dmin)
+ {
+ dmin = dist;
+ sep = Cross;
+ }
+ }
+ }
+
+ }
+
+ const btVector3 deltaC = transB.getOrigin() - transA.getOrigin();
+ if((deltaC.dot(sep))>0.0f)
+ sep = -sep;
+
+ return true;
+}
+
+void btPolyhedralContactClipping::clipFaceAgainstHull(const btVector3& separatingNormal, const btConvexPolyhedron& hullA, const btTransform& transA, btVertexArray& worldVertsB1, const btScalar minDist, btScalar maxDist,btDiscreteCollisionDetectorInterface::Result& resultOut)
+{
+ btVertexArray worldVertsB2;
+ btVertexArray* pVtxIn = &worldVertsB1;
+ btVertexArray* pVtxOut = &worldVertsB2;
+ pVtxOut->reserve(pVtxIn->size());
+
+ int closestFaceA=-1;
+ {
+ btScalar dmin = FLT_MAX;
+ for(int face=0;face<hullA.m_faces.size();face++)
+ {
+ const btVector3 Normal(hullA.m_faces[face].m_plane[0], hullA.m_faces[face].m_plane[1], hullA.m_faces[face].m_plane[2]);
+ const btVector3 faceANormalWS = transA.getBasis() * Normal;
+
+ btScalar d = faceANormalWS.dot(separatingNormal);
+ if (d < dmin)
+ {
+ dmin = d;
+ closestFaceA = face;
+ }
+ }
+ }
+ if (closestFaceA<0)
+ return;
+
+ const btFace& polyA = hullA.m_faces[closestFaceA];
+
+ // clip polygon to back of planes of all faces of hull A that are adjacent to witness face
+ int numContacts = pVtxIn->size();
+ int numVerticesA = polyA.m_indices.size();
+ for(int e0=0;e0<numVerticesA;e0++)
+ {
+ /*const btVector3& a = hullA.m_vertices[polyA.m_indices[e0]];
+ const btVector3& b = hullA.m_vertices[polyA.m_indices[(e0+1)%numVerticesA]];
+ const btVector3 edge0 = a - b;
+ const btVector3 WorldEdge0 = transA.getBasis() * edge0;
+ */
+
+ int otherFace = polyA.m_connectedFaces[e0];
+ btVector3 localPlaneNormal (hullA.m_faces[otherFace].m_plane[0],hullA.m_faces[otherFace].m_plane[1],hullA.m_faces[otherFace].m_plane[2]);
+ btScalar localPlaneEq = hullA.m_faces[otherFace].m_plane[3];
+
+ btVector3 planeNormalWS = transA.getBasis()*localPlaneNormal;
+ btScalar planeEqWS=localPlaneEq-planeNormalWS.dot(transA.getOrigin());
+ //clip face
+
+ clipFace(*pVtxIn, *pVtxOut,planeNormalWS,planeEqWS);
+ btSwap(pVtxIn,pVtxOut);
+ pVtxOut->resize(0);
+ }
+
+
+
+//#define ONLY_REPORT_DEEPEST_POINT
+
+ btVector3 point;
+
+
+ // only keep points that are behind the witness face
+ {
+ btVector3 localPlaneNormal (polyA.m_plane[0],polyA.m_plane[1],polyA.m_plane[2]);
+ btScalar localPlaneEq = polyA.m_plane[3];
+ btVector3 planeNormalWS = transA.getBasis()*localPlaneNormal;
+ btScalar planeEqWS=localPlaneEq-planeNormalWS.dot(transA.getOrigin());
+ for (int i=0;i<pVtxIn->size();i++)
+ {
+
+ btScalar depth = planeNormalWS.dot(pVtxIn->at(i))+planeEqWS;
+ if (depth <=maxDist && depth >=minDist)
+ {
+ btVector3 point = pVtxIn->at(i);
+#ifdef ONLY_REPORT_DEEPEST_POINT
+ curMaxDist = depth;
+#else
+#if 0
+ if (depth<-3)
+ {
+ printf("error in btPolyhedralContactClipping depth = %f\n", depth);
+ printf("likely wrong separatingNormal passed in\n");
+ }
+#endif
+ resultOut.addContactPoint(separatingNormal,point,depth);
+#endif
+ }
+ }
+ }
+#ifdef ONLY_REPORT_DEEPEST_POINT
+ if (curMaxDist<maxDist)
+ {
+ resultOut.addContactPoint(separatingNormal,point,curMaxDist);
+ }
+#endif //ONLY_REPORT_DEEPEST_POINT
+
+}
+
+void btPolyhedralContactClipping::clipHullAgainstHull(const btVector3& separatingNormal, const btConvexPolyhedron& hullA, const btConvexPolyhedron& hullB, const btTransform& transA,const btTransform& transB, const btScalar minDist, btScalar maxDist,btDiscreteCollisionDetectorInterface::Result& resultOut)
+{
+
+ btScalar curMaxDist=maxDist;
+ int closestFaceB=-1;
+
+ {
+ btScalar dmax = -FLT_MAX;
+ for(int face=0;face<hullB.m_faces.size();face++)
+ {
+ const btVector3 Normal(hullB.m_faces[face].m_plane[0], hullB.m_faces[face].m_plane[1], hullB.m_faces[face].m_plane[2]);
+ const btVector3 WorldNormal = transB.getBasis() * Normal;
+
+ btScalar d = WorldNormal.dot(separatingNormal);
+ if (d > dmax)
+ {
+ dmax = d;
+ closestFaceB = face;
+ }
+ }
+ }
+
+
+
+ if (closestFaceB<0)
+ {
+ return;
+ }
+
+
+
+ // setup initial clip face (minimizing face from hull B)
+ btVertexArray worldVertsB1;
+ {
+ const btFace& polyB = hullB.m_faces[closestFaceB];
+ const int numVertices = polyB.m_indices.size();
+ for(int e0=0;e0<numVertices;e0++)
+ {
+ const btVector3& b = hullB.m_vertices[polyB.m_indices[e0]];
+ worldVertsB1.push_back(transB*b);
+ }
+ }
+
+ clipFaceAgainstHull(separatingNormal, hullA, transA,worldVertsB1, minDist, maxDist,resultOut);
+
+}
\ No newline at end of file
Property changes on: code/trunk/src/external/bullet/BulletCollision/NarrowPhaseCollision/btPolyhedralContactClipping.cpp
___________________________________________________________________
Added: svn:eol-style
+ native
Added: code/trunk/src/external/bullet/BulletCollision/NarrowPhaseCollision/btPolyhedralContactClipping.h
===================================================================
--- code/trunk/src/external/bullet/BulletCollision/NarrowPhaseCollision/btPolyhedralContactClipping.h (rev 0)
+++ code/trunk/src/external/bullet/BulletCollision/NarrowPhaseCollision/btPolyhedralContactClipping.h 2011-05-03 03:07:42 UTC (rev 8393)
@@ -0,0 +1,46 @@
+/*
+Bullet Continuous Collision Detection and Physics Library
+Copyright (c) 2011 Advanced Micro Devices, Inc. http://bulletphysics.org
+
+This software is provided 'as-is', without any express or implied warranty.
+In no event will the authors be held liable for any damages arising from the use of this software.
+Permission is granted to anyone to use this software for any purpose,
+including commercial applications, and to alter it and redistribute it freely,
+subject to the following restrictions:
+
+1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
+2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
+3. This notice may not be removed or altered from any source distribution.
+*/
+
+
+///This file was written by Erwin Coumans
+
+
+#ifndef BT_POLYHEDRAL_CONTACT_CLIPPING_H
+#define BT_POLYHEDRAL_CONTACT_CLIPPING_H
+
+
+#include "LinearMath/btAlignedObjectArray.h"
+#include "LinearMath/btTransform.h"
+#include "btDiscreteCollisionDetectorInterface.h"
+
+class btConvexPolyhedron;
+
+typedef btAlignedObjectArray<btVector3> btVertexArray;
+
+// Clips a face to the back of a plane
+struct btPolyhedralContactClipping
+{
+ static void clipHullAgainstHull(const btVector3& separatingNormal, const btConvexPolyhedron& hullA, const btConvexPolyhedron& hullB, const btTransform& transA,const btTransform& transB, const btScalar minDist, btScalar maxDist, btDiscreteCollisionDetectorInterface::Result& resultOut);
+ static void clipFaceAgainstHull(const btVector3& separatingNormal, const btConvexPolyhedron& hullA, const btTransform& transA, btVertexArray& worldVertsB1, const btScalar minDist, btScalar maxDist,btDiscreteCollisionDetectorInterface::Result& resultOut);
+
+ static bool findSeparatingAxis( const btConvexPolyhedron& hullA, const btConvexPolyhedron& hullB, const btTransform& transA,const btTransform& transB, btVector3& sep);
+
+ ///the clipFace method is used internally
+ static void clipFace(const btVertexArray& pVtxIn, btVertexArray& ppVtxOut, const btVector3& planeNormalWS,btScalar planeEqWS);
+
+};
+
+#endif // BT_POLYHEDRAL_CONTACT_CLIPPING_H
+
Property changes on: code/trunk/src/external/bullet/BulletCollision/NarrowPhaseCollision/btPolyhedralContactClipping.h
___________________________________________________________________
Added: svn:eol-style
+ native
Modified: code/trunk/src/external/bullet/BulletCollision/NarrowPhaseCollision/btRaycastCallback.cpp
===================================================================
--- code/trunk/src/external/bullet/BulletCollision/NarrowPhaseCollision/btRaycastCallback.cpp 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletCollision/NarrowPhaseCollision/btRaycastCallback.cpp 2011-05-03 03:07:42 UTC (rev 8393)
@@ -124,8 +124,9 @@
m_convexShapeFrom = convexShapeFrom;
m_convexShapeTo = convexShapeTo;
m_triangleToWorld = triangleToWorld;
- m_hitFraction = 1.0;
- m_triangleCollisionMargin = triangleCollisionMargin;
+ m_hitFraction = 1.0f;
+ m_triangleCollisionMargin = triangleCollisionMargin;
+ m_allowedPenetration = 0.f;
}
void
@@ -148,6 +149,7 @@
btConvexCast::CastResult castResult;
castResult.m_fraction = btScalar(1.);
+ castResult.m_allowedPenetration = m_allowedPenetration;
if (convexCaster.calcTimeOfImpact(m_convexShapeFrom,m_convexShapeTo,m_triangleToWorld, m_triangleToWorld, castResult))
{
//add hit
Modified: code/trunk/src/external/bullet/BulletCollision/NarrowPhaseCollision/btRaycastCallback.h
===================================================================
--- code/trunk/src/external/bullet/BulletCollision/NarrowPhaseCollision/btRaycastCallback.h 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletCollision/NarrowPhaseCollision/btRaycastCallback.h 2011-05-03 03:07:42 UTC (rev 8393)
@@ -13,8 +13,8 @@
3. This notice may not be removed or altered from any source distribution.
*/
-#ifndef RAYCAST_TRI_CALLBACK_H
-#define RAYCAST_TRI_CALLBACK_H
+#ifndef BT_RAYCAST_TRI_CALLBACK_H
+#define BT_RAYCAST_TRI_CALLBACK_H
#include "BulletCollision/CollisionShapes/btTriangleCallback.h"
#include "LinearMath/btTransform.h"
@@ -58,7 +58,8 @@
btTransform m_convexShapeTo;
btTransform m_triangleToWorld;
btScalar m_hitFraction;
- btScalar m_triangleCollisionMargin;
+ btScalar m_triangleCollisionMargin;
+ btScalar m_allowedPenetration;
btTriangleConvexcastCallback (const btConvexShape* convexShape, const btTransform& convexShapeFrom, const btTransform& convexShapeTo, const btTransform& triangleToWorld, const btScalar triangleCollisionMargin);
@@ -67,5 +68,5 @@
virtual btScalar reportHit (const btVector3& hitNormalLocal, const btVector3& hitPointLocal, btScalar hitFraction, int partId, int triangleIndex) = 0;
};
-#endif //RAYCAST_TRI_CALLBACK_H
+#endif //BT_RAYCAST_TRI_CALLBACK_H
Modified: code/trunk/src/external/bullet/BulletCollision/NarrowPhaseCollision/btSimplexSolverInterface.h
===================================================================
--- code/trunk/src/external/bullet/BulletCollision/NarrowPhaseCollision/btSimplexSolverInterface.h 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletCollision/NarrowPhaseCollision/btSimplexSolverInterface.h 2011-05-03 03:07:42 UTC (rev 8393)
@@ -15,8 +15,8 @@
-#ifndef SIMPLEX_SOLVER_INTERFACE_H
-#define SIMPLEX_SOLVER_INTERFACE_H
+#ifndef BT_SIMPLEX_SOLVER_INTERFACE_H
+#define BT_SIMPLEX_SOLVER_INTERFACE_H
#include "LinearMath/btVector3.h"
@@ -59,5 +59,5 @@
};
#endif
-#endif //SIMPLEX_SOLVER_INTERFACE_H
+#endif //BT_SIMPLEX_SOLVER_INTERFACE_H
Modified: code/trunk/src/external/bullet/BulletCollision/NarrowPhaseCollision/btSubSimplexConvexCast.h
===================================================================
--- code/trunk/src/external/bullet/BulletCollision/NarrowPhaseCollision/btSubSimplexConvexCast.h 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletCollision/NarrowPhaseCollision/btSubSimplexConvexCast.h 2011-05-03 03:07:42 UTC (rev 8393)
@@ -14,8 +14,8 @@
*/
-#ifndef SUBSIMPLEX_CONVEX_CAST_H
-#define SUBSIMPLEX_CONVEX_CAST_H
+#ifndef BT_SUBSIMPLEX_CONVEX_CAST_H
+#define BT_SUBSIMPLEX_CONVEX_CAST_H
#include "btConvexCast.h"
#include "btSimplexSolverInterface.h"
@@ -47,4 +47,4 @@
};
-#endif //SUBSIMPLEX_CONVEX_CAST_H
+#endif //BT_SUBSIMPLEX_CONVEX_CAST_H
Modified: code/trunk/src/external/bullet/BulletCollision/NarrowPhaseCollision/btVoronoiSimplexSolver.h
===================================================================
--- code/trunk/src/external/bullet/BulletCollision/NarrowPhaseCollision/btVoronoiSimplexSolver.h 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletCollision/NarrowPhaseCollision/btVoronoiSimplexSolver.h 2011-05-03 03:07:42 UTC (rev 8393)
@@ -15,8 +15,8 @@
-#ifndef btVoronoiSimplexSolver_H
-#define btVoronoiSimplexSolver_H
+#ifndef BT_VORONOI_SIMPLEX_SOLVER_H
+#define BT_VORONOI_SIMPLEX_SOLVER_H
#include "btSimplexSolverInterface.h"
@@ -175,4 +175,5 @@
};
-#endif //VoronoiSimplexSolver
+#endif //BT_VORONOI_SIMPLEX_SOLVER_H
+
Modified: code/trunk/src/external/bullet/BulletDynamics/Character/btCharacterControllerInterface.h
===================================================================
--- code/trunk/src/external/bullet/BulletDynamics/Character/btCharacterControllerInterface.h 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletDynamics/Character/btCharacterControllerInterface.h 2011-05-03 03:07:42 UTC (rev 8393)
@@ -13,8 +13,8 @@
3. This notice may not be removed or altered from any source distribution.
*/
-#ifndef CHARACTER_CONTROLLER_INTERFACE_H
-#define CHARACTER_CONTROLLER_INTERFACE_H
+#ifndef BT_CHARACTER_CONTROLLER_INTERFACE_H
+#define BT_CHARACTER_CONTROLLER_INTERFACE_H
#include "LinearMath/btVector3.h"
#include "BulletDynamics/Dynamics/btActionInterface.h"
@@ -42,4 +42,5 @@
virtual bool onGround () const = 0;
};
-#endif
+#endif //BT_CHARACTER_CONTROLLER_INTERFACE_H
+
Modified: code/trunk/src/external/bullet/BulletDynamics/Character/btKinematicCharacterController.cpp
===================================================================
--- code/trunk/src/external/bullet/BulletDynamics/Character/btKinematicCharacterController.cpp 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletDynamics/Character/btKinematicCharacterController.cpp 2011-05-03 03:07:42 UTC (rev 8393)
@@ -84,7 +84,7 @@
} else
{
///need to transform normal into worldspace
- hitNormalWorld = m_hitCollisionObject->getWorldTransform().getBasis()*convexResult.m_hitNormalLocal;
+ hitNormalWorld = convexResult.m_hitCollisionObject->getWorldTransform().getBasis()*convexResult.m_hitNormalLocal;
}
btScalar dotUp = m_up.dot(hitNormalWorld);
Modified: code/trunk/src/external/bullet/BulletDynamics/Character/btKinematicCharacterController.h
===================================================================
--- code/trunk/src/external/bullet/BulletDynamics/Character/btKinematicCharacterController.h 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletDynamics/Character/btKinematicCharacterController.h 2011-05-03 03:07:42 UTC (rev 8393)
@@ -14,8 +14,8 @@
*/
-#ifndef KINEMATIC_CHARACTER_CONTROLLER_H
-#define KINEMATIC_CHARACTER_CONTROLLER_H
+#ifndef BT_KINEMATIC_CHARACTER_CONTROLLER_H
+#define BT_KINEMATIC_CHARACTER_CONTROLLER_H
#include "LinearMath/btVector3.h"
@@ -159,4 +159,4 @@
bool onGround () const;
};
-#endif // KINEMATIC_CHARACTER_CONTROLLER_H
+#endif // BT_KINEMATIC_CHARACTER_CONTROLLER_H
Modified: code/trunk/src/external/bullet/BulletDynamics/ConstraintSolver/btConeTwistConstraint.cpp
===================================================================
--- code/trunk/src/external/bullet/BulletDynamics/ConstraintSolver/btConeTwistConstraint.cpp 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletDynamics/ConstraintSolver/btConeTwistConstraint.cpp 2011-05-03 03:07:42 UTC (rev 8393)
@@ -1114,4 +1114,14 @@
}
+void btConeTwistConstraint::setFrames(const btTransform & frameA, const btTransform & frameB)
+{
+ m_rbAFrame = frameA;
+ m_rbBFrame = frameB;
+ buildJacobian();
+ //calculateTransforms();
+}
+
+
+
Modified: code/trunk/src/external/bullet/BulletDynamics/ConstraintSolver/btConeTwistConstraint.h
===================================================================
--- code/trunk/src/external/bullet/BulletDynamics/ConstraintSolver/btConeTwistConstraint.h 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletDynamics/ConstraintSolver/btConeTwistConstraint.h 2011-05-03 03:07:42 UTC (rev 8393)
@@ -33,8 +33,8 @@
-#ifndef CONETWISTCONSTRAINT_H
-#define CONETWISTCONSTRAINT_H
+#ifndef BT_CONETWISTCONSTRAINT_H
+#define BT_CONETWISTCONSTRAINT_H
#include "LinearMath/btVector3.h"
#include "btJacobianEntry.h"
@@ -144,6 +144,7 @@
void updateRHS(btScalar timeStep);
+
const btRigidBody& getRigidBodyA() const
{
return m_rbA;
@@ -244,7 +245,6 @@
}
bool isPastSwingLimit() { return m_solveSwingLimit; }
-
void setDamping(btScalar damping) { m_damping = damping; }
void enableMotor(bool b) { m_bMotorEnabled = b; }
@@ -268,6 +268,20 @@
///override the default global value of a parameter (such as ERP or CFM), optionally provide the axis (0..5).
///If no axis is provided, it uses the default axis for this constraint.
virtual void setParam(int num, btScalar value, int axis = -1);
+
+ virtual void setFrames(const btTransform& frameA, const btTransform& frameB);
+
+ const btTransform& getFrameOffsetA() const
+ {
+ return m_rbAFrame;
+ }
+
+ const btTransform& getFrameOffsetB() const
+ {
+ return m_rbBFrame;
+ }
+
+
///return the local value of parameter
virtual btScalar getParam(int num, int axis = -1) const;
@@ -329,4 +343,4 @@
}
-#endif //CONETWISTCONSTRAINT_H
+#endif //BT_CONETWISTCONSTRAINT_H
Modified: code/trunk/src/external/bullet/BulletDynamics/ConstraintSolver/btConstraintSolver.h
===================================================================
--- code/trunk/src/external/bullet/BulletDynamics/ConstraintSolver/btConstraintSolver.h 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletDynamics/ConstraintSolver/btConstraintSolver.h 2011-05-03 03:07:42 UTC (rev 8393)
@@ -13,8 +13,8 @@
3. This notice may not be removed or altered from any source distribution.
*/
-#ifndef CONSTRAINT_SOLVER_H
-#define CONSTRAINT_SOLVER_H
+#ifndef BT_CONSTRAINT_SOLVER_H
+#define BT_CONSTRAINT_SOLVER_H
#include "LinearMath/btScalar.h"
@@ -49,4 +49,4 @@
-#endif //CONSTRAINT_SOLVER_H
+#endif //BT_CONSTRAINT_SOLVER_H
Modified: code/trunk/src/external/bullet/BulletDynamics/ConstraintSolver/btContactConstraint.cpp
===================================================================
--- code/trunk/src/external/bullet/BulletDynamics/ConstraintSolver/btContactConstraint.cpp 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletDynamics/ConstraintSolver/btContactConstraint.cpp 2011-05-03 03:07:42 UTC (rev 8393)
@@ -68,11 +68,55 @@
#include "LinearMath/btMinMax.h"
#include "BulletCollision/NarrowPhaseCollision/btManifoldPoint.h"
-#define ASSERT2 btAssert
-#define USE_INTERNAL_APPLY_IMPULSE 1
+//response between two dynamic objects without friction, assuming 0 penetration depth
+btScalar resolveSingleCollision(
+ btRigidBody* body1,
+ btCollisionObject* colObj2,
+ const btVector3& contactPositionWorld,
+ const btVector3& contactNormalOnB,
+ const btContactSolverInfo& solverInfo,
+ btScalar distance)
+{
+ btRigidBody* body2 = btRigidBody::upcast(colObj2);
+
+
+ const btVector3& normal = contactNormalOnB;
+ btVector3 rel_pos1 = contactPositionWorld - body1->getWorldTransform().getOrigin();
+ btVector3 rel_pos2 = contactPositionWorld - colObj2->getWorldTransform().getOrigin();
+
+ btVector3 vel1 = body1->getVelocityInLocalPoint(rel_pos1);
+ btVector3 vel2 = body2? body2->getVelocityInLocalPoint(rel_pos2) : btVector3(0,0,0);
+ btVector3 vel = vel1 - vel2;
+ btScalar rel_vel;
+ rel_vel = normal.dot(vel);
+
+ btScalar combinedRestitution = body1->getRestitution() * colObj2->getRestitution();
+ btScalar restitution = combinedRestitution* -rel_vel;
+
+ btScalar positionalError = solverInfo.m_erp *-distance /solverInfo.m_timeStep ;
+ btScalar velocityError = -(1.0f + restitution) * rel_vel;// * damping;
+ btScalar denom0 = body1->computeImpulseDenominator(contactPositionWorld,normal);
+ btScalar denom1 = body2? body2->computeImpulseDenominator(contactPositionWorld,normal) : 0.f;
+ btScalar relaxation = 1.f;
+ btScalar jacDiagABInv = relaxation/(denom0+denom1);
+
+ btScalar penetrationImpulse = positionalError * jacDiagABInv;
+ btScalar velocityImpulse = velocityError * jacDiagABInv;
+
+ btScalar normalImpulse = penetrationImpulse+velocityImpulse;
+ normalImpulse = 0.f > normalImpulse ? 0.f: normalImpulse;
+
+ body1->applyImpulse(normal*(normalImpulse), rel_pos1);
+ if (body2)
+ body2->applyImpulse(-normal*(normalImpulse), rel_pos2);
+
+ return normalImpulse;
+}
+
+
//bilateral constraint between two dynamic objects
void resolveSingleBilateral(btRigidBody& body1, const btVector3& pos1,
btRigidBody& body2, const btVector3& pos2,
@@ -83,7 +127,7 @@
btScalar normalLenSqr = normal.length2();
- ASSERT2(btFabs(normalLenSqr) < btScalar(1.1));
+ btAssert(btFabs(normalLenSqr) < btScalar(1.1));
if (normalLenSqr > btScalar(1.1))
{
impulse = btScalar(0.);
Modified: code/trunk/src/external/bullet/BulletDynamics/ConstraintSolver/btContactConstraint.h
===================================================================
--- code/trunk/src/external/bullet/BulletDynamics/ConstraintSolver/btContactConstraint.h 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletDynamics/ConstraintSolver/btContactConstraint.h 2011-05-03 03:07:42 UTC (rev 8393)
@@ -13,8 +13,8 @@
3. This notice may not be removed or altered from any source distribution.
*/
-#ifndef CONTACT_CONSTRAINT_H
-#define CONTACT_CONSTRAINT_H
+#ifndef BT_CONTACT_CONSTRAINT_H
+#define BT_CONTACT_CONSTRAINT_H
#include "LinearMath/btVector3.h"
#include "btJacobianEntry.h"
@@ -57,7 +57,10 @@
};
+///very basic collision resolution without friction
+btScalar resolveSingleCollision(btRigidBody* body1, class btCollisionObject* colObj2, const btVector3& contactPositionWorld,const btVector3& contactNormalOnB, const struct btContactSolverInfo& solverInfo,btScalar distance);
+
///resolveSingleBilateral is an obsolete methods used for vehicle friction between two dynamic objects
void resolveSingleBilateral(btRigidBody& body1, const btVector3& pos1,
btRigidBody& body2, const btVector3& pos2,
@@ -65,4 +68,4 @@
-#endif //CONTACT_CONSTRAINT_H
+#endif //BT_CONTACT_CONSTRAINT_H
Modified: code/trunk/src/external/bullet/BulletDynamics/ConstraintSolver/btContactSolverInfo.h
===================================================================
--- code/trunk/src/external/bullet/BulletDynamics/ConstraintSolver/btContactSolverInfo.h 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletDynamics/ConstraintSolver/btContactSolverInfo.h 2011-05-03 03:07:42 UTC (rev 8393)
@@ -13,8 +13,8 @@
3. This notice may not be removed or altered from any source distribution.
*/
-#ifndef CONTACT_SOLVER_INFO
-#define CONTACT_SOLVER_INFO
+#ifndef BT_CONTACT_SOLVER_INFO
+#define BT_CONTACT_SOLVER_INFO
enum btSolverMode
{
@@ -84,4 +84,4 @@
}
};
-#endif //CONTACT_SOLVER_INFO
+#endif //BT_CONTACT_SOLVER_INFO
Modified: code/trunk/src/external/bullet/BulletDynamics/ConstraintSolver/btGeneric6DofConstraint.cpp
===================================================================
--- code/trunk/src/external/bullet/BulletDynamics/ConstraintSolver/btGeneric6DofConstraint.cpp 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletDynamics/ConstraintSolver/btGeneric6DofConstraint.cpp 2011-05-03 03:07:42 UTC (rev 8393)
@@ -713,7 +713,16 @@
}
+void btGeneric6DofConstraint::setFrames(const btTransform& frameA, const btTransform& frameB)
+{
+ m_frameInA = frameA;
+ m_frameInB = frameB;
+ buildJacobian();
+ calculateTransforms();
+}
+
+
btVector3 btGeneric6DofConstraint::getAxis(int axis_index) const
{
return m_calculatedAxis[axis_index];
@@ -1038,3 +1047,24 @@
}
return retVal;
}
+
+
+
+void btGeneric6DofConstraint::setAxis(const btVector3& axis1,const btVector3& axis2)
+{
+ btVector3 zAxis = axis1.normalized();
+ btVector3 yAxis = axis2.normalized();
+ btVector3 xAxis = yAxis.cross(zAxis); // we want right coordinate system
+
+ btTransform frameInW;
+ frameInW.setIdentity();
+ frameInW.getBasis().setValue( xAxis[0], yAxis[0], zAxis[0],
+ xAxis[1], yAxis[1], zAxis[1],
+ xAxis[2], yAxis[2], zAxis[2]);
+
+ // now get constraint frame in local coordinate systems
+ m_frameInA = m_rbA.getCenterOfMassTransform().inverse() * frameInW;
+ m_frameInB = m_rbB.getCenterOfMassTransform().inverse() * frameInW;
+
+ calculateTransforms();
+}
\ No newline at end of file
Modified: code/trunk/src/external/bullet/BulletDynamics/ConstraintSolver/btGeneric6DofConstraint.h
===================================================================
--- code/trunk/src/external/bullet/BulletDynamics/ConstraintSolver/btGeneric6DofConstraint.h 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletDynamics/ConstraintSolver/btGeneric6DofConstraint.h 2011-05-03 03:07:42 UTC (rev 8393)
@@ -24,8 +24,8 @@
*/
-#ifndef GENERIC_6DOF_CONSTRAINT_H
-#define GENERIC_6DOF_CONSTRAINT_H
+#ifndef BT_GENERIC_6DOF_CONSTRAINT_H
+#define BT_GENERIC_6DOF_CONSTRAINT_H
#include "LinearMath/btVector3.h"
#include "btJacobianEntry.h"
@@ -433,6 +433,7 @@
*/
btScalar getRelativePivotPosition(int axis_index) const;
+ void setFrames(const btTransform & frameA, const btTransform & frameB);
//! Test angular limit.
/*!
@@ -446,23 +447,45 @@
m_linearLimits.m_lowerLimit = linearLower;
}
- void setLinearUpperLimit(const btVector3& linearUpper)
- {
- m_linearLimits.m_upperLimit = linearUpper;
- }
+ void getLinearLowerLimit(btVector3& linearLower)
+ {
+ linearLower = m_linearLimits.m_lowerLimit;
+ }
+ void setLinearUpperLimit(const btVector3& linearUpper)
+ {
+ m_linearLimits.m_upperLimit = linearUpper;
+ }
+
+ void getLinearUpperLimit(btVector3& linearUpper)
+ {
+ linearUpper = m_linearLimits.m_upperLimit;
+ }
+
void setAngularLowerLimit(const btVector3& angularLower)
{
for(int i = 0; i < 3; i++)
m_angularLimits[i].m_loLimit = btNormalizeAngle(angularLower[i]);
}
+ void getAngularLowerLimit(btVector3& angularLower)
+ {
+ for(int i = 0; i < 3; i++)
+ angularLower[i] = m_angularLimits[i].m_loLimit;
+ }
+
void setAngularUpperLimit(const btVector3& angularUpper)
{
for(int i = 0; i < 3; i++)
m_angularLimits[i].m_hiLimit = btNormalizeAngle(angularUpper[i]);
}
+ void getAngularUpperLimit(btVector3& angularUpper)
+ {
+ for(int i = 0; i < 3; i++)
+ angularUpper[i] = m_angularLimits[i].m_hiLimit;
+ }
+
//! Retrieves the angular limit informacion
btRotationalLimitMotor * getRotationalLimitMotor(int index)
{
@@ -525,6 +548,9 @@
///return the local value of parameter
virtual btScalar getParam(int num, int axis = -1) const;
+ void setAxis( const btVector3& axis1, const btVector3& axis2);
+
+
virtual int calculateSerializeBufferSize() const;
///fills the dataBuffer and returns the struct name (and 0 on failure)
@@ -585,4 +611,4 @@
-#endif //GENERIC_6DOF_CONSTRAINT_H
+#endif //BT_GENERIC_6DOF_CONSTRAINT_H
Modified: code/trunk/src/external/bullet/BulletDynamics/ConstraintSolver/btGeneric6DofSpringConstraint.cpp
===================================================================
--- code/trunk/src/external/bullet/BulletDynamics/ConstraintSolver/btGeneric6DofSpringConstraint.cpp 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletDynamics/ConstraintSolver/btGeneric6DofSpringConstraint.cpp 2011-05-03 03:07:42 UTC (rev 8393)
@@ -21,6 +21,8 @@
btGeneric6DofSpringConstraint::btGeneric6DofSpringConstraint(btRigidBody& rbA, btRigidBody& rbB, const btTransform& frameInA, const btTransform& frameInB ,bool useLinearReferenceFrameA)
: btGeneric6DofConstraint(rbA, rbB, frameInA, frameInB, useLinearReferenceFrameA)
{
+ m_objectType = D6_SPRING_CONSTRAINT_TYPE;
+
for(int i = 0; i < 6; i++)
{
m_springEnabled[i] = false;
@@ -147,5 +149,24 @@
}
+void btGeneric6DofSpringConstraint::setAxis(const btVector3& axis1,const btVector3& axis2)
+{
+ btVector3 zAxis = axis1.normalized();
+ btVector3 yAxis = axis2.normalized();
+ btVector3 xAxis = yAxis.cross(zAxis); // we want right coordinate system
+ btTransform frameInW;
+ frameInW.setIdentity();
+ frameInW.getBasis().setValue( xAxis[0], yAxis[0], zAxis[0],
+ xAxis[1], yAxis[1], zAxis[1],
+ xAxis[2], yAxis[2], zAxis[2]);
+ // now get constraint frame in local coordinate systems
+ m_frameInA = m_rbA.getCenterOfMassTransform().inverse() * frameInW;
+ m_frameInB = m_rbB.getCenterOfMassTransform().inverse() * frameInW;
+
+ calculateTransforms();
+}
+
+
+
Modified: code/trunk/src/external/bullet/BulletDynamics/ConstraintSolver/btGeneric6DofSpringConstraint.h
===================================================================
--- code/trunk/src/external/bullet/BulletDynamics/ConstraintSolver/btGeneric6DofSpringConstraint.h 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletDynamics/ConstraintSolver/btGeneric6DofSpringConstraint.h 2011-05-03 03:07:42 UTC (rev 8393)
@@ -13,8 +13,8 @@
3. This notice may not be removed or altered from any source distribution.
*/
-#ifndef GENERIC_6DOF_SPRING_CONSTRAINT_H
-#define GENERIC_6DOF_SPRING_CONSTRAINT_H
+#ifndef BT_GENERIC_6DOF_SPRING_CONSTRAINT_H
+#define BT_GENERIC_6DOF_SPRING_CONSTRAINT_H
#include "LinearMath/btVector3.h"
@@ -48,8 +48,50 @@
void setEquilibriumPoint(); // set the current constraint position/orientation as an equilibrium point for all DOF
void setEquilibriumPoint(int index); // set the current constraint position/orientation as an equilibrium point for given DOF
void setEquilibriumPoint(int index, btScalar val);
+
+ virtual void setAxis( const btVector3& axis1, const btVector3& axis2);
+
virtual void getInfo2 (btConstraintInfo2* info);
+
+ virtual int calculateSerializeBufferSize() const;
+ ///fills the dataBuffer and returns the struct name (and 0 on failure)
+ virtual const char* serialize(void* dataBuffer, btSerializer* serializer) const;
+
};
-#endif // GENERIC_6DOF_SPRING_CONSTRAINT_H
+///do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64
+struct btGeneric6DofSpringConstraintData
+{
+ btGeneric6DofConstraintData m_6dofData;
+
+ int m_springEnabled[6];
+ float m_equilibriumPoint[6];
+ float m_springStiffness[6];
+ float m_springDamping[6];
+};
+
+SIMD_FORCE_INLINE int btGeneric6DofSpringConstraint::calculateSerializeBufferSize() const
+{
+ return sizeof(btGeneric6DofSpringConstraintData);
+}
+
+ ///fills the dataBuffer and returns the struct name (and 0 on failure)
+SIMD_FORCE_INLINE const char* btGeneric6DofSpringConstraint::serialize(void* dataBuffer, btSerializer* serializer) const
+{
+ btGeneric6DofSpringConstraintData* dof = (btGeneric6DofSpringConstraintData*)dataBuffer;
+ btGeneric6DofConstraint::serialize(&dof->m_6dofData,serializer);
+
+ int i;
+ for (i=0;i<6;i++)
+ {
+ dof->m_equilibriumPoint[i] = m_equilibriumPoint[i];
+ dof->m_springDamping[i] = m_springDamping[i];
+ dof->m_springEnabled[i] = m_springEnabled[i]? 1 : 0;
+ dof->m_springStiffness[i] = m_springStiffness[i];
+ }
+ return "btGeneric6DofConstraintData";
+}
+
+#endif // BT_GENERIC_6DOF_SPRING_CONSTRAINT_H
+
Modified: code/trunk/src/external/bullet/BulletDynamics/ConstraintSolver/btHinge2Constraint.h
===================================================================
--- code/trunk/src/external/bullet/BulletDynamics/ConstraintSolver/btHinge2Constraint.h 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletDynamics/ConstraintSolver/btHinge2Constraint.h 2011-05-03 03:07:42 UTC (rev 8393)
@@ -13,8 +13,8 @@
3. This notice may not be removed or altered from any source distribution.
*/
-#ifndef HINGE2_CONSTRAINT_H
-#define HINGE2_CONSTRAINT_H
+#ifndef BT_HINGE2_CONSTRAINT_H
+#define BT_HINGE2_CONSTRAINT_H
@@ -54,5 +54,5 @@
-#endif // HINGE2_CONSTRAINT_H
+#endif // BT_HINGE2_CONSTRAINT_H
Modified: code/trunk/src/external/bullet/BulletDynamics/ConstraintSolver/btHingeConstraint.cpp
===================================================================
--- code/trunk/src/external/bullet/BulletDynamics/ConstraintSolver/btHingeConstraint.cpp 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletDynamics/ConstraintSolver/btHingeConstraint.cpp 2011-05-03 03:07:42 UTC (rev 8393)
@@ -43,6 +43,9 @@
m_useOffsetForConstraintFrame(HINGE_USE_FRAME_OFFSET),
m_useReferenceFrameA(useReferenceFrameA),
m_flags(0)
+#ifdef _BT_USE_CENTER_LIMIT_
+ ,m_limit()
+#endif
{
m_rbAFrame.getOrigin() = pivotInA;
@@ -75,6 +78,7 @@
rbAxisB1.getY(),rbAxisB2.getY(),axisInB.getY(),
rbAxisB1.getZ(),rbAxisB2.getZ(),axisInB.getZ() );
+#ifndef _BT_USE_CENTER_LIMIT_
//start with free
m_lowerLimit = btScalar(1.0f);
m_upperLimit = btScalar(-1.0f);
@@ -82,6 +86,7 @@
m_relaxationFactor = 1.0f;
m_limitSoftness = 0.9f;
m_solveLimit = false;
+#endif
m_referenceSign = m_useReferenceFrameA ? btScalar(-1.f) : btScalar(1.f);
}
@@ -93,6 +98,9 @@
m_useOffsetForConstraintFrame(HINGE_USE_FRAME_OFFSET),
m_useReferenceFrameA(useReferenceFrameA),
m_flags(0)
+#ifdef _BT_USE_CENTER_LIMIT_
+,m_limit()
+#endif
{
// since no frame is given, assume this to be zero angle and just pick rb transform axis
@@ -117,6 +125,7 @@
rbAxisB1.getY(),rbAxisB2.getY(),axisInB.getY(),
rbAxisB1.getZ(),rbAxisB2.getZ(),axisInB.getZ() );
+#ifndef _BT_USE_CENTER_LIMIT_
//start with free
m_lowerLimit = btScalar(1.0f);
m_upperLimit = btScalar(-1.0f);
@@ -124,6 +133,7 @@
m_relaxationFactor = 1.0f;
m_limitSoftness = 0.9f;
m_solveLimit = false;
+#endif
m_referenceSign = m_useReferenceFrameA ? btScalar(-1.f) : btScalar(1.f);
}
@@ -138,7 +148,11 @@
m_useOffsetForConstraintFrame(HINGE_USE_FRAME_OFFSET),
m_useReferenceFrameA(useReferenceFrameA),
m_flags(0)
+#ifdef _BT_USE_CENTER_LIMIT_
+,m_limit()
+#endif
{
+#ifndef _BT_USE_CENTER_LIMIT_
//start with free
m_lowerLimit = btScalar(1.0f);
m_upperLimit = btScalar(-1.0f);
@@ -146,6 +160,7 @@
m_relaxationFactor = 1.0f;
m_limitSoftness = 0.9f;
m_solveLimit = false;
+#endif
m_referenceSign = m_useReferenceFrameA ? btScalar(-1.f) : btScalar(1.f);
}
@@ -159,11 +174,14 @@
m_useOffsetForConstraintFrame(HINGE_USE_FRAME_OFFSET),
m_useReferenceFrameA(useReferenceFrameA),
m_flags(0)
+#ifdef _BT_USE_CENTER_LIMIT_
+,m_limit()
+#endif
{
///not providing rigidbody B means implicitly using worldspace for body B
m_rbBFrame.getOrigin() = m_rbA.getCenterOfMassTransform()(m_rbAFrame.getOrigin());
-
+#ifndef _BT_USE_CENTER_LIMIT_
//start with free
m_lowerLimit = btScalar(1.0f);
m_upperLimit = btScalar(-1.0f);
@@ -171,6 +189,7 @@
m_relaxationFactor = 1.0f;
m_limitSoftness = 0.9f;
m_solveLimit = false;
+#endif
m_referenceSign = m_useReferenceFrameA ? btScalar(-1.f) : btScalar(1.f);
}
@@ -449,8 +468,13 @@
int limit = 0;
if(getSolveLimit())
{
- limit_err = m_correction * m_referenceSign;
- limit = (limit_err > btScalar(0.0)) ? 1 : 2;
+#ifdef _BT_USE_CENTER_LIMIT_
+ limit_err = m_limit.getCorrection() * m_referenceSign;
+#else
+ limit_err = m_correction * m_referenceSign;
+#endif
+ limit = (limit_err > btScalar(0.0)) ? 1 : 2;
+
}
// if the hinge has joint limits or motor, add in the extra row
int powered = 0;
@@ -514,7 +538,11 @@
info->m_upperLimit[srow] = 0;
}
// bounce (we'll use slider parameter abs(1.0 - m_dampingLimAng) for that)
+#ifdef _BT_USE_CENTER_LIMIT_
+ btScalar bounce = m_limit.getRelaxationFactor();
+#else
btScalar bounce = m_relaxationFactor;
+#endif
if(bounce > btScalar(0.0))
{
btScalar vel = angVelA.dot(ax1);
@@ -544,16 +572,24 @@
}
}
}
+#ifdef _BT_USE_CENTER_LIMIT_
+ info->m_constraintError[srow] *= m_limit.getBiasFactor();
+#else
info->m_constraintError[srow] *= m_biasFactor;
+#endif
} // if(limit)
} // if angular limit or powered
}
+void btHingeConstraint::setFrames(const btTransform & frameA, const btTransform & frameB)
+{
+ m_rbAFrame = frameA;
+ m_rbBFrame = frameB;
+ buildJacobian();
+}
-
-
void btHingeConstraint::updateRHS(btScalar timeStep)
{
(void)timeStep;
@@ -577,38 +613,14 @@
}
-#if 0
-void btHingeConstraint::testLimit()
-{
- // Compute limit information
- m_hingeAngle = getHingeAngle();
- m_correction = btScalar(0.);
- m_limitSign = btScalar(0.);
- m_solveLimit = false;
- if (m_lowerLimit <= m_upperLimit)
- {
- if (m_hingeAngle <= m_lowerLimit)
- {
- m_correction = (m_lowerLimit - m_hingeAngle);
- m_limitSign = 1.0f;
- m_solveLimit = true;
- }
- else if (m_hingeAngle >= m_upperLimit)
- {
- m_correction = m_upperLimit - m_hingeAngle;
- m_limitSign = -1.0f;
- m_solveLimit = true;
- }
- }
- return;
-}
-#else
-
void btHingeConstraint::testLimit(const btTransform& transA,const btTransform& transB)
{
// Compute limit information
m_hingeAngle = getHingeAngle(transA,transB);
+#ifdef _BT_USE_CENTER_LIMIT_
+ m_limit.test(m_hingeAngle);
+#else
m_correction = btScalar(0.);
m_limitSign = btScalar(0.);
m_solveLimit = false;
@@ -628,10 +640,11 @@
m_solveLimit = true;
}
}
+#endif
return;
}
-#endif
+
static btVector3 vHinge(0, 0, btScalar(1));
void btHingeConstraint::setMotorTarget(const btQuaternion& qAinB, btScalar dt)
@@ -661,6 +674,9 @@
void btHingeConstraint::setMotorTarget(btScalar targetAngle, btScalar dt)
{
+#ifdef _BT_USE_CENTER_LIMIT_
+ m_limit.fit(targetAngle);
+#else
if (m_lowerLimit < m_upperLimit)
{
if (targetAngle < m_lowerLimit)
@@ -668,7 +684,7 @@
else if (targetAngle > m_upperLimit)
targetAngle = m_upperLimit;
}
-
+#endif
// compute angular velocity
btScalar curAngle = getHingeAngle(m_rbA.getCenterOfMassTransform(),m_rbB.getCenterOfMassTransform());
btScalar dAngle = targetAngle - curAngle;
@@ -839,8 +855,13 @@
int limit = 0;
if(getSolveLimit())
{
- limit_err = m_correction * m_referenceSign;
- limit = (limit_err > btScalar(0.0)) ? 1 : 2;
+#ifdef _BT_USE_CENTER_LIMIT_
+ limit_err = m_limit.getCorrection() * m_referenceSign;
+#else
+ limit_err = m_correction * m_referenceSign;
+#endif
+ limit = (limit_err > btScalar(0.0)) ? 1 : 2;
+
}
// if the hinge has joint limits or motor, add in the extra row
int powered = 0;
@@ -904,7 +925,11 @@
info->m_upperLimit[srow] = 0;
}
// bounce (we'll use slider parameter abs(1.0 - m_dampingLimAng) for that)
+#ifdef _BT_USE_CENTER_LIMIT_
+ btScalar bounce = m_limit.getRelaxationFactor();
+#else
btScalar bounce = m_relaxationFactor;
+#endif
if(bounce > btScalar(0.0))
{
btScalar vel = angVelA.dot(ax1);
@@ -934,7 +959,11 @@
}
}
}
+#ifdef _BT_USE_CENTER_LIMIT_
+ info->m_constraintError[srow] *= m_limit.getBiasFactor();
+#else
info->m_constraintError[srow] *= m_biasFactor;
+#endif
} // if(limit)
} // if angular limit or powered
}
Modified: code/trunk/src/external/bullet/BulletDynamics/ConstraintSolver/btHingeConstraint.h
===================================================================
--- code/trunk/src/external/bullet/BulletDynamics/ConstraintSolver/btHingeConstraint.h 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletDynamics/ConstraintSolver/btHingeConstraint.h 2011-05-03 03:07:42 UTC (rev 8393)
@@ -15,9 +15,12 @@
/* Hinge Constraint by Dirk Gregorius. Limits added by Marcus Hennix at Starbreeze Studios */
-#ifndef HINGECONSTRAINT_H
-#define HINGECONSTRAINT_H
+#ifndef BT_HINGECONSTRAINT_H
+#define BT_HINGECONSTRAINT_H
+#define _BT_USE_CENTER_LIMIT_ 1
+
+
#include "LinearMath/btVector3.h"
#include "btJacobianEntry.h"
#include "btTypedConstraint.h"
@@ -33,6 +36,7 @@
#endif //BT_USE_DOUBLE_PRECISION
+
enum btHingeFlags
{
BT_HINGE_FLAGS_CFM_STOP = 1,
@@ -57,25 +61,31 @@
btScalar m_motorTargetVelocity;
btScalar m_maxMotorImpulse;
+
+#ifdef _BT_USE_CENTER_LIMIT_
+ btAngularLimit m_limit;
+#else
+ btScalar m_lowerLimit;
+ btScalar m_upperLimit;
+ btScalar m_limitSign;
+ btScalar m_correction;
+
btScalar m_limitSoftness;
btScalar m_biasFactor;
- btScalar m_relaxationFactor;
+ btScalar m_relaxationFactor;
- btScalar m_lowerLimit;
- btScalar m_upperLimit;
-
+ bool m_solveLimit;
+#endif
+
btScalar m_kHinge;
- btScalar m_limitSign;
- btScalar m_correction;
btScalar m_accLimitImpulse;
btScalar m_hingeAngle;
- btScalar m_referenceSign;
+ btScalar m_referenceSign;
bool m_angularOnly;
bool m_enableAngularMotor;
- bool m_solveLimit;
bool m_useSolveConstraintObsolete;
bool m_useOffsetForConstraintFrame;
bool m_useReferenceFrameA;
@@ -132,7 +142,19 @@
btRigidBody& getRigidBodyB()
{
return m_rbB;
- }
+ }
+
+ btTransform& getFrameOffsetA()
+ {
+ return m_rbAFrame;
+ }
+
+ btTransform& getFrameOffsetB()
+ {
+ return m_rbBFrame;
+ }
+
+ void setFrames(const btTransform& frameA, const btTransform& frameB);
void setAngularOnly(bool angularOnly)
{
@@ -157,13 +179,15 @@
void setLimit(btScalar low,btScalar high,btScalar _softness = 0.9f, btScalar _biasFactor = 0.3f, btScalar _relaxationFactor = 1.0f)
{
+#ifdef _BT_USE_CENTER_LIMIT_
+ m_limit.set(low, high, _softness, _biasFactor, _relaxationFactor);
+#else
m_lowerLimit = btNormalizeAngle(low);
m_upperLimit = btNormalizeAngle(high);
-
m_limitSoftness = _softness;
m_biasFactor = _biasFactor;
m_relaxationFactor = _relaxationFactor;
-
+#endif
}
void setAxis(btVector3& axisInA)
@@ -182,21 +206,31 @@
btVector3 rbAxisB1 = quatRotate(rotationArc,rbAxisA1);
btVector3 rbAxisB2 = axisInB.cross(rbAxisB1);
+ m_rbBFrame.getOrigin() = m_rbB.getCenterOfMassTransform().inverse()(m_rbA.getCenterOfMassTransform()(pivotInA));
- m_rbBFrame.getOrigin() = m_rbA.getCenterOfMassTransform()(pivotInA);
m_rbBFrame.getBasis().setValue( rbAxisB1.getX(),rbAxisB2.getX(),axisInB.getX(),
rbAxisB1.getY(),rbAxisB2.getY(),axisInB.getY(),
rbAxisB1.getZ(),rbAxisB2.getZ(),axisInB.getZ() );
+ m_rbBFrame.getBasis() = m_rbB.getCenterOfMassTransform().getBasis().inverse() * m_rbBFrame.getBasis();
+
}
btScalar getLowerLimit() const
{
- return m_lowerLimit;
+#ifdef _BT_USE_CENTER_LIMIT_
+ return m_limit.getLow();
+#else
+ return m_lowerLimit;
+#endif
}
btScalar getUpperLimit() const
{
- return m_upperLimit;
+#ifdef _BT_USE_CENTER_LIMIT_
+ return m_limit.getHigh();
+#else
+ return m_upperLimit;
+#endif
}
@@ -215,12 +249,20 @@
inline int getSolveLimit()
{
- return m_solveLimit;
+#ifdef _BT_USE_CENTER_LIMIT_
+ return m_limit.isLimit();
+#else
+ return m_solveLimit;
+#endif
}
inline btScalar getLimitSign()
{
+#ifdef _BT_USE_CENTER_LIMIT_
+ return m_limit.getSign();
+#else
return m_limitSign;
+#endif
}
inline bool getAngularOnly()
@@ -319,14 +361,21 @@
hingeData->m_maxMotorImpulse = float(m_maxMotorImpulse);
hingeData->m_motorTargetVelocity = float(m_motorTargetVelocity);
hingeData->m_useReferenceFrameA = m_useReferenceFrameA;
-
+#ifdef _BT_USE_CENTER_LIMIT_
+ hingeData->m_lowerLimit = float(m_limit.getLow());
+ hingeData->m_upperLimit = float(m_limit.getHigh());
+ hingeData->m_limitSoftness = float(m_limit.getSoftness());
+ hingeData->m_biasFactor = float(m_limit.getBiasFactor());
+ hingeData->m_relaxationFactor = float(m_limit.getRelaxationFactor());
+#else
hingeData->m_lowerLimit = float(m_lowerLimit);
hingeData->m_upperLimit = float(m_upperLimit);
hingeData->m_limitSoftness = float(m_limitSoftness);
hingeData->m_biasFactor = float(m_biasFactor);
hingeData->m_relaxationFactor = float(m_relaxationFactor);
+#endif
return btHingeConstraintDataName;
}
-#endif //HINGECONSTRAINT_H
+#endif //BT_HINGECONSTRAINT_H
Modified: code/trunk/src/external/bullet/BulletDynamics/ConstraintSolver/btJacobianEntry.h
===================================================================
--- code/trunk/src/external/bullet/BulletDynamics/ConstraintSolver/btJacobianEntry.h 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletDynamics/ConstraintSolver/btJacobianEntry.h 2011-05-03 03:07:42 UTC (rev 8393)
@@ -13,8 +13,8 @@
3. This notice may not be removed or altered from any source distribution.
*/
-#ifndef JACOBIAN_ENTRY_H
-#define JACOBIAN_ENTRY_H
+#ifndef BT_JACOBIAN_ENTRY_H
+#define BT_JACOBIAN_ENTRY_H
#include "LinearMath/btVector3.h"
#include "BulletDynamics/Dynamics/btRigidBody.h"
@@ -153,4 +153,4 @@
};
-#endif //JACOBIAN_ENTRY_H
+#endif //BT_JACOBIAN_ENTRY_H
Modified: code/trunk/src/external/bullet/BulletDynamics/ConstraintSolver/btPoint2PointConstraint.h
===================================================================
--- code/trunk/src/external/bullet/BulletDynamics/ConstraintSolver/btPoint2PointConstraint.h 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletDynamics/ConstraintSolver/btPoint2PointConstraint.h 2011-05-03 03:07:42 UTC (rev 8393)
@@ -13,8 +13,8 @@
3. This notice may not be removed or altered from any source distribution.
*/
-#ifndef POINT2POINTCONSTRAINT_H
-#define POINT2POINTCONSTRAINT_H
+#ifndef BT_POINT2POINTCONSTRAINT_H
+#define BT_POINT2POINTCONSTRAINT_H
#include "LinearMath/btVector3.h"
#include "btJacobianEntry.h"
@@ -158,4 +158,4 @@
return btPoint2PointConstraintDataName;
}
-#endif //POINT2POINTCONSTRAINT_H
+#endif //BT_POINT2POINTCONSTRAINT_H
Modified: code/trunk/src/external/bullet/BulletDynamics/ConstraintSolver/btSequentialImpulseConstraintSolver.cpp
===================================================================
--- code/trunk/src/external/bullet/BulletDynamics/ConstraintSolver/btSequentialImpulseConstraintSolver.cpp 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletDynamics/ConstraintSolver/btSequentialImpulseConstraintSolver.cpp 2011-05-03 03:07:42 UTC (rev 8393)
@@ -48,11 +48,11 @@
#ifdef USE_SIMD
#include <emmintrin.h>
-#define vec_splat(x, e) _mm_shuffle_ps(x, x, _MM_SHUFFLE(e,e,e,e))
-static inline __m128 _vmathVfDot3( __m128 vec0, __m128 vec1 )
+#define btVecSplat(x, e) _mm_shuffle_ps(x, x, _MM_SHUFFLE(e,e,e,e))
+static inline __m128 btSimdDot3( __m128 vec0, __m128 vec1 )
{
__m128 result = _mm_mul_ps( vec0, vec1);
- return _mm_add_ps( vec_splat( result, 0 ), _mm_add_ps( vec_splat( result, 1 ), vec_splat( result, 2 ) ) );
+ return _mm_add_ps( btVecSplat( result, 0 ), _mm_add_ps( btVecSplat( result, 1 ), btVecSplat( result, 2 ) ) );
}
#endif//USE_SIMD
@@ -64,8 +64,8 @@
__m128 lowerLimit1 = _mm_set1_ps(c.m_lowerLimit);
__m128 upperLimit1 = _mm_set1_ps(c.m_upperLimit);
__m128 deltaImpulse = _mm_sub_ps(_mm_set1_ps(c.m_rhs), _mm_mul_ps(_mm_set1_ps(c.m_appliedImpulse),_mm_set1_ps(c.m_cfm)));
- __m128 deltaVel1Dotn = _mm_add_ps(_vmathVfDot3(c.m_contactNormal.mVec128,body1.internalGetDeltaLinearVelocity().mVec128), _vmathVfDot3(c.m_relpos1CrossNormal.mVec128,body1.internalGetDeltaAngularVelocity().mVec128));
- __m128 deltaVel2Dotn = _mm_sub_ps(_vmathVfDot3(c.m_relpos2CrossNormal.mVec128,body2.internalGetDeltaAngularVelocity().mVec128),_vmathVfDot3((c.m_contactNormal).mVec128,body2.internalGetDeltaLinearVelocity().mVec128));
+ __m128 deltaVel1Dotn = _mm_add_ps(btSimdDot3(c.m_contactNormal.mVec128,body1.internalGetDeltaLinearVelocity().mVec128), btSimdDot3(c.m_relpos1CrossNormal.mVec128,body1.internalGetDeltaAngularVelocity().mVec128));
+ __m128 deltaVel2Dotn = _mm_sub_ps(btSimdDot3(c.m_relpos2CrossNormal.mVec128,body2.internalGetDeltaAngularVelocity().mVec128),btSimdDot3((c.m_contactNormal).mVec128,body2.internalGetDeltaLinearVelocity().mVec128));
deltaImpulse = _mm_sub_ps(deltaImpulse,_mm_mul_ps(deltaVel1Dotn,_mm_set1_ps(c.m_jacDiagABInv)));
deltaImpulse = _mm_sub_ps(deltaImpulse,_mm_mul_ps(deltaVel2Dotn,_mm_set1_ps(c.m_jacDiagABInv)));
btSimdScalar sum = _mm_add_ps(cpAppliedImp,deltaImpulse);
@@ -127,8 +127,8 @@
__m128 lowerLimit1 = _mm_set1_ps(c.m_lowerLimit);
__m128 upperLimit1 = _mm_set1_ps(c.m_upperLimit);
__m128 deltaImpulse = _mm_sub_ps(_mm_set1_ps(c.m_rhs), _mm_mul_ps(_mm_set1_ps(c.m_appliedImpulse),_mm_set1_ps(c.m_cfm)));
- __m128 deltaVel1Dotn = _mm_add_ps(_vmathVfDot3(c.m_contactNormal.mVec128,body1.internalGetDeltaLinearVelocity().mVec128), _vmathVfDot3(c.m_relpos1CrossNormal.mVec128,body1.internalGetDeltaAngularVelocity().mVec128));
- __m128 deltaVel2Dotn = _mm_sub_ps(_vmathVfDot3(c.m_relpos2CrossNormal.mVec128,body2.internalGetDeltaAngularVelocity().mVec128),_vmathVfDot3((c.m_contactNormal).mVec128,body2.internalGetDeltaLinearVelocity().mVec128));
+ __m128 deltaVel1Dotn = _mm_add_ps(btSimdDot3(c.m_contactNormal.mVec128,body1.internalGetDeltaLinearVelocity().mVec128), btSimdDot3(c.m_relpos1CrossNormal.mVec128,body1.internalGetDeltaAngularVelocity().mVec128));
+ __m128 deltaVel2Dotn = _mm_sub_ps(btSimdDot3(c.m_relpos2CrossNormal.mVec128,body2.internalGetDeltaAngularVelocity().mVec128),btSimdDot3((c.m_contactNormal).mVec128,body2.internalGetDeltaLinearVelocity().mVec128));
deltaImpulse = _mm_sub_ps(deltaImpulse,_mm_mul_ps(deltaVel1Dotn,_mm_set1_ps(c.m_jacDiagABInv)));
deltaImpulse = _mm_sub_ps(deltaImpulse,_mm_mul_ps(deltaVel2Dotn,_mm_set1_ps(c.m_jacDiagABInv)));
btSimdScalar sum = _mm_add_ps(cpAppliedImp,deltaImpulse);
@@ -215,8 +215,8 @@
__m128 lowerLimit1 = _mm_set1_ps(c.m_lowerLimit);
__m128 upperLimit1 = _mm_set1_ps(c.m_upperLimit);
__m128 deltaImpulse = _mm_sub_ps(_mm_set1_ps(c.m_rhsPenetration), _mm_mul_ps(_mm_set1_ps(c.m_appliedPushImpulse),_mm_set1_ps(c.m_cfm)));
- __m128 deltaVel1Dotn = _mm_add_ps(_vmathVfDot3(c.m_contactNormal.mVec128,body1.internalGetPushVelocity().mVec128), _vmathVfDot3(c.m_relpos1CrossNormal.mVec128,body1.internalGetTurnVelocity().mVec128));
- __m128 deltaVel2Dotn = _mm_sub_ps(_vmathVfDot3(c.m_relpos2CrossNormal.mVec128,body2.internalGetTurnVelocity().mVec128),_vmathVfDot3((c.m_contactNormal).mVec128,body2.internalGetPushVelocity().mVec128));
+ __m128 deltaVel1Dotn = _mm_add_ps(btSimdDot3(c.m_contactNormal.mVec128,body1.internalGetPushVelocity().mVec128), btSimdDot3(c.m_relpos1CrossNormal.mVec128,body1.internalGetTurnVelocity().mVec128));
+ __m128 deltaVel2Dotn = _mm_sub_ps(btSimdDot3(c.m_relpos2CrossNormal.mVec128,body2.internalGetTurnVelocity().mVec128),btSimdDot3((c.m_contactNormal).mVec128,body2.internalGetPushVelocity().mVec128));
deltaImpulse = _mm_sub_ps(deltaImpulse,_mm_mul_ps(deltaVel1Dotn,_mm_set1_ps(c.m_jacDiagABInv)));
deltaImpulse = _mm_sub_ps(deltaImpulse,_mm_mul_ps(deltaVel2Dotn,_mm_set1_ps(c.m_jacDiagABInv)));
btSimdScalar sum = _mm_add_ps(cpAppliedImp,deltaImpulse);
@@ -557,8 +557,17 @@
rel_vel = vel1Dotn+vel2Dotn;
btScalar positionalError = 0.f;
- positionalError = -penetration * infoGlobal.m_erp/infoGlobal.m_timeStep;
btScalar velocityError = restitution - rel_vel;// * damping;
+
+ if (penetration>0)
+ {
+ positionalError = 0;
+ velocityError -= penetration / infoGlobal.m_timeStep;
+ } else
+ {
+ positionalError = -penetration * infoGlobal.m_erp/infoGlobal.m_timeStep;
+ }
+
btScalar penetrationImpulse = positionalError*solverConstraint.m_jacDiagABInv;
btScalar velocityImpulse = velocityError *solverConstraint.m_jacDiagABInv;
if (!infoGlobal.m_splitImpulse || (penetration > infoGlobal.m_splitImpulsePenetrationThreshold))
@@ -779,6 +788,7 @@
{
btTypedConstraint* constraint = constraints[j];
constraint->buildJacobian();
+ constraint->internalSetAppliedImpulse(0.0f);
}
}
//btRigidBody* rb0=0,*rb1=0;
@@ -795,7 +805,14 @@
for (i=0;i<numConstraints;i++)
{
btTypedConstraint::btConstraintInfo1& info1 = m_tmpConstraintSizesPool[i];
- constraints[i]->getInfo1(&info1);
+ if (constraints[i]->isEnabled())
+ {
+ constraints[i]->getInfo1(&info1);
+ } else
+ {
+ info1.m_numConstraintRows = 0;
+ info1.nub = 0;
+ }
totalNumRows += info1.m_numConstraintRows;
}
m_tmpSolverNonContactConstraintPool.resize(totalNumRows);
@@ -816,7 +833,6 @@
btTypedConstraint* constraint = constraints[i];
-
btRigidBody& rbA = constraint->getRigidBodyA();
btRigidBody& rbB = constraint->getRigidBodyB();
@@ -825,8 +841,8 @@
for ( j=0;j<info1.m_numConstraintRows;j++)
{
memset(¤tConstraintRow[j],0,sizeof(btSolverConstraint));
- currentConstraintRow[j].m_lowerLimit = -FLT_MAX;
- currentConstraintRow[j].m_upperLimit = FLT_MAX;
+ currentConstraintRow[j].m_lowerLimit = -SIMD_INFINITY;
+ currentConstraintRow[j].m_upperLimit = SIMD_INFINITY;
currentConstraintRow[j].m_appliedImpulse = 0.f;
currentConstraintRow[j].m_appliedPushImpulse = 0.f;
currentConstraintRow[j].m_solverBodyA = &rbA;
@@ -859,6 +875,18 @@
info2.m_numIterations = infoGlobal.m_numIterations;
constraints[i]->getInfo2(&info2);
+ if (currentConstraintRow->m_upperLimit>constraints[i]->getBreakingImpulseThreshold())
+ {
+ currentConstraintRow->m_upperLimit = constraints[i]->getBreakingImpulseThreshold();
+ }
+
+ if (currentConstraintRow->m_lowerLimit<-constraints[i]->getBreakingImpulseThreshold())
+ {
+ currentConstraintRow->m_lowerLimit = -constraints[i]->getBreakingImpulseThreshold();
+ }
+
+
+
///finalize the constraint setup
for ( j=0;j<info1.m_numConstraintRows;j++)
{
@@ -1106,12 +1134,13 @@
//should traverse the contacts random order...
int iteration;
{
+ solveGroupCacheFriendlySplitImpulseIterations(bodies ,numBodies,manifoldPtr, numManifolds,constraints,numConstraints,infoGlobal,debugDrawer,stackAlloc);
+
for ( iteration = 0;iteration<infoGlobal.m_numIterations;iteration++)
{
solveSingleIteration(iteration, bodies ,numBodies,manifoldPtr, numManifolds,constraints,numConstraints,infoGlobal,debugDrawer,stackAlloc);
}
- solveGroupCacheFriendlySplitImpulseIterations(bodies ,numBodies,manifoldPtr, numManifolds,constraints,numConstraints,infoGlobal,debugDrawer,stackAlloc);
}
return 0.f;
}
@@ -1142,9 +1171,11 @@
{
const btSolverConstraint& solverConstr = m_tmpSolverNonContactConstraintPool[j];
btTypedConstraint* constr = (btTypedConstraint*)solverConstr.m_originalContactPoint;
- btScalar sum = constr->internalGetAppliedImpulse();
- sum += solverConstr.m_appliedImpulse;
- constr->internalSetAppliedImpulse(sum);
+ constr->internalSetAppliedImpulse(solverConstr.m_appliedImpulse);
+ if (solverConstr.m_appliedImpulse>constr->getBreakingImpulseThreshold())
+ {
+ constr->setEnabled(false);
+ }
}
Modified: code/trunk/src/external/bullet/BulletDynamics/ConstraintSolver/btSequentialImpulseConstraintSolver.h
===================================================================
--- code/trunk/src/external/bullet/BulletDynamics/ConstraintSolver/btSequentialImpulseConstraintSolver.h 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletDynamics/ConstraintSolver/btSequentialImpulseConstraintSolver.h 2011-05-03 03:07:42 UTC (rev 8393)
@@ -13,8 +13,8 @@
3. This notice may not be removed or altered from any source distribution.
*/
-#ifndef SEQUENTIAL_IMPULSE_CONSTRAINT_SOLVER_H
-#define SEQUENTIAL_IMPULSE_CONSTRAINT_SOLVER_H
+#ifndef BT_SEQUENTIAL_IMPULSE_CONSTRAINT_SOLVER_H
+#define BT_SEQUENTIAL_IMPULSE_CONSTRAINT_SOLVER_H
#include "btConstraintSolver.h"
class btIDebugDraw;
@@ -124,5 +124,5 @@
#endif
-#endif //SEQUENTIAL_IMPULSE_CONSTRAINT_SOLVER_H
+#endif //BT_SEQUENTIAL_IMPULSE_CONSTRAINT_SOLVER_H
Modified: code/trunk/src/external/bullet/BulletDynamics/ConstraintSolver/btSliderConstraint.h
===================================================================
--- code/trunk/src/external/bullet/BulletDynamics/ConstraintSolver/btSliderConstraint.h 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletDynamics/ConstraintSolver/btSliderConstraint.h 2011-05-03 03:07:42 UTC (rev 8393)
@@ -22,8 +22,8 @@
- add conversion for ODE constraint solver
*/
-#ifndef SLIDER_CONSTRAINT_H
-#define SLIDER_CONSTRAINT_H
+#ifndef BT_SLIDER_CONSTRAINT_H
+#define BT_SLIDER_CONSTRAINT_H
@@ -236,8 +236,11 @@
btScalar getTargetAngMotorVelocity() { return m_targetAngMotorVelocity; }
void setMaxAngMotorForce(btScalar maxAngMotorForce) { m_maxAngMotorForce = maxAngMotorForce; }
btScalar getMaxAngMotorForce() { return m_maxAngMotorForce; }
- btScalar getLinearPos() { return m_linPos; }
+
+ btScalar getLinearPos() const { return m_linPos; }
+ btScalar getAngularPos() const { return m_angPos; }
+
// access for ODE solver
bool getSolveLinLimit() { return m_solveLinLim; }
@@ -255,6 +258,15 @@
bool getUseFrameOffset() { return m_useOffsetForConstraintFrame; }
void setUseFrameOffset(bool frameOffsetOnOff) { m_useOffsetForConstraintFrame = frameOffsetOnOff; }
+ void setFrames(const btTransform& frameA, const btTransform& frameB)
+ {
+ m_frameInA=frameA;
+ m_frameInB=frameB;
+ calculateTransforms(m_rbA.getCenterOfMassTransform(),m_rbB.getCenterOfMassTransform());
+ buildJacobian();
+ }
+
+
///override the default global value of a parameter (such as ERP or CFM), optionally provide the axis (0..5).
///If no axis is provided, it uses the default axis for this constraint.
virtual void setParam(int num, btScalar value, int axis = -1);
@@ -317,5 +329,5 @@
-#endif //SLIDER_CONSTRAINT_H
+#endif //BT_SLIDER_CONSTRAINT_H
Modified: code/trunk/src/external/bullet/BulletDynamics/ConstraintSolver/btSolve2LinearConstraint.h
===================================================================
--- code/trunk/src/external/bullet/BulletDynamics/ConstraintSolver/btSolve2LinearConstraint.h 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletDynamics/ConstraintSolver/btSolve2LinearConstraint.h 2011-05-03 03:07:42 UTC (rev 8393)
@@ -13,8 +13,8 @@
3. This notice may not be removed or altered from any source distribution.
*/
-#ifndef SOLVE_2LINEAR_CONSTRAINT_H
-#define SOLVE_2LINEAR_CONSTRAINT_H
+#ifndef BT_SOLVE_2LINEAR_CONSTRAINT_H
+#define BT_SOLVE_2LINEAR_CONSTRAINT_H
#include "LinearMath/btMatrix3x3.h"
#include "LinearMath/btVector3.h"
@@ -104,4 +104,4 @@
};
-#endif //SOLVE_2LINEAR_CONSTRAINT_H
+#endif //BT_SOLVE_2LINEAR_CONSTRAINT_H
Modified: code/trunk/src/external/bullet/BulletDynamics/ConstraintSolver/btTypedConstraint.cpp
===================================================================
--- code/trunk/src/external/bullet/BulletDynamics/ConstraintSolver/btTypedConstraint.cpp 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletDynamics/ConstraintSolver/btTypedConstraint.cpp 2011-05-03 03:07:42 UTC (rev 8393)
@@ -29,7 +29,9 @@
m_rbA(rbA),
m_rbB(getFixedBody()),
m_appliedImpulse(btScalar(0.)),
-m_dbgDrawSize(DEFAULT_DEBUGDRAW_SIZE)
+m_dbgDrawSize(DEFAULT_DEBUGDRAW_SIZE),
+m_breakingImpulseThreshold(SIMD_INFINITY),
+m_isEnabled(true)
{
}
@@ -42,7 +44,9 @@
m_rbA(rbA),
m_rbB(rbB),
m_appliedImpulse(btScalar(0.)),
-m_dbgDrawSize(DEFAULT_DEBUGDRAW_SIZE)
+m_dbgDrawSize(DEFAULT_DEBUGDRAW_SIZE),
+m_breakingImpulseThreshold(SIMD_INFINITY),
+m_isEnabled(true)
{
}
@@ -140,3 +144,71 @@
return s_fixed;
}
+
+void btAngularLimit::set(btScalar low, btScalar high, btScalar _softness, btScalar _biasFactor, btScalar _relaxationFactor)
+{
+ m_halfRange = (high - low) / 2.0f;
+ m_center = btNormalizeAngle(low + m_halfRange);
+ m_softness = _softness;
+ m_biasFactor = _biasFactor;
+ m_relaxationFactor = _relaxationFactor;
+}
+
+void btAngularLimit::test(const btScalar angle)
+{
+ m_correction = 0.0f;
+ m_sign = 0.0f;
+ m_solveLimit = false;
+
+ if (m_halfRange >= 0.0f)
+ {
+ btScalar deviation = btNormalizeAngle(angle - m_center);
+ if (deviation < -m_halfRange)
+ {
+ m_solveLimit = true;
+ m_correction = - (deviation + m_halfRange);
+ m_sign = +1.0f;
+ }
+ else if (deviation > m_halfRange)
+ {
+ m_solveLimit = true;
+ m_correction = m_halfRange - deviation;
+ m_sign = -1.0f;
+ }
+ }
+}
+
+
+btScalar btAngularLimit::getError() const
+{
+ return m_correction * m_sign;
+}
+
+void btAngularLimit::fit(btScalar& angle) const
+{
+ if (m_halfRange > 0.0f)
+ {
+ btScalar relativeAngle = btNormalizeAngle(angle - m_center);
+ if (!btEqual(relativeAngle, m_halfRange))
+ {
+ if (relativeAngle > 0.0f)
+ {
+ angle = getHigh();
+ }
+ else
+ {
+ angle = getLow();
+ }
+ }
+ }
+}
+
+btScalar btAngularLimit::getLow() const
+{
+ return btNormalizeAngle(m_center - m_halfRange);
+}
+
+btScalar btAngularLimit::getHigh() const
+{
+ return btNormalizeAngle(m_center + m_halfRange);
+}
Modified: code/trunk/src/external/bullet/BulletDynamics/ConstraintSolver/btTypedConstraint.h
===================================================================
--- code/trunk/src/external/bullet/BulletDynamics/ConstraintSolver/btTypedConstraint.h 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletDynamics/ConstraintSolver/btTypedConstraint.h 2011-05-03 03:07:42 UTC (rev 8393)
@@ -13,24 +13,26 @@
3. This notice may not be removed or altered from any source distribution.
*/
-#ifndef TYPED_CONSTRAINT_H
-#define TYPED_CONSTRAINT_H
+#ifndef BT_TYPED_CONSTRAINT_H
+#define BT_TYPED_CONSTRAINT_H
class btRigidBody;
#include "LinearMath/btScalar.h"
#include "btSolverConstraint.h"
-#include "BulletCollision/NarrowPhaseCollision/btPersistentManifold.h"
class btSerializer;
+//Don't change any of the existing enum values, so add enum types at the end for serialization compatibility
enum btTypedConstraintType
{
- POINT2POINT_CONSTRAINT_TYPE=MAX_CONTACT_MANIFOLD_TYPE+1,
+ POINT2POINT_CONSTRAINT_TYPE=3,
HINGE_CONSTRAINT_TYPE,
CONETWIST_CONSTRAINT_TYPE,
D6_CONSTRAINT_TYPE,
SLIDER_CONSTRAINT_TYPE,
- CONTACT_CONSTRAINT_TYPE
+ CONTACT_CONSTRAINT_TYPE,
+ D6_SPRING_CONSTRAINT_TYPE,
+ MAX_CONSTRAINT_TYPE
};
@@ -60,6 +62,10 @@
void* m_userConstraintPtr;
};
+ btScalar m_breakingImpulseThreshold;
+ bool m_isEnabled;
+
+
bool m_needsFeedback;
btTypedConstraint& operator=(btTypedConstraint& other)
@@ -153,6 +159,28 @@
return m_appliedImpulse;
}
+
+ btScalar getBreakingImpulseThreshold() const
+ {
+ return m_breakingImpulseThreshold;
+ }
+
+ void setBreakingImpulseThreshold(btScalar threshold)
+ {
+ m_breakingImpulseThreshold = threshold;
+ }
+
+ bool isEnabled() const
+ {
+ return m_isEnabled;
+ }
+
+ void setEnabled(bool enabled)
+ {
+ m_isEnabled=enabled;
+ }
+
+
///internal method used by the constraint solver, don't use them directly
virtual void solveConstraintObsolete(btRigidBody& /*bodyA*/,btRigidBody& /*bodyB*/,btScalar /*timeStep*/) {};
@@ -311,5 +339,98 @@
+class btAngularLimit
+{
+private:
+ btScalar
+ m_center,
+ m_halfRange,
+ m_softness,
+ m_biasFactor,
+ m_relaxationFactor,
+ m_correction,
+ m_sign;
-#endif //TYPED_CONSTRAINT_H
+ bool
+ m_solveLimit;
+
+public:
+ /// Default constructor initializes limit as inactive, allowing free constraint movement
+ btAngularLimit()
+ :m_center(0.0f),
+ m_halfRange(-1.0f),
+ m_softness(0.9f),
+ m_biasFactor(0.3f),
+ m_relaxationFactor(1.0f),
+ m_correction(0.0f),
+ m_sign(0.0f),
+ m_solveLimit(false)
+ {}
+
+ /// Sets all limit's parameters.
+ /// When low > high limit becomes inactive.
+ /// When high - low > 2PI limit is ineffective too becouse no angle can exceed the limit
+ void set(btScalar low, btScalar high, btScalar _softness = 0.9f, btScalar _biasFactor = 0.3f, btScalar _relaxationFactor = 1.0f);
+
+ /// Checks conastaint angle against limit. If limit is active and the angle violates the limit
+ /// correction is calculated.
+ void test(const btScalar angle);
+
+ /// Returns limit's softness
+ inline btScalar getSoftness() const
+ {
+ return m_softness;
+ }
+
+ /// Returns limit's bias factor
+ inline btScalar getBiasFactor() const
+ {
+ return m_biasFactor;
+ }
+
+ /// Returns limit's relaxation factor
+ inline btScalar getRelaxationFactor() const
+ {
+ return m_relaxationFactor;
+ }
+
+ /// Returns correction value evaluated when test() was invoked
+ inline btScalar getCorrection() const
+ {
+ return m_correction;
+ }
+
+ /// Returns sign value evaluated when test() was invoked
+ inline btScalar getSign() const
+ {
+ return m_sign;
+ }
+
+ /// Gives half of the distance between min and max limit angle
+ inline btScalar getHalfRange() const
+ {
+ return m_halfRange;
+ }
+
+ /// Returns true when the last test() invocation recognized limit violation
+ inline bool isLimit() const
+ {
+ return m_solveLimit;
+ }
+
+ /// Checks given angle against limit. If limit is active and angle doesn't fit it, the angle
+ /// returned is modified so it equals to the limit closest to given angle.
+ void fit(btScalar& angle) const;
+
+ /// Returns correction value multiplied by sign value
+ btScalar getError() const;
+
+ btScalar getLow() const;
+
+ btScalar getHigh() const;
+
+};
+
+
+
+#endif //BT_TYPED_CONSTRAINT_H
Modified: code/trunk/src/external/bullet/BulletDynamics/ConstraintSolver/btUniversalConstraint.cpp
===================================================================
--- code/trunk/src/external/bullet/BulletDynamics/ConstraintSolver/btUniversalConstraint.cpp 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletDynamics/ConstraintSolver/btUniversalConstraint.cpp 2011-05-03 03:07:42 UTC (rev 8393)
@@ -61,3 +61,27 @@
setAngularUpperLimit(btVector3(0.f, SIMD_HALF_PI - UNIV_EPS, SIMD_PI - UNIV_EPS));
}
+void btUniversalConstraint::setAxis(const btVector3& axis1,const btVector3& axis2)
+{
+ m_axis1 = axis1;
+ m_axis2 = axis2;
+
+ btVector3 zAxis = axis1.normalized();
+ btVector3 yAxis = axis2.normalized();
+ btVector3 xAxis = yAxis.cross(zAxis); // we want right coordinate system
+
+ btTransform frameInW;
+ frameInW.setIdentity();
+ frameInW.getBasis().setValue( xAxis[0], yAxis[0], zAxis[0],
+ xAxis[1], yAxis[1], zAxis[1],
+ xAxis[2], yAxis[2], zAxis[2]);
+ frameInW.setOrigin(m_anchor);
+
+ // now get constraint frame in local coordinate systems
+ m_frameInA = m_rbA.getCenterOfMassTransform().inverse() * frameInW;
+ m_frameInB = m_rbB.getCenterOfMassTransform().inverse() * frameInW;
+
+ calculateTransforms();
+}
+
+
Modified: code/trunk/src/external/bullet/BulletDynamics/ConstraintSolver/btUniversalConstraint.h
===================================================================
--- code/trunk/src/external/bullet/BulletDynamics/ConstraintSolver/btUniversalConstraint.h 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletDynamics/ConstraintSolver/btUniversalConstraint.h 2011-05-03 03:07:42 UTC (rev 8393)
@@ -13,8 +13,8 @@
3. This notice may not be removed or altered from any source distribution.
*/
-#ifndef UNIVERSAL_CONSTRAINT_H
-#define UNIVERSAL_CONSTRAINT_H
+#ifndef BT_UNIVERSAL_CONSTRAINT_H
+#define BT_UNIVERSAL_CONSTRAINT_H
@@ -52,9 +52,11 @@
// limits
void setUpperLimit(btScalar ang1max, btScalar ang2max) { setAngularUpperLimit(btVector3(0.f, ang1max, ang2max)); }
void setLowerLimit(btScalar ang1min, btScalar ang2min) { setAngularLowerLimit(btVector3(0.f, ang1min, ang2min)); }
+
+ void setAxis( const btVector3& axis1, const btVector3& axis2);
};
-#endif // UNIVERSAL_CONSTRAINT_H
+#endif // BT_UNIVERSAL_CONSTRAINT_H
Modified: code/trunk/src/external/bullet/BulletDynamics/Dynamics/btDiscreteDynamicsWorld.cpp
===================================================================
--- code/trunk/src/external/bullet/BulletDynamics/Dynamics/btDiscreteDynamicsWorld.cpp 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletDynamics/Dynamics/btDiscreteDynamicsWorld.cpp 2011-05-03 03:07:42 UTC (rev 8393)
@@ -35,7 +35,9 @@
#include "BulletDynamics/ConstraintSolver/btConeTwistConstraint.h"
#include "BulletDynamics/ConstraintSolver/btGeneric6DofConstraint.h"
#include "BulletDynamics/ConstraintSolver/btSliderConstraint.h"
+#include "BulletDynamics/ConstraintSolver/btContactConstraint.h"
+
#include "LinearMath/btIDebugDraw.h"
#include "BulletCollision/CollisionShapes/btSphereShape.h"
@@ -46,8 +48,15 @@
#include "LinearMath/btSerializer.h"
+#if 0
+btAlignedObjectArray<btVector3> debugContacts;
+btAlignedObjectArray<btVector3> debugNormals;
+int startHit=2;
+int firstHit=startHit;
+#endif
+
btDiscreteDynamicsWorld::btDiscreteDynamicsWorld(btDispatcher* dispatcher,btBroadphaseInterface* pairCache,btConstraintSolver* constraintSolver, btCollisionConfiguration* collisionConfiguration)
:btDynamicsWorld(dispatcher,pairCache,collisionConfiguration),
m_constraintSolver(constraintSolver),
@@ -314,9 +323,14 @@
dispatchInfo.m_stepCount = 0;
dispatchInfo.m_debugDraw = getDebugDrawer();
+
///perform collision detection
performDiscreteCollisionDetection();
+ if (getDispatchInfo().m_useContinuous)
+ addSpeculativeContacts(timeStep);
+
+
calculateSimulationIslands();
@@ -745,12 +759,13 @@
class btClosestNotMeConvexResultCallback : public btCollisionWorld::ClosestConvexResultCallback
{
+public:
+
btCollisionObject* m_me;
btScalar m_allowedPenetration;
btOverlappingPairCache* m_pairCache;
btDispatcher* m_dispatcher;
-
public:
btClosestNotMeConvexResultCallback (btCollisionObject* me,const btVector3& fromA,const btVector3& toA,btOverlappingPairCache* pairCache,btDispatcher* dispatcher) :
btCollisionWorld::ClosestConvexResultCallback(fromA,toA),
@@ -797,6 +812,7 @@
//call needsResponse, see http://code.google.com/p/bullet/issues/detail?id=179
if (m_dispatcher->needsResponse(m_me,otherObj))
{
+#if 0
///don't do CCD when there are already contact points (touching contact/penetration)
btAlignedObjectArray<btPersistentManifold*> manifoldArray;
btBroadphasePair* collisionPair = m_pairCache->findPair(m_me->getBroadphaseHandle(),proxy0);
@@ -814,8 +830,11 @@
}
}
}
+#endif
+ return true;
}
- return true;
+
+ return false;
}
@@ -824,7 +843,6 @@
///internal debugging variable. this value shouldn't be too high
int gNumClampedCcdMotions=0;
-//#include "stdio.h"
void btDiscreteDynamicsWorld::integrateTransforms(btScalar timeStep)
{
BT_PROFILE("integrateTransforms");
@@ -836,43 +854,211 @@
if (body->isActive() && (!body->isStaticOrKinematicObject()))
{
+
body->predictIntegratedTransform(timeStep, predictedTrans);
+
btScalar squareMotion = (predictedTrans.getOrigin()-body->getWorldTransform().getOrigin()).length2();
- if (body->getCcdSquareMotionThreshold() && body->getCcdSquareMotionThreshold() < squareMotion)
+
+
+ if (getDispatchInfo().m_useContinuous && body->getCcdSquareMotionThreshold() && body->getCcdSquareMotionThreshold() < squareMotion)
{
BT_PROFILE("CCD motion clamping");
if (body->getCollisionShape()->isConvex())
{
gNumClampedCcdMotions++;
-
+#ifdef USE_STATIC_ONLY
+ class StaticOnlyCallback : public btClosestNotMeConvexResultCallback
+ {
+ public:
+
+ StaticOnlyCallback (btCollisionObject* me,const btVector3& fromA,const btVector3& toA,btOverlappingPairCache* pairCache,btDispatcher* dispatcher) :
+ btClosestNotMeConvexResultCallback(me,fromA,toA,pairCache,dispatcher)
+ {
+ }
+
+ virtual bool needsCollision(btBroadphaseProxy* proxy0) const
+ {
+ btCollisionObject* otherObj = (btCollisionObject*) proxy0->m_clientObject;
+ if (!otherObj->isStaticOrKinematicObject())
+ return false;
+ return btClosestNotMeConvexResultCallback::needsCollision(proxy0);
+ }
+ };
+
+ StaticOnlyCallback sweepResults(body,body->getWorldTransform().getOrigin(),predictedTrans.getOrigin(),getBroadphase()->getOverlappingPairCache(),getDispatcher());
+#else
btClosestNotMeConvexResultCallback sweepResults(body,body->getWorldTransform().getOrigin(),predictedTrans.getOrigin(),getBroadphase()->getOverlappingPairCache(),getDispatcher());
+#endif
//btConvexShape* convexShape = static_cast<btConvexShape*>(body->getCollisionShape());
btSphereShape tmpSphere(body->getCcdSweptSphereRadius());//btConvexShape* convexShape = static_cast<btConvexShape*>(body->getCollisionShape());
+ sweepResults.m_allowedPenetration=getDispatchInfo().m_allowedCcdPenetration;
sweepResults.m_collisionFilterGroup = body->getBroadphaseProxy()->m_collisionFilterGroup;
sweepResults.m_collisionFilterMask = body->getBroadphaseProxy()->m_collisionFilterMask;
+ btTransform modifiedPredictedTrans = predictedTrans;
+ modifiedPredictedTrans.setBasis(body->getWorldTransform().getBasis());
- convexSweepTest(&tmpSphere,body->getWorldTransform(),predictedTrans,sweepResults);
+ convexSweepTest(&tmpSphere,body->getWorldTransform(),modifiedPredictedTrans,sweepResults);
if (sweepResults.hasHit() && (sweepResults.m_closestHitFraction < 1.f))
{
+
+ //printf("clamped integration to hit fraction = %f\n",fraction);
body->setHitFraction(sweepResults.m_closestHitFraction);
body->predictIntegratedTransform(timeStep*body->getHitFraction(), predictedTrans);
body->setHitFraction(0.f);
-// printf("clamped integration to hit fraction = %f\n",fraction);
+ body->proceedToTransform( predictedTrans);
+
+#if 0
+ btVector3 linVel = body->getLinearVelocity();
+
+ btScalar maxSpeed = body->getCcdMotionThreshold()/getSolverInfo().m_timeStep;
+ btScalar maxSpeedSqr = maxSpeed*maxSpeed;
+ if (linVel.length2()>maxSpeedSqr)
+ {
+ linVel.normalize();
+ linVel*= maxSpeed;
+ body->setLinearVelocity(linVel);
+ btScalar ms2 = body->getLinearVelocity().length2();
+ body->predictIntegratedTransform(timeStep, predictedTrans);
+
+ btScalar sm2 = (predictedTrans.getOrigin()-body->getWorldTransform().getOrigin()).length2();
+ btScalar smt = body->getCcdSquareMotionThreshold();
+ printf("sm2=%f\n",sm2);
+ }
+#else
+ //response between two dynamic objects without friction, assuming 0 penetration depth
+ btScalar appliedImpulse = 0.f;
+ btScalar depth = 0.f;
+ appliedImpulse = resolveSingleCollision(body,sweepResults.m_hitCollisionObject,sweepResults.m_hitPointWorld,sweepResults.m_hitNormalWorld,getSolverInfo(), depth);
+
+
+#endif
+
+ continue;
}
}
}
+
body->proceedToTransform( predictedTrans);
}
}
}
+void btDiscreteDynamicsWorld::addSpeculativeContacts(btScalar timeStep)
+{
+ BT_PROFILE("addSpeculativeContacts");
+ btTransform predictedTrans;
+ for ( int i=0;i<m_nonStaticRigidBodies.size();i++)
+ {
+ btRigidBody* body = m_nonStaticRigidBodies[i];
+ body->setHitFraction(1.f);
+ if (body->isActive() && (!body->isStaticOrKinematicObject()))
+ {
+ body->predictIntegratedTransform(timeStep, predictedTrans);
+ btScalar squareMotion = (predictedTrans.getOrigin()-body->getWorldTransform().getOrigin()).length2();
+ if (body->getCcdSquareMotionThreshold() && body->getCcdSquareMotionThreshold() < squareMotion)
+ {
+ BT_PROFILE("search speculative contacts");
+ if (body->getCollisionShape()->isConvex())
+ {
+ gNumClampedCcdMotions++;
+
+ btClosestNotMeConvexResultCallback sweepResults(body,body->getWorldTransform().getOrigin(),predictedTrans.getOrigin(),getBroadphase()->getOverlappingPairCache(),getDispatcher());
+ //btConvexShape* convexShape = static_cast<btConvexShape*>(body->getCollisionShape());
+ btSphereShape tmpSphere(body->getCcdSweptSphereRadius());//btConvexShape* convexShape = static_cast<btConvexShape*>(body->getCollisionShape());
+ sweepResults.m_collisionFilterGroup = body->getBroadphaseProxy()->m_collisionFilterGroup;
+ sweepResults.m_collisionFilterMask = body->getBroadphaseProxy()->m_collisionFilterMask;
+ btTransform modifiedPredictedTrans;
+ modifiedPredictedTrans = predictedTrans;
+ modifiedPredictedTrans.setBasis(body->getWorldTransform().getBasis());
+ convexSweepTest(&tmpSphere,body->getWorldTransform(),modifiedPredictedTrans,sweepResults);
+ if (sweepResults.hasHit() && (sweepResults.m_closestHitFraction < 1.f))
+ {
+ btBroadphaseProxy* proxy0 = body->getBroadphaseHandle();
+ btBroadphaseProxy* proxy1 = sweepResults.m_hitCollisionObject->getBroadphaseHandle();
+ btBroadphasePair* pair = sweepResults.m_pairCache->findPair(proxy0,proxy1);
+ if (pair)
+ {
+ if (pair->m_algorithm)
+ {
+ btManifoldArray contacts;
+ pair->m_algorithm->getAllContactManifolds(contacts);
+ if (contacts.size())
+ {
+ btManifoldResult result(body,sweepResults.m_hitCollisionObject);
+ result.setPersistentManifold(contacts[0]);
+
+ btVector3 vec = (modifiedPredictedTrans.getOrigin()-body->getWorldTransform().getOrigin());
+ vec*=sweepResults.m_closestHitFraction;
+
+ btScalar lenSqr = vec.length2();
+ btScalar depth = 0.f;
+ btVector3 pointWorld = sweepResults.m_hitPointWorld;
+ if (lenSqr>SIMD_EPSILON)
+ {
+ depth = btSqrt(lenSqr);
+ pointWorld -= vec;
+ vec /= depth;
+ }
+
+ if (contacts[0]->getBody0()==body)
+ {
+ result.addContactPoint(sweepResults.m_hitNormalWorld,pointWorld,depth);
+#if 0
+ debugContacts.push_back(sweepResults.m_hitPointWorld);//sweepResults.m_hitPointWorld);
+ debugNormals.push_back(sweepResults.m_hitNormalWorld);
+#endif
+ } else
+ {
+ //swapped
+ result.addContactPoint(-sweepResults.m_hitNormalWorld,pointWorld,depth);
+ //sweepResults.m_hitPointWorld,depth);
+
+#if 0
+ if (1)//firstHit==1)
+ {
+ firstHit=0;
+ debugNormals.push_back(sweepResults.m_hitNormalWorld);
+ debugContacts.push_back(pointWorld);//sweepResults.m_hitPointWorld);
+ debugNormals.push_back(sweepResults.m_hitNormalWorld);
+ debugContacts.push_back(sweepResults.m_hitPointWorld);
+ }
+ firstHit--;
+#endif
+ }
+ }
+
+ } else
+ {
+ //no algorithm, use dispatcher to create one
+
+ }
+
+
+ } else
+ {
+ //add an overlapping pair
+ //printf("pair missing\n");
+
+ }
+ }
+ }
+ }
+
+ }
+ }
+}
+
+
+
+
+
void btDiscreteDynamicsWorld::predictUnconstraintMotion(btScalar timeStep)
{
BT_PROFILE("predictUnconstraintMotion");
@@ -1009,6 +1195,7 @@
}
}
break;
+ case D6_SPRING_CONSTRAINT_TYPE:
case D6_CONSTRAINT_TYPE:
{
btGeneric6DofConstraint* p6DOF = (btGeneric6DofConstraint*)constraint;
Modified: code/trunk/src/external/bullet/BulletDynamics/Dynamics/btDiscreteDynamicsWorld.h
===================================================================
--- code/trunk/src/external/bullet/BulletDynamics/Dynamics/btDiscreteDynamicsWorld.h 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletDynamics/Dynamics/btDiscreteDynamicsWorld.h 2011-05-03 03:07:42 UTC (rev 8393)
@@ -62,6 +62,8 @@
virtual void integrateTransforms(btScalar timeStep);
+ virtual void addSpeculativeContacts(btScalar timeStep);
+
virtual void calculateSimulationIslands();
virtual void solveConstraints(btContactSolverInfo& solverInfo);
Modified: code/trunk/src/external/bullet/BulletDynamics/Dynamics/btDynamicsWorld.h
===================================================================
--- code/trunk/src/external/bullet/BulletDynamics/Dynamics/btDynamicsWorld.h 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletDynamics/Dynamics/btDynamicsWorld.h 2011-05-03 03:07:42 UTC (rev 8393)
@@ -32,7 +32,8 @@
{
BT_SIMPLE_DYNAMICS_WORLD=1,
BT_DISCRETE_DYNAMICS_WORLD=2,
- BT_CONTINUOUS_DYNAMICS_WORLD=3
+ BT_CONTINUOUS_DYNAMICS_WORLD=3,
+ BT_SOFT_RIGID_DYNAMICS_WORLD=4
};
///The btDynamicsWorld is the interface class for several dynamics implementation, basic, discrete, parallel, and continuous etc.
@@ -86,6 +87,8 @@
virtual void addRigidBody(btRigidBody* body) = 0;
+ virtual void addRigidBody(btRigidBody* body, short group, short mask) = 0;
+
virtual void removeRigidBody(btRigidBody* body) = 0;
virtual void setConstraintSolver(btConstraintSolver* solver) = 0;
Modified: code/trunk/src/external/bullet/BulletDynamics/Dynamics/btRigidBody.cpp
===================================================================
--- code/trunk/src/external/bullet/BulletDynamics/Dynamics/btRigidBody.cpp 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletDynamics/Dynamics/btRigidBody.cpp 2011-05-03 03:07:42 UTC (rev 8393)
@@ -51,8 +51,8 @@
m_gravity_acceleration.setValue(btScalar(0.0), btScalar(0.0), btScalar(0.0));
m_totalForce.setValue(btScalar(0.0), btScalar(0.0), btScalar(0.0));
m_totalTorque.setValue(btScalar(0.0), btScalar(0.0), btScalar(0.0)),
- m_linearDamping = btScalar(0.);
- m_angularDamping = btScalar(0.5);
+ setDamping(constructionInfo.m_linearDamping, constructionInfo.m_angularDamping);
+
m_linearSleepingThreshold = constructionInfo.m_linearSleepingThreshold;
m_angularSleepingThreshold = constructionInfo.m_angularSleepingThreshold;
m_optionalMotionState = constructionInfo.m_motionState;
@@ -84,7 +84,6 @@
m_debugBodyId = uniqueId++;
setMassProps(constructionInfo.m_mass, constructionInfo.m_localInertia);
- setDamping(constructionInfo.m_linearDamping, constructionInfo.m_angularDamping);
updateInertiaTensor();
m_rigidbodyFlags = 0;
Modified: code/trunk/src/external/bullet/BulletDynamics/Dynamics/btRigidBody.h
===================================================================
--- code/trunk/src/external/bullet/BulletDynamics/Dynamics/btRigidBody.h 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletDynamics/Dynamics/btRigidBody.h 2011-05-03 03:07:42 UTC (rev 8393)
@@ -13,8 +13,8 @@
3. This notice may not be removed or altered from any source distribution.
*/
-#ifndef RIGIDBODY_H
-#define RIGIDBODY_H
+#ifndef BT_RIGIDBODY_H
+#define BT_RIGIDBODY_H
#include "LinearMath/btAlignedObjectArray.h"
#include "LinearMath/btTransform.h"
@@ -89,8 +89,8 @@
int m_rigidbodyFlags;
int m_debugBodyId;
+
-
protected:
ATTRIBUTE_ALIGNED64(btVector3 m_deltaLinearVelocity);
@@ -270,12 +270,12 @@
m_totalForce += force*m_linearFactor;
}
- const btVector3& getTotalForce()
+ const btVector3& getTotalForce() const
{
return m_totalForce;
};
- const btVector3& getTotalTorque()
+ const btVector3& getTotalTorque() const
{
return m_totalTorque;
};
@@ -504,7 +504,7 @@
return m_constraintRefs[index];
}
- int getNumConstraintRefs()
+ int getNumConstraintRefs() const
{
return m_constraintRefs.size();
}
@@ -617,6 +617,7 @@
void internalWritebackVelocity(btScalar timeStep);
+
///////////////////////////////////////////////
@@ -686,5 +687,5 @@
-#endif
+#endif //BT_RIGIDBODY_H
Modified: code/trunk/src/external/bullet/BulletDynamics/Dynamics/btSimpleDynamicsWorld.cpp
===================================================================
--- code/trunk/src/external/bullet/BulletDynamics/Dynamics/btSimpleDynamicsWorld.cpp 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletDynamics/Dynamics/btSimpleDynamicsWorld.cpp 2011-05-03 03:07:42 UTC (rev 8393)
@@ -78,7 +78,7 @@
btContactSolverInfo infoGlobal;
infoGlobal.m_timeStep = timeStep;
m_constraintSolver->prepareSolve(0,numManifolds);
- m_constraintSolver->solveGroup(0,0,manifoldPtr, numManifolds,0,0,infoGlobal,m_debugDrawer, m_stackAlloc,m_dispatcher1);
+ m_constraintSolver->solveGroup(&getCollisionObjectArray()[0],getNumCollisionObjects(),manifoldPtr, numManifolds,0,0,infoGlobal,m_debugDrawer, m_stackAlloc,m_dispatcher1);
m_constraintSolver->allSolved(infoGlobal,m_debugDrawer, m_stackAlloc);
}
@@ -155,6 +155,33 @@
}
}
+void btSimpleDynamicsWorld::addRigidBody(btRigidBody* body, short group, short mask)
+{
+ body->setGravity(m_gravity);
+
+ if (body->getCollisionShape())
+ {
+ addCollisionObject(body,group,mask);
+ }
+}
+
+
+void btSimpleDynamicsWorld::debugDrawWorld()
+{
+
+}
+
+void btSimpleDynamicsWorld::addAction(btActionInterface* action)
+{
+
+}
+
+void btSimpleDynamicsWorld::removeAction(btActionInterface* action)
+{
+
+}
+
+
void btSimpleDynamicsWorld::updateAabbs()
{
btTransform predictedTrans;
Modified: code/trunk/src/external/bullet/BulletDynamics/Dynamics/btSimpleDynamicsWorld.h
===================================================================
--- code/trunk/src/external/bullet/BulletDynamics/Dynamics/btSimpleDynamicsWorld.h 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletDynamics/Dynamics/btSimpleDynamicsWorld.h 2011-05-03 03:07:42 UTC (rev 8393)
@@ -56,8 +56,16 @@
virtual void addRigidBody(btRigidBody* body);
+ virtual void addRigidBody(btRigidBody* body, short group, short mask);
+
virtual void removeRigidBody(btRigidBody* body);
+ virtual void debugDrawWorld();
+
+ virtual void addAction(btActionInterface* action);
+
+ virtual void removeAction(btActionInterface* action);
+
///removeCollisionObject will first check if it is a rigid body, if so call removeRigidBody otherwise call btCollisionWorld::removeCollisionObject
virtual void removeCollisionObject(btCollisionObject* collisionObject);
Modified: code/trunk/src/external/bullet/BulletDynamics/Vehicle/btRaycastVehicle.cpp
===================================================================
--- code/trunk/src/external/bullet/BulletDynamics/Vehicle/btRaycastVehicle.cpp 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletDynamics/Vehicle/btRaycastVehicle.cpp 2011-05-03 03:07:42 UTC (rev 8393)
@@ -22,6 +22,9 @@
#include "LinearMath/btIDebugDraw.h"
#include "BulletDynamics/ConstraintSolver/btContactConstraint.h"
+#define ROLLING_INFLUENCE_FIX
+
+
btRigidBody& btActionInterface::getFixedBody()
{
static btRigidBody s_fixed(0, 0,0);
@@ -694,7 +697,12 @@
btVector3 sideImp = m_axle[wheel] * m_sideImpulse[wheel];
+#if defined ROLLING_INFLUENCE_FIX // fix. It only worked if car's up was along Y - VT.
+ btVector3 vChassisWorldUp = getRigidBody()->getCenterOfMassTransform().getBasis().getColumn(m_indexUpAxis);
+ rel_pos -= vChassisWorldUp * (vChassisWorldUp.dot(rel_pos) * (1.f-wheelInfo.m_rollInfluence));
+#else
rel_pos[m_indexUpAxis] *= wheelInfo.m_rollInfluence;
+#endif
m_chassisBody->applyImpulse(sideImp,rel_pos);
//apply friction impulse on the ground
Modified: code/trunk/src/external/bullet/BulletDynamics/Vehicle/btRaycastVehicle.h
===================================================================
--- code/trunk/src/external/bullet/BulletDynamics/Vehicle/btRaycastVehicle.h 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletDynamics/Vehicle/btRaycastVehicle.h 2011-05-03 03:07:42 UTC (rev 8393)
@@ -8,8 +8,8 @@
* of this software for any purpose.
* It is provided "as is" without express or implied warranty.
*/
-#ifndef RAYCASTVEHICLE_H
-#define RAYCASTVEHICLE_H
+#ifndef BT_RAYCASTVEHICLE_H
+#define BT_RAYCASTVEHICLE_H
#include "BulletDynamics/Dynamics/btRigidBody.h"
#include "BulletDynamics/ConstraintSolver/btTypedConstraint.h"
@@ -112,7 +112,7 @@
void updateWheelTransform( int wheelIndex, bool interpolatedTransform = true );
- void setRaycastWheelInfo( int wheelIndex , bool isInContact, const btVector3& hitPoint, const btVector3& hitNormal,btScalar depth);
+// void setRaycastWheelInfo( int wheelIndex , bool isInContact, const btVector3& hitPoint, const btVector3& hitNormal,btScalar depth);
btWheelInfo& addWheel( const btVector3& connectionPointCS0, const btVector3& wheelDirectionCS0,const btVector3& wheelAxleCS,btScalar suspensionRestLength,btScalar wheelRadius,const btVehicleTuning& tuning, bool isFrontWheel);
@@ -232,5 +232,5 @@
};
-#endif //RAYCASTVEHICLE_H
+#endif //BT_RAYCASTVEHICLE_H
Modified: code/trunk/src/external/bullet/BulletDynamics/Vehicle/btVehicleRaycaster.h
===================================================================
--- code/trunk/src/external/bullet/BulletDynamics/Vehicle/btVehicleRaycaster.h 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletDynamics/Vehicle/btVehicleRaycaster.h 2011-05-03 03:07:42 UTC (rev 8393)
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005 Erwin Coumans http://continuousphysics.com/Bullet/
+ * Copyright (c) 2005 Erwin Coumans http://bulletphysics.org
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
@@ -8,8 +8,8 @@
* of this software for any purpose.
* It is provided "as is" without express or implied warranty.
*/
-#ifndef VEHICLE_RAYCASTER_H
-#define VEHICLE_RAYCASTER_H
+#ifndef BT_VEHICLE_RAYCASTER_H
+#define BT_VEHICLE_RAYCASTER_H
#include "LinearMath/btVector3.h"
@@ -31,5 +31,5 @@
};
-#endif //VEHICLE_RAYCASTER_H
+#endif //BT_VEHICLE_RAYCASTER_H
Modified: code/trunk/src/external/bullet/BulletDynamics/Vehicle/btWheelInfo.h
===================================================================
--- code/trunk/src/external/bullet/BulletDynamics/Vehicle/btWheelInfo.h 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/BulletDynamics/Vehicle/btWheelInfo.h 2011-05-03 03:07:42 UTC (rev 8393)
@@ -8,8 +8,8 @@
* of this software for any purpose.
* It is provided "as is" without express or implied warranty.
*/
-#ifndef WHEEL_INFO_H
-#define WHEEL_INFO_H
+#ifndef BT_WHEEL_INFO_H
+#define BT_WHEEL_INFO_H
#include "LinearMath/btVector3.h"
#include "LinearMath/btTransform.h"
@@ -115,5 +115,5 @@
};
-#endif //WHEEL_INFO_H
+#endif //BT_WHEEL_INFO_H
Modified: code/trunk/src/external/bullet/CMakeLists.txt
===================================================================
--- code/trunk/src/external/bullet/CMakeLists.txt 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/CMakeLists.txt 2011-05-03 03:07:42 UTC (rev 8393)
@@ -30,7 +30,7 @@
ORXONOX_EXTERNAL
NO_DLL_INTERFACE
VERSION
- 2.77
+ 2.78
SOURCE_FILES
${BULLET_FILES}
)
Modified: code/trunk/src/external/bullet/ChangeLog
===================================================================
--- code/trunk/src/external/bullet/ChangeLog 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/ChangeLog 2011-05-03 03:07:42 UTC (rev 8393)
@@ -4,11 +4,13 @@
This ChangeLog is incomplete, for an up-to-date list of all fixed issues see http://bullet.googlecode.com
using http://tinyurl.com/yabmjjj
+2011 April 8
+ - Bullet 2.78 release 2383
+ - Added FractureDemo
+ - Added Separatinx Axis Test and Polyhedral Clipping support (See InternalEdgeDemo)
+ - Added speculative contacts as CCD response method (See CcdPhysicsDemo)
+ - OpenCL and DirectCompute cloth as basic support for capsule collision
-2010 September 21
- - Bullet 2.77 release based on revision 2218
- - Added Visual Studio project files for OpenCL and Direct Compute in msvc folder
-
2010 September 7
- autotools now uses CamelCase naming for libraryes just like cmake:
libbulletdynamics -> libBulletDynamics, libbulletmath -> libLinearMath
Modified: code/trunk/src/external/bullet/LinearMath/CMakeLists.txt
===================================================================
--- code/trunk/src/external/bullet/LinearMath/CMakeLists.txt 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/LinearMath/CMakeLists.txt 2011-05-03 03:07:42 UTC (rev 8393)
@@ -3,6 +3,7 @@
COMPILATION_BEGIN BulletLinearMathCompilation.cpp
btAlignedAllocator.cpp
btConvexHull.cpp
+ btConvexHullComputer.cpp
btGeometryUtil.cpp
btQuickprof.cpp
btSerializer.cpp
@@ -13,6 +14,7 @@
btAlignedAllocator.h
btAlignedObjectArray.h
btConvexHull.h
+ btConvexHullComputer.h
btDefaultMotionState.h
btGeometryUtil.h
btHashMap.h
Modified: code/trunk/src/external/bullet/LinearMath/btAabbUtil2.h
===================================================================
--- code/trunk/src/external/bullet/LinearMath/btAabbUtil2.h 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/LinearMath/btAabbUtil2.h 2011-05-03 03:07:42 UTC (rev 8393)
@@ -14,8 +14,8 @@
-#ifndef AABB_UTIL2
-#define AABB_UTIL2
+#ifndef BT_AABB_UTIL2
+#define BT_AABB_UTIL2
#include "btTransform.h"
#include "btVector3.h"
@@ -231,6 +231,6 @@
}
#endif //USE_BANCHLESS
-#endif
+#endif //BT_AABB_UTIL2
Modified: code/trunk/src/external/bullet/LinearMath/btAlignedObjectArray.h
===================================================================
--- code/trunk/src/external/bullet/LinearMath/btAlignedObjectArray.h 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/LinearMath/btAlignedObjectArray.h 2011-05-03 03:07:42 UTC (rev 8393)
@@ -406,7 +406,7 @@
int findBinarySearch(const T& key) const
{
int first = 0;
- int last = size();
+ int last = size()-1;
//assume sorted array
while (first <= last) {
Modified: code/trunk/src/external/bullet/LinearMath/btConvexHull.h
===================================================================
--- code/trunk/src/external/bullet/LinearMath/btConvexHull.h 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/LinearMath/btConvexHull.h 2011-05-03 03:07:42 UTC (rev 8393)
@@ -16,8 +16,8 @@
///includes modifications/improvements by John Ratcliff, see BringOutYourDead below.
-#ifndef CD_HULL_H
-#define CD_HULL_H
+#ifndef BT_CD_HULL_H
+#define BT_CD_HULL_H
#include "btVector3.h"
#include "btAlignedObjectArray.h"
@@ -237,5 +237,5 @@
};
-#endif
+#endif //BT_CD_HULL_H
Added: code/trunk/src/external/bullet/LinearMath/btConvexHullComputer.cpp
===================================================================
--- code/trunk/src/external/bullet/LinearMath/btConvexHullComputer.cpp (rev 0)
+++ code/trunk/src/external/bullet/LinearMath/btConvexHullComputer.cpp 2011-05-03 03:07:42 UTC (rev 8393)
@@ -0,0 +1,2749 @@
+/*
+Copyright (c) 2011 Ole Kniemeyer, MAXON, www.maxon.net
+
+This software is provided 'as-is', without any express or implied warranty.
+In no event will the authors be held liable for any damages arising from the use of this software.
+Permission is granted to anyone to use this software for any purpose,
+including commercial applications, and to alter it and redistribute it freely,
+subject to the following restrictions:
+
+1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
+2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
+3. This notice may not be removed or altered from any source distribution.
+*/
+
+#include <string.h>
+
+#include "btConvexHullComputer.h"
+#include "btAlignedObjectArray.h"
+#include "btMinMax.h"
+#include "btVector3.h"
+
+#ifdef __GNUC__
+ #include <stdint.h>
+#elif defined(_MSC_VER)
+ typedef __int32 int32_t;
+ typedef __int64 int64_t;
+ typedef unsigned __int32 uint32_t;
+ typedef unsigned __int64 uint64_t;
+#else
+ typedef int int32_t;
+ typedef long long int int64_t;
+ typedef unsigned int uint32_t;
+ typedef unsigned long long int uint64_t;
+#endif
+
+
+//The definition of USE_X86_64_ASM is moved into the build system. You can enable it manually by commenting out the following lines
+//#if (defined(__GNUC__) && defined(__x86_64__) && !defined(__ICL)) // || (defined(__ICL) && defined(_M_X64)) bug in Intel compiler, disable inline assembly
+// #define USE_X86_64_ASM
+//#endif
+
+
+//#define DEBUG_CONVEX_HULL
+//#define SHOW_ITERATIONS
+
+#if defined(DEBUG_CONVEX_HULL) || defined(SHOW_ITERATIONS)
+ #include <stdio.h>
+#endif
+
+// Convex hull implementation based on Preparata and Hong
+// Ole Kniemeyer, MAXON Computer GmbH
+class btConvexHullInternal
+{
+ public:
+
+ class Point64
+ {
+ public:
+ int64_t x;
+ int64_t y;
+ int64_t z;
+
+ Point64(int64_t x, int64_t y, int64_t z): x(x), y(y), z(z)
+ {
+ }
+
+ bool isZero()
+ {
+ return (x == 0) && (y == 0) && (z == 0);
+ }
+
+ int64_t dot(const Point64& b) const
+ {
+ return x * b.x + y * b.y + z * b.z;
+ }
+ };
+
+ class Point32
+ {
+ public:
+ int32_t x;
+ int32_t y;
+ int32_t z;
+ int index;
+
+ Point32()
+ {
+ }
+
+ Point32(int32_t x, int32_t y, int32_t z): x(x), y(y), z(z), index(-1)
+ {
+ }
+
+ bool operator==(const Point32& b) const
+ {
+ return (x == b.x) && (y == b.y) && (z == b.z);
+ }
+
+ bool operator!=(const Point32& b) const
+ {
+ return (x != b.x) || (y != b.y) || (z != b.z);
+ }
+
+ bool isZero()
+ {
+ return (x == 0) && (y == 0) && (z == 0);
+ }
+
+ Point64 cross(const Point32& b) const
+ {
+ return Point64(y * b.z - z * b.y, z * b.x - x * b.z, x * b.y - y * b.x);
+ }
+
+ Point64 cross(const Point64& b) const
+ {
+ return Point64(y * b.z - z * b.y, z * b.x - x * b.z, x * b.y - y * b.x);
+ }
+
+ int64_t dot(const Point32& b) const
+ {
+ return x * b.x + y * b.y + z * b.z;
+ }
+
+ int64_t dot(const Point64& b) const
+ {
+ return x * b.x + y * b.y + z * b.z;
+ }
+
+ Point32 operator+(const Point32& b) const
+ {
+ return Point32(x + b.x, y + b.y, z + b.z);
+ }
+
+ Point32 operator-(const Point32& b) const
+ {
+ return Point32(x - b.x, y - b.y, z - b.z);
+ }
+ };
+
+ class Int128
+ {
+ public:
+ uint64_t low;
+ uint64_t high;
+
+ Int128()
+ {
+ }
+
+ Int128(uint64_t low, uint64_t high): low(low), high(high)
+ {
+ }
+
+ Int128(uint64_t low): low(low), high(0)
+ {
+ }
+
+ Int128(int64_t value): low(value), high((value >= 0) ? 0 : (uint64_t) -1LL)
+ {
+ }
+
+ static Int128 mul(int64_t a, int64_t b);
+
+ static Int128 mul(uint64_t a, uint64_t b);
+
+ Int128 operator-() const
+ {
+ return Int128((uint64_t) -(int64_t)low, ~high + (low == 0));
+ }
+
+ Int128 operator+(const Int128& b) const
+ {
+#ifdef USE_X86_64_ASM
+ Int128 result;
+ __asm__ ("addq %[bl], %[rl]\n\t"
+ "adcq %[bh], %[rh]\n\t"
+ : [rl] "=r" (result.low), [rh] "=r" (result.high)
+ : "0"(low), "1"(high), [bl] "g"(b.low), [bh] "g"(b.high)
+ : "cc" );
+ return result;
+#else
+ uint64_t lo = low + b.low;
+ return Int128(lo, high + b.high + (lo < low));
+#endif
+ }
+
+ Int128 operator-(const Int128& b) const
+ {
+#ifdef USE_X86_64_ASM
+ Int128 result;
+ __asm__ ("subq %[bl], %[rl]\n\t"
+ "sbbq %[bh], %[rh]\n\t"
+ : [rl] "=r" (result.low), [rh] "=r" (result.high)
+ : "0"(low), "1"(high), [bl] "g"(b.low), [bh] "g"(b.high)
+ : "cc" );
+ return result;
+#else
+ return *this + -b;
+#endif
+ }
+
+ Int128& operator+=(const Int128& b)
+ {
+#ifdef USE_X86_64_ASM
+ __asm__ ("addq %[bl], %[rl]\n\t"
+ "adcq %[bh], %[rh]\n\t"
+ : [rl] "=r" (low), [rh] "=r" (high)
+ : "0"(low), "1"(high), [bl] "g"(b.low), [bh] "g"(b.high)
+ : "cc" );
+#else
+ uint64_t lo = low + b.low;
+ if (lo < low)
+ {
+ ++high;
+ }
+ low = lo;
+ high += b.high;
+#endif
+ return *this;
+ }
+
+ Int128& operator++()
+ {
+ if (++low == 0)
+ {
+ ++high;
+ }
+ return *this;
+ }
+
+ Int128 operator*(int64_t b) const;
+
+ btScalar toScalar() const
+ {
+ return ((int64_t) high >= 0) ? btScalar(high) * (btScalar(0x100000000LL) * btScalar(0x100000000LL)) + btScalar(low)
+ : -(-*this).toScalar();
+ }
+
+ int getSign() const
+ {
+ return ((int64_t) high < 0) ? -1 : (high || low) ? 1 : 0;
+ }
+
+ bool operator<(const Int128& b) const
+ {
+ return (high < b.high) || ((high == b.high) && (low < b.low));
+ }
+
+ int ucmp(const Int128&b) const
+ {
+ if (high < b.high)
+ {
+ return -1;
+ }
+ if (high > b.high)
+ {
+ return 1;
+ }
+ if (low < b.low)
+ {
+ return -1;
+ }
+ if (low > b.low)
+ {
+ return 1;
+ }
+ return 0;
+ }
+ };
+
+
+ class Rational64
+ {
+ private:
+ uint64_t numerator;
+ uint64_t denominator;
+ int sign;
+
+ public:
+ Rational64(int64_t numerator, int64_t denominator)
+ {
+ if (numerator > 0)
+ {
+ sign = 1;
+ this->numerator = (uint64_t) numerator;
+ }
+ else if (numerator < 0)
+ {
+ sign = -1;
+ this->numerator = (uint64_t) -numerator;
+ }
+ else
+ {
+ sign = 0;
+ this->numerator = 0;
+ }
+ if (denominator > 0)
+ {
+ this->denominator = (uint64_t) denominator;
+ }
+ else if (denominator < 0)
+ {
+ sign = -sign;
+ this->denominator = (uint64_t) -denominator;
+ }
+ else
+ {
+ this->denominator = 0;
+ }
+ }
+
+ bool isNegativeInfinity() const
+ {
+ return (sign < 0) && (denominator == 0);
+ }
+
+ bool isNaN() const
+ {
+ return (sign == 0) && (denominator == 0);
+ }
+
+ int compare(const Rational64& b) const;
+
+ btScalar toScalar() const
+ {
+ return sign * ((denominator == 0) ? SIMD_INFINITY : (btScalar) numerator / denominator);
+ }
+ };
+
+
+ class Rational128
+ {
+ private:
+ Int128 numerator;
+ Int128 denominator;
+ int sign;
+ bool isInt64;
+
+ public:
+ Rational128(int64_t value)
+ {
+ if (value > 0)
+ {
+ sign = 1;
+ this->numerator = value;
+ }
+ else if (value < 0)
+ {
+ sign = -1;
+ this->numerator = -value;
+ }
+ else
+ {
+ sign = 0;
+ this->numerator = (uint64_t) 0;
+ }
+ this->denominator = (uint64_t) 1;
+ isInt64 = true;
+ }
+
+ Rational128(const Int128& numerator, const Int128& denominator)
+ {
+ sign = numerator.getSign();
+ if (sign >= 0)
+ {
+ this->numerator = numerator;
+ }
+ else
+ {
+ this->numerator = -numerator;
+ }
+ int dsign = denominator.getSign();
+ if (dsign >= 0)
+ {
+ this->denominator = denominator;
+ }
+ else
+ {
+ sign = -sign;
+ this->denominator = -denominator;
+ }
+ isInt64 = false;
+ }
+
+ int compare(const Rational128& b) const;
+
+ int compare(int64_t b) const;
+
+ btScalar toScalar() const
+ {
+ return sign * ((denominator.getSign() == 0) ? SIMD_INFINITY : numerator.toScalar() / denominator.toScalar());
+ }
+ };
+
+ class PointR128
+ {
+ public:
+ Int128 x;
+ Int128 y;
+ Int128 z;
+ Int128 denominator;
+
+ PointR128()
+ {
+ }
+
+ PointR128(Int128 x, Int128 y, Int128 z, Int128 denominator): x(x), y(y), z(z), denominator(denominator)
+ {
+ }
+
+ btScalar xvalue() const
+ {
+ return x.toScalar() / denominator.toScalar();
+ }
+
+ btScalar yvalue() const
+ {
+ return y.toScalar() / denominator.toScalar();
+ }
+
+ btScalar zvalue() const
+ {
+ return z.toScalar() / denominator.toScalar();
+ }
+ };
+
+
+ class Edge;
+ class Face;
+
+ class Vertex
+ {
+ public:
+ Vertex* next;
+ Vertex* prev;
+ Edge* edges;
+ Face* firstNearbyFace;
+ Face* lastNearbyFace;
+ PointR128 point128;
+ Point32 point;
+ int copy;
+
+ Vertex(): next(NULL), prev(NULL), edges(NULL), firstNearbyFace(NULL), lastNearbyFace(NULL), copy(-1)
+ {
+ }
+
+#ifdef DEBUG_CONVEX_HULL
+ void print()
+ {
+ printf("V%d (%d, %d, %d)", point.index, point.x, point.y, point.z);
+ }
+
+ void printGraph();
+#endif
+
+ Point32 operator-(const Vertex& b) const
+ {
+ return point - b.point;
+ }
+
+ Rational128 dot(const Point64& b) const
+ {
+ return (point.index >= 0) ? Rational128(point.dot(b))
+ : Rational128(point128.x * b.x + point128.y * b.y + point128.z * b.z, point128.denominator);
+ }
+
+ btScalar xvalue() const
+ {
+ return (point.index >= 0) ? btScalar(point.x) : point128.xvalue();
+ }
+
+ btScalar yvalue() const
+ {
+ return (point.index >= 0) ? btScalar(point.y) : point128.yvalue();
+ }
+
+ btScalar zvalue() const
+ {
+ return (point.index >= 0) ? btScalar(point.z) : point128.zvalue();
+ }
+
+ void receiveNearbyFaces(Vertex* src)
+ {
+ if (lastNearbyFace)
+ {
+ lastNearbyFace->nextWithSameNearbyVertex = src->firstNearbyFace;
+ }
+ else
+ {
+ firstNearbyFace = src->firstNearbyFace;
+ }
+ if (src->lastNearbyFace)
+ {
+ lastNearbyFace = src->lastNearbyFace;
+ }
+ for (Face* f = src->firstNearbyFace; f; f = f->nextWithSameNearbyVertex)
+ {
+ btAssert(f->nearbyVertex == src);
+ f->nearbyVertex = this;
+ }
+ src->firstNearbyFace = NULL;
+ src->lastNearbyFace = NULL;
+ }
+ };
+
+
+ class Edge
+ {
+ public:
+ Edge* next;
+ Edge* prev;
+ Edge* reverse;
+ Vertex* target;
+ Face* face;
+ int copy;
+
+ ~Edge()
+ {
+ next = NULL;
+ prev = NULL;
+ reverse = NULL;
+ target = NULL;
+ face = NULL;
+ }
+
+ void link(Edge* n)
+ {
+ btAssert(reverse->target == n->reverse->target);
+ next = n;
+ n->prev = this;
+ }
+
+#ifdef DEBUG_CONVEX_HULL
+ void print()
+ {
+ printf("E%p : %d -> %d, n=%p p=%p (0 %d\t%d\t%d) -> (%d %d %d)", this, reverse->target->point.index, target->point.index, next, prev,
+ reverse->target->point.x, reverse->target->point.y, reverse->target->point.z, target->point.x, target->point.y, target->point.z);
+ }
+#endif
+ };
+
+ class Face
+ {
+ public:
+ Face* next;
+ Vertex* nearbyVertex;
+ Face* nextWithSameNearbyVertex;
+ Point32 origin;
+ Point32 dir0;
+ Point32 dir1;
+
+ Face(): next(NULL), nearbyVertex(NULL), nextWithSameNearbyVertex(NULL)
+ {
+ }
+
+ void init(Vertex* a, Vertex* b, Vertex* c)
+ {
+ nearbyVertex = a;
+ origin = a->point;
+ dir0 = *b - *a;
+ dir1 = *c - *a;
+ if (a->lastNearbyFace)
+ {
+ a->lastNearbyFace->nextWithSameNearbyVertex = this;
+ }
+ else
+ {
+ a->firstNearbyFace = this;
+ }
+ a->lastNearbyFace = this;
+ }
+
+ Point64 getNormal()
+ {
+ return dir0.cross(dir1);
+ }
+ };
+
+ template<typename UWord, typename UHWord> class DMul
+ {
+ private:
+ static uint32_t high(uint64_t value)
+ {
+ return (uint32_t) (value >> 32);
+ }
+
+ static uint32_t low(uint64_t value)
+ {
+ return (uint32_t) value;
+ }
+
+ static uint64_t mul(uint32_t a, uint32_t b)
+ {
+ return (uint64_t) a * (uint64_t) b;
+ }
+
+ static void shlHalf(uint64_t& value)
+ {
+ value <<= 32;
+ }
+
+ static uint64_t high(Int128 value)
+ {
+ return value.high;
+ }
+
+ static uint64_t low(Int128 value)
+ {
+ return value.low;
+ }
+
+ static Int128 mul(uint64_t a, uint64_t b)
+ {
+ return Int128::mul(a, b);
+ }
+
+ static void shlHalf(Int128& value)
+ {
+ value.high = value.low;
+ value.low = 0;
+ }
+
+ public:
+
+ static void mul(UWord a, UWord b, UWord& resLow, UWord& resHigh)
+ {
+ UWord p00 = mul(low(a), low(b));
+ UWord p01 = mul(low(a), high(b));
+ UWord p10 = mul(high(a), low(b));
+ UWord p11 = mul(high(a), high(b));
+ UWord p0110 = UWord(low(p01)) + UWord(low(p10));
+ p11 += high(p01);
+ p11 += high(p10);
+ p11 += high(p0110);
+ shlHalf(p0110);
+ p00 += p0110;
+ if (p00 < p0110)
+ {
+ ++p11;
+ }
+ resLow = p00;
+ resHigh = p11;
+ }
+ };
+
+ private:
+
+ class IntermediateHull
+ {
+ public:
+ Vertex* minXy;
+ Vertex* maxXy;
+ Vertex* minYx;
+ Vertex* maxYx;
+
+ IntermediateHull(): minXy(NULL), maxXy(NULL), minYx(NULL), maxYx(NULL)
+ {
+ }
+
+ void print();
+ };
+
+ enum Orientation {NONE, CLOCKWISE, COUNTER_CLOCKWISE};
+
+ template <typename T> class PoolArray
+ {
+ private:
+ T* array;
+ int size;
+
+ public:
+ PoolArray<T>* next;
+
+ PoolArray(int size): size(size), next(NULL)
+ {
+ array = (T*) btAlignedAlloc(sizeof(T) * size, 16);
+ }
+
+ ~PoolArray()
+ {
+ btAlignedFree(array);
+ }
+
+ T* init()
+ {
+ T* o = array;
+ for (int i = 0; i < size; i++, o++)
+ {
+ o->next = (i+1 < size) ? o + 1 : NULL;
+ }
+ return array;
+ }
+ };
+
+ template <typename T> class Pool
+ {
+ private:
+ PoolArray<T>* arrays;
+ PoolArray<T>* nextArray;
+ T* freeObjects;
+ int arraySize;
+
+ public:
+ Pool(): arrays(NULL), nextArray(NULL), freeObjects(NULL), arraySize(256)
+ {
+ }
+
+ ~Pool()
+ {
+ while (arrays)
+ {
+ PoolArray<T>* p = arrays;
+ arrays = p->next;
+ p->~PoolArray<T>();
+ btAlignedFree(p);
+ }
+ }
+
+ void reset()
+ {
+ nextArray = arrays;
+ freeObjects = NULL;
+ }
+
+ void setArraySize(int arraySize)
+ {
+ this->arraySize = arraySize;
+ }
+
+ T* newObject()
+ {
+ T* o = freeObjects;
+ if (!o)
+ {
+ PoolArray<T>* p = nextArray;
+ if (p)
+ {
+ nextArray = p->next;
+ }
+ else
+ {
+ p = new(btAlignedAlloc(sizeof(PoolArray<T>), 16)) PoolArray<T>(arraySize);
+ p->next = arrays;
+ arrays = p;
+ }
+ o = p->init();
+ }
+ freeObjects = o->next;
+ return new(o) T();
+ };
+
+ void freeObject(T* object)
+ {
+ object->~T();
+ object->next = freeObjects;
+ freeObjects = object;
+ }
+ };
+
+ btVector3 scaling;
+ btVector3 center;
+ Pool<Vertex> vertexPool;
+ Pool<Edge> edgePool;
+ Pool<Face> facePool;
+ btAlignedObjectArray<Vertex*> originalVertices;
+ int mergeStamp;
+ int minAxis;
+ int medAxis;
+ int maxAxis;
+ int usedEdgePairs;
+ int maxUsedEdgePairs;
+
+ static Orientation getOrientation(const Edge* prev, const Edge* next, const Point32& s, const Point32& t);
+ Edge* findMaxAngle(bool ccw, const Vertex* start, const Point32& s, const Point64& rxs, const Point64& sxrxs, Rational64& minCot);
+ void findEdgeForCoplanarFaces(Vertex* c0, Vertex* c1, Edge*& e0, Edge*& e1, Vertex* stop0, Vertex* stop1);
+
+ Edge* newEdgePair(Vertex* from, Vertex* to);
+
+ void removeEdgePair(Edge* edge)
+ {
+ Edge* n = edge->next;
+ Edge* r = edge->reverse;
+
+ btAssert(edge->target && r->target);
+
+ if (n != edge)
+ {
+ n->prev = edge->prev;
+ edge->prev->next = n;
+ r->target->edges = n;
+ }
+ else
+ {
+ r->target->edges = NULL;
+ }
+
+ n = r->next;
+
+ if (n != r)
+ {
+ n->prev = r->prev;
+ r->prev->next = n;
+ edge->target->edges = n;
+ }
+ else
+ {
+ edge->target->edges = NULL;
+ }
+
+ edgePool.freeObject(edge);
+ edgePool.freeObject(r);
+ usedEdgePairs--;
+ }
+
+ void computeInternal(int start, int end, IntermediateHull& result);
+
+ bool mergeProjection(IntermediateHull& h0, IntermediateHull& h1, Vertex*& c0, Vertex*& c1);
+
+ void merge(IntermediateHull& h0, IntermediateHull& h1);
+
+ btVector3 toBtVector(const Point32& v);
+
+ btVector3 getBtNormal(Face* face);
+
+ bool shiftFace(Face* face, btScalar amount, btAlignedObjectArray<Vertex*> stack);
+
+ public:
+ Vertex* vertexList;
+
+ void compute(const void* coords, bool doubleCoords, int stride, int count);
+
+ btVector3 getCoordinates(const Vertex* v);
+
+ btScalar shrink(btScalar amount, btScalar clampAmount);
+};
+
+
+btConvexHullInternal::Int128 btConvexHullInternal::Int128::operator*(int64_t b) const
+{
+ bool negative = (int64_t) high < 0;
+ Int128 a = negative ? -*this : *this;
+ if (b < 0)
+ {
+ negative = !negative;
+ b = -b;
+ }
+ Int128 result = mul(a.low, (uint64_t) b);
+ result.high += a.high * (uint64_t) b;
+ return negative ? -result : result;
+}
+
+btConvexHullInternal::Int128 btConvexHullInternal::Int128::mul(int64_t a, int64_t b)
+{
+ Int128 result;
+
+#ifdef USE_X86_64_ASM
+ __asm__ ("imulq %[b]"
+ : "=a" (result.low), "=d" (result.high)
+ : "0"(a), [b] "r"(b)
+ : "cc" );
+ return result;
+
+#else
+ bool negative = a < 0;
+ if (negative)
+ {
+ a = -a;
+ }
+ if (b < 0)
+ {
+ negative = !negative;
+ b = -b;
+ }
+ DMul<uint64_t, uint32_t>::mul((uint64_t) a, (uint64_t) b, result.low, result.high);
+ return negative ? -result : result;
+#endif
+}
+
+btConvexHullInternal::Int128 btConvexHullInternal::Int128::mul(uint64_t a, uint64_t b)
+{
+ Int128 result;
+
+#ifdef USE_X86_64_ASM
+ __asm__ ("mulq %[b]"
+ : "=a" (result.low), "=d" (result.high)
+ : "0"(a), [b] "r"(b)
+ : "cc" );
+
+#else
+ DMul<uint64_t, uint32_t>::mul(a, b, result.low, result.high);
+#endif
+
+ return result;
+}
+
+int btConvexHullInternal::Rational64::compare(const Rational64& b) const
+{
+ if (sign != b.sign)
+ {
+ return sign - b.sign;
+ }
+ else if (sign == 0)
+ {
+ return 0;
+ }
+
+ // return (numerator * b.denominator > b.numerator * denominator) ? sign : (numerator * b.denominator < b.numerator * denominator) ? -sign : 0;
+
+#ifdef USE_X86_64_ASM
+
+ int result;
+ int64_t tmp;
+ int64_t dummy;
+ __asm__ ("mulq %[bn]\n\t"
+ "movq %%rax, %[tmp]\n\t"
+ "movq %%rdx, %%rbx\n\t"
+ "movq %[tn], %%rax\n\t"
+ "mulq %[bd]\n\t"
+ "subq %[tmp], %%rax\n\t"
+ "sbbq %%rbx, %%rdx\n\t" // rdx:rax contains 128-bit-difference "numerator*b.denominator - b.numerator*denominator"
+ "setnsb %%bh\n\t" // bh=1 if difference is non-negative, bh=0 otherwise
+ "orq %%rdx, %%rax\n\t"
+ "setnzb %%bl\n\t" // bl=1 if difference if non-zero, bl=0 if it is zero
+ "decb %%bh\n\t" // now bx=0x0000 if difference is zero, 0xff01 if it is negative, 0x0001 if it is positive (i.e., same sign as difference)
+ "shll $16, %%ebx\n\t" // ebx has same sign as difference
+ : "=&b"(result), [tmp] "=&r"(tmp), "=a"(dummy)
+ : "a"(denominator), [bn] "g"(b.numerator), [tn] "g"(numerator), [bd] "g"(b.denominator)
+ : "%rdx", "cc" );
+ return result ? result ^ sign // if sign is +1, only bit 0 of result is inverted, which does not change the sign of result (and cannot result in zero)
+ // if sign is -1, all bits of result are inverted, which changes the sign of result (and again cannot result in zero)
+ : 0;
+
+#else
+
+ return sign * Int128::mul(numerator, b.denominator).ucmp(Int128::mul(denominator, b.numerator));
+
+#endif
+}
+
+int btConvexHullInternal::Rational128::compare(const Rational128& b) const
+{
+ if (sign != b.sign)
+ {
+ return sign - b.sign;
+ }
+ else if (sign == 0)
+ {
+ return 0;
+ }
+ if (isInt64)
+ {
+ return -b.compare(sign * (int64_t) numerator.low);
+ }
+
+ Int128 nbdLow, nbdHigh, dbnLow, dbnHigh;
+ DMul<Int128, uint64_t>::mul(numerator, b.denominator, nbdLow, nbdHigh);
+ DMul<Int128, uint64_t>::mul(denominator, b.numerator, dbnLow, dbnHigh);
+
+ int cmp = nbdHigh.ucmp(dbnHigh);
+ if (cmp)
+ {
+ return cmp * sign;
+ }
+ return nbdLow.ucmp(dbnLow) * sign;
+}
+
+int btConvexHullInternal::Rational128::compare(int64_t b) const
+{
+ if (isInt64)
+ {
+ int64_t a = sign * (int64_t) numerator.low;
+ return (a > b) ? 1 : (a < b) ? -1 : 0;
+ }
+ if (b > 0)
+ {
+ if (sign <= 0)
+ {
+ return -1;
+ }
+ }
+ else if (b < 0)
+ {
+ if (sign >= 0)
+ {
+ return 1;
+ }
+ b = -b;
+ }
+ else
+ {
+ return sign;
+ }
+
+ return numerator.ucmp(denominator * b) * sign;
+}
+
+
+btConvexHullInternal::Edge* btConvexHullInternal::newEdgePair(Vertex* from, Vertex* to)
+{
+ btAssert(from && to);
+ Edge* e = edgePool.newObject();
+ Edge* r = edgePool.newObject();
+ e->reverse = r;
+ r->reverse = e;
+ e->copy = mergeStamp;
+ r->copy = mergeStamp;
+ e->target = to;
+ r->target = from;
+ e->face = NULL;
+ r->face = NULL;
+ usedEdgePairs++;
+ if (usedEdgePairs > maxUsedEdgePairs)
+ {
+ maxUsedEdgePairs = usedEdgePairs;
+ }
+ return e;
+}
+
+bool btConvexHullInternal::mergeProjection(IntermediateHull& h0, IntermediateHull& h1, Vertex*& c0, Vertex*& c1)
+{
+ Vertex* v0 = h0.maxYx;
+ Vertex* v1 = h1.minYx;
+ if ((v0->point.x == v1->point.x) && (v0->point.y == v1->point.y))
+ {
+ btAssert(v0->point.z < v1->point.z);
+ Vertex* v1p = v1->prev;
+ if (v1p == v1)
+ {
+ c0 = v0;
+ if (v1->edges)
+ {
+ btAssert(v1->edges->next == v1->edges);
+ v1 = v1->edges->target;
+ btAssert(v1->edges->next == v1->edges);
+ }
+ c1 = v1;
+ return false;
+ }
+ Vertex* v1n = v1->next;
+ v1p->next = v1n;
+ v1n->prev = v1p;
+ if (v1 == h1.minXy)
+ {
+ if ((v1n->point.x < v1p->point.x) || ((v1n->point.x == v1p->point.x) && (v1n->point.y < v1p->point.y)))
+ {
+ h1.minXy = v1n;
+ }
+ else
+ {
+ h1.minXy = v1p;
+ }
+ }
+ if (v1 == h1.maxXy)
+ {
+ if ((v1n->point.x > v1p->point.x) || ((v1n->point.x == v1p->point.x) && (v1n->point.y > v1p->point.y)))
+ {
+ h1.maxXy = v1n;
+ }
+ else
+ {
+ h1.maxXy = v1p;
+ }
+ }
+ }
+
+ v0 = h0.maxXy;
+ v1 = h1.maxXy;
+ Vertex* v00 = NULL;
+ Vertex* v10 = NULL;
+ int32_t sign = 1;
+
+ for (int side = 0; side <= 1; side++)
+ {
+ int32_t dx = (v1->point.x - v0->point.x) * sign;
+ if (dx > 0)
+ {
+ while (true)
+ {
+ int32_t dy = v1->point.y - v0->point.y;
+
+ Vertex* w0 = side ? v0->next : v0->prev;
+ if (w0 != v0)
+ {
+ int32_t dx0 = (w0->point.x - v0->point.x) * sign;
+ int32_t dy0 = w0->point.y - v0->point.y;
+ if ((dy0 <= 0) && ((dx0 == 0) || ((dx0 < 0) && (dy0 * dx <= dy * dx0))))
+ {
+ v0 = w0;
+ dx = (v1->point.x - v0->point.x) * sign;
+ continue;
+ }
+ }
+
+ Vertex* w1 = side ? v1->next : v1->prev;
+ if (w1 != v1)
+ {
+ int32_t dx1 = (w1->point.x - v1->point.x) * sign;
+ int32_t dy1 = w1->point.y - v1->point.y;
+ int32_t dxn = (w1->point.x - v0->point.x) * sign;
+ if ((dxn > 0) && (dy1 < 0) && ((dx1 == 0) || ((dx1 < 0) && (dy1 * dx < dy * dx1))))
+ {
+ v1 = w1;
+ dx = dxn;
+ continue;
+ }
+ }
+
+ break;
+ }
+ }
+ else if (dx < 0)
+ {
+ while (true)
+ {
+ int32_t dy = v1->point.y - v0->point.y;
+
+ Vertex* w1 = side ? v1->prev : v1->next;
+ if (w1 != v1)
+ {
+ int32_t dx1 = (w1->point.x - v1->point.x) * sign;
+ int32_t dy1 = w1->point.y - v1->point.y;
+ if ((dy1 >= 0) && ((dx1 == 0) || ((dx1 < 0) && (dy1 * dx <= dy * dx1))))
+ {
+ v1 = w1;
+ dx = (v1->point.x - v0->point.x) * sign;
+ continue;
+ }
+ }
+
+ Vertex* w0 = side ? v0->prev : v0->next;
+ if (w0 != v0)
+ {
+ int32_t dx0 = (w0->point.x - v0->point.x) * sign;
+ int32_t dy0 = w0->point.y - v0->point.y;
+ int32_t dxn = (v1->point.x - w0->point.x) * sign;
+ if ((dxn < 0) && (dy0 > 0) && ((dx0 == 0) || ((dx0 < 0) && (dy0 * dx < dy * dx0))))
+ {
+ v0 = w0;
+ dx = dxn;
+ continue;
+ }
+ }
+
+ break;
+ }
+ }
+ else
+ {
+ int32_t x = v0->point.x;
+ int32_t y0 = v0->point.y;
+ Vertex* w0 = v0;
+ Vertex* t;
+ while (((t = side ? w0->next : w0->prev) != v0) && (t->point.x == x) && (t->point.y <= y0))
+ {
+ w0 = t;
+ y0 = t->point.y;
+ }
+ v0 = w0;
+
+ int32_t y1 = v1->point.y;
+ Vertex* w1 = v1;
+ while (((t = side ? w1->prev : w1->next) != v1) && (t->point.x == x) && (t->point.y >= y1))
+ {
+ w1 = t;
+ y1 = t->point.y;
+ }
+ v1 = w1;
+ }
+
+ if (side == 0)
+ {
+ v00 = v0;
+ v10 = v1;
+
+ v0 = h0.minXy;
+ v1 = h1.minXy;
+ sign = -1;
+ }
+ }
+
+ v0->prev = v1;
+ v1->next = v0;
+
+ v00->next = v10;
+ v10->prev = v00;
+
+ if (h1.minXy->point.x < h0.minXy->point.x)
+ {
+ h0.minXy = h1.minXy;
+ }
+ if (h1.maxXy->point.x >= h0.maxXy->point.x)
+ {
+ h0.maxXy = h1.maxXy;
+ }
+
+ h0.maxYx = h1.maxYx;
+
+ c0 = v00;
+ c1 = v10;
+
+ return true;
+}
+
+void btConvexHullInternal::computeInternal(int start, int end, IntermediateHull& result)
+{
+ int n = end - start;
+ switch (n)
+ {
+ case 0:
+ result.minXy = NULL;
+ result.maxXy = NULL;
+ result.minYx = NULL;
+ result.maxYx = NULL;
+ return;
+ case 2:
+ {
+ Vertex* v = originalVertices[start];
+ Vertex* w = v + 1;
+ if (v->point != w->point)
+ {
+ int32_t dx = v->point.x - w->point.x;
+ int32_t dy = v->point.y - w->point.y;
+
+ if ((dx == 0) && (dy == 0))
+ {
+ if (v->point.z > w->point.z)
+ {
+ Vertex* t = w;
+ w = v;
+ v = t;
+ }
+ btAssert(v->point.z < w->point.z);
+ v->next = v;
+ v->prev = v;
+ result.minXy = v;
+ result.maxXy = v;
+ result.minYx = v;
+ result.maxYx = v;
+ }
+ else
+ {
+ v->next = w;
+ v->prev = w;
+ w->next = v;
+ w->prev = v;
+
+ if ((dx < 0) || ((dx == 0) && (dy < 0)))
+ {
+ result.minXy = v;
+ result.maxXy = w;
+ }
+ else
+ {
+ result.minXy = w;
+ result.maxXy = v;
+ }
+
+ if ((dy < 0) || ((dy == 0) && (dx < 0)))
+ {
+ result.minYx = v;
+ result.maxYx = w;
+ }
+ else
+ {
+ result.minYx = w;
+ result.maxYx = v;
+ }
+ }
+
+ Edge* e = newEdgePair(v, w);
+ e->link(e);
+ v->edges = e;
+
+ e = e->reverse;
+ e->link(e);
+ w->edges = e;
+
+ return;
+ }
+ }
+ // lint -fallthrough
+ case 1:
+ {
+ Vertex* v = originalVertices[start];
+ v->edges = NULL;
+ v->next = v;
+ v->prev = v;
+
+ result.minXy = v;
+ result.maxXy = v;
+ result.minYx = v;
+ result.maxYx = v;
+
+ return;
+ }
+ }
+
+ int split0 = start + n / 2;
+ Point32 p = originalVertices[split0-1]->point;
+ int split1 = split0;
+ while ((split1 < end) && (originalVertices[split1]->point == p))
+ {
+ split1++;
+ }
+ computeInternal(start, split0, result);
+ IntermediateHull hull1;
+ computeInternal(split1, end, hull1);
+#ifdef DEBUG_CONVEX_HULL
+ printf("\n\nMerge\n");
+ result.print();
+ hull1.print();
+#endif
+ merge(result, hull1);
+#ifdef DEBUG_CONVEX_HULL
+ printf("\n Result\n");
+ result.print();
+#endif
+}
+
+#ifdef DEBUG_CONVEX_HULL
+void btConvexHullInternal::IntermediateHull::print()
+{
+ printf(" Hull\n");
+ for (Vertex* v = minXy; v; )
+ {
+ printf(" ");
+ v->print();
+ if (v == maxXy)
+ {
+ printf(" maxXy");
+ }
+ if (v == minYx)
+ {
+ printf(" minYx");
+ }
+ if (v == maxYx)
+ {
+ printf(" maxYx");
+ }
+ if (v->next->prev != v)
+ {
+ printf(" Inconsistency");
+ }
+ printf("\n");
+ v = v->next;
+ if (v == minXy)
+ {
+ break;
+ }
+ }
+ if (minXy)
+ {
+ minXy->copy = (minXy->copy == -1) ? -2 : -1;
+ minXy->printGraph();
+ }
+}
+
+void btConvexHullInternal::Vertex::printGraph()
+{
+ print();
+ printf("\nEdges\n");
+ Edge* e = edges;
+ if (e)
+ {
+ do
+ {
+ e->print();
+ printf("\n");
+ e = e->next;
+ } while (e != edges);
+ do
+ {
+ Vertex* v = e->target;
+ if (v->copy != copy)
+ {
+ v->copy = copy;
+ v->printGraph();
+ }
+ e = e->next;
+ } while (e != edges);
+ }
+}
+#endif
+
+btConvexHullInternal::Orientation btConvexHullInternal::getOrientation(const Edge* prev, const Edge* next, const Point32& s, const Point32& t)
+{
+ btAssert(prev->reverse->target == next->reverse->target);
+ if (prev->next == next)
+ {
+ if (prev->prev == next)
+ {
+ Point64 n = t.cross(s);
+ Point64 m = (*prev->target - *next->reverse->target).cross(*next->target - *next->reverse->target);
+ btAssert(!m.isZero());
+ int64_t dot = n.dot(m);
+ btAssert(dot != 0);
+ return (dot > 0) ? COUNTER_CLOCKWISE : CLOCKWISE;
+ }
+ return COUNTER_CLOCKWISE;
+ }
+ else if (prev->prev == next)
+ {
+ return CLOCKWISE;
+ }
+ else
+ {
+ return NONE;
+ }
+}
+
+btConvexHullInternal::Edge* btConvexHullInternal::findMaxAngle(bool ccw, const Vertex* start, const Point32& s, const Point64& rxs, const Point64& sxrxs, Rational64& minCot)
+{
+ Edge* minEdge = NULL;
+
+#ifdef DEBUG_CONVEX_HULL
+ printf("find max edge for %d\n", start->point.index);
+#endif
+ Edge* e = start->edges;
+ if (e)
+ {
+ do
+ {
+ if (e->copy > mergeStamp)
+ {
+ Point32 t = *e->target - *start;
+ Rational64 cot(t.dot(sxrxs), t.dot(rxs));
+#ifdef DEBUG_CONVEX_HULL
+ printf(" Angle is %f (%d) for ", (float) btAtan(cot.toScalar()), (int) cot.isNaN());
+ e->print();
+#endif
+ if (cot.isNaN())
+ {
+ btAssert(ccw ? (t.dot(s) < 0) : (t.dot(s) > 0));
+ }
+ else
+ {
+ int cmp;
+ if (minEdge == NULL)
+ {
+ minCot = cot;
+ minEdge = e;
+ }
+ else if ((cmp = cot.compare(minCot)) < 0)
+ {
+ minCot = cot;
+ minEdge = e;
+ }
+ else if ((cmp == 0) && (ccw == (getOrientation(minEdge, e, s, t) == COUNTER_CLOCKWISE)))
+ {
+ minEdge = e;
+ }
+ }
+#ifdef DEBUG_CONVEX_HULL
+ printf("\n");
+#endif
+ }
+ e = e->next;
+ } while (e != start->edges);
+ }
+ return minEdge;
+}
+
+void btConvexHullInternal::findEdgeForCoplanarFaces(Vertex* c0, Vertex* c1, Edge*& e0, Edge*& e1, Vertex* stop0, Vertex* stop1)
+{
+ Edge* start0 = e0;
+ Edge* start1 = e1;
+ Point32 et0 = start0 ? start0->target->point : c0->point;
+ Point32 et1 = start1 ? start1->target->point : c1->point;
+ Point32 s = c1->point - c0->point;
+ Point64 normal = ((start0 ? start0 : start1)->target->point - c0->point).cross(s);
+ int64_t dist = c0->point.dot(normal);
+ btAssert(!start1 || (start1->target->point.dot(normal) == dist));
+ Point64 perp = s.cross(normal);
+ btAssert(!perp.isZero());
+
+#ifdef DEBUG_CONVEX_HULL
+ printf(" Advancing %d %d (%p %p, %d %d)\n", c0->point.index, c1->point.index, start0, start1, start0 ? start0->target->point.index : -1, start1 ? start1->target->point.index : -1);
+#endif
+
+ int64_t maxDot0 = et0.dot(perp);
+ if (e0)
+ {
+ while (e0->target != stop0)
+ {
+ Edge* e = e0->reverse->prev;
+ if (e->target->point.dot(normal) < dist)
+ {
+ break;
+ }
+ btAssert(e->target->point.dot(normal) == dist);
+ if (e->copy == mergeStamp)
+ {
+ break;
+ }
+ int64_t dot = e->target->point.dot(perp);
+ if (dot <= maxDot0)
+ {
+ break;
+ }
+ maxDot0 = dot;
+ e0 = e;
+ et0 = e->target->point;
+ }
+ }
+
+ int64_t maxDot1 = et1.dot(perp);
+ if (e1)
+ {
+ while (e1->target != stop1)
+ {
+ Edge* e = e1->reverse->next;
+ if (e->target->point.dot(normal) < dist)
+ {
+ break;
+ }
+ btAssert(e->target->point.dot(normal) == dist);
+ if (e->copy == mergeStamp)
+ {
+ break;
+ }
+ int64_t dot = e->target->point.dot(perp);
+ if (dot <= maxDot1)
+ {
+ break;
+ }
+ maxDot1 = dot;
+ e1 = e;
+ et1 = e->target->point;
+ }
+ }
+
+#ifdef DEBUG_CONVEX_HULL
+ printf(" Starting at %d %d\n", et0.index, et1.index);
+#endif
+
+ int64_t dx = maxDot1 - maxDot0;
+ if (dx > 0)
+ {
+ while (true)
+ {
+ int64_t dy = (et1 - et0).dot(s);
+
+ if (e0 && (e0->target != stop0))
+ {
+ Edge* f0 = e0->next->reverse;
+ if (f0->copy > mergeStamp)
+ {
+ int64_t dx0 = (f0->target->point - et0).dot(perp);
+ int64_t dy0 = (f0->target->point - et0).dot(s);
+ if ((dx0 == 0) ? (dy0 < 0) : ((dx0 < 0) && (Rational64(dy0, dx0).compare(Rational64(dy, dx)) >= 0)))
+ {
+ et0 = f0->target->point;
+ dx = (et1 - et0).dot(perp);
+ e0 = (e0 == start0) ? NULL : f0;
+ continue;
+ }
+ }
+ }
+
+ if (e1 && (e1->target != stop1))
+ {
+ Edge* f1 = e1->reverse->next;
+ if (f1->copy > mergeStamp)
+ {
+ Point32 d1 = f1->target->point - et1;
+ if (d1.dot(normal) == 0)
+ {
+ int64_t dx1 = d1.dot(perp);
+ int64_t dy1 = d1.dot(s);
+ int64_t dxn = (f1->target->point - et0).dot(perp);
+ if ((dxn > 0) && ((dx1 == 0) ? (dy1 < 0) : ((dx1 < 0) && (Rational64(dy1, dx1).compare(Rational64(dy, dx)) > 0))))
+ {
+ e1 = f1;
+ et1 = e1->target->point;
+ dx = dxn;
+ continue;
+ }
+ }
+ else
+ {
+ btAssert((e1 == start1) && (d1.dot(normal) < 0));
+ }
+ }
+ }
+
+ break;
+ }
+ }
+ else if (dx < 0)
+ {
+ while (true)
+ {
+ int64_t dy = (et1 - et0).dot(s);
+
+ if (e1 && (e1->target != stop1))
+ {
+ Edge* f1 = e1->prev->reverse;
+ if (f1->copy > mergeStamp)
+ {
+ int64_t dx1 = (f1->target->point - et1).dot(perp);
+ int64_t dy1 = (f1->target->point - et1).dot(s);
+ if ((dx1 == 0) ? (dy1 > 0) : ((dx1 < 0) && (Rational64(dy1, dx1).compare(Rational64(dy, dx)) <= 0)))
+ {
+ et1 = f1->target->point;
+ dx = (et1 - et0).dot(perp);
+ e1 = (e1 == start1) ? NULL : f1;
+ continue;
+ }
+ }
+ }
+
+ if (e0 && (e0->target != stop0))
+ {
+ Edge* f0 = e0->reverse->prev;
+ if (f0->copy > mergeStamp)
+ {
+ Point32 d0 = f0->target->point - et0;
+ if (d0.dot(normal) == 0)
+ {
+ int64_t dx0 = d0.dot(perp);
+ int64_t dy0 = d0.dot(s);
+ int64_t dxn = (et1 - f0->target->point).dot(perp);
+ if ((dxn < 0) && ((dx0 == 0) ? (dy0 > 0) : ((dx0 < 0) && (Rational64(dy0, dx0).compare(Rational64(dy, dx)) < 0))))
+ {
+ e0 = f0;
+ et0 = e0->target->point;
+ dx = dxn;
+ continue;
+ }
+ }
+ else
+ {
+ btAssert((e0 == start0) && (d0.dot(normal) < 0));
+ }
+ }
+ }
+
+ break;
+ }
+ }
+#ifdef DEBUG_CONVEX_HULL
+ printf(" Advanced edges to %d %d\n", et0.index, et1.index);
+#endif
+}
+
+
+void btConvexHullInternal::merge(IntermediateHull& h0, IntermediateHull& h1)
+{
+ if (!h1.maxXy)
+ {
+ return;
+ }
+ if (!h0.maxXy)
+ {
+ h0 = h1;
+ return;
+ }
+
+ mergeStamp--;
+
+ Vertex* c0 = NULL;
+ Edge* toPrev0 = NULL;
+ Edge* firstNew0 = NULL;
+ Edge* pendingHead0 = NULL;
+ Edge* pendingTail0 = NULL;
+ Vertex* c1 = NULL;
+ Edge* toPrev1 = NULL;
+ Edge* firstNew1 = NULL;
+ Edge* pendingHead1 = NULL;
+ Edge* pendingTail1 = NULL;
+ Point32 prevPoint;
+
+ if (mergeProjection(h0, h1, c0, c1))
+ {
+ Point32 s = *c1 - *c0;
+ Point64 normal = Point32(0, 0, -1).cross(s);
+ Point64 t = s.cross(normal);
+ btAssert(!t.isZero());
+
+ Edge* e = c0->edges;
+ Edge* start0 = NULL;
+ if (e)
+ {
+ do
+ {
+ int64_t dot = (*e->target - *c0).dot(normal);
+ btAssert(dot <= 0);
+ if ((dot == 0) && ((*e->target - *c0).dot(t) > 0))
+ {
+ if (!start0 || (getOrientation(start0, e, s, Point32(0, 0, -1)) == CLOCKWISE))
+ {
+ start0 = e;
+ }
+ }
+ e = e->next;
+ } while (e != c0->edges);
+ }
+
+ e = c1->edges;
+ Edge* start1 = NULL;
+ if (e)
+ {
+ do
+ {
+ int64_t dot = (*e->target - *c1).dot(normal);
+ btAssert(dot <= 0);
+ if ((dot == 0) && ((*e->target - *c1).dot(t) > 0))
+ {
+ if (!start1 || (getOrientation(start1, e, s, Point32(0, 0, -1)) == COUNTER_CLOCKWISE))
+ {
+ start1 = e;
+ }
+ }
+ e = e->next;
+ } while (e != c1->edges);
+ }
+
+ if (start0 || start1)
+ {
+ findEdgeForCoplanarFaces(c0, c1, start0, start1, NULL, NULL);
+ if (start0)
+ {
+ c0 = start0->target;
+ }
+ if (start1)
+ {
+ c1 = start1->target;
+ }
+ }
+
+ prevPoint = c1->point;
+ prevPoint.z++;
+ }
+ else
+ {
+ prevPoint = c1->point;
+ prevPoint.x++;
+ }
+
+ Vertex* first0 = c0;
+ Vertex* first1 = c1;
+ bool firstRun = true;
+
+ while (true)
+ {
+ Point32 s = *c1 - *c0;
+ Point32 r = prevPoint - c0->point;
+ Point64 rxs = r.cross(s);
+ Point64 sxrxs = s.cross(rxs);
+
+#ifdef DEBUG_CONVEX_HULL
+ printf("\n Checking %d %d\n", c0->point.index, c1->point.index);
+#endif
+ Rational64 minCot0(0, 0);
+ Edge* min0 = findMaxAngle(false, c0, s, rxs, sxrxs, minCot0);
+ Rational64 minCot1(0, 0);
+ Edge* min1 = findMaxAngle(true, c1, s, rxs, sxrxs, minCot1);
+ if (!min0 && !min1)
+ {
+ Edge* e = newEdgePair(c0, c1);
+ e->link(e);
+ c0->edges = e;
+
+ e = e->reverse;
+ e->link(e);
+ c1->edges = e;
+ return;
+ }
+ else
+ {
+ int cmp = !min0 ? 1 : !min1 ? -1 : minCot0.compare(minCot1);
+#ifdef DEBUG_CONVEX_HULL
+ printf(" -> Result %d\n", cmp);
+#endif
+ if (firstRun || ((cmp >= 0) ? !minCot1.isNegativeInfinity() : !minCot0.isNegativeInfinity()))
+ {
+ Edge* e = newEdgePair(c0, c1);
+ if (pendingTail0)
+ {
+ pendingTail0->prev = e;
+ }
+ else
+ {
+ pendingHead0 = e;
+ }
+ e->next = pendingTail0;
+ pendingTail0 = e;
+
+ e = e->reverse;
+ if (pendingTail1)
+ {
+ pendingTail1->next = e;
+ }
+ else
+ {
+ pendingHead1 = e;
+ }
+ e->prev = pendingTail1;
+ pendingTail1 = e;
+ }
+
+ Edge* e0 = min0;
+ Edge* e1 = min1;
+
+#ifdef DEBUG_CONVEX_HULL
+ printf(" Found min edges to %d %d\n", e0 ? e0->target->point.index : -1, e1 ? e1->target->point.index : -1);
+#endif
+
+ if (cmp == 0)
+ {
+ findEdgeForCoplanarFaces(c0, c1, e0, e1, NULL, NULL);
+ }
+
+ if ((cmp >= 0) && e1)
+ {
+ if (toPrev1)
+ {
+ for (Edge* e = toPrev1->next, *n = NULL; e != min1; e = n)
+ {
+ n = e->next;
+ removeEdgePair(e);
+ }
+ }
+
+ if (pendingTail1)
+ {
+ if (toPrev1)
+ {
+ toPrev1->link(pendingHead1);
+ }
+ else
+ {
+ min1->prev->link(pendingHead1);
+ firstNew1 = pendingHead1;
+ }
+ pendingTail1->link(min1);
+ pendingHead1 = NULL;
+ pendingTail1 = NULL;
+ }
+ else if (!toPrev1)
+ {
+ firstNew1 = min1;
+ }
+
+ prevPoint = c1->point;
+ c1 = e1->target;
+ toPrev1 = e1->reverse;
+ }
+
+ if ((cmp <= 0) && e0)
+ {
+ if (toPrev0)
+ {
+ for (Edge* e = toPrev0->prev, *n = NULL; e != min0; e = n)
+ {
+ n = e->prev;
+ removeEdgePair(e);
+ }
+ }
+
+ if (pendingTail0)
+ {
+ if (toPrev0)
+ {
+ pendingHead0->link(toPrev0);
+ }
+ else
+ {
+ pendingHead0->link(min0->next);
+ firstNew0 = pendingHead0;
+ }
+ min0->link(pendingTail0);
+ pendingHead0 = NULL;
+ pendingTail0 = NULL;
+ }
+ else if (!toPrev0)
+ {
+ firstNew0 = min0;
+ }
+
+ prevPoint = c0->point;
+ c0 = e0->target;
+ toPrev0 = e0->reverse;
+ }
+ }
+
+ if ((c0 == first0) && (c1 == first1))
+ {
+ if (toPrev0 == NULL)
+ {
+ pendingHead0->link(pendingTail0);
+ c0->edges = pendingTail0;
+ }
+ else
+ {
+ for (Edge* e = toPrev0->prev, *n = NULL; e != firstNew0; e = n)
+ {
+ n = e->prev;
+ removeEdgePair(e);
+ }
+ if (pendingTail0)
+ {
+ pendingHead0->link(toPrev0);
+ firstNew0->link(pendingTail0);
+ }
+ }
+
+ if (toPrev1 == NULL)
+ {
+ pendingTail1->link(pendingHead1);
+ c1->edges = pendingTail1;
+ }
+ else
+ {
+ for (Edge* e = toPrev1->next, *n = NULL; e != firstNew1; e = n)
+ {
+ n = e->next;
+ removeEdgePair(e);
+ }
+ if (pendingTail1)
+ {
+ toPrev1->link(pendingHead1);
+ pendingTail1->link(firstNew1);
+ }
+ }
+
+ return;
+ }
+
+ firstRun = false;
+ }
+}
+
+
+static bool pointCmp(const btConvexHullInternal::Point32& p, const btConvexHullInternal::Point32& q)
+{
+ return (p.y < q.y) || ((p.y == q.y) && ((p.x < q.x) || ((p.x == q.x) && (p.z < q.z))));
+}
+
+void btConvexHullInternal::compute(const void* coords, bool doubleCoords, int stride, int count)
+{
+ btVector3 min(btScalar(1e30), btScalar(1e30), btScalar(1e30)), max(btScalar(-1e30), btScalar(-1e30), btScalar(-1e30));
+ const char* ptr = (const char*) coords;
+ if (doubleCoords)
+ {
+ for (int i = 0; i < count; i++)
+ {
+ const double* v = (const double*) ptr;
+ btVector3 p((btScalar) v[0], (btScalar) v[1], (btScalar) v[2]);
+ ptr += stride;
+ min.setMin(p);
+ max.setMax(p);
+ }
+ }
+ else
+ {
+ for (int i = 0; i < count; i++)
+ {
+ const float* v = (const float*) ptr;
+ btVector3 p(v[0], v[1], v[2]);
+ ptr += stride;
+ min.setMin(p);
+ max.setMax(p);
+ }
+ }
+
+ btVector3 s = max - min;
+ maxAxis = s.maxAxis();
+ minAxis = s.minAxis();
+ if (minAxis == maxAxis)
+ {
+ minAxis = (maxAxis + 1) % 3;
+ }
+ medAxis = 3 - maxAxis - minAxis;
+
+ s /= btScalar(10216);
+
+ scaling = s;
+ if (s[0] > 0)
+ {
+ s[0] = btScalar(1) / s[0];
+ }
+ if (s[1] > 0)
+ {
+ s[1] = btScalar(1) / s[1];
+ }
+ if (s[2] > 0)
+ {
+ s[2] = btScalar(1) / s[2];
+ }
+
+ center = (min + max) * btScalar(0.5);
+
+ btAlignedObjectArray<Point32> points;
+ points.resize(count);
+ ptr = (const char*) coords;
+ if (doubleCoords)
+ {
+ for (int i = 0; i < count; i++)
+ {
+ const double* v = (const double*) ptr;
+ btVector3 p((btScalar) v[0], (btScalar) v[1], (btScalar) v[2]);
+ ptr += stride;
+ p = (p - center) * s;
+ points[i].x = (int32_t) p[medAxis];
+ points[i].y = (int32_t) p[maxAxis];
+ points[i].z = (int32_t) p[minAxis];
+ points[i].index = i;
+ }
+ }
+ else
+ {
+ for (int i = 0; i < count; i++)
+ {
+ const float* v = (const float*) ptr;
+ btVector3 p(v[0], v[1], v[2]);
+ ptr += stride;
+ p = (p - center) * s;
+ points[i].x = (int32_t) p[medAxis];
+ points[i].y = (int32_t) p[maxAxis];
+ points[i].z = (int32_t) p[minAxis];
+ points[i].index = i;
+ }
+ }
+ points.quickSort(pointCmp);
+
+ vertexPool.reset();
+ vertexPool.setArraySize(count);
+ originalVertices.resize(count);
+ for (int i = 0; i < count; i++)
+ {
+ Vertex* v = vertexPool.newObject();
+ v->edges = NULL;
+ v->point = points[i];
+ v->copy = -1;
+ originalVertices[i] = v;
+ }
+
+ points.clear();
+
+ edgePool.reset();
+ edgePool.setArraySize(6 * count);
+
+ usedEdgePairs = 0;
+ maxUsedEdgePairs = 0;
+
+ mergeStamp = -3;
+
+ IntermediateHull hull;
+ computeInternal(0, count, hull);
+ vertexList = hull.minXy;
+#ifdef DEBUG_CONVEX_HULL
+ printf("max. edges %d (3v = %d)", maxUsedEdgePairs, 3 * count);
+#endif
+}
+
+btVector3 btConvexHullInternal::toBtVector(const Point32& v)
+{
+ btVector3 p;
+ p[medAxis] = btScalar(v.x);
+ p[maxAxis] = btScalar(v.y);
+ p[minAxis] = btScalar(v.z);
+ return p * scaling;
+}
+
+btVector3 btConvexHullInternal::getBtNormal(Face* face)
+{
+ btVector3 normal = toBtVector(face->dir0).cross(toBtVector(face->dir1));
+ normal /= ((medAxis + 1 == maxAxis) || (medAxis - 2 == maxAxis)) ? normal.length() : -normal.length();
+ return normal;
+}
+
+btVector3 btConvexHullInternal::getCoordinates(const Vertex* v)
+{
+ btVector3 p;
+ p[medAxis] = v->xvalue();
+ p[maxAxis] = v->yvalue();
+ p[minAxis] = v->zvalue();
+ return p * scaling + center;
+}
+
+btScalar btConvexHullInternal::shrink(btScalar amount, btScalar clampAmount)
+{
+ if (!vertexList)
+ {
+ return 0;
+ }
+ int stamp = --mergeStamp;
+ btAlignedObjectArray<Vertex*> stack;
+ vertexList->copy = stamp;
+ stack.push_back(vertexList);
+ btAlignedObjectArray<Face*> faces;
+
+ Point32 ref = vertexList->point;
+ Int128 hullCenterX(0, 0);
+ Int128 hullCenterY(0, 0);
+ Int128 hullCenterZ(0, 0);
+ Int128 volume(0, 0);
+
+ while (stack.size() > 0)
+ {
+ Vertex* v = stack[stack.size() - 1];
+ stack.pop_back();
+ Edge* e = v->edges;
+ if (e)
+ {
+ do
+ {
+ if (e->target->copy != stamp)
+ {
+ e->target->copy = stamp;
+ stack.push_back(e->target);
+ }
+ if (e->copy != stamp)
+ {
+ Face* face = facePool.newObject();
+ face->init(e->target, e->reverse->prev->target, v);
+ faces.push_back(face);
+ Edge* f = e;
+
+ Vertex* a = NULL;
+ Vertex* b = NULL;
+ do
+ {
+ if (a && b)
+ {
+ int64_t vol = (v->point - ref).dot((a->point - ref).cross(b->point - ref));
+ btAssert(vol >= 0);
+ Point32 c = v->point + a->point + b->point + ref;
+ hullCenterX += vol * c.x;
+ hullCenterY += vol * c.y;
+ hullCenterZ += vol * c.z;
+ volume += vol;
+ }
+
+ btAssert(f->copy != stamp);
+ f->copy = stamp;
+ f->face = face;
+
+ a = b;
+ b = f->target;
+
+ f = f->reverse->prev;
+ } while (f != e);
+ }
+ e = e->next;
+ } while (e != v->edges);
+ }
+ }
+
+ if (volume.getSign() <= 0)
+ {
+ return 0;
+ }
+
+ btVector3 hullCenter;
+ hullCenter[medAxis] = hullCenterX.toScalar();
+ hullCenter[maxAxis] = hullCenterY.toScalar();
+ hullCenter[minAxis] = hullCenterZ.toScalar();
+ hullCenter /= 4 * volume.toScalar();
+ hullCenter *= scaling;
+
+ int faceCount = faces.size();
+
+ if (clampAmount > 0)
+ {
+ btScalar minDist = SIMD_INFINITY;
+ for (int i = 0; i < faceCount; i++)
+ {
+ btVector3 normal = getBtNormal(faces[i]);
+ btScalar dist = normal.dot(toBtVector(faces[i]->origin) - hullCenter);
+ if (dist < minDist)
+ {
+ minDist = dist;
+ }
+ }
+
+ if (minDist <= 0)
+ {
+ return 0;
+ }
+
+ amount = btMin(amount, minDist * clampAmount);
+ }
+
+ unsigned int seed = 243703;
+ for (int i = 0; i < faceCount; i++, seed = 1664525 * seed + 1013904223)
+ {
+ btSwap(faces[i], faces[seed % faceCount]);
+ }
+
+ for (int i = 0; i < faceCount; i++)
+ {
+ if (!shiftFace(faces[i], amount, stack))
+ {
+ return -amount;
+ }
+ }
+
+ return amount;
+}
+
+bool btConvexHullInternal::shiftFace(Face* face, btScalar amount, btAlignedObjectArray<Vertex*> stack)
+{
+ btVector3 origShift = getBtNormal(face) * -amount;
+ if (scaling[0] > 0)
+ {
+ origShift[0] /= scaling[0];
+ }
+ if (scaling[1] > 0)
+ {
+ origShift[1] /= scaling[1];
+ }
+ if (scaling[2] > 0)
+ {
+ origShift[2] /= scaling[2];
+ }
+ Point32 shift((int32_t) origShift[medAxis], (int32_t) origShift[maxAxis], (int32_t) origShift[minAxis]);
+ if (shift.isZero())
+ {
+ return true;
+ }
+ Point64 normal = face->getNormal();
+#ifdef DEBUG_CONVEX_HULL
+ printf("\nShrinking face (%d %d %d) (%d %d %d) (%d %d %d) by (%d %d %d)\n",
+ face->origin.x, face->origin.y, face->origin.z, face->dir0.x, face->dir0.y, face->dir0.z, face->dir1.x, face->dir1.y, face->dir1.z, shift.x, shift.y, shift.z);
+#endif
+ int64_t origDot = face->origin.dot(normal);
+ Point32 shiftedOrigin = face->origin + shift;
+ int64_t shiftedDot = shiftedOrigin.dot(normal);
+ btAssert(shiftedDot <= origDot);
+ if (shiftedDot >= origDot)
+ {
+ return false;
+ }
+
+ Edge* intersection = NULL;
+
+ Edge* startEdge = face->nearbyVertex->edges;
+#ifdef DEBUG_CONVEX_HULL
+ printf("Start edge is ");
+ startEdge->print();
+ printf(", normal is (%lld %lld %lld), shifted dot is %lld\n", normal.x, normal.y, normal.z, shiftedDot);
+#endif
+ Rational128 optDot = face->nearbyVertex->dot(normal);
+ int cmp = optDot.compare(shiftedDot);
+#ifdef SHOW_ITERATIONS
+ int n = 0;
+#endif
+ if (cmp >= 0)
+ {
+ Edge* e = startEdge;
+ do
+ {
+#ifdef SHOW_ITERATIONS
+ n++;
+#endif
+ Rational128 dot = e->target->dot(normal);
+ btAssert(dot.compare(origDot) <= 0);
+#ifdef DEBUG_CONVEX_HULL
+ printf("Moving downwards, edge is ");
+ e->print();
+ printf(", dot is %f (%f %lld)\n", (float) dot.toScalar(), (float) optDot.toScalar(), shiftedDot);
+#endif
+ if (dot.compare(optDot) < 0)
+ {
+ int c = dot.compare(shiftedDot);
+ optDot = dot;
+ e = e->reverse;
+ startEdge = e;
+ if (c < 0)
+ {
+ intersection = e;
+ break;
+ }
+ cmp = c;
+ }
+ e = e->prev;
+ } while (e != startEdge);
+
+ if (!intersection)
+ {
+ return false;
+ }
+ }
+ else
+ {
+ Edge* e = startEdge;
+ do
+ {
+#ifdef SHOW_ITERATIONS
+ n++;
+#endif
+ Rational128 dot = e->target->dot(normal);
+ btAssert(dot.compare(origDot) <= 0);
+#ifdef DEBUG_CONVEX_HULL
+ printf("Moving upwards, edge is ");
+ e->print();
+ printf(", dot is %f (%f %lld)\n", (float) dot.toScalar(), (float) optDot.toScalar(), shiftedDot);
+#endif
+ if (dot.compare(optDot) > 0)
+ {
+ cmp = dot.compare(shiftedDot);
+ if (cmp >= 0)
+ {
+ intersection = e;
+ break;
+ }
+ optDot = dot;
+ e = e->reverse;
+ startEdge = e;
+ }
+ e = e->prev;
+ } while (e != startEdge);
+
+ if (!intersection)
+ {
+ return true;
+ }
+ }
+
+#ifdef SHOW_ITERATIONS
+ printf("Needed %d iterations to find initial intersection\n", n);
+#endif
+
+ if (cmp == 0)
+ {
+ Edge* e = intersection->reverse->next;
+#ifdef SHOW_ITERATIONS
+ n = 0;
+#endif
+ while (e->target->dot(normal).compare(shiftedDot) <= 0)
+ {
+#ifdef SHOW_ITERATIONS
+ n++;
+#endif
+ e = e->next;
+ if (e == intersection->reverse)
+ {
+ return true;
+ }
+#ifdef DEBUG_CONVEX_HULL
+ printf("Checking for outwards edge, current edge is ");
+ e->print();
+ printf("\n");
+#endif
+ }
+#ifdef SHOW_ITERATIONS
+ printf("Needed %d iterations to check for complete containment\n", n);
+#endif
+ }
+
+ Edge* firstIntersection = NULL;
+ Edge* faceEdge = NULL;
+ Edge* firstFaceEdge = NULL;
+
+#ifdef SHOW_ITERATIONS
+ int m = 0;
+#endif
+ while (true)
+ {
+#ifdef SHOW_ITERATIONS
+ m++;
+#endif
+#ifdef DEBUG_CONVEX_HULL
+ printf("Intersecting edge is ");
+ intersection->print();
+ printf("\n");
+#endif
+ if (cmp == 0)
+ {
+ Edge* e = intersection->reverse->next;
+ startEdge = e;
+#ifdef SHOW_ITERATIONS
+ n = 0;
+#endif
+ while (true)
+ {
+#ifdef SHOW_ITERATIONS
+ n++;
+#endif
+ if (e->target->dot(normal).compare(shiftedDot) >= 0)
+ {
+ break;
+ }
+ intersection = e->reverse;
+ e = e->next;
+ if (e == startEdge)
+ {
+ return true;
+ }
+ }
+#ifdef SHOW_ITERATIONS
+ printf("Needed %d iterations to advance intersection\n", n);
+#endif
+ }
+
+#ifdef DEBUG_CONVEX_HULL
+ printf("Advanced intersecting edge to ");
+ intersection->print();
+ printf(", cmp = %d\n", cmp);
+#endif
+
+ if (!firstIntersection)
+ {
+ firstIntersection = intersection;
+ }
+ else if (intersection == firstIntersection)
+ {
+ break;
+ }
+
+ int prevCmp = cmp;
+ Edge* prevIntersection = intersection;
+ Edge* prevFaceEdge = faceEdge;
+
+ Edge* e = intersection->reverse;
+#ifdef SHOW_ITERATIONS
+ n = 0;
+#endif
+ while (true)
+ {
+#ifdef SHOW_ITERATIONS
+ n++;
+#endif
+ e = e->reverse->prev;
+ btAssert(e != intersection->reverse);
+ cmp = e->target->dot(normal).compare(shiftedDot);
+#ifdef DEBUG_CONVEX_HULL
+ printf("Testing edge ");
+ e->print();
+ printf(" -> cmp = %d\n", cmp);
+#endif
+ if (cmp >= 0)
+ {
+ intersection = e;
+ break;
+ }
+ }
+#ifdef SHOW_ITERATIONS
+ printf("Needed %d iterations to find other intersection of face\n", n);
+#endif
+
+ if (cmp > 0)
+ {
+ Vertex* removed = intersection->target;
+ e = intersection->reverse;
+ if (e->prev == e)
+ {
+ removed->edges = NULL;
+ }
+ else
+ {
+ removed->edges = e->prev;
+ e->prev->link(e->next);
+ e->link(e);
+ }
+#ifdef DEBUG_CONVEX_HULL
+ printf("1: Removed part contains (%d %d %d)\n", removed->point.x, removed->point.y, removed->point.z);
+#endif
+
+ Point64 n0 = intersection->face->getNormal();
+ Point64 n1 = intersection->reverse->face->getNormal();
+ int64_t m00 = face->dir0.dot(n0);
+ int64_t m01 = face->dir1.dot(n0);
+ int64_t m10 = face->dir0.dot(n1);
+ int64_t m11 = face->dir1.dot(n1);
+ int64_t r0 = (intersection->face->origin - shiftedOrigin).dot(n0);
+ int64_t r1 = (intersection->reverse->face->origin - shiftedOrigin).dot(n1);
+ Int128 det = Int128::mul(m00, m11) - Int128::mul(m01, m10);
+ btAssert(det.getSign() != 0);
+ Vertex* v = vertexPool.newObject();
+ v->point.index = -1;
+ v->copy = -1;
+ v->point128 = PointR128(Int128::mul(face->dir0.x * r0, m11) - Int128::mul(face->dir0.x * r1, m01)
+ + Int128::mul(face->dir1.x * r1, m00) - Int128::mul(face->dir1.x * r0, m10) + det * shiftedOrigin.x,
+ Int128::mul(face->dir0.y * r0, m11) - Int128::mul(face->dir0.y * r1, m01)
+ + Int128::mul(face->dir1.y * r1, m00) - Int128::mul(face->dir1.y * r0, m10) + det * shiftedOrigin.y,
+ Int128::mul(face->dir0.z * r0, m11) - Int128::mul(face->dir0.z * r1, m01)
+ + Int128::mul(face->dir1.z * r1, m00) - Int128::mul(face->dir1.z * r0, m10) + det * shiftedOrigin.z,
+ det);
+ v->point.x = (int32_t) v->point128.xvalue();
+ v->point.y = (int32_t) v->point128.yvalue();
+ v->point.z = (int32_t) v->point128.zvalue();
+ intersection->target = v;
+ v->edges = e;
+
+ stack.push_back(v);
+ stack.push_back(removed);
+ stack.push_back(NULL);
+ }
+
+ if (cmp || prevCmp || (prevIntersection->reverse->next->target != intersection->target))
+ {
+ faceEdge = newEdgePair(prevIntersection->target, intersection->target);
+ if (prevCmp == 0)
+ {
+ faceEdge->link(prevIntersection->reverse->next);
+ }
+ if ((prevCmp == 0) || prevFaceEdge)
+ {
+ prevIntersection->reverse->link(faceEdge);
+ }
+ if (cmp == 0)
+ {
+ intersection->reverse->prev->link(faceEdge->reverse);
+ }
+ faceEdge->reverse->link(intersection->reverse);
+ }
+ else
+ {
+ faceEdge = prevIntersection->reverse->next;
+ }
+
+ if (prevFaceEdge)
+ {
+ if (prevCmp > 0)
+ {
+ faceEdge->link(prevFaceEdge->reverse);
+ }
+ else if (faceEdge != prevFaceEdge->reverse)
+ {
+ stack.push_back(prevFaceEdge->target);
+ while (faceEdge->next != prevFaceEdge->reverse)
+ {
+ Vertex* removed = faceEdge->next->target;
+ removeEdgePair(faceEdge->next);
+ stack.push_back(removed);
+#ifdef DEBUG_CONVEX_HULL
+ printf("2: Removed part contains (%d %d %d)\n", removed->point.x, removed->point.y, removed->point.z);
+#endif
+ }
+ stack.push_back(NULL);
+ }
+ }
+ faceEdge->face = face;
+ faceEdge->reverse->face = intersection->face;
+
+ if (!firstFaceEdge)
+ {
+ firstFaceEdge = faceEdge;
+ }
+ }
+#ifdef SHOW_ITERATIONS
+ printf("Needed %d iterations to process all intersections\n", m);
+#endif
+
+ if (cmp > 0)
+ {
+ firstFaceEdge->reverse->target = faceEdge->target;
+ firstIntersection->reverse->link(firstFaceEdge);
+ firstFaceEdge->link(faceEdge->reverse);
+ }
+ else if (firstFaceEdge != faceEdge->reverse)
+ {
+ stack.push_back(faceEdge->target);
+ while (firstFaceEdge->next != faceEdge->reverse)
+ {
+ Vertex* removed = firstFaceEdge->next->target;
+ removeEdgePair(firstFaceEdge->next);
+ stack.push_back(removed);
+#ifdef DEBUG_CONVEX_HULL
+ printf("3: Removed part contains (%d %d %d)\n", removed->point.x, removed->point.y, removed->point.z);
+#endif
+ }
+ stack.push_back(NULL);
+ }
+
+ btAssert(stack.size() > 0);
+ vertexList = stack[0];
+
+#ifdef DEBUG_CONVEX_HULL
+ printf("Removing part\n");
+#endif
+#ifdef SHOW_ITERATIONS
+ n = 0;
+#endif
+ int pos = 0;
+ while (pos < stack.size())
+ {
+ int end = stack.size();
+ while (pos < end)
+ {
+ Vertex* kept = stack[pos++];
+#ifdef DEBUG_CONVEX_HULL
+ kept->print();
+#endif
+ bool deeper = false;
+ Vertex* removed;
+ while ((removed = stack[pos++]) != NULL)
+ {
+#ifdef SHOW_ITERATIONS
+ n++;
+#endif
+ kept->receiveNearbyFaces(removed);
+ while (removed->edges)
+ {
+ if (!deeper)
+ {
+ deeper = true;
+ stack.push_back(kept);
+ }
+ stack.push_back(removed->edges->target);
+ removeEdgePair(removed->edges);
+ }
+ }
+ if (deeper)
+ {
+ stack.push_back(NULL);
+ }
+ }
+ }
+#ifdef SHOW_ITERATIONS
+ printf("Needed %d iterations to remove part\n", n);
+#endif
+
+ stack.resize(0);
+ face->origin = shiftedOrigin;
+
+ return true;
+}
+
+
+static int getVertexCopy(btConvexHullInternal::Vertex* vertex, btAlignedObjectArray<btConvexHullInternal::Vertex*>& vertices)
+{
+ int index = vertex->copy;
+ if (index < 0)
+ {
+ index = vertices.size();
+ vertex->copy = index;
+ vertices.push_back(vertex);
+#ifdef DEBUG_CONVEX_HULL
+ printf("Vertex %d gets index *%d\n", vertex->point.index, index);
+#endif
+ }
+ return index;
+}
+
+btScalar btConvexHullComputer::compute(const void* coords, bool doubleCoords, int stride, int count, btScalar shrink, btScalar shrinkClamp)
+{
+ if (count <= 0)
+ {
+ vertices.clear();
+ edges.clear();
+ faces.clear();
+ return 0;
+ }
+
+ btConvexHullInternal hull;
+ hull.compute(coords, doubleCoords, stride, count);
+
+ btScalar shift = 0;
+ if ((shrink > 0) && ((shift = hull.shrink(shrink, shrinkClamp)) < 0))
+ {
+ vertices.clear();
+ edges.clear();
+ faces.clear();
+ return shift;
+ }
+
+ vertices.resize(0);
+ edges.resize(0);
+ faces.resize(0);
+
+ btAlignedObjectArray<btConvexHullInternal::Vertex*> oldVertices;
+ getVertexCopy(hull.vertexList, oldVertices);
+ int copied = 0;
+ while (copied < oldVertices.size())
+ {
+ btConvexHullInternal::Vertex* v = oldVertices[copied];
+ vertices.push_back(hull.getCoordinates(v));
+ btConvexHullInternal::Edge* firstEdge = v->edges;
+ if (firstEdge)
+ {
+ int firstCopy = -1;
+ int prevCopy = -1;
+ btConvexHullInternal::Edge* e = firstEdge;
+ do
+ {
+ if (e->copy < 0)
+ {
+ int s = edges.size();
+ edges.push_back(Edge());
+ edges.push_back(Edge());
+ Edge* c = &edges[s];
+ Edge* r = &edges[s + 1];
+ e->copy = s;
+ e->reverse->copy = s + 1;
+ c->reverse = 1;
+ r->reverse = -1;
+ c->targetVertex = getVertexCopy(e->target, oldVertices);
+ r->targetVertex = copied;
+#ifdef DEBUG_CONVEX_HULL
+ printf(" CREATE: Vertex *%d has edge to *%d\n", copied, c->getTargetVertex());
+#endif
+ }
+ if (prevCopy >= 0)
+ {
+ edges[e->copy].next = prevCopy - e->copy;
+ }
+ else
+ {
+ firstCopy = e->copy;
+ }
+ prevCopy = e->copy;
+ e = e->next;
+ } while (e != firstEdge);
+ edges[firstCopy].next = prevCopy - firstCopy;
+ }
+ copied++;
+ }
+
+ for (int i = 0; i < copied; i++)
+ {
+ btConvexHullInternal::Vertex* v = oldVertices[i];
+ btConvexHullInternal::Edge* firstEdge = v->edges;
+ if (firstEdge)
+ {
+ btConvexHullInternal::Edge* e = firstEdge;
+ do
+ {
+ if (e->copy >= 0)
+ {
+#ifdef DEBUG_CONVEX_HULL
+ printf("Vertex *%d has edge to *%d\n", i, edges[e->copy].getTargetVertex());
+#endif
+ faces.push_back(e->copy);
+ btConvexHullInternal::Edge* f = e;
+ do
+ {
+#ifdef DEBUG_CONVEX_HULL
+ printf(" Face *%d\n", edges[f->copy].getTargetVertex());
+#endif
+ f->copy = -1;
+ f = f->reverse->prev;
+ } while (f != e);
+ }
+ e = e->next;
+ } while (e != firstEdge);
+ }
+ }
+
+ return shift;
+}
+
+
+
+
+
Property changes on: code/trunk/src/external/bullet/LinearMath/btConvexHullComputer.cpp
___________________________________________________________________
Added: svn:eol-style
+ native
Added: code/trunk/src/external/bullet/LinearMath/btConvexHullComputer.h
===================================================================
--- code/trunk/src/external/bullet/LinearMath/btConvexHullComputer.h (rev 0)
+++ code/trunk/src/external/bullet/LinearMath/btConvexHullComputer.h 2011-05-03 03:07:42 UTC (rev 8393)
@@ -0,0 +1,103 @@
+/*
+Copyright (c) 2011 Ole Kniemeyer, MAXON, www.maxon.net
+
+This software is provided 'as-is', without any express or implied warranty.
+In no event will the authors be held liable for any damages arising from the use of this software.
+Permission is granted to anyone to use this software for any purpose,
+including commercial applications, and to alter it and redistribute it freely,
+subject to the following restrictions:
+
+1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
+2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
+3. This notice may not be removed or altered from any source distribution.
+*/
+
+#ifndef BT_CONVEX_HULL_COMPUTER_H
+#define BT_CONVEX_HULL_COMPUTER_H
+
+#include "btVector3.h"
+#include "btAlignedObjectArray.h"
+
+/// Convex hull implementation based on Preparata and Hong
+/// See http://code.google.com/p/bullet/issues/detail?id=275
+/// Ole Kniemeyer, MAXON Computer GmbH
+class btConvexHullComputer
+{
+ private:
+ btScalar compute(const void* coords, bool doubleCoords, int stride, int count, btScalar shrink, btScalar shrinkClamp);
+
+ public:
+
+ class Edge
+ {
+ private:
+ int next;
+ int reverse;
+ int targetVertex;
+
+ friend class btConvexHullComputer;
+
+ public:
+ int getSourceVertex() const
+ {
+ return (this + reverse)->targetVertex;
+ }
+
+ int getTargetVertex() const
+ {
+ return targetVertex;
+ }
+
+ const Edge* getNextEdgeOfVertex() const // counter-clockwise list of all edges of a vertex
+ {
+ return this + next;
+ }
+
+ const Edge* getNextEdgeOfFace() const // clockwise list of all edges of a face
+ {
+ return (this + reverse)->getNextEdgeOfVertex();
+ }
+
+ const Edge* getReverseEdge() const
+ {
+ return this + reverse;
+ }
+ };
+
+
+ // Vertices of the output hull
+ btAlignedObjectArray<btVector3> vertices;
+
+ // Edges of the output hull
+ btAlignedObjectArray<Edge> edges;
+
+ // Faces of the convex hull. Each entry is an index into the "edges" array pointing to an edge of the face. Faces are planar n-gons
+ btAlignedObjectArray<int> faces;
+
+ /*
+ Compute convex hull of "count" vertices stored in "coords". "stride" is the difference in bytes
+ between the addresses of consecutive vertices. If "shrink" is positive, the convex hull is shrunken
+ by that amount (each face is moved by "shrink" length units towards the center along its normal).
+ If "shrinkClamp" is positive, "shrink" is clamped to not exceed "shrinkClamp * innerRadius", where "innerRadius"
+ is the minimum distance of a face to the center of the convex hull.
+
+ The returned value is the amount by which the hull has been shrunken. If it is negative, the amount was so large
+ that the resulting convex hull is empty.
+
+ The output convex hull can be found in the member variables "vertices", "edges", "faces".
+ */
+ btScalar compute(const float* coords, int stride, int count, btScalar shrink, btScalar shrinkClamp)
+ {
+ return compute(coords, false, stride, count, shrink, shrinkClamp);
+ }
+
+ // same as above, but double precision
+ btScalar compute(const double* coords, int stride, int count, btScalar shrink, btScalar shrinkClamp)
+ {
+ return compute(coords, true, stride, count, shrink, shrinkClamp);
+ }
+};
+
+
+#endif //BT_CONVEX_HULL_COMPUTER_H
+
Property changes on: code/trunk/src/external/bullet/LinearMath/btConvexHullComputer.h
___________________________________________________________________
Added: svn:eol-style
+ native
Modified: code/trunk/src/external/bullet/LinearMath/btDefaultMotionState.h
===================================================================
--- code/trunk/src/external/bullet/LinearMath/btDefaultMotionState.h 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/LinearMath/btDefaultMotionState.h 2011-05-03 03:07:42 UTC (rev 8393)
@@ -1,5 +1,5 @@
-#ifndef DEFAULT_MOTION_STATE_H
-#define DEFAULT_MOTION_STATE_H
+#ifndef BT_DEFAULT_MOTION_STATE_H
+#define BT_DEFAULT_MOTION_STATE_H
#include "btMotionState.h"
@@ -37,4 +37,4 @@
};
-#endif //DEFAULT_MOTION_STATE_H
+#endif //BT_DEFAULT_MOTION_STATE_H
Modified: code/trunk/src/external/bullet/LinearMath/btHashMap.h
===================================================================
--- code/trunk/src/external/bullet/LinearMath/btHashMap.h 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/LinearMath/btHashMap.h 2011-05-03 03:07:42 UTC (rev 8393)
@@ -1,3 +1,19 @@
+/*
+Bullet Continuous Collision Detection and Physics Library
+Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.org
+
+This software is provided 'as-is', without any express or implied warranty.
+In no event will the authors be held liable for any damages arising from the use of this software.
+Permission is granted to anyone to use this software for any purpose,
+including commercial applications, and to alter it and redistribute it freely,
+subject to the following restrictions:
+
+1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
+2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
+3. This notice may not be removed or altered from any source distribution.
+*/
+
+
#ifndef BT_HASH_MAP_H
#define BT_HASH_MAP_H
Modified: code/trunk/src/external/bullet/LinearMath/btIDebugDraw.h
===================================================================
--- code/trunk/src/external/bullet/LinearMath/btIDebugDraw.h 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/LinearMath/btIDebugDraw.h 2011-05-03 03:07:42 UTC (rev 8393)
@@ -14,8 +14,8 @@
*/
-#ifndef IDEBUG_DRAW__H
-#define IDEBUG_DRAW__H
+#ifndef BT_IDEBUG_DRAW__H
+#define BT_IDEBUG_DRAW__H
#include "btVector3.h"
#include "btTransform.h"
@@ -309,8 +309,109 @@
drawLine(trans * btVector3(bbMax[0], bbMax[1], bbMax[2]), trans * btVector3(bbMin[0], bbMax[1], bbMax[2]), color);
drawLine(trans * btVector3(bbMin[0], bbMax[1], bbMax[2]), trans * btVector3(bbMin[0], bbMin[1], bbMax[2]), color);
}
+
+ virtual void drawCapsule(btScalar radius, btScalar halfHeight, int upAxis, const btTransform& transform, const btVector3& color)
+ {
+ btVector3 capStart(0.f,0.f,0.f);
+ capStart[upAxis] = -halfHeight;
+
+ btVector3 capEnd(0.f,0.f,0.f);
+ capEnd[upAxis] = halfHeight;
+
+ // Draw the ends
+ {
+
+ btTransform childTransform = transform;
+ childTransform.getOrigin() = transform * capStart;
+ drawSphere(radius, childTransform, color);
+ }
+
+ {
+ btTransform childTransform = transform;
+ childTransform.getOrigin() = transform * capEnd;
+ drawSphere(radius, childTransform, color);
+ }
+
+ // Draw some additional lines
+ btVector3 start = transform.getOrigin();
+
+ capStart[(upAxis+1)%3] = radius;
+ capEnd[(upAxis+1)%3] = radius;
+ drawLine(start+transform.getBasis() * capStart,start+transform.getBasis() * capEnd, color);
+ capStart[(upAxis+1)%3] = -radius;
+ capEnd[(upAxis+1)%3] = -radius;
+ drawLine(start+transform.getBasis() * capStart,start+transform.getBasis() * capEnd, color);
+
+ capStart[(upAxis+1)%3] = 0.f;
+ capEnd[(upAxis+1)%3] = 0.f;
+
+ capStart[(upAxis+2)%3] = radius;
+ capEnd[(upAxis+2)%3] = radius;
+ drawLine(start+transform.getBasis() * capStart,start+transform.getBasis() * capEnd, color);
+ capStart[(upAxis+2)%3] = -radius;
+ capEnd[(upAxis+2)%3] = -radius;
+ drawLine(start+transform.getBasis() * capStart,start+transform.getBasis() * capEnd, color);
+ }
+
+ virtual void drawCylinder(btScalar radius, btScalar halfHeight, int upAxis, const btTransform& transform, const btVector3& color)
+ {
+ btVector3 start = transform.getOrigin();
+ btVector3 offsetHeight(0,0,0);
+ offsetHeight[upAxis] = halfHeight;
+ btVector3 offsetRadius(0,0,0);
+ offsetRadius[(upAxis+1)%3] = radius;
+ drawLine(start+transform.getBasis() * (offsetHeight+offsetRadius),start+transform.getBasis() * (-offsetHeight+offsetRadius),color);
+ drawLine(start+transform.getBasis() * (offsetHeight-offsetRadius),start+transform.getBasis() * (-offsetHeight-offsetRadius),color);
+
+ // Drawing top and bottom caps of the cylinder
+ btVector3 yaxis(0,0,0);
+ yaxis[upAxis] = btScalar(1.0);
+ btVector3 xaxis(0,0,0);
+ xaxis[(upAxis+1)%3] = btScalar(1.0);
+ drawArc(start-transform.getBasis()*(offsetHeight),transform.getBasis()*yaxis,transform.getBasis()*xaxis,radius,radius,0,SIMD_2_PI,color,false,btScalar(10.0));
+ drawArc(start+transform.getBasis()*(offsetHeight),transform.getBasis()*yaxis,transform.getBasis()*xaxis,radius,radius,0,SIMD_2_PI,color,false,btScalar(10.0));
+ }
+
+ virtual void drawCone(btScalar radius, btScalar height, int upAxis, const btTransform& transform, const btVector3& color)
+ {
+
+ btVector3 start = transform.getOrigin();
+
+ btVector3 offsetHeight(0,0,0);
+ offsetHeight[upAxis] = height * btScalar(0.5);
+ btVector3 offsetRadius(0,0,0);
+ offsetRadius[(upAxis+1)%3] = radius;
+ btVector3 offset2Radius(0,0,0);
+ offset2Radius[(upAxis+2)%3] = radius;
+
+ drawLine(start+transform.getBasis() * (offsetHeight),start+transform.getBasis() * (-offsetHeight+offsetRadius),color);
+ drawLine(start+transform.getBasis() * (offsetHeight),start+transform.getBasis() * (-offsetHeight-offsetRadius),color);
+ drawLine(start+transform.getBasis() * (offsetHeight),start+transform.getBasis() * (-offsetHeight+offset2Radius),color);
+ drawLine(start+transform.getBasis() * (offsetHeight),start+transform.getBasis() * (-offsetHeight-offset2Radius),color);
+
+ // Drawing the base of the cone
+ btVector3 yaxis(0,0,0);
+ yaxis[upAxis] = btScalar(1.0);
+ btVector3 xaxis(0,0,0);
+ xaxis[(upAxis+1)%3] = btScalar(1.0);
+ drawArc(start-transform.getBasis()*(offsetHeight),transform.getBasis()*yaxis,transform.getBasis()*xaxis,radius,radius,0,SIMD_2_PI,color,false,10.0);
+ }
+
+ virtual void drawPlane(const btVector3& planeNormal, btScalar planeConst, const btTransform& transform, const btVector3& color)
+ {
+ btVector3 planeOrigin = planeNormal * planeConst;
+ btVector3 vec0,vec1;
+ btPlaneSpace1(planeNormal,vec0,vec1);
+ btScalar vecLen = 100.f;
+ btVector3 pt0 = planeOrigin + vec0*vecLen;
+ btVector3 pt1 = planeOrigin - vec0*vecLen;
+ btVector3 pt2 = planeOrigin + vec1*vecLen;
+ btVector3 pt3 = planeOrigin - vec1*vecLen;
+ drawLine(transform*pt0,transform*pt1,color);
+ drawLine(transform*pt2,transform*pt3,color);
+ }
};
-#endif //IDEBUG_DRAW__H
+#endif //BT_IDEBUG_DRAW__H
Modified: code/trunk/src/external/bullet/LinearMath/btList.h
===================================================================
--- code/trunk/src/external/bullet/LinearMath/btList.h 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/LinearMath/btList.h 2011-05-03 03:07:42 UTC (rev 8393)
@@ -14,8 +14,8 @@
-#ifndef GEN_LIST_H
-#define GEN_LIST_H
+#ifndef BT_GEN_LIST_H
+#define BT_GEN_LIST_H
class btGEN_Link {
public:
@@ -67,7 +67,7 @@
btGEN_Link m_tail;
};
-#endif
+#endif //BT_GEN_LIST_H
Modified: code/trunk/src/external/bullet/LinearMath/btMatrix3x3.h
===================================================================
--- code/trunk/src/external/bullet/LinearMath/btMatrix3x3.h 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/LinearMath/btMatrix3x3.h 2011-05-03 03:07:42 UTC (rev 8393)
@@ -110,8 +110,18 @@
* Equivilant to this = this * m */
btMatrix3x3& operator*=(const btMatrix3x3& m);
- /** @brief Set from a carray of btScalars
- * @param m A pointer to the beginning of an array of 9 btScalars */
+ /** @brief Adds by the target matrix on the right
+ * @param m matrix to be applied
+ * Equivilant to this = this + m */
+ btMatrix3x3& operator+=(const btMatrix3x3& m);
+
+ /** @brief Substractss by the target matrix on the right
+ * @param m matrix to be applied
+ * Equivilant to this = this - m */
+ btMatrix3x3& operator-=(const btMatrix3x3& m);
+
+ /** @brief Set from the rotational part of a 4x4 OpenGL matrix
+ * @param m A pointer to the beginning of the array of scalars*/
void setFromOpenGLSubMatrix(const btScalar *m)
{
m_el[0].setValue(m[0],m[4],m[8]);
@@ -208,7 +218,7 @@
return identityMatrix;
}
- /**@brief Fill the values of the matrix into a 9 element array
+ /**@brief Fill the rotational part of an OpenGL matrix and clear the shear/perspective
* @param m The array to be filled */
void getOpenGLSubMatrix(btScalar *m) const
{
@@ -523,6 +533,79 @@
return *this;
}
+SIMD_FORCE_INLINE btMatrix3x3&
+btMatrix3x3::operator+=(const btMatrix3x3& m)
+{
+ setValue(
+ m_el[0][0]+m.m_el[0][0],
+ m_el[0][1]+m.m_el[0][1],
+ m_el[0][2]+m.m_el[0][2],
+ m_el[1][0]+m.m_el[1][0],
+ m_el[1][1]+m.m_el[1][1],
+ m_el[1][2]+m.m_el[1][2],
+ m_el[2][0]+m.m_el[2][0],
+ m_el[2][1]+m.m_el[2][1],
+ m_el[2][2]+m.m_el[2][2]);
+ return *this;
+}
+
+SIMD_FORCE_INLINE btMatrix3x3
+operator*(const btMatrix3x3& m, const btScalar & k)
+{
+ return btMatrix3x3(
+ m[0].x()*k,m[0].y()*k,m[0].z()*k,
+ m[1].x()*k,m[1].y()*k,m[1].z()*k,
+ m[2].x()*k,m[2].y()*k,m[2].z()*k);
+}
+
+ SIMD_FORCE_INLINE btMatrix3x3
+operator+(const btMatrix3x3& m1, const btMatrix3x3& m2)
+{
+ return btMatrix3x3(
+ m1[0][0]+m2[0][0],
+ m1[0][1]+m2[0][1],
+ m1[0][2]+m2[0][2],
+ m1[1][0]+m2[1][0],
+ m1[1][1]+m2[1][1],
+ m1[1][2]+m2[1][2],
+ m1[2][0]+m2[2][0],
+ m1[2][1]+m2[2][1],
+ m1[2][2]+m2[2][2]);
+}
+
+SIMD_FORCE_INLINE btMatrix3x3
+operator-(const btMatrix3x3& m1, const btMatrix3x3& m2)
+{
+ return btMatrix3x3(
+ m1[0][0]-m2[0][0],
+ m1[0][1]-m2[0][1],
+ m1[0][2]-m2[0][2],
+ m1[1][0]-m2[1][0],
+ m1[1][1]-m2[1][1],
+ m1[1][2]-m2[1][2],
+ m1[2][0]-m2[2][0],
+ m1[2][1]-m2[2][1],
+ m1[2][2]-m2[2][2]);
+}
+
+
+SIMD_FORCE_INLINE btMatrix3x3&
+btMatrix3x3::operator-=(const btMatrix3x3& m)
+{
+ setValue(
+ m_el[0][0]-m.m_el[0][0],
+ m_el[0][1]-m.m_el[0][1],
+ m_el[0][2]-m.m_el[0][2],
+ m_el[1][0]-m.m_el[1][0],
+ m_el[1][1]-m.m_el[1][1],
+ m_el[1][2]-m.m_el[1][2],
+ m_el[2][0]-m.m_el[2][0],
+ m_el[2][1]-m.m_el[2][1],
+ m_el[2][2]-m.m_el[2][2]);
+ return *this;
+}
+
+
SIMD_FORCE_INLINE btScalar
btMatrix3x3::determinant() const
{
Modified: code/trunk/src/external/bullet/LinearMath/btMinMax.h
===================================================================
--- code/trunk/src/external/bullet/LinearMath/btMinMax.h 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/LinearMath/btMinMax.h 2011-05-03 03:07:42 UTC (rev 8393)
@@ -14,8 +14,8 @@
-#ifndef GEN_MINMAX_H
-#define GEN_MINMAX_H
+#ifndef BT_GEN_MINMAX_H
+#define BT_GEN_MINMAX_H
#include "LinearMath/btScalar.h"
@@ -68,4 +68,4 @@
}
}
-#endif
+#endif //BT_GEN_MINMAX_H
Modified: code/trunk/src/external/bullet/LinearMath/btPoolAllocator.h
===================================================================
--- code/trunk/src/external/bullet/LinearMath/btPoolAllocator.h 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/LinearMath/btPoolAllocator.h 2011-05-03 03:07:42 UTC (rev 8393)
@@ -62,6 +62,11 @@
return m_maxElements - m_freeCount;
}
+ int getMaxCount() const
+ {
+ return m_maxElements;
+ }
+
void* allocate(int size)
{
// release mode fix
Modified: code/trunk/src/external/bullet/LinearMath/btQuadWord.h
===================================================================
--- code/trunk/src/external/bullet/LinearMath/btQuadWord.h 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/LinearMath/btQuadWord.h 2011-05-03 03:07:42 UTC (rev 8393)
@@ -13,8 +13,8 @@
*/
-#ifndef SIMD_QUADWORD_H
-#define SIMD_QUADWORD_H
+#ifndef BT_SIMD_QUADWORD_H
+#define BT_SIMD_QUADWORD_H
#include "btScalar.h"
#include "btMinMax.h"
@@ -177,4 +177,4 @@
};
-#endif //SIMD_QUADWORD_H
+#endif //BT_SIMD_QUADWORD_H
Modified: code/trunk/src/external/bullet/LinearMath/btQuaternion.h
===================================================================
--- code/trunk/src/external/bullet/LinearMath/btQuaternion.h 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/LinearMath/btQuaternion.h 2011-05-03 03:07:42 UTC (rev 8393)
@@ -14,8 +14,8 @@
-#ifndef SIMD__QUATERNION_H_
-#define SIMD__QUATERNION_H_
+#ifndef BT_SIMD__QUATERNION_H_
+#define BT_SIMD__QUATERNION_H_
#include "btVector3.h"
@@ -426,7 +426,7 @@
return shortestArcQuat(v0,v1);
}
-#endif
+#endif //BT_SIMD__QUATERNION_H_
Modified: code/trunk/src/external/bullet/LinearMath/btQuickprof.h
===================================================================
--- code/trunk/src/external/bullet/LinearMath/btQuickprof.h 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/LinearMath/btQuickprof.h 2011-05-03 03:07:42 UTC (rev 8393)
@@ -12,8 +12,8 @@
-#ifndef QUICK_PROF_H
-#define QUICK_PROF_H
+#ifndef BT_QUICK_PROF_H
+#define BT_QUICK_PROF_H
//To disable built-in profiling, please comment out next line
//#define BT_NO_PROFILE 1
@@ -191,6 +191,6 @@
-#endif //QUICK_PROF_H
+#endif //BT_QUICK_PROF_H
Modified: code/trunk/src/external/bullet/LinearMath/btRandom.h
===================================================================
--- code/trunk/src/external/bullet/LinearMath/btRandom.h 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/LinearMath/btRandom.h 2011-05-03 03:07:42 UTC (rev 8393)
@@ -14,8 +14,8 @@
-#ifndef GEN_RANDOM_H
-#define GEN_RANDOM_H
+#ifndef BT_GEN_RANDOM_H
+#define BT_GEN_RANDOM_H
#ifdef MT19937
@@ -38,5 +38,5 @@
#endif
-#endif
+#endif //BT_GEN_RANDOM_H
Modified: code/trunk/src/external/bullet/LinearMath/btScalar.h
===================================================================
--- code/trunk/src/external/bullet/LinearMath/btScalar.h 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/LinearMath/btScalar.h 2011-05-03 03:07:42 UTC (rev 8393)
@@ -14,8 +14,8 @@
-#ifndef SIMD___SCALAR_H
-#define SIMD___SCALAR_H
+#ifndef BT_SCALAR_H
+#define BT_SCALAR_H
#ifdef BT_MANAGED_CODE
//Aligned data types not supported in managed code
@@ -25,12 +25,10 @@
#include <math.h>
#include <stdlib.h>//size_t for MSVC 6.0
-#include <cstdlib>
-#include <cfloat>
#include <float.h>
/* SVN $Revision$ on $Date$ from http://bullet.googlecode.com*/
-#define BT_BULLET_VERSION 277
+#define BT_BULLET_VERSION 278
inline int btGetVersion()
{
@@ -286,11 +284,7 @@
SIMD_FORCE_INLINE btScalar btAtan2(btScalar x, btScalar y) { return atan2f(x, y); }
SIMD_FORCE_INLINE btScalar btExp(btScalar x) { return expf(x); }
SIMD_FORCE_INLINE btScalar btLog(btScalar x) { return logf(x); }
- #if defined( __MINGW32__ )
- SIMD_FORCE_INLINE btScalar btPow(btScalar x,btScalar y) { return pow(x,y); }
- #else
- SIMD_FORCE_INLINE btScalar btPow(btScalar x,btScalar y) { return powf(x,y); }
- #endif
+SIMD_FORCE_INLINE btScalar btPow(btScalar x,btScalar y) { return powf(x,y); }
SIMD_FORCE_INLINE btScalar btFmod(btScalar x,btScalar y) { return fmodf(x,y); }
#endif
@@ -525,4 +519,4 @@
return m_objectType;
}
};
-#endif //SIMD___SCALAR_H
+#endif //BT_SCALAR_H
Modified: code/trunk/src/external/bullet/LinearMath/btSerializer.cpp
===================================================================
--- code/trunk/src/external/bullet/LinearMath/btSerializer.cpp 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/LinearMath/btSerializer.cpp 2011-05-03 03:07:42 UTC (rev 8393)
@@ -1,5 +1,5 @@
-unsigned char sBulletDNAstr64[]= {
-83,68,78,65,78,65,77,69,-79,0,0,0,109,95,115,105,122,101,0,109,
+unsigned char sBulletDNAstr[]= {
+83,68,78,65,78,65,77,69,42,1,0,0,109,95,115,105,122,101,0,109,
95,99,97,112,97,99,105,116,121,0,42,109,95,100,97,116,97,0,109,95,
99,111,108,108,105,115,105,111,110,83,104,97,112,101,115,0,109,95,99,111,
108,108,105,115,105,111,110,79,98,106,101,99,116,115,0,109,95,99,111,110,
@@ -40,255 +40,382 @@
115,105,116,105,111,110,65,114,114,97,121,80,116,114,0,109,95,108,111,99,
97,108,80,111,115,105,116,105,111,110,65,114,114,97,121,83,105,122,101,0,
109,95,118,97,108,117,101,0,109,95,112,97,100,91,50,93,0,109,95,118,
-97,108,117,101,115,91,51,93,0,42,109,95,118,101,114,116,105,99,101,115,
-51,102,0,42,109,95,118,101,114,116,105,99,101,115,51,100,0,42,109,95,
-105,110,100,105,99,101,115,51,50,0,42,109,95,51,105,110,100,105,99,101,
-115,49,54,0,42,109,95,105,110,100,105,99,101,115,49,54,0,109,95,110,
-117,109,84,114,105,97,110,103,108,101,115,0,109,95,110,117,109,86,101,114,
-116,105,99,101,115,0,42,109,95,109,101,115,104,80,97,114,116,115,80,116,
-114,0,109,95,115,99,97,108,105,110,103,0,109,95,110,117,109,77,101,115,
-104,80,97,114,116,115,0,109,95,109,101,115,104,73,110,116,101,114,102,97,
-99,101,0,42,109,95,113,117,97,110,116,105,122,101,100,70,108,111,97,116,
-66,118,104,0,42,109,95,113,117,97,110,116,105,122,101,100,68,111,117,98,
-108,101,66,118,104,0,42,109,95,116,114,105,97,110,103,108,101,73,110,102,
-111,77,97,112,0,109,95,112,97,100,51,91,52,93,0,109,95,116,114,97,
-110,115,102,111,114,109,0,42,109,95,99,104,105,108,100,83,104,97,112,101,
-0,109,95,99,104,105,108,100,83,104,97,112,101,84,121,112,101,0,109,95,
-99,104,105,108,100,77,97,114,103,105,110,0,42,109,95,99,104,105,108,100,
-83,104,97,112,101,80,116,114,0,109,95,110,117,109,67,104,105,108,100,83,
-104,97,112,101,115,0,109,95,117,112,65,120,105,115,0,109,95,102,108,97,
-103,115,0,109,95,101,100,103,101,86,48,86,49,65,110,103,108,101,0,109,
-95,101,100,103,101,86,49,86,50,65,110,103,108,101,0,109,95,101,100,103,
-101,86,50,86,48,65,110,103,108,101,0,42,109,95,104,97,115,104,84,97,
-98,108,101,80,116,114,0,42,109,95,110,101,120,116,80,116,114,0,42,109,
-95,118,97,108,117,101,65,114,114,97,121,80,116,114,0,42,109,95,107,101,
-121,65,114,114,97,121,80,116,114,0,109,95,99,111,110,118,101,120,69,112,
-115,105,108,111,110,0,109,95,112,108,97,110,97,114,69,112,115,105,108,111,
-110,0,109,95,101,113,117,97,108,86,101,114,116,101,120,84,104,114,101,115,
-104,111,108,100,0,109,95,101,100,103,101,68,105,115,116,97,110,99,101,84,
-104,114,101,115,104,111,108,100,0,109,95,122,101,114,111,65,114,101,97,84,
-104,114,101,115,104,111,108,100,0,109,95,110,101,120,116,83,105,122,101,0,
-109,95,104,97,115,104,84,97,98,108,101,83,105,122,101,0,109,95,110,117,
-109,86,97,108,117,101,115,0,109,95,110,117,109,75,101,121,115,0,109,95,
-103,105,109,112,97,99,116,83,117,98,84,121,112,101,0,42,109,95,117,110,
-115,99,97,108,101,100,80,111,105,110,116,115,70,108,111,97,116,80,116,114,
-0,42,109,95,117,110,115,99,97,108,101,100,80,111,105,110,116,115,68,111,
-117,98,108,101,80,116,114,0,109,95,110,117,109,85,110,115,99,97,108,101,
-100,80,111,105,110,116,115,0,109,95,112,97,100,100,105,110,103,51,91,52,
-93,0,42,109,95,98,114,111,97,100,112,104,97,115,101,72,97,110,100,108,
-101,0,42,109,95,99,111,108,108,105,115,105,111,110,83,104,97,112,101,0,
-42,109,95,114,111,111,116,67,111,108,108,105,115,105,111,110,83,104,97,112,
-101,0,109,95,119,111,114,108,100,84,114,97,110,115,102,111,114,109,0,109,
-95,105,110,116,101,114,112,111,108,97,116,105,111,110,87,111,114,108,100,84,
-114,97,110,115,102,111,114,109,0,109,95,105,110,116,101,114,112,111,108,97,
-116,105,111,110,76,105,110,101,97,114,86,101,108,111,99,105,116,121,0,109,
-95,105,110,116,101,114,112,111,108,97,116,105,111,110,65,110,103,117,108,97,
-114,86,101,108,111,99,105,116,121,0,109,95,97,110,105,115,111,116,114,111,
-112,105,99,70,114,105,99,116,105,111,110,0,109,95,99,111,110,116,97,99,
-116,80,114,111,99,101,115,115,105,110,103,84,104,114,101,115,104,111,108,100,
-0,109,95,100,101,97,99,116,105,118,97,116,105,111,110,84,105,109,101,0,
-109,95,102,114,105,99,116,105,111,110,0,109,95,114,101,115,116,105,116,117,
-116,105,111,110,0,109,95,104,105,116,70,114,97,99,116,105,111,110,0,109,
-95,99,99,100,83,119,101,112,116,83,112,104,101,114,101,82,97,100,105,117,
-115,0,109,95,99,99,100,77,111,116,105,111,110,84,104,114,101,115,104,111,
-108,100,0,109,95,104,97,115,65,110,105,115,111,116,114,111,112,105,99,70,
-114,105,99,116,105,111,110,0,109,95,99,111,108,108,105,115,105,111,110,70,
-108,97,103,115,0,109,95,105,115,108,97,110,100,84,97,103,49,0,109,95,
-99,111,109,112,97,110,105,111,110,73,100,0,109,95,97,99,116,105,118,97,
-116,105,111,110,83,116,97,116,101,49,0,109,95,105,110,116,101,114,110,97,
-108,84,121,112,101,0,109,95,99,104,101,99,107,67,111,108,108,105,100,101,
-87,105,116,104,0,109,95,99,111,108,108,105,115,105,111,110,79,98,106,101,
-99,116,68,97,116,97,0,109,95,105,110,118,73,110,101,114,116,105,97,84,
-101,110,115,111,114,87,111,114,108,100,0,109,95,108,105,110,101,97,114,86,
-101,108,111,99,105,116,121,0,109,95,97,110,103,117,108,97,114,86,101,108,
-111,99,105,116,121,0,109,95,97,110,103,117,108,97,114,70,97,99,116,111,
-114,0,109,95,108,105,110,101,97,114,70,97,99,116,111,114,0,109,95,103,
-114,97,118,105,116,121,0,109,95,103,114,97,118,105,116,121,95,97,99,99,
-101,108,101,114,97,116,105,111,110,0,109,95,105,110,118,73,110,101,114,116,
-105,97,76,111,99,97,108,0,109,95,116,111,116,97,108,70,111,114,99,101,
-0,109,95,116,111,116,97,108,84,111,114,113,117,101,0,109,95,105,110,118,
-101,114,115,101,77,97,115,115,0,109,95,108,105,110,101,97,114,68,97,109,
-112,105,110,103,0,109,95,97,110,103,117,108,97,114,68,97,109,112,105,110,
-103,0,109,95,97,100,100,105,116,105,111,110,97,108,68,97,109,112,105,110,
-103,70,97,99,116,111,114,0,109,95,97,100,100,105,116,105,111,110,97,108,
-76,105,110,101,97,114,68,97,109,112,105,110,103,84,104,114,101,115,104,111,
-108,100,83,113,114,0,109,95,97,100,100,105,116,105,111,110,97,108,65,110,
-103,117,108,97,114,68,97,109,112,105,110,103,84,104,114,101,115,104,111,108,
-100,83,113,114,0,109,95,97,100,100,105,116,105,111,110,97,108,65,110,103,
-117,108,97,114,68,97,109,112,105,110,103,70,97,99,116,111,114,0,109,95,
-108,105,110,101,97,114,83,108,101,101,112,105,110,103,84,104,114,101,115,104,
-111,108,100,0,109,95,97,110,103,117,108,97,114,83,108,101,101,112,105,110,
-103,84,104,114,101,115,104,111,108,100,0,109,95,97,100,100,105,116,105,111,
-110,97,108,68,97,109,112,105,110,103,0,109,95,110,117,109,67,111,110,115,
-116,114,97,105,110,116,82,111,119,115,0,110,117,98,0,42,109,95,114,98,
-65,0,42,109,95,114,98,66,0,109,95,111,98,106,101,99,116,84,121,112,
-101,0,109,95,117,115,101,114,67,111,110,115,116,114,97,105,110,116,84,121,
-112,101,0,109,95,117,115,101,114,67,111,110,115,116,114,97,105,110,116,73,
-100,0,109,95,110,101,101,100,115,70,101,101,100,98,97,99,107,0,109,95,
-97,112,112,108,105,101,100,73,109,112,117,108,115,101,0,109,95,100,98,103,
-68,114,97,119,83,105,122,101,0,109,95,100,105,115,97,98,108,101,67,111,
-108,108,105,115,105,111,110,115,66,101,116,119,101,101,110,76,105,110,107,101,
-100,66,111,100,105,101,115,0,109,95,112,97,100,52,91,52,93,0,109,95,
-116,121,112,101,67,111,110,115,116,114,97,105,110,116,68,97,116,97,0,109,
-95,112,105,118,111,116,73,110,65,0,109,95,112,105,118,111,116,73,110,66,
-0,109,95,114,98,65,70,114,97,109,101,0,109,95,114,98,66,70,114,97,
-109,101,0,109,95,117,115,101,82,101,102,101,114,101,110,99,101,70,114,97,
-109,101,65,0,109,95,97,110,103,117,108,97,114,79,110,108,121,0,109,95,
-101,110,97,98,108,101,65,110,103,117,108,97,114,77,111,116,111,114,0,109,
-95,109,111,116,111,114,84,97,114,103,101,116,86,101,108,111,99,105,116,121,
-0,109,95,109,97,120,77,111,116,111,114,73,109,112,117,108,115,101,0,109,
-95,108,111,119,101,114,76,105,109,105,116,0,109,95,117,112,112,101,114,76,
-105,109,105,116,0,109,95,108,105,109,105,116,83,111,102,116,110,101,115,115,
-0,109,95,98,105,97,115,70,97,99,116,111,114,0,109,95,114,101,108,97,
-120,97,116,105,111,110,70,97,99,116,111,114,0,109,95,115,119,105,110,103,
-83,112,97,110,49,0,109,95,115,119,105,110,103,83,112,97,110,50,0,109,
-95,116,119,105,115,116,83,112,97,110,0,109,95,100,97,109,112,105,110,103,
-0,109,95,108,105,110,101,97,114,85,112,112,101,114,76,105,109,105,116,0,
-109,95,108,105,110,101,97,114,76,111,119,101,114,76,105,109,105,116,0,109,
-95,97,110,103,117,108,97,114,85,112,112,101,114,76,105,109,105,116,0,109,
-95,97,110,103,117,108,97,114,76,111,119,101,114,76,105,109,105,116,0,109,
-95,117,115,101,76,105,110,101,97,114,82,101,102,101,114,101,110,99,101,70,
-114,97,109,101,65,0,109,95,117,115,101,79,102,102,115,101,116,70,111,114,
-67,111,110,115,116,114,97,105,110,116,70,114,97,109,101,0,84,89,80,69,
-58,0,0,0,99,104,97,114,0,117,99,104,97,114,0,115,104,111,114,116,
-0,117,115,104,111,114,116,0,105,110,116,0,108,111,110,103,0,117,108,111,
-110,103,0,102,108,111,97,116,0,100,111,117,98,108,101,0,118,111,105,100,
-0,80,111,105,110,116,101,114,65,114,114,97,121,0,98,116,80,104,121,115,
-105,99,115,83,121,115,116,101,109,0,76,105,115,116,66,97,115,101,0,98,
-116,86,101,99,116,111,114,51,70,108,111,97,116,68,97,116,97,0,98,116,
-86,101,99,116,111,114,51,68,111,117,98,108,101,68,97,116,97,0,98,116,
-77,97,116,114,105,120,51,120,51,70,108,111,97,116,68,97,116,97,0,98,
-116,77,97,116,114,105,120,51,120,51,68,111,117,98,108,101,68,97,116,97,
-0,98,116,84,114,97,110,115,102,111,114,109,70,108,111,97,116,68,97,116,
-97,0,98,116,84,114,97,110,115,102,111,114,109,68,111,117,98,108,101,68,
-97,116,97,0,98,116,66,118,104,83,117,98,116,114,101,101,73,110,102,111,
+97,108,117,101,115,91,51,93,0,109,95,112,97,100,0,42,109,95,118,101,
+114,116,105,99,101,115,51,102,0,42,109,95,118,101,114,116,105,99,101,115,
+51,100,0,42,109,95,105,110,100,105,99,101,115,51,50,0,42,109,95,51,
+105,110,100,105,99,101,115,49,54,0,42,109,95,51,105,110,100,105,99,101,
+115,56,0,42,109,95,105,110,100,105,99,101,115,49,54,0,109,95,110,117,
+109,84,114,105,97,110,103,108,101,115,0,109,95,110,117,109,86,101,114,116,
+105,99,101,115,0,42,109,95,109,101,115,104,80,97,114,116,115,80,116,114,
+0,109,95,115,99,97,108,105,110,103,0,109,95,110,117,109,77,101,115,104,
+80,97,114,116,115,0,109,95,109,101,115,104,73,110,116,101,114,102,97,99,
+101,0,42,109,95,113,117,97,110,116,105,122,101,100,70,108,111,97,116,66,
+118,104,0,42,109,95,113,117,97,110,116,105,122,101,100,68,111,117,98,108,
+101,66,118,104,0,42,109,95,116,114,105,97,110,103,108,101,73,110,102,111,
+77,97,112,0,109,95,112,97,100,51,91,52,93,0,109,95,116,114,105,109,
+101,115,104,83,104,97,112,101,68,97,116,97,0,109,95,116,114,97,110,115,
+102,111,114,109,0,42,109,95,99,104,105,108,100,83,104,97,112,101,0,109,
+95,99,104,105,108,100,83,104,97,112,101,84,121,112,101,0,109,95,99,104,
+105,108,100,77,97,114,103,105,110,0,42,109,95,99,104,105,108,100,83,104,
+97,112,101,80,116,114,0,109,95,110,117,109,67,104,105,108,100,83,104,97,
+112,101,115,0,109,95,117,112,65,120,105,115,0,109,95,102,108,97,103,115,
+0,109,95,101,100,103,101,86,48,86,49,65,110,103,108,101,0,109,95,101,
+100,103,101,86,49,86,50,65,110,103,108,101,0,109,95,101,100,103,101,86,
+50,86,48,65,110,103,108,101,0,42,109,95,104,97,115,104,84,97,98,108,
+101,80,116,114,0,42,109,95,110,101,120,116,80,116,114,0,42,109,95,118,
+97,108,117,101,65,114,114,97,121,80,116,114,0,42,109,95,107,101,121,65,
+114,114,97,121,80,116,114,0,109,95,99,111,110,118,101,120,69,112,115,105,
+108,111,110,0,109,95,112,108,97,110,97,114,69,112,115,105,108,111,110,0,
+109,95,101,113,117,97,108,86,101,114,116,101,120,84,104,114,101,115,104,111,
+108,100,0,109,95,101,100,103,101,68,105,115,116,97,110,99,101,84,104,114,
+101,115,104,111,108,100,0,109,95,122,101,114,111,65,114,101,97,84,104,114,
+101,115,104,111,108,100,0,109,95,110,101,120,116,83,105,122,101,0,109,95,
+104,97,115,104,84,97,98,108,101,83,105,122,101,0,109,95,110,117,109,86,
+97,108,117,101,115,0,109,95,110,117,109,75,101,121,115,0,109,95,103,105,
+109,112,97,99,116,83,117,98,84,121,112,101,0,42,109,95,117,110,115,99,
+97,108,101,100,80,111,105,110,116,115,70,108,111,97,116,80,116,114,0,42,
+109,95,117,110,115,99,97,108,101,100,80,111,105,110,116,115,68,111,117,98,
+108,101,80,116,114,0,109,95,110,117,109,85,110,115,99,97,108,101,100,80,
+111,105,110,116,115,0,109,95,112,97,100,100,105,110,103,51,91,52,93,0,
+42,109,95,98,114,111,97,100,112,104,97,115,101,72,97,110,100,108,101,0,
+42,109,95,99,111,108,108,105,115,105,111,110,83,104,97,112,101,0,42,109,
+95,114,111,111,116,67,111,108,108,105,115,105,111,110,83,104,97,112,101,0,
+109,95,119,111,114,108,100,84,114,97,110,115,102,111,114,109,0,109,95,105,
+110,116,101,114,112,111,108,97,116,105,111,110,87,111,114,108,100,84,114,97,
+110,115,102,111,114,109,0,109,95,105,110,116,101,114,112,111,108,97,116,105,
+111,110,76,105,110,101,97,114,86,101,108,111,99,105,116,121,0,109,95,105,
+110,116,101,114,112,111,108,97,116,105,111,110,65,110,103,117,108,97,114,86,
+101,108,111,99,105,116,121,0,109,95,97,110,105,115,111,116,114,111,112,105,
+99,70,114,105,99,116,105,111,110,0,109,95,99,111,110,116,97,99,116,80,
+114,111,99,101,115,115,105,110,103,84,104,114,101,115,104,111,108,100,0,109,
+95,100,101,97,99,116,105,118,97,116,105,111,110,84,105,109,101,0,109,95,
+102,114,105,99,116,105,111,110,0,109,95,114,101,115,116,105,116,117,116,105,
+111,110,0,109,95,104,105,116,70,114,97,99,116,105,111,110,0,109,95,99,
+99,100,83,119,101,112,116,83,112,104,101,114,101,82,97,100,105,117,115,0,
+109,95,99,99,100,77,111,116,105,111,110,84,104,114,101,115,104,111,108,100,
+0,109,95,104,97,115,65,110,105,115,111,116,114,111,112,105,99,70,114,105,
+99,116,105,111,110,0,109,95,99,111,108,108,105,115,105,111,110,70,108,97,
+103,115,0,109,95,105,115,108,97,110,100,84,97,103,49,0,109,95,99,111,
+109,112,97,110,105,111,110,73,100,0,109,95,97,99,116,105,118,97,116,105,
+111,110,83,116,97,116,101,49,0,109,95,105,110,116,101,114,110,97,108,84,
+121,112,101,0,109,95,99,104,101,99,107,67,111,108,108,105,100,101,87,105,
+116,104,0,109,95,99,111,108,108,105,115,105,111,110,79,98,106,101,99,116,
+68,97,116,97,0,109,95,105,110,118,73,110,101,114,116,105,97,84,101,110,
+115,111,114,87,111,114,108,100,0,109,95,108,105,110,101,97,114,86,101,108,
+111,99,105,116,121,0,109,95,97,110,103,117,108,97,114,86,101,108,111,99,
+105,116,121,0,109,95,97,110,103,117,108,97,114,70,97,99,116,111,114,0,
+109,95,108,105,110,101,97,114,70,97,99,116,111,114,0,109,95,103,114,97,
+118,105,116,121,0,109,95,103,114,97,118,105,116,121,95,97,99,99,101,108,
+101,114,97,116,105,111,110,0,109,95,105,110,118,73,110,101,114,116,105,97,
+76,111,99,97,108,0,109,95,116,111,116,97,108,70,111,114,99,101,0,109,
+95,116,111,116,97,108,84,111,114,113,117,101,0,109,95,105,110,118,101,114,
+115,101,77,97,115,115,0,109,95,108,105,110,101,97,114,68,97,109,112,105,
+110,103,0,109,95,97,110,103,117,108,97,114,68,97,109,112,105,110,103,0,
+109,95,97,100,100,105,116,105,111,110,97,108,68,97,109,112,105,110,103,70,
+97,99,116,111,114,0,109,95,97,100,100,105,116,105,111,110,97,108,76,105,
+110,101,97,114,68,97,109,112,105,110,103,84,104,114,101,115,104,111,108,100,
+83,113,114,0,109,95,97,100,100,105,116,105,111,110,97,108,65,110,103,117,
+108,97,114,68,97,109,112,105,110,103,84,104,114,101,115,104,111,108,100,83,
+113,114,0,109,95,97,100,100,105,116,105,111,110,97,108,65,110,103,117,108,
+97,114,68,97,109,112,105,110,103,70,97,99,116,111,114,0,109,95,108,105,
+110,101,97,114,83,108,101,101,112,105,110,103,84,104,114,101,115,104,111,108,
+100,0,109,95,97,110,103,117,108,97,114,83,108,101,101,112,105,110,103,84,
+104,114,101,115,104,111,108,100,0,109,95,97,100,100,105,116,105,111,110,97,
+108,68,97,109,112,105,110,103,0,109,95,110,117,109,67,111,110,115,116,114,
+97,105,110,116,82,111,119,115,0,110,117,98,0,42,109,95,114,98,65,0,
+42,109,95,114,98,66,0,109,95,111,98,106,101,99,116,84,121,112,101,0,
+109,95,117,115,101,114,67,111,110,115,116,114,97,105,110,116,84,121,112,101,
+0,109,95,117,115,101,114,67,111,110,115,116,114,97,105,110,116,73,100,0,
+109,95,110,101,101,100,115,70,101,101,100,98,97,99,107,0,109,95,97,112,
+112,108,105,101,100,73,109,112,117,108,115,101,0,109,95,100,98,103,68,114,
+97,119,83,105,122,101,0,109,95,100,105,115,97,98,108,101,67,111,108,108,
+105,115,105,111,110,115,66,101,116,119,101,101,110,76,105,110,107,101,100,66,
+111,100,105,101,115,0,109,95,112,97,100,52,91,52,93,0,109,95,116,121,
+112,101,67,111,110,115,116,114,97,105,110,116,68,97,116,97,0,109,95,112,
+105,118,111,116,73,110,65,0,109,95,112,105,118,111,116,73,110,66,0,109,
+95,114,98,65,70,114,97,109,101,0,109,95,114,98,66,70,114,97,109,101,
+0,109,95,117,115,101,82,101,102,101,114,101,110,99,101,70,114,97,109,101,
+65,0,109,95,97,110,103,117,108,97,114,79,110,108,121,0,109,95,101,110,
+97,98,108,101,65,110,103,117,108,97,114,77,111,116,111,114,0,109,95,109,
+111,116,111,114,84,97,114,103,101,116,86,101,108,111,99,105,116,121,0,109,
+95,109,97,120,77,111,116,111,114,73,109,112,117,108,115,101,0,109,95,108,
+111,119,101,114,76,105,109,105,116,0,109,95,117,112,112,101,114,76,105,109,
+105,116,0,109,95,108,105,109,105,116,83,111,102,116,110,101,115,115,0,109,
+95,98,105,97,115,70,97,99,116,111,114,0,109,95,114,101,108,97,120,97,
+116,105,111,110,70,97,99,116,111,114,0,109,95,115,119,105,110,103,83,112,
+97,110,49,0,109,95,115,119,105,110,103,83,112,97,110,50,0,109,95,116,
+119,105,115,116,83,112,97,110,0,109,95,100,97,109,112,105,110,103,0,109,
+95,108,105,110,101,97,114,85,112,112,101,114,76,105,109,105,116,0,109,95,
+108,105,110,101,97,114,76,111,119,101,114,76,105,109,105,116,0,109,95,97,
+110,103,117,108,97,114,85,112,112,101,114,76,105,109,105,116,0,109,95,97,
+110,103,117,108,97,114,76,111,119,101,114,76,105,109,105,116,0,109,95,117,
+115,101,76,105,110,101,97,114,82,101,102,101,114,101,110,99,101,70,114,97,
+109,101,65,0,109,95,117,115,101,79,102,102,115,101,116,70,111,114,67,111,
+110,115,116,114,97,105,110,116,70,114,97,109,101,0,109,95,54,100,111,102,
+68,97,116,97,0,109,95,115,112,114,105,110,103,69,110,97,98,108,101,100,
+91,54,93,0,109,95,101,113,117,105,108,105,98,114,105,117,109,80,111,105,
+110,116,91,54,93,0,109,95,115,112,114,105,110,103,83,116,105,102,102,110,
+101,115,115,91,54,93,0,109,95,115,112,114,105,110,103,68,97,109,112,105,
+110,103,91,54,93,0,109,95,108,105,110,101,97,114,83,116,105,102,102,110,
+101,115,115,0,109,95,97,110,103,117,108,97,114,83,116,105,102,102,110,101,
+115,115,0,109,95,118,111,108,117,109,101,83,116,105,102,102,110,101,115,115,
+0,42,109,95,109,97,116,101,114,105,97,108,0,109,95,112,111,115,105,116,
+105,111,110,0,109,95,112,114,101,118,105,111,117,115,80,111,115,105,116,105,
+111,110,0,109,95,118,101,108,111,99,105,116,121,0,109,95,97,99,99,117,
+109,117,108,97,116,101,100,70,111,114,99,101,0,109,95,110,111,114,109,97,
+108,0,109,95,97,114,101,97,0,109,95,97,116,116,97,99,104,0,109,95,
+110,111,100,101,73,110,100,105,99,101,115,91,50,93,0,109,95,114,101,115,
+116,76,101,110,103,116,104,0,109,95,98,98,101,110,100,105,110,103,0,109,
+95,110,111,100,101,73,110,100,105,99,101,115,91,51,93,0,109,95,114,101,
+115,116,65,114,101,97,0,109,95,99,48,91,52,93,0,109,95,110,111,100,
+101,73,110,100,105,99,101,115,91,52,93,0,109,95,114,101,115,116,86,111,
+108,117,109,101,0,109,95,99,49,0,109,95,99,50,0,109,95,99,48,0,
+109,95,108,111,99,97,108,70,114,97,109,101,0,42,109,95,114,105,103,105,
+100,66,111,100,121,0,109,95,110,111,100,101,73,110,100,101,120,0,109,95,
+97,101,114,111,77,111,100,101,108,0,109,95,98,97,117,109,103,97,114,116,
+101,0,109,95,100,114,97,103,0,109,95,108,105,102,116,0,109,95,112,114,
+101,115,115,117,114,101,0,109,95,118,111,108,117,109,101,0,109,95,100,121,
+110,97,109,105,99,70,114,105,99,116,105,111,110,0,109,95,112,111,115,101,
+77,97,116,99,104,0,109,95,114,105,103,105,100,67,111,110,116,97,99,116,
+72,97,114,100,110,101,115,115,0,109,95,107,105,110,101,116,105,99,67,111,
+110,116,97,99,116,72,97,114,100,110,101,115,115,0,109,95,115,111,102,116,
+67,111,110,116,97,99,116,72,97,114,100,110,101,115,115,0,109,95,97,110,
+99,104,111,114,72,97,114,100,110,101,115,115,0,109,95,115,111,102,116,82,
+105,103,105,100,67,108,117,115,116,101,114,72,97,114,100,110,101,115,115,0,
+109,95,115,111,102,116,75,105,110,101,116,105,99,67,108,117,115,116,101,114,
+72,97,114,100,110,101,115,115,0,109,95,115,111,102,116,83,111,102,116,67,
+108,117,115,116,101,114,72,97,114,100,110,101,115,115,0,109,95,115,111,102,
+116,82,105,103,105,100,67,108,117,115,116,101,114,73,109,112,117,108,115,101,
+83,112,108,105,116,0,109,95,115,111,102,116,75,105,110,101,116,105,99,67,
+108,117,115,116,101,114,73,109,112,117,108,115,101,83,112,108,105,116,0,109,
+95,115,111,102,116,83,111,102,116,67,108,117,115,116,101,114,73,109,112,117,
+108,115,101,83,112,108,105,116,0,109,95,109,97,120,86,111,108,117,109,101,
+0,109,95,116,105,109,101,83,99,97,108,101,0,109,95,118,101,108,111,99,
+105,116,121,73,116,101,114,97,116,105,111,110,115,0,109,95,112,111,115,105,
+116,105,111,110,73,116,101,114,97,116,105,111,110,115,0,109,95,100,114,105,
+102,116,73,116,101,114,97,116,105,111,110,115,0,109,95,99,108,117,115,116,
+101,114,73,116,101,114,97,116,105,111,110,115,0,109,95,114,111,116,0,109,
+95,115,99,97,108,101,0,109,95,97,113,113,0,109,95,99,111,109,0,42,
+109,95,112,111,115,105,116,105,111,110,115,0,42,109,95,119,101,105,103,104,
+116,115,0,109,95,110,117,109,80,111,115,105,116,105,111,110,115,0,109,95,
+110,117,109,87,101,105,103,116,115,0,109,95,98,118,111,108,117,109,101,0,
+109,95,98,102,114,97,109,101,0,109,95,102,114,97,109,101,120,102,111,114,
+109,0,109,95,108,111,99,105,105,0,109,95,105,110,118,119,105,0,109,95,
+118,105,109,112,117,108,115,101,115,91,50,93,0,109,95,100,105,109,112,117,
+108,115,101,115,91,50,93,0,109,95,108,118,0,109,95,97,118,0,42,109,
+95,102,114,97,109,101,114,101,102,115,0,42,109,95,110,111,100,101,73,110,
+100,105,99,101,115,0,42,109,95,109,97,115,115,101,115,0,109,95,110,117,
+109,70,114,97,109,101,82,101,102,115,0,109,95,110,117,109,78,111,100,101,
+115,0,109,95,110,117,109,77,97,115,115,101,115,0,109,95,105,100,109,97,
+115,115,0,109,95,105,109,97,115,115,0,109,95,110,118,105,109,112,117,108,
+115,101,115,0,109,95,110,100,105,109,112,117,108,115,101,115,0,109,95,110,
+100,97,109,112,105,110,103,0,109,95,108,100,97,109,112,105,110,103,0,109,
+95,97,100,97,109,112,105,110,103,0,109,95,109,97,116,99,104,105,110,103,
+0,109,95,109,97,120,83,101,108,102,67,111,108,108,105,115,105,111,110,73,
+109,112,117,108,115,101,0,109,95,115,101,108,102,67,111,108,108,105,115,105,
+111,110,73,109,112,117,108,115,101,70,97,99,116,111,114,0,109,95,99,111,
+110,116,97,105,110,115,65,110,99,104,111,114,0,109,95,99,111,108,108,105,
+100,101,0,109,95,99,108,117,115,116,101,114,73,110,100,101,120,0,42,109,
+95,98,111,100,121,65,0,42,109,95,98,111,100,121,66,0,109,95,114,101,
+102,115,91,50,93,0,109,95,99,102,109,0,109,95,101,114,112,0,109,95,
+115,112,108,105,116,0,109,95,100,101,108,101,116,101,0,109,95,114,101,108,
+80,111,115,105,116,105,111,110,91,50,93,0,109,95,98,111,100,121,65,116,
+121,112,101,0,109,95,98,111,100,121,66,116,121,112,101,0,109,95,106,111,
+105,110,116,84,121,112,101,0,42,109,95,112,111,115,101,0,42,42,109,95,
+109,97,116,101,114,105,97,108,115,0,42,109,95,110,111,100,101,115,0,42,
+109,95,108,105,110,107,115,0,42,109,95,102,97,99,101,115,0,42,109,95,
+116,101,116,114,97,104,101,100,114,97,0,42,109,95,97,110,99,104,111,114,
+115,0,42,109,95,99,108,117,115,116,101,114,115,0,42,109,95,106,111,105,
+110,116,115,0,109,95,110,117,109,77,97,116,101,114,105,97,108,115,0,109,
+95,110,117,109,76,105,110,107,115,0,109,95,110,117,109,70,97,99,101,115,
+0,109,95,110,117,109,84,101,116,114,97,104,101,100,114,97,0,109,95,110,
+117,109,65,110,99,104,111,114,115,0,109,95,110,117,109,67,108,117,115,116,
+101,114,115,0,109,95,110,117,109,74,111,105,110,116,115,0,109,95,99,111,
+110,102,105,103,0,0,0,0,84,89,80,69,72,0,0,0,99,104,97,114,
+0,117,99,104,97,114,0,115,104,111,114,116,0,117,115,104,111,114,116,0,
+105,110,116,0,108,111,110,103,0,117,108,111,110,103,0,102,108,111,97,116,
+0,100,111,117,98,108,101,0,118,111,105,100,0,80,111,105,110,116,101,114,
+65,114,114,97,121,0,98,116,80,104,121,115,105,99,115,83,121,115,116,101,
+109,0,76,105,115,116,66,97,115,101,0,98,116,86,101,99,116,111,114,51,
+70,108,111,97,116,68,97,116,97,0,98,116,86,101,99,116,111,114,51,68,
+111,117,98,108,101,68,97,116,97,0,98,116,77,97,116,114,105,120,51,120,
+51,70,108,111,97,116,68,97,116,97,0,98,116,77,97,116,114,105,120,51,
+120,51,68,111,117,98,108,101,68,97,116,97,0,98,116,84,114,97,110,115,
+102,111,114,109,70,108,111,97,116,68,97,116,97,0,98,116,84,114,97,110,
+115,102,111,114,109,68,111,117,98,108,101,68,97,116,97,0,98,116,66,118,
+104,83,117,98,116,114,101,101,73,110,102,111,68,97,116,97,0,98,116,79,
+112,116,105,109,105,122,101,100,66,118,104,78,111,100,101,70,108,111,97,116,
68,97,116,97,0,98,116,79,112,116,105,109,105,122,101,100,66,118,104,78,
-111,100,101,70,108,111,97,116,68,97,116,97,0,98,116,79,112,116,105,109,
-105,122,101,100,66,118,104,78,111,100,101,68,111,117,98,108,101,68,97,116,
-97,0,98,116,81,117,97,110,116,105,122,101,100,66,118,104,78,111,100,101,
-68,97,116,97,0,98,116,81,117,97,110,116,105,122,101,100,66,118,104,70,
-108,111,97,116,68,97,116,97,0,98,116,81,117,97,110,116,105,122,101,100,
-66,118,104,68,111,117,98,108,101,68,97,116,97,0,98,116,67,111,108,108,
-105,115,105,111,110,83,104,97,112,101,68,97,116,97,0,98,116,83,116,97,
-116,105,99,80,108,97,110,101,83,104,97,112,101,68,97,116,97,0,98,116,
-67,111,110,118,101,120,73,110,116,101,114,110,97,108,83,104,97,112,101,68,
-97,116,97,0,98,116,80,111,115,105,116,105,111,110,65,110,100,82,97,100,
-105,117,115,0,98,116,77,117,108,116,105,83,112,104,101,114,101,83,104,97,
-112,101,68,97,116,97,0,98,116,73,110,116,73,110,100,101,120,68,97,116,
-97,0,98,116,83,104,111,114,116,73,110,116,73,110,100,101,120,68,97,116,
-97,0,98,116,83,104,111,114,116,73,110,116,73,110,100,101,120,84,114,105,
-112,108,101,116,68,97,116,97,0,98,116,77,101,115,104,80,97,114,116,68,
-97,116,97,0,98,116,83,116,114,105,100,105,110,103,77,101,115,104,73,110,
-116,101,114,102,97,99,101,68,97,116,97,0,98,116,84,114,105,97,110,103,
-108,101,77,101,115,104,83,104,97,112,101,68,97,116,97,0,98,116,84,114,
-105,97,110,103,108,101,73,110,102,111,77,97,112,68,97,116,97,0,98,116,
-67,111,109,112,111,117,110,100,83,104,97,112,101,67,104,105,108,100,68,97,
-116,97,0,98,116,67,111,109,112,111,117,110,100,83,104,97,112,101,68,97,
-116,97,0,98,116,67,121,108,105,110,100,101,114,83,104,97,112,101,68,97,
-116,97,0,98,116,67,97,112,115,117,108,101,83,104,97,112,101,68,97,116,
-97,0,98,116,84,114,105,97,110,103,108,101,73,110,102,111,68,97,116,97,
-0,98,116,71,73,109,112,97,99,116,77,101,115,104,83,104,97,112,101,68,
-97,116,97,0,98,116,67,111,110,118,101,120,72,117,108,108,83,104,97,112,
-101,68,97,116,97,0,98,116,67,111,108,108,105,115,105,111,110,79,98,106,
-101,99,116,68,111,117,98,108,101,68,97,116,97,0,98,116,67,111,108,108,
-105,115,105,111,110,79,98,106,101,99,116,70,108,111,97,116,68,97,116,97,
-0,98,116,82,105,103,105,100,66,111,100,121,70,108,111,97,116,68,97,116,
-97,0,98,116,82,105,103,105,100,66,111,100,121,68,111,117,98,108,101,68,
-97,116,97,0,98,116,67,111,110,115,116,114,97,105,110,116,73,110,102,111,
-49,0,98,116,84,121,112,101,100,67,111,110,115,116,114,97,105,110,116,68,
-97,116,97,0,98,116,82,105,103,105,100,66,111,100,121,68,97,116,97,0,
-98,116,80,111,105,110,116,50,80,111,105,110,116,67,111,110,115,116,114,97,
-105,110,116,70,108,111,97,116,68,97,116,97,0,98,116,80,111,105,110,116,
-50,80,111,105,110,116,67,111,110,115,116,114,97,105,110,116,68,111,117,98,
-108,101,68,97,116,97,0,98,116,72,105,110,103,101,67,111,110,115,116,114,
-97,105,110,116,68,111,117,98,108,101,68,97,116,97,0,98,116,72,105,110,
-103,101,67,111,110,115,116,114,97,105,110,116,70,108,111,97,116,68,97,116,
-97,0,98,116,67,111,110,101,84,119,105,115,116,67,111,110,115,116,114,97,
-105,110,116,68,97,116,97,0,98,116,71,101,110,101,114,105,99,54,68,111,
-102,67,111,110,115,116,114,97,105,110,116,68,97,116,97,0,98,116,83,108,
-105,100,101,114,67,111,110,115,116,114,97,105,110,116,68,97,116,97,0,0,
-84,76,69,78,1,0,1,0,2,0,2,0,4,0,4,0,4,0,4,0,
-8,0,0,0,16,0,48,0,16,0,16,0,32,0,48,0,96,0,64,0,
--128,0,20,0,48,0,80,0,16,0,96,0,-112,0,16,0,56,0,56,0,
-20,0,72,0,4,0,4,0,8,0,48,0,32,0,80,0,72,0,80,0,
-32,0,64,0,64,0,16,0,72,0,80,0,-40,1,8,1,-16,1,-88,3,
-8,0,56,0,0,0,88,0,120,0,96,1,-32,0,-40,0,0,1,-48,0,
-83,84,82,67,47,0,0,0,10,0,3,0,4,0,0,0,4,0,1,0,
-9,0,2,0,11,0,3,0,10,0,3,0,10,0,4,0,10,0,5,0,
-12,0,2,0,9,0,6,0,9,0,7,0,13,0,1,0,7,0,8,0,
-14,0,1,0,8,0,8,0,15,0,1,0,13,0,9,0,16,0,1,0,
-14,0,9,0,17,0,2,0,15,0,10,0,13,0,11,0,18,0,2,0,
-16,0,10,0,14,0,11,0,19,0,4,0,4,0,12,0,4,0,13,0,
-2,0,14,0,2,0,15,0,20,0,6,0,13,0,16,0,13,0,17,0,
-4,0,18,0,4,0,19,0,4,0,20,0,0,0,21,0,21,0,6,0,
-14,0,16,0,14,0,17,0,4,0,18,0,4,0,19,0,4,0,20,0,
-0,0,21,0,22,0,3,0,2,0,14,0,2,0,15,0,4,0,22,0,
-23,0,12,0,13,0,23,0,13,0,24,0,13,0,25,0,4,0,26,0,
-4,0,27,0,4,0,28,0,4,0,29,0,20,0,30,0,22,0,31,0,
-19,0,32,0,4,0,33,0,4,0,34,0,24,0,12,0,14,0,23,0,
-14,0,24,0,14,0,25,0,4,0,26,0,4,0,27,0,4,0,28,0,
-4,0,29,0,21,0,30,0,22,0,31,0,4,0,33,0,4,0,34,0,
-19,0,32,0,25,0,3,0,0,0,35,0,4,0,36,0,0,0,37,0,
-26,0,5,0,25,0,38,0,13,0,39,0,13,0,40,0,7,0,41,0,
-0,0,21,0,27,0,5,0,25,0,38,0,13,0,39,0,13,0,42,0,
-7,0,43,0,4,0,44,0,28,0,2,0,13,0,45,0,7,0,46,0,
-29,0,4,0,27,0,47,0,28,0,48,0,4,0,49,0,0,0,37,0,
-30,0,1,0,4,0,50,0,31,0,2,0,2,0,50,0,0,0,51,0,
-32,0,2,0,2,0,52,0,0,0,51,0,33,0,7,0,13,0,53,0,
-14,0,54,0,30,0,55,0,32,0,56,0,31,0,57,0,4,0,58,0,
-4,0,59,0,34,0,4,0,33,0,60,0,13,0,61,0,4,0,62,0,
-0,0,37,0,35,0,7,0,25,0,38,0,34,0,63,0,23,0,64,0,
-24,0,65,0,36,0,66,0,7,0,43,0,0,0,67,0,37,0,4,0,
-17,0,68,0,25,0,69,0,4,0,70,0,7,0,71,0,38,0,4,0,
-25,0,38,0,37,0,72,0,4,0,73,0,7,0,43,0,39,0,3,0,
-27,0,47,0,4,0,74,0,0,0,37,0,40,0,3,0,27,0,47,0,
-4,0,74,0,0,0,37,0,41,0,4,0,4,0,75,0,7,0,76,0,
-7,0,77,0,7,0,78,0,36,0,14,0,4,0,79,0,4,0,80,0,
-41,0,81,0,4,0,82,0,7,0,83,0,7,0,84,0,7,0,85,0,
-7,0,86,0,7,0,87,0,4,0,88,0,4,0,89,0,4,0,90,0,
-4,0,91,0,0,0,37,0,42,0,5,0,25,0,38,0,34,0,63,0,
-13,0,39,0,7,0,43,0,4,0,92,0,43,0,5,0,27,0,47,0,
-13,0,93,0,14,0,94,0,4,0,95,0,0,0,96,0,44,0,24,0,
-9,0,97,0,9,0,98,0,25,0,99,0,0,0,35,0,18,0,100,0,
-18,0,101,0,14,0,102,0,14,0,103,0,14,0,104,0,8,0,105,0,
-8,0,106,0,8,0,107,0,8,0,108,0,8,0,109,0,8,0,110,0,
-8,0,111,0,4,0,112,0,4,0,113,0,4,0,114,0,4,0,115,0,
-4,0,116,0,4,0,117,0,4,0,118,0,0,0,37,0,45,0,23,0,
-9,0,97,0,9,0,98,0,25,0,99,0,0,0,35,0,17,0,100,0,
-17,0,101,0,13,0,102,0,13,0,103,0,13,0,104,0,7,0,105,0,
-7,0,106,0,7,0,107,0,7,0,108,0,7,0,109,0,7,0,110,0,
-7,0,111,0,4,0,112,0,4,0,113,0,4,0,114,0,4,0,115,0,
-4,0,116,0,4,0,117,0,4,0,118,0,46,0,21,0,45,0,119,0,
-15,0,120,0,13,0,121,0,13,0,122,0,13,0,123,0,13,0,124,0,
-13,0,125,0,13,0,126,0,13,0,127,0,13,0,-128,0,13,0,-127,0,
-7,0,-126,0,7,0,-125,0,7,0,-124,0,7,0,-123,0,7,0,-122,0,
-7,0,-121,0,7,0,-120,0,7,0,-119,0,7,0,-118,0,4,0,-117,0,
-47,0,22,0,44,0,119,0,16,0,120,0,14,0,121,0,14,0,122,0,
-14,0,123,0,14,0,124,0,14,0,125,0,14,0,126,0,14,0,127,0,
-14,0,-128,0,14,0,-127,0,8,0,-126,0,8,0,-125,0,8,0,-124,0,
-8,0,-123,0,8,0,-122,0,8,0,-121,0,8,0,-120,0,8,0,-119,0,
-8,0,-118,0,4,0,-117,0,0,0,37,0,48,0,2,0,4,0,-116,0,
-4,0,-115,0,49,0,11,0,50,0,-114,0,50,0,-113,0,0,0,35,0,
-4,0,-112,0,4,0,-111,0,4,0,-110,0,4,0,-109,0,7,0,-108,0,
-7,0,-107,0,4,0,-106,0,0,0,-105,0,51,0,3,0,49,0,-104,0,
-13,0,-103,0,13,0,-102,0,52,0,3,0,49,0,-104,0,14,0,-103,0,
-14,0,-102,0,53,0,13,0,49,0,-104,0,18,0,-101,0,18,0,-100,0,
-4,0,-99,0,4,0,-98,0,4,0,-97,0,7,0,-96,0,7,0,-95,0,
-7,0,-94,0,7,0,-93,0,7,0,-92,0,7,0,-91,0,7,0,-90,0,
-54,0,13,0,49,0,-104,0,17,0,-101,0,17,0,-100,0,4,0,-99,0,
-4,0,-98,0,4,0,-97,0,7,0,-96,0,7,0,-95,0,7,0,-94,0,
-7,0,-93,0,7,0,-92,0,7,0,-91,0,7,0,-90,0,55,0,11,0,
-49,0,-104,0,17,0,-101,0,17,0,-100,0,7,0,-89,0,7,0,-88,0,
-7,0,-87,0,7,0,-92,0,7,0,-91,0,7,0,-90,0,7,0,-86,0,
-0,0,21,0,56,0,9,0,49,0,-104,0,17,0,-101,0,17,0,-100,0,
-13,0,-85,0,13,0,-84,0,13,0,-83,0,13,0,-82,0,4,0,-81,0,
-4,0,-80,0,57,0,9,0,49,0,-104,0,17,0,-101,0,17,0,-100,0,
-7,0,-85,0,7,0,-84,0,7,0,-83,0,7,0,-82,0,4,0,-81,0,
-4,0,-80,0,};
-int sBulletDNAlen64= sizeof(sBulletDNAstr64);
-
-unsigned char sBulletDNAstr[]= {
-83,68,78,65,78,65,77,69,-79,0,0,0,109,95,115,105,122,101,0,109,
+111,100,101,68,111,117,98,108,101,68,97,116,97,0,98,116,81,117,97,110,
+116,105,122,101,100,66,118,104,78,111,100,101,68,97,116,97,0,98,116,81,
+117,97,110,116,105,122,101,100,66,118,104,70,108,111,97,116,68,97,116,97,
+0,98,116,81,117,97,110,116,105,122,101,100,66,118,104,68,111,117,98,108,
+101,68,97,116,97,0,98,116,67,111,108,108,105,115,105,111,110,83,104,97,
+112,101,68,97,116,97,0,98,116,83,116,97,116,105,99,80,108,97,110,101,
+83,104,97,112,101,68,97,116,97,0,98,116,67,111,110,118,101,120,73,110,
+116,101,114,110,97,108,83,104,97,112,101,68,97,116,97,0,98,116,80,111,
+115,105,116,105,111,110,65,110,100,82,97,100,105,117,115,0,98,116,77,117,
+108,116,105,83,112,104,101,114,101,83,104,97,112,101,68,97,116,97,0,98,
+116,73,110,116,73,110,100,101,120,68,97,116,97,0,98,116,83,104,111,114,
+116,73,110,116,73,110,100,101,120,68,97,116,97,0,98,116,83,104,111,114,
+116,73,110,116,73,110,100,101,120,84,114,105,112,108,101,116,68,97,116,97,
+0,98,116,67,104,97,114,73,110,100,101,120,84,114,105,112,108,101,116,68,
+97,116,97,0,98,116,77,101,115,104,80,97,114,116,68,97,116,97,0,98,
+116,83,116,114,105,100,105,110,103,77,101,115,104,73,110,116,101,114,102,97,
+99,101,68,97,116,97,0,98,116,84,114,105,97,110,103,108,101,77,101,115,
+104,83,104,97,112,101,68,97,116,97,0,98,116,84,114,105,97,110,103,108,
+101,73,110,102,111,77,97,112,68,97,116,97,0,98,116,83,99,97,108,101,
+100,84,114,105,97,110,103,108,101,77,101,115,104,83,104,97,112,101,68,97,
+116,97,0,98,116,67,111,109,112,111,117,110,100,83,104,97,112,101,67,104,
+105,108,100,68,97,116,97,0,98,116,67,111,109,112,111,117,110,100,83,104,
+97,112,101,68,97,116,97,0,98,116,67,121,108,105,110,100,101,114,83,104,
+97,112,101,68,97,116,97,0,98,116,67,97,112,115,117,108,101,83,104,97,
+112,101,68,97,116,97,0,98,116,84,114,105,97,110,103,108,101,73,110,102,
+111,68,97,116,97,0,98,116,71,73,109,112,97,99,116,77,101,115,104,83,
+104,97,112,101,68,97,116,97,0,98,116,67,111,110,118,101,120,72,117,108,
+108,83,104,97,112,101,68,97,116,97,0,98,116,67,111,108,108,105,115,105,
+111,110,79,98,106,101,99,116,68,111,117,98,108,101,68,97,116,97,0,98,
+116,67,111,108,108,105,115,105,111,110,79,98,106,101,99,116,70,108,111,97,
+116,68,97,116,97,0,98,116,82,105,103,105,100,66,111,100,121,70,108,111,
+97,116,68,97,116,97,0,98,116,82,105,103,105,100,66,111,100,121,68,111,
+117,98,108,101,68,97,116,97,0,98,116,67,111,110,115,116,114,97,105,110,
+116,73,110,102,111,49,0,98,116,84,121,112,101,100,67,111,110,115,116,114,
+97,105,110,116,68,97,116,97,0,98,116,82,105,103,105,100,66,111,100,121,
+68,97,116,97,0,98,116,80,111,105,110,116,50,80,111,105,110,116,67,111,
+110,115,116,114,97,105,110,116,70,108,111,97,116,68,97,116,97,0,98,116,
+80,111,105,110,116,50,80,111,105,110,116,67,111,110,115,116,114,97,105,110,
+116,68,111,117,98,108,101,68,97,116,97,0,98,116,72,105,110,103,101,67,
+111,110,115,116,114,97,105,110,116,68,111,117,98,108,101,68,97,116,97,0,
+98,116,72,105,110,103,101,67,111,110,115,116,114,97,105,110,116,70,108,111,
+97,116,68,97,116,97,0,98,116,67,111,110,101,84,119,105,115,116,67,111,
+110,115,116,114,97,105,110,116,68,97,116,97,0,98,116,71,101,110,101,114,
+105,99,54,68,111,102,67,111,110,115,116,114,97,105,110,116,68,97,116,97,
+0,98,116,71,101,110,101,114,105,99,54,68,111,102,83,112,114,105,110,103,
+67,111,110,115,116,114,97,105,110,116,68,97,116,97,0,98,116,83,108,105,
+100,101,114,67,111,110,115,116,114,97,105,110,116,68,97,116,97,0,83,111,
+102,116,66,111,100,121,77,97,116,101,114,105,97,108,68,97,116,97,0,83,
+111,102,116,66,111,100,121,78,111,100,101,68,97,116,97,0,83,111,102,116,
+66,111,100,121,76,105,110,107,68,97,116,97,0,83,111,102,116,66,111,100,
+121,70,97,99,101,68,97,116,97,0,83,111,102,116,66,111,100,121,84,101,
+116,114,97,68,97,116,97,0,83,111,102,116,82,105,103,105,100,65,110,99,
+104,111,114,68,97,116,97,0,83,111,102,116,66,111,100,121,67,111,110,102,
+105,103,68,97,116,97,0,83,111,102,116,66,111,100,121,80,111,115,101,68,
+97,116,97,0,83,111,102,116,66,111,100,121,67,108,117,115,116,101,114,68,
+97,116,97,0,98,116,83,111,102,116,66,111,100,121,74,111,105,110,116,68,
+97,116,97,0,98,116,83,111,102,116,66,111,100,121,70,108,111,97,116,68,
+97,116,97,0,84,76,69,78,1,0,1,0,2,0,2,0,4,0,4,0,
+4,0,4,0,8,0,0,0,12,0,36,0,8,0,16,0,32,0,48,0,
+96,0,64,0,-128,0,20,0,48,0,80,0,16,0,84,0,-124,0,12,0,
+52,0,52,0,20,0,64,0,4,0,4,0,8,0,4,0,32,0,28,0,
+60,0,56,0,76,0,76,0,24,0,60,0,60,0,16,0,64,0,68,0,
+-56,1,-8,0,-32,1,-104,3,8,0,44,0,0,0,76,0,108,0,84,1,
+-44,0,-52,0,-12,0,84,1,-60,0,16,0,100,0,20,0,36,0,100,0,
+92,0,104,0,-64,0,92,1,104,0,-92,1,83,84,82,67,61,0,0,0,
+10,0,3,0,4,0,0,0,4,0,1,0,9,0,2,0,11,0,3,0,
+10,0,3,0,10,0,4,0,10,0,5,0,12,0,2,0,9,0,6,0,
+9,0,7,0,13,0,1,0,7,0,8,0,14,0,1,0,8,0,8,0,
+15,0,1,0,13,0,9,0,16,0,1,0,14,0,9,0,17,0,2,0,
+15,0,10,0,13,0,11,0,18,0,2,0,16,0,10,0,14,0,11,0,
+19,0,4,0,4,0,12,0,4,0,13,0,2,0,14,0,2,0,15,0,
+20,0,6,0,13,0,16,0,13,0,17,0,4,0,18,0,4,0,19,0,
+4,0,20,0,0,0,21,0,21,0,6,0,14,0,16,0,14,0,17,0,
+4,0,18,0,4,0,19,0,4,0,20,0,0,0,21,0,22,0,3,0,
+2,0,14,0,2,0,15,0,4,0,22,0,23,0,12,0,13,0,23,0,
+13,0,24,0,13,0,25,0,4,0,26,0,4,0,27,0,4,0,28,0,
+4,0,29,0,20,0,30,0,22,0,31,0,19,0,32,0,4,0,33,0,
+4,0,34,0,24,0,12,0,14,0,23,0,14,0,24,0,14,0,25,0,
+4,0,26,0,4,0,27,0,4,0,28,0,4,0,29,0,21,0,30,0,
+22,0,31,0,4,0,33,0,4,0,34,0,19,0,32,0,25,0,3,0,
+0,0,35,0,4,0,36,0,0,0,37,0,26,0,5,0,25,0,38,0,
+13,0,39,0,13,0,40,0,7,0,41,0,0,0,21,0,27,0,5,0,
+25,0,38,0,13,0,39,0,13,0,42,0,7,0,43,0,4,0,44,0,
+28,0,2,0,13,0,45,0,7,0,46,0,29,0,4,0,27,0,47,0,
+28,0,48,0,4,0,49,0,0,0,37,0,30,0,1,0,4,0,50,0,
+31,0,2,0,2,0,50,0,0,0,51,0,32,0,2,0,2,0,52,0,
+0,0,51,0,33,0,2,0,0,0,52,0,0,0,53,0,34,0,8,0,
+13,0,54,0,14,0,55,0,30,0,56,0,32,0,57,0,33,0,58,0,
+31,0,59,0,4,0,60,0,4,0,61,0,35,0,4,0,34,0,62,0,
+13,0,63,0,4,0,64,0,0,0,37,0,36,0,7,0,25,0,38,0,
+35,0,65,0,23,0,66,0,24,0,67,0,37,0,68,0,7,0,43,0,
+0,0,69,0,38,0,2,0,36,0,70,0,13,0,39,0,39,0,4,0,
+17,0,71,0,25,0,72,0,4,0,73,0,7,0,74,0,40,0,4,0,
+25,0,38,0,39,0,75,0,4,0,76,0,7,0,43,0,41,0,3,0,
+27,0,47,0,4,0,77,0,0,0,37,0,42,0,3,0,27,0,47,0,
+4,0,77,0,0,0,37,0,43,0,4,0,4,0,78,0,7,0,79,0,
+7,0,80,0,7,0,81,0,37,0,14,0,4,0,82,0,4,0,83,0,
+43,0,84,0,4,0,85,0,7,0,86,0,7,0,87,0,7,0,88,0,
+7,0,89,0,7,0,90,0,4,0,91,0,4,0,92,0,4,0,93,0,
+4,0,94,0,0,0,37,0,44,0,5,0,25,0,38,0,35,0,65,0,
+13,0,39,0,7,0,43,0,4,0,95,0,45,0,5,0,27,0,47,0,
+13,0,96,0,14,0,97,0,4,0,98,0,0,0,99,0,46,0,24,0,
+9,0,100,0,9,0,101,0,25,0,102,0,0,0,35,0,18,0,103,0,
+18,0,104,0,14,0,105,0,14,0,106,0,14,0,107,0,8,0,108,0,
+8,0,109,0,8,0,110,0,8,0,111,0,8,0,112,0,8,0,113,0,
+8,0,114,0,4,0,115,0,4,0,116,0,4,0,117,0,4,0,118,0,
+4,0,119,0,4,0,120,0,4,0,121,0,0,0,37,0,47,0,23,0,
+9,0,100,0,9,0,101,0,25,0,102,0,0,0,35,0,17,0,103,0,
+17,0,104,0,13,0,105,0,13,0,106,0,13,0,107,0,7,0,108,0,
+7,0,109,0,7,0,110,0,7,0,111,0,7,0,112,0,7,0,113,0,
+7,0,114,0,4,0,115,0,4,0,116,0,4,0,117,0,4,0,118,0,
+4,0,119,0,4,0,120,0,4,0,121,0,48,0,21,0,47,0,122,0,
+15,0,123,0,13,0,124,0,13,0,125,0,13,0,126,0,13,0,127,0,
+13,0,-128,0,13,0,-127,0,13,0,-126,0,13,0,-125,0,13,0,-124,0,
+7,0,-123,0,7,0,-122,0,7,0,-121,0,7,0,-120,0,7,0,-119,0,
+7,0,-118,0,7,0,-117,0,7,0,-116,0,7,0,-115,0,4,0,-114,0,
+49,0,22,0,46,0,122,0,16,0,123,0,14,0,124,0,14,0,125,0,
+14,0,126,0,14,0,127,0,14,0,-128,0,14,0,-127,0,14,0,-126,0,
+14,0,-125,0,14,0,-124,0,8,0,-123,0,8,0,-122,0,8,0,-121,0,
+8,0,-120,0,8,0,-119,0,8,0,-118,0,8,0,-117,0,8,0,-116,0,
+8,0,-115,0,4,0,-114,0,0,0,37,0,50,0,2,0,4,0,-113,0,
+4,0,-112,0,51,0,11,0,52,0,-111,0,52,0,-110,0,0,0,35,0,
+4,0,-109,0,4,0,-108,0,4,0,-107,0,4,0,-106,0,7,0,-105,0,
+7,0,-104,0,4,0,-103,0,0,0,-102,0,53,0,3,0,51,0,-101,0,
+13,0,-100,0,13,0,-99,0,54,0,3,0,51,0,-101,0,14,0,-100,0,
+14,0,-99,0,55,0,13,0,51,0,-101,0,18,0,-98,0,18,0,-97,0,
+4,0,-96,0,4,0,-95,0,4,0,-94,0,7,0,-93,0,7,0,-92,0,
+7,0,-91,0,7,0,-90,0,7,0,-89,0,7,0,-88,0,7,0,-87,0,
+56,0,13,0,51,0,-101,0,17,0,-98,0,17,0,-97,0,4,0,-96,0,
+4,0,-95,0,4,0,-94,0,7,0,-93,0,7,0,-92,0,7,0,-91,0,
+7,0,-90,0,7,0,-89,0,7,0,-88,0,7,0,-87,0,57,0,11,0,
+51,0,-101,0,17,0,-98,0,17,0,-97,0,7,0,-86,0,7,0,-85,0,
+7,0,-84,0,7,0,-89,0,7,0,-88,0,7,0,-87,0,7,0,-83,0,
+0,0,21,0,58,0,9,0,51,0,-101,0,17,0,-98,0,17,0,-97,0,
+13,0,-82,0,13,0,-81,0,13,0,-80,0,13,0,-79,0,4,0,-78,0,
+4,0,-77,0,59,0,5,0,58,0,-76,0,4,0,-75,0,7,0,-74,0,
+7,0,-73,0,7,0,-72,0,60,0,9,0,51,0,-101,0,17,0,-98,0,
+17,0,-97,0,7,0,-82,0,7,0,-81,0,7,0,-80,0,7,0,-79,0,
+4,0,-78,0,4,0,-77,0,61,0,4,0,7,0,-71,0,7,0,-70,0,
+7,0,-69,0,4,0,78,0,62,0,10,0,61,0,-68,0,13,0,-67,0,
+13,0,-66,0,13,0,-65,0,13,0,-64,0,13,0,-63,0,7,0,-123,0,
+7,0,-62,0,4,0,-61,0,4,0,53,0,63,0,4,0,61,0,-68,0,
+4,0,-60,0,7,0,-59,0,4,0,-58,0,64,0,4,0,13,0,-63,0,
+61,0,-68,0,4,0,-57,0,7,0,-56,0,65,0,7,0,13,0,-55,0,
+61,0,-68,0,4,0,-54,0,7,0,-53,0,7,0,-52,0,7,0,-51,0,
+4,0,53,0,66,0,6,0,15,0,-50,0,13,0,-52,0,13,0,-49,0,
+52,0,-48,0,4,0,-47,0,7,0,-51,0,67,0,26,0,4,0,-46,0,
+7,0,-45,0,7,0,-83,0,7,0,-44,0,7,0,-43,0,7,0,-42,0,
+7,0,-41,0,7,0,-40,0,7,0,-39,0,7,0,-38,0,7,0,-37,0,
+7,0,-36,0,7,0,-35,0,7,0,-34,0,7,0,-33,0,7,0,-32,0,
+7,0,-31,0,7,0,-30,0,7,0,-29,0,7,0,-28,0,7,0,-27,0,
+4,0,-26,0,4,0,-25,0,4,0,-24,0,4,0,-23,0,4,0,116,0,
+68,0,12,0,15,0,-22,0,15,0,-21,0,15,0,-20,0,13,0,-19,0,
+13,0,-18,0,7,0,-17,0,4,0,-16,0,4,0,-15,0,4,0,-14,0,
+4,0,-13,0,7,0,-53,0,4,0,53,0,69,0,27,0,17,0,-12,0,
+15,0,-11,0,15,0,-10,0,13,0,-19,0,13,0,-9,0,13,0,-8,0,
+13,0,-7,0,13,0,-6,0,13,0,-5,0,4,0,-4,0,7,0,-3,0,
+4,0,-2,0,4,0,-1,0,4,0,0,1,7,0,1,1,7,0,2,1,
+4,0,3,1,4,0,4,1,7,0,5,1,7,0,6,1,7,0,7,1,
+7,0,8,1,7,0,9,1,7,0,10,1,4,0,11,1,4,0,12,1,
+4,0,13,1,70,0,12,0,9,0,14,1,9,0,15,1,13,0,16,1,
+7,0,17,1,7,0,18,1,7,0,19,1,4,0,20,1,13,0,21,1,
+4,0,22,1,4,0,23,1,4,0,24,1,4,0,53,0,71,0,19,0,
+47,0,122,0,68,0,25,1,61,0,26,1,62,0,27,1,63,0,28,1,
+64,0,29,1,65,0,30,1,66,0,31,1,69,0,32,1,70,0,33,1,
+4,0,34,1,4,0,-1,0,4,0,35,1,4,0,36,1,4,0,37,1,
+4,0,38,1,4,0,39,1,4,0,40,1,67,0,41,1,};
+int sBulletDNAlen= sizeof(sBulletDNAstr);
+unsigned char sBulletDNAstr64[]= {
+83,68,78,65,78,65,77,69,42,1,0,0,109,95,115,105,122,101,0,109,
95,99,97,112,97,99,105,116,121,0,42,109,95,100,97,116,97,0,109,95,
99,111,108,108,105,115,105,111,110,83,104,97,112,101,115,0,109,95,99,111,
108,108,105,115,105,111,110,79,98,106,101,99,116,115,0,109,95,99,111,110,
@@ -329,249 +456,377 @@
115,105,116,105,111,110,65,114,114,97,121,80,116,114,0,109,95,108,111,99,
97,108,80,111,115,105,116,105,111,110,65,114,114,97,121,83,105,122,101,0,
109,95,118,97,108,117,101,0,109,95,112,97,100,91,50,93,0,109,95,118,
-97,108,117,101,115,91,51,93,0,42,109,95,118,101,114,116,105,99,101,115,
-51,102,0,42,109,95,118,101,114,116,105,99,101,115,51,100,0,42,109,95,
-105,110,100,105,99,101,115,51,50,0,42,109,95,51,105,110,100,105,99,101,
-115,49,54,0,42,109,95,105,110,100,105,99,101,115,49,54,0,109,95,110,
-117,109,84,114,105,97,110,103,108,101,115,0,109,95,110,117,109,86,101,114,
-116,105,99,101,115,0,42,109,95,109,101,115,104,80,97,114,116,115,80,116,
-114,0,109,95,115,99,97,108,105,110,103,0,109,95,110,117,109,77,101,115,
-104,80,97,114,116,115,0,109,95,109,101,115,104,73,110,116,101,114,102,97,
-99,101,0,42,109,95,113,117,97,110,116,105,122,101,100,70,108,111,97,116,
-66,118,104,0,42,109,95,113,117,97,110,116,105,122,101,100,68,111,117,98,
-108,101,66,118,104,0,42,109,95,116,114,105,97,110,103,108,101,73,110,102,
-111,77,97,112,0,109,95,112,97,100,51,91,52,93,0,109,95,116,114,97,
-110,115,102,111,114,109,0,42,109,95,99,104,105,108,100,83,104,97,112,101,
-0,109,95,99,104,105,108,100,83,104,97,112,101,84,121,112,101,0,109,95,
-99,104,105,108,100,77,97,114,103,105,110,0,42,109,95,99,104,105,108,100,
-83,104,97,112,101,80,116,114,0,109,95,110,117,109,67,104,105,108,100,83,
-104,97,112,101,115,0,109,95,117,112,65,120,105,115,0,109,95,102,108,97,
-103,115,0,109,95,101,100,103,101,86,48,86,49,65,110,103,108,101,0,109,
-95,101,100,103,101,86,49,86,50,65,110,103,108,101,0,109,95,101,100,103,
-101,86,50,86,48,65,110,103,108,101,0,42,109,95,104,97,115,104,84,97,
-98,108,101,80,116,114,0,42,109,95,110,101,120,116,80,116,114,0,42,109,
-95,118,97,108,117,101,65,114,114,97,121,80,116,114,0,42,109,95,107,101,
-121,65,114,114,97,121,80,116,114,0,109,95,99,111,110,118,101,120,69,112,
-115,105,108,111,110,0,109,95,112,108,97,110,97,114,69,112,115,105,108,111,
-110,0,109,95,101,113,117,97,108,86,101,114,116,101,120,84,104,114,101,115,
-104,111,108,100,0,109,95,101,100,103,101,68,105,115,116,97,110,99,101,84,
-104,114,101,115,104,111,108,100,0,109,95,122,101,114,111,65,114,101,97,84,
-104,114,101,115,104,111,108,100,0,109,95,110,101,120,116,83,105,122,101,0,
-109,95,104,97,115,104,84,97,98,108,101,83,105,122,101,0,109,95,110,117,
-109,86,97,108,117,101,115,0,109,95,110,117,109,75,101,121,115,0,109,95,
-103,105,109,112,97,99,116,83,117,98,84,121,112,101,0,42,109,95,117,110,
-115,99,97,108,101,100,80,111,105,110,116,115,70,108,111,97,116,80,116,114,
-0,42,109,95,117,110,115,99,97,108,101,100,80,111,105,110,116,115,68,111,
-117,98,108,101,80,116,114,0,109,95,110,117,109,85,110,115,99,97,108,101,
-100,80,111,105,110,116,115,0,109,95,112,97,100,100,105,110,103,51,91,52,
-93,0,42,109,95,98,114,111,97,100,112,104,97,115,101,72,97,110,100,108,
-101,0,42,109,95,99,111,108,108,105,115,105,111,110,83,104,97,112,101,0,
-42,109,95,114,111,111,116,67,111,108,108,105,115,105,111,110,83,104,97,112,
-101,0,109,95,119,111,114,108,100,84,114,97,110,115,102,111,114,109,0,109,
-95,105,110,116,101,114,112,111,108,97,116,105,111,110,87,111,114,108,100,84,
-114,97,110,115,102,111,114,109,0,109,95,105,110,116,101,114,112,111,108,97,
-116,105,111,110,76,105,110,101,97,114,86,101,108,111,99,105,116,121,0,109,
-95,105,110,116,101,114,112,111,108,97,116,105,111,110,65,110,103,117,108,97,
-114,86,101,108,111,99,105,116,121,0,109,95,97,110,105,115,111,116,114,111,
-112,105,99,70,114,105,99,116,105,111,110,0,109,95,99,111,110,116,97,99,
-116,80,114,111,99,101,115,115,105,110,103,84,104,114,101,115,104,111,108,100,
-0,109,95,100,101,97,99,116,105,118,97,116,105,111,110,84,105,109,101,0,
-109,95,102,114,105,99,116,105,111,110,0,109,95,114,101,115,116,105,116,117,
-116,105,111,110,0,109,95,104,105,116,70,114,97,99,116,105,111,110,0,109,
-95,99,99,100,83,119,101,112,116,83,112,104,101,114,101,82,97,100,105,117,
-115,0,109,95,99,99,100,77,111,116,105,111,110,84,104,114,101,115,104,111,
-108,100,0,109,95,104,97,115,65,110,105,115,111,116,114,111,112,105,99,70,
-114,105,99,116,105,111,110,0,109,95,99,111,108,108,105,115,105,111,110,70,
-108,97,103,115,0,109,95,105,115,108,97,110,100,84,97,103,49,0,109,95,
-99,111,109,112,97,110,105,111,110,73,100,0,109,95,97,99,116,105,118,97,
-116,105,111,110,83,116,97,116,101,49,0,109,95,105,110,116,101,114,110,97,
-108,84,121,112,101,0,109,95,99,104,101,99,107,67,111,108,108,105,100,101,
-87,105,116,104,0,109,95,99,111,108,108,105,115,105,111,110,79,98,106,101,
-99,116,68,97,116,97,0,109,95,105,110,118,73,110,101,114,116,105,97,84,
-101,110,115,111,114,87,111,114,108,100,0,109,95,108,105,110,101,97,114,86,
-101,108,111,99,105,116,121,0,109,95,97,110,103,117,108,97,114,86,101,108,
-111,99,105,116,121,0,109,95,97,110,103,117,108,97,114,70,97,99,116,111,
-114,0,109,95,108,105,110,101,97,114,70,97,99,116,111,114,0,109,95,103,
-114,97,118,105,116,121,0,109,95,103,114,97,118,105,116,121,95,97,99,99,
-101,108,101,114,97,116,105,111,110,0,109,95,105,110,118,73,110,101,114,116,
-105,97,76,111,99,97,108,0,109,95,116,111,116,97,108,70,111,114,99,101,
-0,109,95,116,111,116,97,108,84,111,114,113,117,101,0,109,95,105,110,118,
-101,114,115,101,77,97,115,115,0,109,95,108,105,110,101,97,114,68,97,109,
-112,105,110,103,0,109,95,97,110,103,117,108,97,114,68,97,109,112,105,110,
-103,0,109,95,97,100,100,105,116,105,111,110,97,108,68,97,109,112,105,110,
-103,70,97,99,116,111,114,0,109,95,97,100,100,105,116,105,111,110,97,108,
-76,105,110,101,97,114,68,97,109,112,105,110,103,84,104,114,101,115,104,111,
-108,100,83,113,114,0,109,95,97,100,100,105,116,105,111,110,97,108,65,110,
-103,117,108,97,114,68,97,109,112,105,110,103,84,104,114,101,115,104,111,108,
-100,83,113,114,0,109,95,97,100,100,105,116,105,111,110,97,108,65,110,103,
-117,108,97,114,68,97,109,112,105,110,103,70,97,99,116,111,114,0,109,95,
-108,105,110,101,97,114,83,108,101,101,112,105,110,103,84,104,114,101,115,104,
-111,108,100,0,109,95,97,110,103,117,108,97,114,83,108,101,101,112,105,110,
-103,84,104,114,101,115,104,111,108,100,0,109,95,97,100,100,105,116,105,111,
-110,97,108,68,97,109,112,105,110,103,0,109,95,110,117,109,67,111,110,115,
-116,114,97,105,110,116,82,111,119,115,0,110,117,98,0,42,109,95,114,98,
-65,0,42,109,95,114,98,66,0,109,95,111,98,106,101,99,116,84,121,112,
-101,0,109,95,117,115,101,114,67,111,110,115,116,114,97,105,110,116,84,121,
-112,101,0,109,95,117,115,101,114,67,111,110,115,116,114,97,105,110,116,73,
-100,0,109,95,110,101,101,100,115,70,101,101,100,98,97,99,107,0,109,95,
-97,112,112,108,105,101,100,73,109,112,117,108,115,101,0,109,95,100,98,103,
-68,114,97,119,83,105,122,101,0,109,95,100,105,115,97,98,108,101,67,111,
-108,108,105,115,105,111,110,115,66,101,116,119,101,101,110,76,105,110,107,101,
-100,66,111,100,105,101,115,0,109,95,112,97,100,52,91,52,93,0,109,95,
-116,121,112,101,67,111,110,115,116,114,97,105,110,116,68,97,116,97,0,109,
-95,112,105,118,111,116,73,110,65,0,109,95,112,105,118,111,116,73,110,66,
-0,109,95,114,98,65,70,114,97,109,101,0,109,95,114,98,66,70,114,97,
-109,101,0,109,95,117,115,101,82,101,102,101,114,101,110,99,101,70,114,97,
-109,101,65,0,109,95,97,110,103,117,108,97,114,79,110,108,121,0,109,95,
-101,110,97,98,108,101,65,110,103,117,108,97,114,77,111,116,111,114,0,109,
-95,109,111,116,111,114,84,97,114,103,101,116,86,101,108,111,99,105,116,121,
-0,109,95,109,97,120,77,111,116,111,114,73,109,112,117,108,115,101,0,109,
-95,108,111,119,101,114,76,105,109,105,116,0,109,95,117,112,112,101,114,76,
-105,109,105,116,0,109,95,108,105,109,105,116,83,111,102,116,110,101,115,115,
-0,109,95,98,105,97,115,70,97,99,116,111,114,0,109,95,114,101,108,97,
-120,97,116,105,111,110,70,97,99,116,111,114,0,109,95,115,119,105,110,103,
-83,112,97,110,49,0,109,95,115,119,105,110,103,83,112,97,110,50,0,109,
-95,116,119,105,115,116,83,112,97,110,0,109,95,100,97,109,112,105,110,103,
-0,109,95,108,105,110,101,97,114,85,112,112,101,114,76,105,109,105,116,0,
-109,95,108,105,110,101,97,114,76,111,119,101,114,76,105,109,105,116,0,109,
-95,97,110,103,117,108,97,114,85,112,112,101,114,76,105,109,105,116,0,109,
-95,97,110,103,117,108,97,114,76,111,119,101,114,76,105,109,105,116,0,109,
-95,117,115,101,76,105,110,101,97,114,82,101,102,101,114,101,110,99,101,70,
-114,97,109,101,65,0,109,95,117,115,101,79,102,102,115,101,116,70,111,114,
-67,111,110,115,116,114,97,105,110,116,70,114,97,109,101,0,84,89,80,69,
-58,0,0,0,99,104,97,114,0,117,99,104,97,114,0,115,104,111,114,116,
-0,117,115,104,111,114,116,0,105,110,116,0,108,111,110,103,0,117,108,111,
-110,103,0,102,108,111,97,116,0,100,111,117,98,108,101,0,118,111,105,100,
-0,80,111,105,110,116,101,114,65,114,114,97,121,0,98,116,80,104,121,115,
-105,99,115,83,121,115,116,101,109,0,76,105,115,116,66,97,115,101,0,98,
-116,86,101,99,116,111,114,51,70,108,111,97,116,68,97,116,97,0,98,116,
-86,101,99,116,111,114,51,68,111,117,98,108,101,68,97,116,97,0,98,116,
-77,97,116,114,105,120,51,120,51,70,108,111,97,116,68,97,116,97,0,98,
-116,77,97,116,114,105,120,51,120,51,68,111,117,98,108,101,68,97,116,97,
-0,98,116,84,114,97,110,115,102,111,114,109,70,108,111,97,116,68,97,116,
-97,0,98,116,84,114,97,110,115,102,111,114,109,68,111,117,98,108,101,68,
-97,116,97,0,98,116,66,118,104,83,117,98,116,114,101,101,73,110,102,111,
+97,108,117,101,115,91,51,93,0,109,95,112,97,100,0,42,109,95,118,101,
+114,116,105,99,101,115,51,102,0,42,109,95,118,101,114,116,105,99,101,115,
+51,100,0,42,109,95,105,110,100,105,99,101,115,51,50,0,42,109,95,51,
+105,110,100,105,99,101,115,49,54,0,42,109,95,51,105,110,100,105,99,101,
+115,56,0,42,109,95,105,110,100,105,99,101,115,49,54,0,109,95,110,117,
+109,84,114,105,97,110,103,108,101,115,0,109,95,110,117,109,86,101,114,116,
+105,99,101,115,0,42,109,95,109,101,115,104,80,97,114,116,115,80,116,114,
+0,109,95,115,99,97,108,105,110,103,0,109,95,110,117,109,77,101,115,104,
+80,97,114,116,115,0,109,95,109,101,115,104,73,110,116,101,114,102,97,99,
+101,0,42,109,95,113,117,97,110,116,105,122,101,100,70,108,111,97,116,66,
+118,104,0,42,109,95,113,117,97,110,116,105,122,101,100,68,111,117,98,108,
+101,66,118,104,0,42,109,95,116,114,105,97,110,103,108,101,73,110,102,111,
+77,97,112,0,109,95,112,97,100,51,91,52,93,0,109,95,116,114,105,109,
+101,115,104,83,104,97,112,101,68,97,116,97,0,109,95,116,114,97,110,115,
+102,111,114,109,0,42,109,95,99,104,105,108,100,83,104,97,112,101,0,109,
+95,99,104,105,108,100,83,104,97,112,101,84,121,112,101,0,109,95,99,104,
+105,108,100,77,97,114,103,105,110,0,42,109,95,99,104,105,108,100,83,104,
+97,112,101,80,116,114,0,109,95,110,117,109,67,104,105,108,100,83,104,97,
+112,101,115,0,109,95,117,112,65,120,105,115,0,109,95,102,108,97,103,115,
+0,109,95,101,100,103,101,86,48,86,49,65,110,103,108,101,0,109,95,101,
+100,103,101,86,49,86,50,65,110,103,108,101,0,109,95,101,100,103,101,86,
+50,86,48,65,110,103,108,101,0,42,109,95,104,97,115,104,84,97,98,108,
+101,80,116,114,0,42,109,95,110,101,120,116,80,116,114,0,42,109,95,118,
+97,108,117,101,65,114,114,97,121,80,116,114,0,42,109,95,107,101,121,65,
+114,114,97,121,80,116,114,0,109,95,99,111,110,118,101,120,69,112,115,105,
+108,111,110,0,109,95,112,108,97,110,97,114,69,112,115,105,108,111,110,0,
+109,95,101,113,117,97,108,86,101,114,116,101,120,84,104,114,101,115,104,111,
+108,100,0,109,95,101,100,103,101,68,105,115,116,97,110,99,101,84,104,114,
+101,115,104,111,108,100,0,109,95,122,101,114,111,65,114,101,97,84,104,114,
+101,115,104,111,108,100,0,109,95,110,101,120,116,83,105,122,101,0,109,95,
+104,97,115,104,84,97,98,108,101,83,105,122,101,0,109,95,110,117,109,86,
+97,108,117,101,115,0,109,95,110,117,109,75,101,121,115,0,109,95,103,105,
+109,112,97,99,116,83,117,98,84,121,112,101,0,42,109,95,117,110,115,99,
+97,108,101,100,80,111,105,110,116,115,70,108,111,97,116,80,116,114,0,42,
+109,95,117,110,115,99,97,108,101,100,80,111,105,110,116,115,68,111,117,98,
+108,101,80,116,114,0,109,95,110,117,109,85,110,115,99,97,108,101,100,80,
+111,105,110,116,115,0,109,95,112,97,100,100,105,110,103,51,91,52,93,0,
+42,109,95,98,114,111,97,100,112,104,97,115,101,72,97,110,100,108,101,0,
+42,109,95,99,111,108,108,105,115,105,111,110,83,104,97,112,101,0,42,109,
+95,114,111,111,116,67,111,108,108,105,115,105,111,110,83,104,97,112,101,0,
+109,95,119,111,114,108,100,84,114,97,110,115,102,111,114,109,0,109,95,105,
+110,116,101,114,112,111,108,97,116,105,111,110,87,111,114,108,100,84,114,97,
+110,115,102,111,114,109,0,109,95,105,110,116,101,114,112,111,108,97,116,105,
+111,110,76,105,110,101,97,114,86,101,108,111,99,105,116,121,0,109,95,105,
+110,116,101,114,112,111,108,97,116,105,111,110,65,110,103,117,108,97,114,86,
+101,108,111,99,105,116,121,0,109,95,97,110,105,115,111,116,114,111,112,105,
+99,70,114,105,99,116,105,111,110,0,109,95,99,111,110,116,97,99,116,80,
+114,111,99,101,115,115,105,110,103,84,104,114,101,115,104,111,108,100,0,109,
+95,100,101,97,99,116,105,118,97,116,105,111,110,84,105,109,101,0,109,95,
+102,114,105,99,116,105,111,110,0,109,95,114,101,115,116,105,116,117,116,105,
+111,110,0,109,95,104,105,116,70,114,97,99,116,105,111,110,0,109,95,99,
+99,100,83,119,101,112,116,83,112,104,101,114,101,82,97,100,105,117,115,0,
+109,95,99,99,100,77,111,116,105,111,110,84,104,114,101,115,104,111,108,100,
+0,109,95,104,97,115,65,110,105,115,111,116,114,111,112,105,99,70,114,105,
+99,116,105,111,110,0,109,95,99,111,108,108,105,115,105,111,110,70,108,97,
+103,115,0,109,95,105,115,108,97,110,100,84,97,103,49,0,109,95,99,111,
+109,112,97,110,105,111,110,73,100,0,109,95,97,99,116,105,118,97,116,105,
+111,110,83,116,97,116,101,49,0,109,95,105,110,116,101,114,110,97,108,84,
+121,112,101,0,109,95,99,104,101,99,107,67,111,108,108,105,100,101,87,105,
+116,104,0,109,95,99,111,108,108,105,115,105,111,110,79,98,106,101,99,116,
+68,97,116,97,0,109,95,105,110,118,73,110,101,114,116,105,97,84,101,110,
+115,111,114,87,111,114,108,100,0,109,95,108,105,110,101,97,114,86,101,108,
+111,99,105,116,121,0,109,95,97,110,103,117,108,97,114,86,101,108,111,99,
+105,116,121,0,109,95,97,110,103,117,108,97,114,70,97,99,116,111,114,0,
+109,95,108,105,110,101,97,114,70,97,99,116,111,114,0,109,95,103,114,97,
+118,105,116,121,0,109,95,103,114,97,118,105,116,121,95,97,99,99,101,108,
+101,114,97,116,105,111,110,0,109,95,105,110,118,73,110,101,114,116,105,97,
+76,111,99,97,108,0,109,95,116,111,116,97,108,70,111,114,99,101,0,109,
+95,116,111,116,97,108,84,111,114,113,117,101,0,109,95,105,110,118,101,114,
+115,101,77,97,115,115,0,109,95,108,105,110,101,97,114,68,97,109,112,105,
+110,103,0,109,95,97,110,103,117,108,97,114,68,97,109,112,105,110,103,0,
+109,95,97,100,100,105,116,105,111,110,97,108,68,97,109,112,105,110,103,70,
+97,99,116,111,114,0,109,95,97,100,100,105,116,105,111,110,97,108,76,105,
+110,101,97,114,68,97,109,112,105,110,103,84,104,114,101,115,104,111,108,100,
+83,113,114,0,109,95,97,100,100,105,116,105,111,110,97,108,65,110,103,117,
+108,97,114,68,97,109,112,105,110,103,84,104,114,101,115,104,111,108,100,83,
+113,114,0,109,95,97,100,100,105,116,105,111,110,97,108,65,110,103,117,108,
+97,114,68,97,109,112,105,110,103,70,97,99,116,111,114,0,109,95,108,105,
+110,101,97,114,83,108,101,101,112,105,110,103,84,104,114,101,115,104,111,108,
+100,0,109,95,97,110,103,117,108,97,114,83,108,101,101,112,105,110,103,84,
+104,114,101,115,104,111,108,100,0,109,95,97,100,100,105,116,105,111,110,97,
+108,68,97,109,112,105,110,103,0,109,95,110,117,109,67,111,110,115,116,114,
+97,105,110,116,82,111,119,115,0,110,117,98,0,42,109,95,114,98,65,0,
+42,109,95,114,98,66,0,109,95,111,98,106,101,99,116,84,121,112,101,0,
+109,95,117,115,101,114,67,111,110,115,116,114,97,105,110,116,84,121,112,101,
+0,109,95,117,115,101,114,67,111,110,115,116,114,97,105,110,116,73,100,0,
+109,95,110,101,101,100,115,70,101,101,100,98,97,99,107,0,109,95,97,112,
+112,108,105,101,100,73,109,112,117,108,115,101,0,109,95,100,98,103,68,114,
+97,119,83,105,122,101,0,109,95,100,105,115,97,98,108,101,67,111,108,108,
+105,115,105,111,110,115,66,101,116,119,101,101,110,76,105,110,107,101,100,66,
+111,100,105,101,115,0,109,95,112,97,100,52,91,52,93,0,109,95,116,121,
+112,101,67,111,110,115,116,114,97,105,110,116,68,97,116,97,0,109,95,112,
+105,118,111,116,73,110,65,0,109,95,112,105,118,111,116,73,110,66,0,109,
+95,114,98,65,70,114,97,109,101,0,109,95,114,98,66,70,114,97,109,101,
+0,109,95,117,115,101,82,101,102,101,114,101,110,99,101,70,114,97,109,101,
+65,0,109,95,97,110,103,117,108,97,114,79,110,108,121,0,109,95,101,110,
+97,98,108,101,65,110,103,117,108,97,114,77,111,116,111,114,0,109,95,109,
+111,116,111,114,84,97,114,103,101,116,86,101,108,111,99,105,116,121,0,109,
+95,109,97,120,77,111,116,111,114,73,109,112,117,108,115,101,0,109,95,108,
+111,119,101,114,76,105,109,105,116,0,109,95,117,112,112,101,114,76,105,109,
+105,116,0,109,95,108,105,109,105,116,83,111,102,116,110,101,115,115,0,109,
+95,98,105,97,115,70,97,99,116,111,114,0,109,95,114,101,108,97,120,97,
+116,105,111,110,70,97,99,116,111,114,0,109,95,115,119,105,110,103,83,112,
+97,110,49,0,109,95,115,119,105,110,103,83,112,97,110,50,0,109,95,116,
+119,105,115,116,83,112,97,110,0,109,95,100,97,109,112,105,110,103,0,109,
+95,108,105,110,101,97,114,85,112,112,101,114,76,105,109,105,116,0,109,95,
+108,105,110,101,97,114,76,111,119,101,114,76,105,109,105,116,0,109,95,97,
+110,103,117,108,97,114,85,112,112,101,114,76,105,109,105,116,0,109,95,97,
+110,103,117,108,97,114,76,111,119,101,114,76,105,109,105,116,0,109,95,117,
+115,101,76,105,110,101,97,114,82,101,102,101,114,101,110,99,101,70,114,97,
+109,101,65,0,109,95,117,115,101,79,102,102,115,101,116,70,111,114,67,111,
+110,115,116,114,97,105,110,116,70,114,97,109,101,0,109,95,54,100,111,102,
+68,97,116,97,0,109,95,115,112,114,105,110,103,69,110,97,98,108,101,100,
+91,54,93,0,109,95,101,113,117,105,108,105,98,114,105,117,109,80,111,105,
+110,116,91,54,93,0,109,95,115,112,114,105,110,103,83,116,105,102,102,110,
+101,115,115,91,54,93,0,109,95,115,112,114,105,110,103,68,97,109,112,105,
+110,103,91,54,93,0,109,95,108,105,110,101,97,114,83,116,105,102,102,110,
+101,115,115,0,109,95,97,110,103,117,108,97,114,83,116,105,102,102,110,101,
+115,115,0,109,95,118,111,108,117,109,101,83,116,105,102,102,110,101,115,115,
+0,42,109,95,109,97,116,101,114,105,97,108,0,109,95,112,111,115,105,116,
+105,111,110,0,109,95,112,114,101,118,105,111,117,115,80,111,115,105,116,105,
+111,110,0,109,95,118,101,108,111,99,105,116,121,0,109,95,97,99,99,117,
+109,117,108,97,116,101,100,70,111,114,99,101,0,109,95,110,111,114,109,97,
+108,0,109,95,97,114,101,97,0,109,95,97,116,116,97,99,104,0,109,95,
+110,111,100,101,73,110,100,105,99,101,115,91,50,93,0,109,95,114,101,115,
+116,76,101,110,103,116,104,0,109,95,98,98,101,110,100,105,110,103,0,109,
+95,110,111,100,101,73,110,100,105,99,101,115,91,51,93,0,109,95,114,101,
+115,116,65,114,101,97,0,109,95,99,48,91,52,93,0,109,95,110,111,100,
+101,73,110,100,105,99,101,115,91,52,93,0,109,95,114,101,115,116,86,111,
+108,117,109,101,0,109,95,99,49,0,109,95,99,50,0,109,95,99,48,0,
+109,95,108,111,99,97,108,70,114,97,109,101,0,42,109,95,114,105,103,105,
+100,66,111,100,121,0,109,95,110,111,100,101,73,110,100,101,120,0,109,95,
+97,101,114,111,77,111,100,101,108,0,109,95,98,97,117,109,103,97,114,116,
+101,0,109,95,100,114,97,103,0,109,95,108,105,102,116,0,109,95,112,114,
+101,115,115,117,114,101,0,109,95,118,111,108,117,109,101,0,109,95,100,121,
+110,97,109,105,99,70,114,105,99,116,105,111,110,0,109,95,112,111,115,101,
+77,97,116,99,104,0,109,95,114,105,103,105,100,67,111,110,116,97,99,116,
+72,97,114,100,110,101,115,115,0,109,95,107,105,110,101,116,105,99,67,111,
+110,116,97,99,116,72,97,114,100,110,101,115,115,0,109,95,115,111,102,116,
+67,111,110,116,97,99,116,72,97,114,100,110,101,115,115,0,109,95,97,110,
+99,104,111,114,72,97,114,100,110,101,115,115,0,109,95,115,111,102,116,82,
+105,103,105,100,67,108,117,115,116,101,114,72,97,114,100,110,101,115,115,0,
+109,95,115,111,102,116,75,105,110,101,116,105,99,67,108,117,115,116,101,114,
+72,97,114,100,110,101,115,115,0,109,95,115,111,102,116,83,111,102,116,67,
+108,117,115,116,101,114,72,97,114,100,110,101,115,115,0,109,95,115,111,102,
+116,82,105,103,105,100,67,108,117,115,116,101,114,73,109,112,117,108,115,101,
+83,112,108,105,116,0,109,95,115,111,102,116,75,105,110,101,116,105,99,67,
+108,117,115,116,101,114,73,109,112,117,108,115,101,83,112,108,105,116,0,109,
+95,115,111,102,116,83,111,102,116,67,108,117,115,116,101,114,73,109,112,117,
+108,115,101,83,112,108,105,116,0,109,95,109,97,120,86,111,108,117,109,101,
+0,109,95,116,105,109,101,83,99,97,108,101,0,109,95,118,101,108,111,99,
+105,116,121,73,116,101,114,97,116,105,111,110,115,0,109,95,112,111,115,105,
+116,105,111,110,73,116,101,114,97,116,105,111,110,115,0,109,95,100,114,105,
+102,116,73,116,101,114,97,116,105,111,110,115,0,109,95,99,108,117,115,116,
+101,114,73,116,101,114,97,116,105,111,110,115,0,109,95,114,111,116,0,109,
+95,115,99,97,108,101,0,109,95,97,113,113,0,109,95,99,111,109,0,42,
+109,95,112,111,115,105,116,105,111,110,115,0,42,109,95,119,101,105,103,104,
+116,115,0,109,95,110,117,109,80,111,115,105,116,105,111,110,115,0,109,95,
+110,117,109,87,101,105,103,116,115,0,109,95,98,118,111,108,117,109,101,0,
+109,95,98,102,114,97,109,101,0,109,95,102,114,97,109,101,120,102,111,114,
+109,0,109,95,108,111,99,105,105,0,109,95,105,110,118,119,105,0,109,95,
+118,105,109,112,117,108,115,101,115,91,50,93,0,109,95,100,105,109,112,117,
+108,115,101,115,91,50,93,0,109,95,108,118,0,109,95,97,118,0,42,109,
+95,102,114,97,109,101,114,101,102,115,0,42,109,95,110,111,100,101,73,110,
+100,105,99,101,115,0,42,109,95,109,97,115,115,101,115,0,109,95,110,117,
+109,70,114,97,109,101,82,101,102,115,0,109,95,110,117,109,78,111,100,101,
+115,0,109,95,110,117,109,77,97,115,115,101,115,0,109,95,105,100,109,97,
+115,115,0,109,95,105,109,97,115,115,0,109,95,110,118,105,109,112,117,108,
+115,101,115,0,109,95,110,100,105,109,112,117,108,115,101,115,0,109,95,110,
+100,97,109,112,105,110,103,0,109,95,108,100,97,109,112,105,110,103,0,109,
+95,97,100,97,109,112,105,110,103,0,109,95,109,97,116,99,104,105,110,103,
+0,109,95,109,97,120,83,101,108,102,67,111,108,108,105,115,105,111,110,73,
+109,112,117,108,115,101,0,109,95,115,101,108,102,67,111,108,108,105,115,105,
+111,110,73,109,112,117,108,115,101,70,97,99,116,111,114,0,109,95,99,111,
+110,116,97,105,110,115,65,110,99,104,111,114,0,109,95,99,111,108,108,105,
+100,101,0,109,95,99,108,117,115,116,101,114,73,110,100,101,120,0,42,109,
+95,98,111,100,121,65,0,42,109,95,98,111,100,121,66,0,109,95,114,101,
+102,115,91,50,93,0,109,95,99,102,109,0,109,95,101,114,112,0,109,95,
+115,112,108,105,116,0,109,95,100,101,108,101,116,101,0,109,95,114,101,108,
+80,111,115,105,116,105,111,110,91,50,93,0,109,95,98,111,100,121,65,116,
+121,112,101,0,109,95,98,111,100,121,66,116,121,112,101,0,109,95,106,111,
+105,110,116,84,121,112,101,0,42,109,95,112,111,115,101,0,42,42,109,95,
+109,97,116,101,114,105,97,108,115,0,42,109,95,110,111,100,101,115,0,42,
+109,95,108,105,110,107,115,0,42,109,95,102,97,99,101,115,0,42,109,95,
+116,101,116,114,97,104,101,100,114,97,0,42,109,95,97,110,99,104,111,114,
+115,0,42,109,95,99,108,117,115,116,101,114,115,0,42,109,95,106,111,105,
+110,116,115,0,109,95,110,117,109,77,97,116,101,114,105,97,108,115,0,109,
+95,110,117,109,76,105,110,107,115,0,109,95,110,117,109,70,97,99,101,115,
+0,109,95,110,117,109,84,101,116,114,97,104,101,100,114,97,0,109,95,110,
+117,109,65,110,99,104,111,114,115,0,109,95,110,117,109,67,108,117,115,116,
+101,114,115,0,109,95,110,117,109,74,111,105,110,116,115,0,109,95,99,111,
+110,102,105,103,0,0,0,0,84,89,80,69,72,0,0,0,99,104,97,114,
+0,117,99,104,97,114,0,115,104,111,114,116,0,117,115,104,111,114,116,0,
+105,110,116,0,108,111,110,103,0,117,108,111,110,103,0,102,108,111,97,116,
+0,100,111,117,98,108,101,0,118,111,105,100,0,80,111,105,110,116,101,114,
+65,114,114,97,121,0,98,116,80,104,121,115,105,99,115,83,121,115,116,101,
+109,0,76,105,115,116,66,97,115,101,0,98,116,86,101,99,116,111,114,51,
+70,108,111,97,116,68,97,116,97,0,98,116,86,101,99,116,111,114,51,68,
+111,117,98,108,101,68,97,116,97,0,98,116,77,97,116,114,105,120,51,120,
+51,70,108,111,97,116,68,97,116,97,0,98,116,77,97,116,114,105,120,51,
+120,51,68,111,117,98,108,101,68,97,116,97,0,98,116,84,114,97,110,115,
+102,111,114,109,70,108,111,97,116,68,97,116,97,0,98,116,84,114,97,110,
+115,102,111,114,109,68,111,117,98,108,101,68,97,116,97,0,98,116,66,118,
+104,83,117,98,116,114,101,101,73,110,102,111,68,97,116,97,0,98,116,79,
+112,116,105,109,105,122,101,100,66,118,104,78,111,100,101,70,108,111,97,116,
68,97,116,97,0,98,116,79,112,116,105,109,105,122,101,100,66,118,104,78,
-111,100,101,70,108,111,97,116,68,97,116,97,0,98,116,79,112,116,105,109,
-105,122,101,100,66,118,104,78,111,100,101,68,111,117,98,108,101,68,97,116,
-97,0,98,116,81,117,97,110,116,105,122,101,100,66,118,104,78,111,100,101,
-68,97,116,97,0,98,116,81,117,97,110,116,105,122,101,100,66,118,104,70,
-108,111,97,116,68,97,116,97,0,98,116,81,117,97,110,116,105,122,101,100,
-66,118,104,68,111,117,98,108,101,68,97,116,97,0,98,116,67,111,108,108,
-105,115,105,111,110,83,104,97,112,101,68,97,116,97,0,98,116,83,116,97,
-116,105,99,80,108,97,110,101,83,104,97,112,101,68,97,116,97,0,98,116,
-67,111,110,118,101,120,73,110,116,101,114,110,97,108,83,104,97,112,101,68,
-97,116,97,0,98,116,80,111,115,105,116,105,111,110,65,110,100,82,97,100,
-105,117,115,0,98,116,77,117,108,116,105,83,112,104,101,114,101,83,104,97,
-112,101,68,97,116,97,0,98,116,73,110,116,73,110,100,101,120,68,97,116,
-97,0,98,116,83,104,111,114,116,73,110,116,73,110,100,101,120,68,97,116,
-97,0,98,116,83,104,111,114,116,73,110,116,73,110,100,101,120,84,114,105,
-112,108,101,116,68,97,116,97,0,98,116,77,101,115,104,80,97,114,116,68,
-97,116,97,0,98,116,83,116,114,105,100,105,110,103,77,101,115,104,73,110,
-116,101,114,102,97,99,101,68,97,116,97,0,98,116,84,114,105,97,110,103,
-108,101,77,101,115,104,83,104,97,112,101,68,97,116,97,0,98,116,84,114,
-105,97,110,103,108,101,73,110,102,111,77,97,112,68,97,116,97,0,98,116,
-67,111,109,112,111,117,110,100,83,104,97,112,101,67,104,105,108,100,68,97,
-116,97,0,98,116,67,111,109,112,111,117,110,100,83,104,97,112,101,68,97,
-116,97,0,98,116,67,121,108,105,110,100,101,114,83,104,97,112,101,68,97,
-116,97,0,98,116,67,97,112,115,117,108,101,83,104,97,112,101,68,97,116,
-97,0,98,116,84,114,105,97,110,103,108,101,73,110,102,111,68,97,116,97,
-0,98,116,71,73,109,112,97,99,116,77,101,115,104,83,104,97,112,101,68,
-97,116,97,0,98,116,67,111,110,118,101,120,72,117,108,108,83,104,97,112,
-101,68,97,116,97,0,98,116,67,111,108,108,105,115,105,111,110,79,98,106,
-101,99,116,68,111,117,98,108,101,68,97,116,97,0,98,116,67,111,108,108,
-105,115,105,111,110,79,98,106,101,99,116,70,108,111,97,116,68,97,116,97,
-0,98,116,82,105,103,105,100,66,111,100,121,70,108,111,97,116,68,97,116,
-97,0,98,116,82,105,103,105,100,66,111,100,121,68,111,117,98,108,101,68,
-97,116,97,0,98,116,67,111,110,115,116,114,97,105,110,116,73,110,102,111,
-49,0,98,116,84,121,112,101,100,67,111,110,115,116,114,97,105,110,116,68,
-97,116,97,0,98,116,82,105,103,105,100,66,111,100,121,68,97,116,97,0,
-98,116,80,111,105,110,116,50,80,111,105,110,116,67,111,110,115,116,114,97,
-105,110,116,70,108,111,97,116,68,97,116,97,0,98,116,80,111,105,110,116,
-50,80,111,105,110,116,67,111,110,115,116,114,97,105,110,116,68,111,117,98,
-108,101,68,97,116,97,0,98,116,72,105,110,103,101,67,111,110,115,116,114,
-97,105,110,116,68,111,117,98,108,101,68,97,116,97,0,98,116,72,105,110,
-103,101,67,111,110,115,116,114,97,105,110,116,70,108,111,97,116,68,97,116,
-97,0,98,116,67,111,110,101,84,119,105,115,116,67,111,110,115,116,114,97,
-105,110,116,68,97,116,97,0,98,116,71,101,110,101,114,105,99,54,68,111,
-102,67,111,110,115,116,114,97,105,110,116,68,97,116,97,0,98,116,83,108,
-105,100,101,114,67,111,110,115,116,114,97,105,110,116,68,97,116,97,0,0,
-84,76,69,78,1,0,1,0,2,0,2,0,4,0,4,0,4,0,4,0,
-8,0,0,0,12,0,36,0,8,0,16,0,32,0,48,0,96,0,64,0,
--128,0,20,0,48,0,80,0,16,0,84,0,-124,0,12,0,52,0,52,0,
-20,0,64,0,4,0,4,0,8,0,28,0,28,0,60,0,56,0,76,0,
-24,0,60,0,60,0,16,0,64,0,68,0,-56,1,-8,0,-32,1,-104,3,
-8,0,44,0,0,0,76,0,108,0,84,1,-44,0,-52,0,-12,0,-60,0,
-83,84,82,67,47,0,0,0,10,0,3,0,4,0,0,0,4,0,1,0,
-9,0,2,0,11,0,3,0,10,0,3,0,10,0,4,0,10,0,5,0,
-12,0,2,0,9,0,6,0,9,0,7,0,13,0,1,0,7,0,8,0,
-14,0,1,0,8,0,8,0,15,0,1,0,13,0,9,0,16,0,1,0,
-14,0,9,0,17,0,2,0,15,0,10,0,13,0,11,0,18,0,2,0,
-16,0,10,0,14,0,11,0,19,0,4,0,4,0,12,0,4,0,13,0,
-2,0,14,0,2,0,15,0,20,0,6,0,13,0,16,0,13,0,17,0,
-4,0,18,0,4,0,19,0,4,0,20,0,0,0,21,0,21,0,6,0,
-14,0,16,0,14,0,17,0,4,0,18,0,4,0,19,0,4,0,20,0,
-0,0,21,0,22,0,3,0,2,0,14,0,2,0,15,0,4,0,22,0,
-23,0,12,0,13,0,23,0,13,0,24,0,13,0,25,0,4,0,26,0,
-4,0,27,0,4,0,28,0,4,0,29,0,20,0,30,0,22,0,31,0,
-19,0,32,0,4,0,33,0,4,0,34,0,24,0,12,0,14,0,23,0,
-14,0,24,0,14,0,25,0,4,0,26,0,4,0,27,0,4,0,28,0,
-4,0,29,0,21,0,30,0,22,0,31,0,4,0,33,0,4,0,34,0,
-19,0,32,0,25,0,3,0,0,0,35,0,4,0,36,0,0,0,37,0,
-26,0,5,0,25,0,38,0,13,0,39,0,13,0,40,0,7,0,41,0,
-0,0,21,0,27,0,5,0,25,0,38,0,13,0,39,0,13,0,42,0,
-7,0,43,0,4,0,44,0,28,0,2,0,13,0,45,0,7,0,46,0,
-29,0,4,0,27,0,47,0,28,0,48,0,4,0,49,0,0,0,37,0,
-30,0,1,0,4,0,50,0,31,0,2,0,2,0,50,0,0,0,51,0,
-32,0,2,0,2,0,52,0,0,0,51,0,33,0,7,0,13,0,53,0,
-14,0,54,0,30,0,55,0,32,0,56,0,31,0,57,0,4,0,58,0,
-4,0,59,0,34,0,4,0,33,0,60,0,13,0,61,0,4,0,62,0,
-0,0,37,0,35,0,7,0,25,0,38,0,34,0,63,0,23,0,64,0,
-24,0,65,0,36,0,66,0,7,0,43,0,0,0,67,0,37,0,4,0,
-17,0,68,0,25,0,69,0,4,0,70,0,7,0,71,0,38,0,4,0,
-25,0,38,0,37,0,72,0,4,0,73,0,7,0,43,0,39,0,3,0,
-27,0,47,0,4,0,74,0,0,0,37,0,40,0,3,0,27,0,47,0,
-4,0,74,0,0,0,37,0,41,0,4,0,4,0,75,0,7,0,76,0,
-7,0,77,0,7,0,78,0,36,0,14,0,4,0,79,0,4,0,80,0,
-41,0,81,0,4,0,82,0,7,0,83,0,7,0,84,0,7,0,85,0,
-7,0,86,0,7,0,87,0,4,0,88,0,4,0,89,0,4,0,90,0,
-4,0,91,0,0,0,37,0,42,0,5,0,25,0,38,0,34,0,63,0,
-13,0,39,0,7,0,43,0,4,0,92,0,43,0,5,0,27,0,47,0,
-13,0,93,0,14,0,94,0,4,0,95,0,0,0,96,0,44,0,24,0,
-9,0,97,0,9,0,98,0,25,0,99,0,0,0,35,0,18,0,100,0,
-18,0,101,0,14,0,102,0,14,0,103,0,14,0,104,0,8,0,105,0,
-8,0,106,0,8,0,107,0,8,0,108,0,8,0,109,0,8,0,110,0,
-8,0,111,0,4,0,112,0,4,0,113,0,4,0,114,0,4,0,115,0,
-4,0,116,0,4,0,117,0,4,0,118,0,0,0,37,0,45,0,23,0,
-9,0,97,0,9,0,98,0,25,0,99,0,0,0,35,0,17,0,100,0,
-17,0,101,0,13,0,102,0,13,0,103,0,13,0,104,0,7,0,105,0,
-7,0,106,0,7,0,107,0,7,0,108,0,7,0,109,0,7,0,110,0,
-7,0,111,0,4,0,112,0,4,0,113,0,4,0,114,0,4,0,115,0,
-4,0,116,0,4,0,117,0,4,0,118,0,46,0,21,0,45,0,119,0,
-15,0,120,0,13,0,121,0,13,0,122,0,13,0,123,0,13,0,124,0,
-13,0,125,0,13,0,126,0,13,0,127,0,13,0,-128,0,13,0,-127,0,
-7,0,-126,0,7,0,-125,0,7,0,-124,0,7,0,-123,0,7,0,-122,0,
-7,0,-121,0,7,0,-120,0,7,0,-119,0,7,0,-118,0,4,0,-117,0,
-47,0,22,0,44,0,119,0,16,0,120,0,14,0,121,0,14,0,122,0,
-14,0,123,0,14,0,124,0,14,0,125,0,14,0,126,0,14,0,127,0,
-14,0,-128,0,14,0,-127,0,8,0,-126,0,8,0,-125,0,8,0,-124,0,
-8,0,-123,0,8,0,-122,0,8,0,-121,0,8,0,-120,0,8,0,-119,0,
-8,0,-118,0,4,0,-117,0,0,0,37,0,48,0,2,0,4,0,-116,0,
-4,0,-115,0,49,0,11,0,50,0,-114,0,50,0,-113,0,0,0,35,0,
-4,0,-112,0,4,0,-111,0,4,0,-110,0,4,0,-109,0,7,0,-108,0,
-7,0,-107,0,4,0,-106,0,0,0,-105,0,51,0,3,0,49,0,-104,0,
-13,0,-103,0,13,0,-102,0,52,0,3,0,49,0,-104,0,14,0,-103,0,
-14,0,-102,0,53,0,13,0,49,0,-104,0,18,0,-101,0,18,0,-100,0,
-4,0,-99,0,4,0,-98,0,4,0,-97,0,7,0,-96,0,7,0,-95,0,
-7,0,-94,0,7,0,-93,0,7,0,-92,0,7,0,-91,0,7,0,-90,0,
-54,0,13,0,49,0,-104,0,17,0,-101,0,17,0,-100,0,4,0,-99,0,
-4,0,-98,0,4,0,-97,0,7,0,-96,0,7,0,-95,0,7,0,-94,0,
-7,0,-93,0,7,0,-92,0,7,0,-91,0,7,0,-90,0,55,0,11,0,
-49,0,-104,0,17,0,-101,0,17,0,-100,0,7,0,-89,0,7,0,-88,0,
-7,0,-87,0,7,0,-92,0,7,0,-91,0,7,0,-90,0,7,0,-86,0,
-0,0,21,0,56,0,9,0,49,0,-104,0,17,0,-101,0,17,0,-100,0,
-13,0,-85,0,13,0,-84,0,13,0,-83,0,13,0,-82,0,4,0,-81,0,
-4,0,-80,0,57,0,9,0,49,0,-104,0,17,0,-101,0,17,0,-100,0,
-7,0,-85,0,7,0,-84,0,7,0,-83,0,7,0,-82,0,4,0,-81,0,
-4,0,-80,0,};
-int sBulletDNAlen= sizeof(sBulletDNAstr);
+111,100,101,68,111,117,98,108,101,68,97,116,97,0,98,116,81,117,97,110,
+116,105,122,101,100,66,118,104,78,111,100,101,68,97,116,97,0,98,116,81,
+117,97,110,116,105,122,101,100,66,118,104,70,108,111,97,116,68,97,116,97,
+0,98,116,81,117,97,110,116,105,122,101,100,66,118,104,68,111,117,98,108,
+101,68,97,116,97,0,98,116,67,111,108,108,105,115,105,111,110,83,104,97,
+112,101,68,97,116,97,0,98,116,83,116,97,116,105,99,80,108,97,110,101,
+83,104,97,112,101,68,97,116,97,0,98,116,67,111,110,118,101,120,73,110,
+116,101,114,110,97,108,83,104,97,112,101,68,97,116,97,0,98,116,80,111,
+115,105,116,105,111,110,65,110,100,82,97,100,105,117,115,0,98,116,77,117,
+108,116,105,83,112,104,101,114,101,83,104,97,112,101,68,97,116,97,0,98,
+116,73,110,116,73,110,100,101,120,68,97,116,97,0,98,116,83,104,111,114,
+116,73,110,116,73,110,100,101,120,68,97,116,97,0,98,116,83,104,111,114,
+116,73,110,116,73,110,100,101,120,84,114,105,112,108,101,116,68,97,116,97,
+0,98,116,67,104,97,114,73,110,100,101,120,84,114,105,112,108,101,116,68,
+97,116,97,0,98,116,77,101,115,104,80,97,114,116,68,97,116,97,0,98,
+116,83,116,114,105,100,105,110,103,77,101,115,104,73,110,116,101,114,102,97,
+99,101,68,97,116,97,0,98,116,84,114,105,97,110,103,108,101,77,101,115,
+104,83,104,97,112,101,68,97,116,97,0,98,116,84,114,105,97,110,103,108,
+101,73,110,102,111,77,97,112,68,97,116,97,0,98,116,83,99,97,108,101,
+100,84,114,105,97,110,103,108,101,77,101,115,104,83,104,97,112,101,68,97,
+116,97,0,98,116,67,111,109,112,111,117,110,100,83,104,97,112,101,67,104,
+105,108,100,68,97,116,97,0,98,116,67,111,109,112,111,117,110,100,83,104,
+97,112,101,68,97,116,97,0,98,116,67,121,108,105,110,100,101,114,83,104,
+97,112,101,68,97,116,97,0,98,116,67,97,112,115,117,108,101,83,104,97,
+112,101,68,97,116,97,0,98,116,84,114,105,97,110,103,108,101,73,110,102,
+111,68,97,116,97,0,98,116,71,73,109,112,97,99,116,77,101,115,104,83,
+104,97,112,101,68,97,116,97,0,98,116,67,111,110,118,101,120,72,117,108,
+108,83,104,97,112,101,68,97,116,97,0,98,116,67,111,108,108,105,115,105,
+111,110,79,98,106,101,99,116,68,111,117,98,108,101,68,97,116,97,0,98,
+116,67,111,108,108,105,115,105,111,110,79,98,106,101,99,116,70,108,111,97,
+116,68,97,116,97,0,98,116,82,105,103,105,100,66,111,100,121,70,108,111,
+97,116,68,97,116,97,0,98,116,82,105,103,105,100,66,111,100,121,68,111,
+117,98,108,101,68,97,116,97,0,98,116,67,111,110,115,116,114,97,105,110,
+116,73,110,102,111,49,0,98,116,84,121,112,101,100,67,111,110,115,116,114,
+97,105,110,116,68,97,116,97,0,98,116,82,105,103,105,100,66,111,100,121,
+68,97,116,97,0,98,116,80,111,105,110,116,50,80,111,105,110,116,67,111,
+110,115,116,114,97,105,110,116,70,108,111,97,116,68,97,116,97,0,98,116,
+80,111,105,110,116,50,80,111,105,110,116,67,111,110,115,116,114,97,105,110,
+116,68,111,117,98,108,101,68,97,116,97,0,98,116,72,105,110,103,101,67,
+111,110,115,116,114,97,105,110,116,68,111,117,98,108,101,68,97,116,97,0,
+98,116,72,105,110,103,101,67,111,110,115,116,114,97,105,110,116,70,108,111,
+97,116,68,97,116,97,0,98,116,67,111,110,101,84,119,105,115,116,67,111,
+110,115,116,114,97,105,110,116,68,97,116,97,0,98,116,71,101,110,101,114,
+105,99,54,68,111,102,67,111,110,115,116,114,97,105,110,116,68,97,116,97,
+0,98,116,71,101,110,101,114,105,99,54,68,111,102,83,112,114,105,110,103,
+67,111,110,115,116,114,97,105,110,116,68,97,116,97,0,98,116,83,108,105,
+100,101,114,67,111,110,115,116,114,97,105,110,116,68,97,116,97,0,83,111,
+102,116,66,111,100,121,77,97,116,101,114,105,97,108,68,97,116,97,0,83,
+111,102,116,66,111,100,121,78,111,100,101,68,97,116,97,0,83,111,102,116,
+66,111,100,121,76,105,110,107,68,97,116,97,0,83,111,102,116,66,111,100,
+121,70,97,99,101,68,97,116,97,0,83,111,102,116,66,111,100,121,84,101,
+116,114,97,68,97,116,97,0,83,111,102,116,82,105,103,105,100,65,110,99,
+104,111,114,68,97,116,97,0,83,111,102,116,66,111,100,121,67,111,110,102,
+105,103,68,97,116,97,0,83,111,102,116,66,111,100,121,80,111,115,101,68,
+97,116,97,0,83,111,102,116,66,111,100,121,67,108,117,115,116,101,114,68,
+97,116,97,0,98,116,83,111,102,116,66,111,100,121,74,111,105,110,116,68,
+97,116,97,0,98,116,83,111,102,116,66,111,100,121,70,108,111,97,116,68,
+97,116,97,0,84,76,69,78,1,0,1,0,2,0,2,0,4,0,4,0,
+4,0,4,0,8,0,0,0,16,0,48,0,16,0,16,0,32,0,48,0,
+96,0,64,0,-128,0,20,0,48,0,80,0,16,0,96,0,-112,0,16,0,
+56,0,56,0,20,0,72,0,4,0,4,0,8,0,4,0,56,0,32,0,
+80,0,72,0,96,0,80,0,32,0,64,0,64,0,16,0,72,0,80,0,
+-40,1,8,1,-16,1,-88,3,8,0,56,0,0,0,88,0,120,0,96,1,
+-32,0,-40,0,0,1,96,1,-48,0,16,0,104,0,24,0,40,0,104,0,
+96,0,104,0,-56,0,104,1,112,0,-40,1,83,84,82,67,61,0,0,0,
+10,0,3,0,4,0,0,0,4,0,1,0,9,0,2,0,11,0,3,0,
+10,0,3,0,10,0,4,0,10,0,5,0,12,0,2,0,9,0,6,0,
+9,0,7,0,13,0,1,0,7,0,8,0,14,0,1,0,8,0,8,0,
+15,0,1,0,13,0,9,0,16,0,1,0,14,0,9,0,17,0,2,0,
+15,0,10,0,13,0,11,0,18,0,2,0,16,0,10,0,14,0,11,0,
+19,0,4,0,4,0,12,0,4,0,13,0,2,0,14,0,2,0,15,0,
+20,0,6,0,13,0,16,0,13,0,17,0,4,0,18,0,4,0,19,0,
+4,0,20,0,0,0,21,0,21,0,6,0,14,0,16,0,14,0,17,0,
+4,0,18,0,4,0,19,0,4,0,20,0,0,0,21,0,22,0,3,0,
+2,0,14,0,2,0,15,0,4,0,22,0,23,0,12,0,13,0,23,0,
+13,0,24,0,13,0,25,0,4,0,26,0,4,0,27,0,4,0,28,0,
+4,0,29,0,20,0,30,0,22,0,31,0,19,0,32,0,4,0,33,0,
+4,0,34,0,24,0,12,0,14,0,23,0,14,0,24,0,14,0,25,0,
+4,0,26,0,4,0,27,0,4,0,28,0,4,0,29,0,21,0,30,0,
+22,0,31,0,4,0,33,0,4,0,34,0,19,0,32,0,25,0,3,0,
+0,0,35,0,4,0,36,0,0,0,37,0,26,0,5,0,25,0,38,0,
+13,0,39,0,13,0,40,0,7,0,41,0,0,0,21,0,27,0,5,0,
+25,0,38,0,13,0,39,0,13,0,42,0,7,0,43,0,4,0,44,0,
+28,0,2,0,13,0,45,0,7,0,46,0,29,0,4,0,27,0,47,0,
+28,0,48,0,4,0,49,0,0,0,37,0,30,0,1,0,4,0,50,0,
+31,0,2,0,2,0,50,0,0,0,51,0,32,0,2,0,2,0,52,0,
+0,0,51,0,33,0,2,0,0,0,52,0,0,0,53,0,34,0,8,0,
+13,0,54,0,14,0,55,0,30,0,56,0,32,0,57,0,33,0,58,0,
+31,0,59,0,4,0,60,0,4,0,61,0,35,0,4,0,34,0,62,0,
+13,0,63,0,4,0,64,0,0,0,37,0,36,0,7,0,25,0,38,0,
+35,0,65,0,23,0,66,0,24,0,67,0,37,0,68,0,7,0,43,0,
+0,0,69,0,38,0,2,0,36,0,70,0,13,0,39,0,39,0,4,0,
+17,0,71,0,25,0,72,0,4,0,73,0,7,0,74,0,40,0,4,0,
+25,0,38,0,39,0,75,0,4,0,76,0,7,0,43,0,41,0,3,0,
+27,0,47,0,4,0,77,0,0,0,37,0,42,0,3,0,27,0,47,0,
+4,0,77,0,0,0,37,0,43,0,4,0,4,0,78,0,7,0,79,0,
+7,0,80,0,7,0,81,0,37,0,14,0,4,0,82,0,4,0,83,0,
+43,0,84,0,4,0,85,0,7,0,86,0,7,0,87,0,7,0,88,0,
+7,0,89,0,7,0,90,0,4,0,91,0,4,0,92,0,4,0,93,0,
+4,0,94,0,0,0,37,0,44,0,5,0,25,0,38,0,35,0,65,0,
+13,0,39,0,7,0,43,0,4,0,95,0,45,0,5,0,27,0,47,0,
+13,0,96,0,14,0,97,0,4,0,98,0,0,0,99,0,46,0,24,0,
+9,0,100,0,9,0,101,0,25,0,102,0,0,0,35,0,18,0,103,0,
+18,0,104,0,14,0,105,0,14,0,106,0,14,0,107,0,8,0,108,0,
+8,0,109,0,8,0,110,0,8,0,111,0,8,0,112,0,8,0,113,0,
+8,0,114,0,4,0,115,0,4,0,116,0,4,0,117,0,4,0,118,0,
+4,0,119,0,4,0,120,0,4,0,121,0,0,0,37,0,47,0,23,0,
+9,0,100,0,9,0,101,0,25,0,102,0,0,0,35,0,17,0,103,0,
+17,0,104,0,13,0,105,0,13,0,106,0,13,0,107,0,7,0,108,0,
+7,0,109,0,7,0,110,0,7,0,111,0,7,0,112,0,7,0,113,0,
+7,0,114,0,4,0,115,0,4,0,116,0,4,0,117,0,4,0,118,0,
+4,0,119,0,4,0,120,0,4,0,121,0,48,0,21,0,47,0,122,0,
+15,0,123,0,13,0,124,0,13,0,125,0,13,0,126,0,13,0,127,0,
+13,0,-128,0,13,0,-127,0,13,0,-126,0,13,0,-125,0,13,0,-124,0,
+7,0,-123,0,7,0,-122,0,7,0,-121,0,7,0,-120,0,7,0,-119,0,
+7,0,-118,0,7,0,-117,0,7,0,-116,0,7,0,-115,0,4,0,-114,0,
+49,0,22,0,46,0,122,0,16,0,123,0,14,0,124,0,14,0,125,0,
+14,0,126,0,14,0,127,0,14,0,-128,0,14,0,-127,0,14,0,-126,0,
+14,0,-125,0,14,0,-124,0,8,0,-123,0,8,0,-122,0,8,0,-121,0,
+8,0,-120,0,8,0,-119,0,8,0,-118,0,8,0,-117,0,8,0,-116,0,
+8,0,-115,0,4,0,-114,0,0,0,37,0,50,0,2,0,4,0,-113,0,
+4,0,-112,0,51,0,11,0,52,0,-111,0,52,0,-110,0,0,0,35,0,
+4,0,-109,0,4,0,-108,0,4,0,-107,0,4,0,-106,0,7,0,-105,0,
+7,0,-104,0,4,0,-103,0,0,0,-102,0,53,0,3,0,51,0,-101,0,
+13,0,-100,0,13,0,-99,0,54,0,3,0,51,0,-101,0,14,0,-100,0,
+14,0,-99,0,55,0,13,0,51,0,-101,0,18,0,-98,0,18,0,-97,0,
+4,0,-96,0,4,0,-95,0,4,0,-94,0,7,0,-93,0,7,0,-92,0,
+7,0,-91,0,7,0,-90,0,7,0,-89,0,7,0,-88,0,7,0,-87,0,
+56,0,13,0,51,0,-101,0,17,0,-98,0,17,0,-97,0,4,0,-96,0,
+4,0,-95,0,4,0,-94,0,7,0,-93,0,7,0,-92,0,7,0,-91,0,
+7,0,-90,0,7,0,-89,0,7,0,-88,0,7,0,-87,0,57,0,11,0,
+51,0,-101,0,17,0,-98,0,17,0,-97,0,7,0,-86,0,7,0,-85,0,
+7,0,-84,0,7,0,-89,0,7,0,-88,0,7,0,-87,0,7,0,-83,0,
+0,0,21,0,58,0,9,0,51,0,-101,0,17,0,-98,0,17,0,-97,0,
+13,0,-82,0,13,0,-81,0,13,0,-80,0,13,0,-79,0,4,0,-78,0,
+4,0,-77,0,59,0,5,0,58,0,-76,0,4,0,-75,0,7,0,-74,0,
+7,0,-73,0,7,0,-72,0,60,0,9,0,51,0,-101,0,17,0,-98,0,
+17,0,-97,0,7,0,-82,0,7,0,-81,0,7,0,-80,0,7,0,-79,0,
+4,0,-78,0,4,0,-77,0,61,0,4,0,7,0,-71,0,7,0,-70,0,
+7,0,-69,0,4,0,78,0,62,0,10,0,61,0,-68,0,13,0,-67,0,
+13,0,-66,0,13,0,-65,0,13,0,-64,0,13,0,-63,0,7,0,-123,0,
+7,0,-62,0,4,0,-61,0,4,0,53,0,63,0,4,0,61,0,-68,0,
+4,0,-60,0,7,0,-59,0,4,0,-58,0,64,0,4,0,13,0,-63,0,
+61,0,-68,0,4,0,-57,0,7,0,-56,0,65,0,7,0,13,0,-55,0,
+61,0,-68,0,4,0,-54,0,7,0,-53,0,7,0,-52,0,7,0,-51,0,
+4,0,53,0,66,0,6,0,15,0,-50,0,13,0,-52,0,13,0,-49,0,
+52,0,-48,0,4,0,-47,0,7,0,-51,0,67,0,26,0,4,0,-46,0,
+7,0,-45,0,7,0,-83,0,7,0,-44,0,7,0,-43,0,7,0,-42,0,
+7,0,-41,0,7,0,-40,0,7,0,-39,0,7,0,-38,0,7,0,-37,0,
+7,0,-36,0,7,0,-35,0,7,0,-34,0,7,0,-33,0,7,0,-32,0,
+7,0,-31,0,7,0,-30,0,7,0,-29,0,7,0,-28,0,7,0,-27,0,
+4,0,-26,0,4,0,-25,0,4,0,-24,0,4,0,-23,0,4,0,116,0,
+68,0,12,0,15,0,-22,0,15,0,-21,0,15,0,-20,0,13,0,-19,0,
+13,0,-18,0,7,0,-17,0,4,0,-16,0,4,0,-15,0,4,0,-14,0,
+4,0,-13,0,7,0,-53,0,4,0,53,0,69,0,27,0,17,0,-12,0,
+15,0,-11,0,15,0,-10,0,13,0,-19,0,13,0,-9,0,13,0,-8,0,
+13,0,-7,0,13,0,-6,0,13,0,-5,0,4,0,-4,0,7,0,-3,0,
+4,0,-2,0,4,0,-1,0,4,0,0,1,7,0,1,1,7,0,2,1,
+4,0,3,1,4,0,4,1,7,0,5,1,7,0,6,1,7,0,7,1,
+7,0,8,1,7,0,9,1,7,0,10,1,4,0,11,1,4,0,12,1,
+4,0,13,1,70,0,12,0,9,0,14,1,9,0,15,1,13,0,16,1,
+7,0,17,1,7,0,18,1,7,0,19,1,4,0,20,1,13,0,21,1,
+4,0,22,1,4,0,23,1,4,0,24,1,4,0,53,0,71,0,19,0,
+47,0,122,0,68,0,25,1,61,0,26,1,62,0,27,1,63,0,28,1,
+64,0,29,1,65,0,30,1,66,0,31,1,69,0,32,1,70,0,33,1,
+4,0,34,1,4,0,-1,0,4,0,35,1,4,0,36,1,4,0,37,1,
+4,0,38,1,4,0,39,1,4,0,40,1,67,0,41,1,};
+int sBulletDNAlen64= sizeof(sBulletDNAstr64);
Modified: code/trunk/src/external/bullet/LinearMath/btSerializer.h
===================================================================
--- code/trunk/src/external/bullet/LinearMath/btSerializer.h 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/LinearMath/btSerializer.h 2011-05-03 03:07:42 UTC (rev 8393)
@@ -111,6 +111,7 @@
# define MAKE_ID(a,b,c,d) ( (int)(d)<<24 | (int)(c)<<16 | (b)<<8 | (a) )
#endif
+#define BT_SOFTBODY_CODE MAKE_ID('S','B','D','Y')
#define BT_COLLISIONOBJECT_CODE MAKE_ID('C','O','B','J')
#define BT_RIGIDBODY_CODE MAKE_ID('R','B','D','Y')
#define BT_CONSTRAINT_CODE MAKE_ID('C','O','N','S')
@@ -119,10 +120,11 @@
#define BT_TRIANLGE_INFO_MAP MAKE_ID('T','M','A','P')
#define BT_SHAPE_CODE MAKE_ID('S','H','A','P')
#define BT_ARRAY_CODE MAKE_ID('A','R','A','Y')
+#define BT_SBMATERIAL_CODE MAKE_ID('S','B','M','T')
+#define BT_SBNODE_CODE MAKE_ID('S','B','N','D')
#define BT_DNA_CODE MAKE_ID('D','N','A','1')
-
struct btPointerUid
{
union
@@ -132,7 +134,8 @@
};
};
-
+///The btDefaultSerializer is the main Bullet serialization class.
+///The constructor takes an optional argument for backwards compatibility, it is recommended to leave this empty/zero.
class btDefaultSerializer : public btSerializer
{
@@ -371,14 +374,14 @@
- btDefaultSerializer(int totalSize)
+ btDefaultSerializer(int totalSize=0)
:m_totalSize(totalSize),
m_currentSize(0),
m_dna(0),
m_dnaLength(0),
m_serializationFlags(0)
{
- m_buffer = (unsigned char*)btAlignedAlloc(totalSize, 16);
+ m_buffer = m_totalSize?(unsigned char*)btAlignedAlloc(totalSize,16):0;
const bool VOID_IS_8 = ((sizeof(void*)==8));
@@ -419,16 +422,14 @@
btAlignedFree(m_dna);
}
- virtual void startSerialization()
+ void writeHeader(unsigned char* buffer) const
{
- m_uniqueIdGenerator= 1;
+
- m_currentSize = BT_HEADER_LENGTH;
-
#ifdef BT_USE_DOUBLE_PRECISION
- memcpy(m_buffer, "BULLETd", 7);
+ memcpy(buffer, "BULLETd", 7);
#else
- memcpy(m_buffer, "BULLETf", 7);
+ memcpy(buffer, "BULLETf", 7);
#endif //BT_USE_DOUBLE_PRECISION
int littleEndian= 1;
@@ -436,25 +437,35 @@
if (sizeof(void*)==8)
{
- m_buffer[7] = '-';
+ buffer[7] = '-';
} else
{
- m_buffer[7] = '_';
+ buffer[7] = '_';
}
if (littleEndian)
{
- m_buffer[8]='v';
+ buffer[8]='v';
} else
{
- m_buffer[8]='V';
+ buffer[8]='V';
}
- m_buffer[9] = '2';
- m_buffer[10] = '7';
- m_buffer[11] = '7';
+ buffer[9] = '2';
+ buffer[10] = '7';
+ buffer[11] = '8';
+ }
+
+ virtual void startSerialization()
+ {
+ m_uniqueIdGenerator= 1;
+ if (m_totalSize)
+ {
+ unsigned char* buffer = internalAlloc(BT_HEADER_LENGTH);
+ writeHeader(buffer);
+ }
}
@@ -462,7 +473,30 @@
{
writeDNA();
+ //if we didn't pre-allocate a buffer, we need to create a contiguous buffer now
+ int mysize = 0;
+ if (!m_totalSize)
+ {
+ if (m_buffer)
+ btAlignedFree(m_buffer);
+ m_currentSize += BT_HEADER_LENGTH;
+ m_buffer = (unsigned char*)btAlignedAlloc(m_currentSize,16);
+
+ unsigned char* currentPtr = m_buffer;
+ writeHeader(m_buffer);
+ currentPtr += BT_HEADER_LENGTH;
+ mysize+=BT_HEADER_LENGTH;
+ for (int i=0;i< m_chunkPtrs.size();i++)
+ {
+ int curLength = sizeof(btChunk)+m_chunkPtrs[i]->m_length;
+ memcpy(currentPtr,m_chunkPtrs[i], curLength);
+ btAlignedFree(m_chunkPtrs[i]);
+ currentPtr+=curLength;
+ mysize+=curLength;
+ }
+ }
+
mTypes.clear();
mStructs.clear();
mTlens.clear();
@@ -471,6 +505,7 @@
m_chunkP.clear();
m_nameMap.clear();
m_uniquePointers.clear();
+ m_chunkPtrs.clear();
}
virtual void* getUniquePointer(void*oldPtr)
@@ -522,15 +557,29 @@
}
+ virtual unsigned char* internalAlloc(size_t size)
+ {
+ unsigned char* ptr = 0;
+ if (m_totalSize)
+ {
+ ptr = m_buffer+m_currentSize;
+ m_currentSize += int(size);
+ btAssert(m_currentSize<m_totalSize);
+ } else
+ {
+ ptr = (unsigned char*)btAlignedAlloc(size,16);
+ m_currentSize += int(size);
+ }
+ return ptr;
+ }
+
virtual btChunk* allocate(size_t size, int numElements)
{
- unsigned char* ptr = m_buffer+m_currentSize;
- m_currentSize += int(size)*numElements+sizeof(btChunk);
- btAssert(m_currentSize<m_totalSize);
+ unsigned char* ptr = internalAlloc(int(size)*numElements+sizeof(btChunk));
unsigned char* data = ptr + sizeof(btChunk);
Modified: code/trunk/src/external/bullet/LinearMath/btTransform.h
===================================================================
--- code/trunk/src/external/bullet/LinearMath/btTransform.h 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/LinearMath/btTransform.h 2011-05-03 03:07:42 UTC (rev 8393)
@@ -14,8 +14,8 @@
-#ifndef btTransform_H
-#define btTransform_H
+#ifndef BT_TRANSFORM_H
+#define BT_TRANSFORM_H
#include "btMatrix3x3.h"
@@ -298,7 +298,7 @@
}
-#endif
+#endif //BT_TRANSFORM_H
Modified: code/trunk/src/external/bullet/LinearMath/btTransformUtil.h
===================================================================
--- code/trunk/src/external/bullet/LinearMath/btTransformUtil.h 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/LinearMath/btTransformUtil.h 2011-05-03 03:07:42 UTC (rev 8393)
@@ -13,8 +13,8 @@
*/
-#ifndef SIMD_TRANSFORM_UTIL_H
-#define SIMD_TRANSFORM_UTIL_H
+#ifndef BT_TRANSFORM_UTIL_H
+#define BT_TRANSFORM_UTIL_H
#include "btTransform.h"
#define ANGULAR_MOTION_THRESHOLD btScalar(0.5)*SIMD_HALF_PI
@@ -224,5 +224,5 @@
};
-#endif //SIMD_TRANSFORM_UTIL_H
+#endif //BT_TRANSFORM_UTIL_H
Modified: code/trunk/src/external/bullet/LinearMath/btVector3.h
===================================================================
--- code/trunk/src/external/bullet/LinearMath/btVector3.h 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/LinearMath/btVector3.h 2011-05-03 03:07:42 UTC (rev 8393)
@@ -14,8 +14,8 @@
-#ifndef SIMD__VECTOR3_H
-#define SIMD__VECTOR3_H
+#ifndef BT_VECTOR3_H
+#define BT_VECTOR3_H
#include "btScalar.h"
@@ -763,4 +763,4 @@
}
-#endif //SIMD__VECTOR3_H
+#endif //BT_VECTOR3_H
Modified: code/trunk/src/external/bullet/VERSION
===================================================================
--- code/trunk/src/external/bullet/VERSION 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/VERSION 2011-05-03 03:07:42 UTC (rev 8393)
@@ -1 +1 @@
-2.77
+2.78
Modified: code/trunk/src/external/bullet/btBulletCollisionCommon.h
===================================================================
--- code/trunk/src/external/bullet/btBulletCollisionCommon.h 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/btBulletCollisionCommon.h 2011-05-03 03:07:42 UTC (rev 8393)
@@ -33,6 +33,7 @@
#include "BulletCollision/CollisionShapes/btTriangleMesh.h"
#include "BulletCollision/CollisionShapes/btConvexTriangleMeshShape.h"
#include "BulletCollision/CollisionShapes/btBvhTriangleMeshShape.h"
+#include "BulletCollision/CollisionShapes/btScaledBvhTriangleMeshShape.h"
#include "BulletCollision/CollisionShapes/btTriangleMeshShape.h"
#include "BulletCollision/CollisionShapes/btTriangleIndexVertexArray.h"
#include "BulletCollision/CollisionShapes/btCompoundShape.h"
Modified: code/trunk/src/external/bullet/changes_orxonox.diff
===================================================================
--- code/trunk/src/external/bullet/changes_orxonox.diff 2011-05-02 21:53:18 UTC (rev 8392)
+++ code/trunk/src/external/bullet/changes_orxonox.diff 2011-05-03 03:07:42 UTC (rev 8393)
@@ -1,15 +1 @@
---- LinearMath/btScalar.h Tue Aug 10 13:19:44 2010
-+++ LinearMath/btScalar.h Sun Feb 27 01:27:34 2011
-@@ -286,7 +286,11 @@
- SIMD_FORCE_INLINE btScalar btAtan2(btScalar x, btScalar y) { return atan2f(x, y); }
- SIMD_FORCE_INLINE btScalar btExp(btScalar x) { return expf(x); }
- SIMD_FORCE_INLINE btScalar btLog(btScalar x) { return logf(x); }
--SIMD_FORCE_INLINE btScalar btPow(btScalar x,btScalar y) { return powf(x,y); }
-+ #if defined( __MINGW32__ )
-+ SIMD_FORCE_INLINE btScalar btPow(btScalar x,btScalar y) { return pow(x,y); }
-+ #else
-+ SIMD_FORCE_INLINE btScalar btPow(btScalar x,btScalar y) { return powf(x,y); }
-+ #endif
- SIMD_FORCE_INLINE btScalar btFmod(btScalar x,btScalar y) { return fmodf(x,y); }
-
- #endif
+
More information about the Orxonox-commit
mailing list