Add the old Bullet 2.x obsolete demos, and CMake buildsystem files, and gradually move them to newer Bullet 3.x structure

Use statically linked freeglut, instead of dynamic glut for the obsolete Bullet 2.x demos
Add the 'reset' method to b3GpuDynamicsWorld, and use it in the BasicGpuDemo (pretty slow in debug mode, use release mode)
Don't crash in btCollisionWorld, if there is no collision dispatcher
This commit is contained in:
erwin coumans
2013-12-19 12:40:59 -08:00
parent 222ecb156d
commit 69e5454d18
320 changed files with 189807 additions and 105 deletions

View File

@@ -0,0 +1,286 @@
INCLUDE_DIRECTORIES( ${BULLET_PHYSICS_SOURCE_DIR}/src )
SET(BulletCollision_SRCS
BroadphaseCollision/btAxisSweep3.cpp
BroadphaseCollision/btBroadphaseProxy.cpp
BroadphaseCollision/btCollisionAlgorithm.cpp
BroadphaseCollision/btDbvt.cpp
BroadphaseCollision/btDbvtBroadphase.cpp
BroadphaseCollision/btDispatcher.cpp
BroadphaseCollision/btMultiSapBroadphase.cpp
BroadphaseCollision/btOverlappingPairCache.cpp
BroadphaseCollision/btQuantizedBvh.cpp
BroadphaseCollision/btSimpleBroadphase.cpp
CollisionDispatch/btActivatingCollisionAlgorithm.cpp
CollisionDispatch/btBoxBoxCollisionAlgorithm.cpp
CollisionDispatch/btBox2dBox2dCollisionAlgorithm.cpp
CollisionDispatch/btBoxBoxDetector.cpp
CollisionDispatch/btCollisionDispatcher.cpp
CollisionDispatch/btCollisionObject.cpp
CollisionDispatch/btCollisionWorld.cpp
CollisionDispatch/btCompoundCollisionAlgorithm.cpp
CollisionDispatch/btCompoundCompoundCollisionAlgorithm.cpp
CollisionDispatch/btConvexConcaveCollisionAlgorithm.cpp
CollisionDispatch/btConvexConvexAlgorithm.cpp
CollisionDispatch/btConvexPlaneCollisionAlgorithm.cpp
CollisionDispatch/btConvex2dConvex2dAlgorithm.cpp
CollisionDispatch/btDefaultCollisionConfiguration.cpp
CollisionDispatch/btEmptyCollisionAlgorithm.cpp
CollisionDispatch/btGhostObject.cpp
CollisionDispatch/btHashedSimplePairCache.cpp
CollisionDispatch/btInternalEdgeUtility.cpp
CollisionDispatch/btInternalEdgeUtility.h
CollisionDispatch/btManifoldResult.cpp
CollisionDispatch/btSimulationIslandManager.cpp
CollisionDispatch/btSphereBoxCollisionAlgorithm.cpp
CollisionDispatch/btSphereSphereCollisionAlgorithm.cpp
CollisionDispatch/btSphereTriangleCollisionAlgorithm.cpp
CollisionDispatch/btUnionFind.cpp
CollisionDispatch/SphereTriangleDetector.cpp
CollisionShapes/btBoxShape.cpp
CollisionShapes/btBox2dShape.cpp
CollisionShapes/btBvhTriangleMeshShape.cpp
CollisionShapes/btCapsuleShape.cpp
CollisionShapes/btCollisionShape.cpp
CollisionShapes/btCompoundShape.cpp
CollisionShapes/btConcaveShape.cpp
CollisionShapes/btConeShape.cpp
CollisionShapes/btConvexHullShape.cpp
CollisionShapes/btConvexInternalShape.cpp
CollisionShapes/btConvexPointCloudShape.cpp
CollisionShapes/btConvexPolyhedron.cpp
CollisionShapes/btConvexShape.cpp
CollisionShapes/btConvex2dShape.cpp
CollisionShapes/btConvexTriangleMeshShape.cpp
CollisionShapes/btCylinderShape.cpp
CollisionShapes/btEmptyShape.cpp
CollisionShapes/btHeightfieldTerrainShape.cpp
CollisionShapes/btMinkowskiSumShape.cpp
CollisionShapes/btMultimaterialTriangleMeshShape.cpp
CollisionShapes/btMultiSphereShape.cpp
CollisionShapes/btOptimizedBvh.cpp
CollisionShapes/btPolyhedralConvexShape.cpp
CollisionShapes/btScaledBvhTriangleMeshShape.cpp
CollisionShapes/btShapeHull.cpp
CollisionShapes/btSphereShape.cpp
CollisionShapes/btStaticPlaneShape.cpp
CollisionShapes/btStridingMeshInterface.cpp
CollisionShapes/btTetrahedronShape.cpp
CollisionShapes/btTriangleBuffer.cpp
CollisionShapes/btTriangleCallback.cpp
CollisionShapes/btTriangleIndexVertexArray.cpp
CollisionShapes/btTriangleIndexVertexMaterialArray.cpp
CollisionShapes/btTriangleMesh.cpp
CollisionShapes/btTriangleMeshShape.cpp
CollisionShapes/btUniformScalingShape.cpp
Gimpact/btContactProcessing.cpp
Gimpact/btGenericPoolAllocator.cpp
Gimpact/btGImpactBvh.cpp
Gimpact/btGImpactCollisionAlgorithm.cpp
Gimpact/btGImpactQuantizedBvh.cpp
Gimpact/btGImpactShape.cpp
Gimpact/btTriangleShapeEx.cpp
Gimpact/gim_box_set.cpp
Gimpact/gim_contact.cpp
Gimpact/gim_memory.cpp
Gimpact/gim_tri_collision.cpp
NarrowPhaseCollision/btContinuousConvexCollision.cpp
NarrowPhaseCollision/btConvexCast.cpp
NarrowPhaseCollision/btGjkConvexCast.cpp
NarrowPhaseCollision/btGjkEpa2.cpp
NarrowPhaseCollision/btGjkEpaPenetrationDepthSolver.cpp
NarrowPhaseCollision/btGjkPairDetector.cpp
NarrowPhaseCollision/btMinkowskiPenetrationDepthSolver.cpp
NarrowPhaseCollision/btPersistentManifold.cpp
NarrowPhaseCollision/btRaycastCallback.cpp
NarrowPhaseCollision/btSubSimplexConvexCast.cpp
NarrowPhaseCollision/btVoronoiSimplexSolver.cpp
NarrowPhaseCollision/btPolyhedralContactClipping.cpp
)
SET(Root_HDRS
../btBulletCollisionCommon.h
)
SET(BroadphaseCollision_HDRS
BroadphaseCollision/btAxisSweep3.h
BroadphaseCollision/btBroadphaseInterface.h
BroadphaseCollision/btBroadphaseProxy.h
BroadphaseCollision/btCollisionAlgorithm.h
BroadphaseCollision/btDbvt.h
BroadphaseCollision/btDbvtBroadphase.h
BroadphaseCollision/btDispatcher.h
BroadphaseCollision/btMultiSapBroadphase.h
BroadphaseCollision/btOverlappingPairCache.h
BroadphaseCollision/btOverlappingPairCallback.h
BroadphaseCollision/btQuantizedBvh.h
BroadphaseCollision/btSimpleBroadphase.h
)
SET(CollisionDispatch_HDRS
CollisionDispatch/btActivatingCollisionAlgorithm.h
CollisionDispatch/btBoxBoxCollisionAlgorithm.h
CollisionDispatch/btBox2dBox2dCollisionAlgorithm.h
CollisionDispatch/btBoxBoxDetector.h
CollisionDispatch/btCollisionConfiguration.h
CollisionDispatch/btCollisionCreateFunc.h
CollisionDispatch/btCollisionDispatcher.h
CollisionDispatch/btCollisionObject.h
CollisionDispatch/btCollisionObjectWrapper.h
CollisionDispatch/btCollisionWorld.h
CollisionDispatch/btCompoundCollisionAlgorithm.h
CollisionDispatch/btCompoundCompoundCollisionAlgorithm.h
CollisionDispatch/btConvexConcaveCollisionAlgorithm.h
CollisionDispatch/btConvexConvexAlgorithm.h
CollisionDispatch/btConvex2dConvex2dAlgorithm.h
CollisionDispatch/btConvexPlaneCollisionAlgorithm.h
CollisionDispatch/btDefaultCollisionConfiguration.h
CollisionDispatch/btEmptyCollisionAlgorithm.h
CollisionDispatch/btGhostObject.h
CollisionDispatch/btHashedSimplePairCache.h
CollisionDispatch/btManifoldResult.h
CollisionDispatch/btSimulationIslandManager.h
CollisionDispatch/btSphereBoxCollisionAlgorithm.h
CollisionDispatch/btSphereSphereCollisionAlgorithm.h
CollisionDispatch/btSphereTriangleCollisionAlgorithm.h
CollisionDispatch/btUnionFind.h
CollisionDispatch/SphereTriangleDetector.h
)
SET(CollisionShapes_HDRS
CollisionShapes/btBoxShape.h
CollisionShapes/btBox2dShape.h
CollisionShapes/btBvhTriangleMeshShape.h
CollisionShapes/btCapsuleShape.h
CollisionShapes/btCollisionMargin.h
CollisionShapes/btCollisionShape.h
CollisionShapes/btCompoundShape.h
CollisionShapes/btConcaveShape.h
CollisionShapes/btConeShape.h
CollisionShapes/btConvexHullShape.h
CollisionShapes/btConvexInternalShape.h
CollisionShapes/btConvexPointCloudShape.h
CollisionShapes/btConvexPolyhedron.h
CollisionShapes/btConvexShape.h
CollisionShapes/btConvex2dShape.h
CollisionShapes/btConvexTriangleMeshShape.h
CollisionShapes/btCylinderShape.h
CollisionShapes/btEmptyShape.h
CollisionShapes/btHeightfieldTerrainShape.h
CollisionShapes/btMaterial.h
CollisionShapes/btMinkowskiSumShape.h
CollisionShapes/btMultimaterialTriangleMeshShape.h
CollisionShapes/btMultiSphereShape.h
CollisionShapes/btOptimizedBvh.h
CollisionShapes/btPolyhedralConvexShape.h
CollisionShapes/btScaledBvhTriangleMeshShape.h
CollisionShapes/btShapeHull.h
CollisionShapes/btSphereShape.h
CollisionShapes/btStaticPlaneShape.h
CollisionShapes/btStridingMeshInterface.h
CollisionShapes/btTetrahedronShape.h
CollisionShapes/btTriangleBuffer.h
CollisionShapes/btTriangleCallback.h
CollisionShapes/btTriangleIndexVertexArray.h
CollisionShapes/btTriangleIndexVertexMaterialArray.h
CollisionShapes/btTriangleInfoMap.h
CollisionShapes/btTriangleMesh.h
CollisionShapes/btTriangleMeshShape.h
CollisionShapes/btTriangleShape.h
CollisionShapes/btUniformScalingShape.h
)
SET(Gimpact_HDRS
Gimpact/btBoxCollision.h
Gimpact/btClipPolygon.h
Gimpact/btContactProcessing.h
Gimpact/btGenericPoolAllocator.h
Gimpact/btGeometryOperations.h
Gimpact/btGImpactBvh.h
Gimpact/btGImpactCollisionAlgorithm.h
Gimpact/btGImpactMassUtil.h
Gimpact/btGImpactQuantizedBvh.h
Gimpact/btGImpactShape.h
Gimpact/btQuantization.h
Gimpact/btTriangleShapeEx.h
Gimpact/gim_array.h
Gimpact/gim_basic_geometry_operations.h
Gimpact/gim_bitset.h
Gimpact/gim_box_collision.h
Gimpact/gim_box_set.h
Gimpact/gim_clip_polygon.h
Gimpact/gim_contact.h
Gimpact/gim_geom_types.h
Gimpact/gim_geometry.h
Gimpact/gim_hash_table.h
Gimpact/gim_linear_math.h
Gimpact/gim_math.h
Gimpact/gim_memory.h
Gimpact/gim_radixsort.h
Gimpact/gim_tri_collision.h
)
SET(NarrowPhaseCollision_HDRS
NarrowPhaseCollision/btContinuousConvexCollision.h
NarrowPhaseCollision/btConvexCast.h
NarrowPhaseCollision/btConvexPenetrationDepthSolver.h
NarrowPhaseCollision/btDiscreteCollisionDetectorInterface.h
NarrowPhaseCollision/btGjkConvexCast.h
NarrowPhaseCollision/btGjkEpa2.h
NarrowPhaseCollision/btGjkEpaPenetrationDepthSolver.h
NarrowPhaseCollision/btGjkPairDetector.h
NarrowPhaseCollision/btManifoldPoint.h
NarrowPhaseCollision/btMinkowskiPenetrationDepthSolver.h
NarrowPhaseCollision/btPersistentManifold.h
NarrowPhaseCollision/btPointCollector.h
NarrowPhaseCollision/btRaycastCallback.h
NarrowPhaseCollision/btSimplexSolverInterface.h
NarrowPhaseCollision/btSubSimplexConvexCast.h
NarrowPhaseCollision/btVoronoiSimplexSolver.h
NarrowPhaseCollision/btPolyhedralContactClipping.h
)
SET(BulletCollision_HDRS
${Root_HDRS}
${BroadphaseCollision_HDRS}
${CollisionDispatch_HDRS}
${CollisionShapes_HDRS}
${Gimpact_HDRS}
${NarrowPhaseCollision_HDRS}
)
ADD_LIBRARY(BulletCollision ${BulletCollision_SRCS} ${BulletCollision_HDRS})
SET_TARGET_PROPERTIES(BulletCollision PROPERTIES VERSION ${BULLET_VERSION})
SET_TARGET_PROPERTIES(BulletCollision PROPERTIES SOVERSION ${BULLET_VERSION})
IF (BUILD_SHARED_LIBS)
TARGET_LINK_LIBRARIES(BulletCollision LinearMath)
ENDIF (BUILD_SHARED_LIBS)
IF (INSTALL_LIBS)
IF (NOT INTERNAL_CREATE_DISTRIBUTABLE_MSVC_PROJECTFILES)
#INSTALL of other files requires CMake 2.6
IF (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 2.5)
IF (APPLE AND BUILD_SHARED_LIBS AND FRAMEWORK)
INSTALL(TARGETS BulletCollision DESTINATION .)
ELSE (APPLE AND BUILD_SHARED_LIBS AND FRAMEWORK)
INSTALL(TARGETS BulletCollision RUNTIME DESTINATION bin
LIBRARY DESTINATION lib${LIB_SUFFIX}
ARCHIVE DESTINATION lib${LIB_SUFFIX})
INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
DESTINATION ${INCLUDE_INSTALL_DIR} FILES_MATCHING PATTERN "*.h" PATTERN ".svn" EXCLUDE PATTERN "CMakeFiles" EXCLUDE)
INSTALL(FILES ../btBulletCollisionCommon.h
DESTINATION ${INCLUDE_INSTALL_DIR}/BulletCollision)
ENDIF (APPLE AND BUILD_SHARED_LIBS AND FRAMEWORK)
ENDIF (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 2.5)
IF (APPLE AND BUILD_SHARED_LIBS AND FRAMEWORK)
SET_TARGET_PROPERTIES(BulletCollision PROPERTIES FRAMEWORK true)
SET_TARGET_PROPERTIES(BulletCollision PROPERTIES PUBLIC_HEADER "${Root_HDRS}")
# Have to list out sub-directories manually:
SET_PROPERTY(SOURCE ${BroadphaseCollision_HDRS} PROPERTY MACOSX_PACKAGE_LOCATION Headers/BroadphaseCollision)
SET_PROPERTY(SOURCE ${CollisionDispatch_HDRS} PROPERTY MACOSX_PACKAGE_LOCATION Headers/CollisionDispatch)
SET_PROPERTY(SOURCE ${CollisionShapes_HDRS} PROPERTY MACOSX_PACKAGE_LOCATION Headers/CollisionShapes)
SET_PROPERTY(SOURCE ${Gimpact_HDRS} PROPERTY MACOSX_PACKAGE_LOCATION Headers/Gimpact)
SET_PROPERTY(SOURCE ${NarrowPhaseCollision_HDRS} PROPERTY MACOSX_PACKAGE_LOCATION Headers/NarrowPhaseCollision)
ENDIF (APPLE AND BUILD_SHARED_LIBS AND FRAMEWORK)
ENDIF (NOT INTERNAL_CREATE_DISTRIBUTABLE_MSVC_PROJECTFILES)
ENDIF (INSTALL_LIBS)

View File

@@ -1424,19 +1424,22 @@ void btCollisionWorld::debugDrawWorld()
{
if (getDebugDrawer() && getDebugDrawer()->getDebugMode() & btIDebugDraw::DBG_DrawContactPoints)
{
int numManifolds = getDispatcher()->getNumManifolds();
btVector3 color(1,1,0);
for (int i=0;i<numManifolds;i++)
if (getDispatcher())
{
btPersistentManifold* contactManifold = getDispatcher()->getManifoldByIndexInternal(i);
//btCollisionObject* obA = static_cast<btCollisionObject*>(contactManifold->getBody0());
//btCollisionObject* obB = static_cast<btCollisionObject*>(contactManifold->getBody1());
int numContacts = contactManifold->getNumContacts();
for (int j=0;j<numContacts;j++)
int numManifolds = getDispatcher()->getNumManifolds();
btVector3 color(1,1,0);
for (int i=0;i<numManifolds;i++)
{
btManifoldPoint& cp = contactManifold->getContactPoint(j);
getDebugDrawer()->drawContactPoint(cp.m_positionWorldOnB,cp.m_normalWorldOnB,cp.getDistance(),cp.getLifeTime(),color);
btPersistentManifold* contactManifold = getDispatcher()->getManifoldByIndexInternal(i);
//btCollisionObject* obA = static_cast<btCollisionObject*>(contactManifold->getBody0());
//btCollisionObject* obB = static_cast<btCollisionObject*>(contactManifold->getBody1());
int numContacts = contactManifold->getNumContacts();
for (int j=0;j<numContacts;j++)
{
btManifoldPoint& cp = contactManifold->getContactPoint(j);
getDebugDrawer()->drawContactPoint(cp.m_positionWorldOnB,cp.m_normalWorldOnB,cp.getDistance(),cp.getLifeTime(),color);
}
}
}
}

View File

@@ -0,0 +1,155 @@
INCLUDE_DIRECTORIES( ${BULLET_PHYSICS_SOURCE_DIR}/src )
SET(BulletDynamics_SRCS
Character/btKinematicCharacterController.cpp
ConstraintSolver/btConeTwistConstraint.cpp
ConstraintSolver/btContactConstraint.cpp
ConstraintSolver/btFixedConstraint.cpp
ConstraintSolver/btGearConstraint.cpp
ConstraintSolver/btGeneric6DofConstraint.cpp
ConstraintSolver/btGeneric6DofSpringConstraint.cpp
ConstraintSolver/btHinge2Constraint.cpp
ConstraintSolver/btHingeConstraint.cpp
ConstraintSolver/btPoint2PointConstraint.cpp
ConstraintSolver/btSequentialImpulseConstraintSolver.cpp
ConstraintSolver/btNNCGConstraintSolver.cpp
ConstraintSolver/btSliderConstraint.cpp
ConstraintSolver/btSolve2LinearConstraint.cpp
ConstraintSolver/btTypedConstraint.cpp
ConstraintSolver/btUniversalConstraint.cpp
Dynamics/btDiscreteDynamicsWorld.cpp
Dynamics/btRigidBody.cpp
Dynamics/btSimpleDynamicsWorld.cpp
# Dynamics/Bullet-C-API.cpp
Vehicle/btRaycastVehicle.cpp
Vehicle/btWheelInfo.cpp
Featherstone/btMultiBody.cpp
Featherstone/btMultiBodyConstraintSolver.cpp
Featherstone/btMultiBodyDynamicsWorld.cpp
Featherstone/btMultiBodyJointLimitConstraint.cpp
Featherstone/btMultiBodyConstraint.cpp
Featherstone/btMultiBodyPoint2Point.cpp
Featherstone/btMultiBodyJointMotor.cpp
MLCPSolvers/btDantzigLCP.cpp
MLCPSolvers/btMLCPSolver.cpp
)
SET(Root_HDRS
../btBulletDynamicsCommon.h
../btBulletCollisionCommon.h
)
SET(ConstraintSolver_HDRS
ConstraintSolver/btConeTwistConstraint.h
ConstraintSolver/btConstraintSolver.h
ConstraintSolver/btContactConstraint.h
ConstraintSolver/btContactSolverInfo.h
ConstraintSolver/btFixedConstraint.h
ConstraintSolver/btGearConstraint.h
ConstraintSolver/btGeneric6DofConstraint.h
ConstraintSolver/btGeneric6DofSpringConstraint.h
ConstraintSolver/btHinge2Constraint.h
ConstraintSolver/btHingeConstraint.h
ConstraintSolver/btJacobianEntry.h
ConstraintSolver/btPoint2PointConstraint.h
ConstraintSolver/btSequentialImpulseConstraintSolver.h
ConstraintSolver/btNNCGConstraintSolver.h
ConstraintSolver/btSliderConstraint.h
ConstraintSolver/btSolve2LinearConstraint.h
ConstraintSolver/btSolverBody.h
ConstraintSolver/btSolverConstraint.h
ConstraintSolver/btTypedConstraint.h
ConstraintSolver/btUniversalConstraint.h
)
SET(Dynamics_HDRS
Dynamics/btActionInterface.h
Dynamics/btDiscreteDynamicsWorld.h
Dynamics/btDynamicsWorld.h
Dynamics/btSimpleDynamicsWorld.h
Dynamics/btRigidBody.h
)
SET(Vehicle_HDRS
Vehicle/btRaycastVehicle.h
Vehicle/btVehicleRaycaster.h
Vehicle/btWheelInfo.h
)
SET(Featherstone_HDRS
Featherstone/btMultiBody.h
Featherstone/btMultiBodyConstraintSolver.h
Featherstone/btMultiBodyDynamicsWorld.h
Featherstone/btMultiBodyLink.h
Featherstone/btMultiBodyLinkCollider.h
Featherstone/btMultiBodySolverConstraint.h
Featherstone/btMultiBodyConstraint.h
Featherstone/btMultiBodyJointLimitConstraint.h
Featherstone/btMultiBodyConstraint.h
Featherstone/btMultiBodyPoint2Point.h
Featherstone/btMultiBodyJointMotor.h
)
SET(MLCPSolvers_HDRS
MLCPSolvers/btDantzigLCP.h
MLCPSolvers/btDantzigSolver.h
MLCPSolvers/btMLCPSolver.h
MLCPSolvers/btMLCPSolverInterface.h
MLCPSolvers/btPATHSolver.h
MLCPSolvers/btSolveProjectedGaussSeidel.h
)
SET(Character_HDRS
Character/btCharacterControllerInterface.h
Character/btKinematicCharacterController.h
)
SET(BulletDynamics_HDRS
${Root_HDRS}
${ConstraintSolver_HDRS}
${Dynamics_HDRS}
${Vehicle_HDRS}
${Character_HDRS}
${Featherstone_HDRS}
${MLCPSolvers_HDRS}
)
ADD_LIBRARY(BulletDynamics ${BulletDynamics_SRCS} ${BulletDynamics_HDRS})
SET_TARGET_PROPERTIES(BulletDynamics PROPERTIES VERSION ${BULLET_VERSION})
SET_TARGET_PROPERTIES(BulletDynamics PROPERTIES SOVERSION ${BULLET_VERSION})
IF (BUILD_SHARED_LIBS)
TARGET_LINK_LIBRARIES(BulletDynamics BulletCollision LinearMath)
ENDIF (BUILD_SHARED_LIBS)
IF (INSTALL_LIBS)
IF (NOT INTERNAL_CREATE_DISTRIBUTABLE_MSVC_PROJECTFILES)
IF (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 2.5)
IF (APPLE AND BUILD_SHARED_LIBS AND FRAMEWORK)
INSTALL(TARGETS BulletDynamics DESTINATION .)
ELSE (APPLE AND BUILD_SHARED_LIBS AND FRAMEWORK)
INSTALL(TARGETS BulletDynamics RUNTIME DESTINATION bin
LIBRARY DESTINATION lib${LIB_SUFFIX}
ARCHIVE DESTINATION lib${LIB_SUFFIX})
INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
DESTINATION ${INCLUDE_INSTALL_DIR} FILES_MATCHING PATTERN "*.h" PATTERN
".svn" EXCLUDE PATTERN "CMakeFiles" EXCLUDE)
INSTALL(FILES ../btBulletDynamicsCommon.h
DESTINATION ${INCLUDE_INSTALL_DIR}/BulletDynamics)
ENDIF (APPLE AND BUILD_SHARED_LIBS AND FRAMEWORK)
ENDIF (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 2.5)
IF (APPLE AND BUILD_SHARED_LIBS AND FRAMEWORK)
SET_TARGET_PROPERTIES(BulletDynamics PROPERTIES FRAMEWORK true)
SET_TARGET_PROPERTIES(BulletDynamics PROPERTIES PUBLIC_HEADER "${Root_HDRS}")
# Have to list out sub-directories manually:
SET_PROPERTY(SOURCE ${ConstraintSolver_HDRS} PROPERTY MACOSX_PACKAGE_LOCATION Headers/ConstraintSolver)
SET_PROPERTY(SOURCE ${Dynamics_HDRS} PROPERTY MACOSX_PACKAGE_LOCATION Headers/Dynamics)
SET_PROPERTY(SOURCE ${Vehicle_HDRS} PROPERTY MACOSX_PACKAGE_LOCATION Headers/Vehicle)
SET_PROPERTY(SOURCE ${Character_HDRS} PROPERTY MACOSX_PACKAGE_LOCATION Headers/Character)
SET_PROPERTY(SOURCE ${Featherstone_HDRS} PROPERTY MACOSX_PACKAGE_LOCATION Headers/Featherstone)
SET_PROPERTY(SOURCE ${MLCPSolvers_HDRS} PROPERTY MACOSX_PACKAGE_LOCATION Headers/MLCPSolvers)
ENDIF (APPLE AND BUILD_SHARED_LIBS AND FRAMEWORK)
ENDIF (NOT INTERNAL_CREATE_DISTRIBUTABLE_MSVC_PROJECTFILES)
ENDIF (INSTALL_LIBS)

View File

@@ -29,9 +29,10 @@ subject to the following restrictions:
static btVector3
getNormalizedVector(const btVector3& v)
{
btVector3 n = v.normalized();
if (n.length() < SIMD_EPSILON) {
n.setValue(0, 0, 0);
btVector3 n(0, 0, 0);
if (v.length() > SIMD_EPSILON) {
n = v.normalized();
}
return n;
}

32
src/CMakeLists.txt Normal file
View File

@@ -0,0 +1,32 @@
SUBDIRS( BulletSoftBody BulletCollision BulletDynamics LinearMath )
IF(BUILD_MULTITHREADING)
SUBDIRS(MiniCL BulletMultiThreaded)
ENDIF()
IF(INSTALL_LIBS)
#INSTALL of other files requires CMake 2.6
IF (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 2.5)
IF (APPLE AND BUILD_SHARED_LIBS AND FRAMEWORK)
# Don't actually need to install any common files, the frameworks include everything
ELSE (APPLE AND BUILD_SHARED_LIBS AND FRAMEWORK)
INSTALL(FILES btBulletCollisionCommon.h btBulletDynamicsCommon.h Bullet-C-Api.h DESTINATION ${INCLUDE_INSTALL_DIR})
INSTALL(FILES vectormath/vmInclude.h DESTINATION ${INCLUDE_INSTALL_DIR}/vectormath)
INSTALL(FILES vectormath/scalar/boolInVec.h
vectormath/scalar/floatInVec.h
vectormath/scalar/mat_aos.h
vectormath/scalar/quat_aos.h
vectormath/scalar/vec_aos.h
vectormath/scalar/vectormath_aos.h
DESTINATION ${INCLUDE_INSTALL_DIR}/vectormath/scalar)
INSTALL(FILES vectormath/sse/boolInVec.h
vectormath/sse/floatInVec.h
vectormath/sse/mat_aos.h
vectormath/sse/quat_aos.h
vectormath/sse/vec_aos.h
vectormath/sse/vecidx_aos.h
vectormath/sse/vectormath_aos.h
DESTINATION ${INCLUDE_INSTALL_DIR}/vectormath/sse)
ENDIF (APPLE AND BUILD_SHARED_LIBS AND FRAMEWORK)
ENDIF (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 2.5)
ENDIF(INSTALL_LIBS)

View File

@@ -0,0 +1,72 @@
INCLUDE_DIRECTORIES(
${BULLET_PHYSICS_SOURCE_DIR}/src
)
SET(LinearMath_SRCS
btAlignedAllocator.cpp
btConvexHull.cpp
btConvexHullComputer.cpp
btGeometryUtil.cpp
btPolarDecomposition.cpp
btQuickprof.cpp
btSerializer.cpp
btVector3.cpp
)
SET(LinearMath_HDRS
btAabbUtil2.h
btAlignedAllocator.h
btAlignedObjectArray.h
btConvexHull.h
btConvexHullComputer.h
btDefaultMotionState.h
btGeometryUtil.h
btGrahamScan2dConvexHull.h
btHashMap.h
btIDebugDraw.h
btList.h
btMatrix3x3.h
btMinMax.h
btMotionState.h
btPolarDecomposition.h
btPoolAllocator.h
btQuadWord.h
btQuaternion.h
btQuickprof.h
btRandom.h
btScalar.h
btSerializer.h
btStackAlloc.h
btTransform.h
btTransformUtil.h
btVector3.h
)
ADD_LIBRARY(LinearMath ${LinearMath_SRCS} ${LinearMath_HDRS})
SET_TARGET_PROPERTIES(LinearMath PROPERTIES VERSION ${BULLET_VERSION})
SET_TARGET_PROPERTIES(LinearMath PROPERTIES SOVERSION ${BULLET_VERSION})
IF (INSTALL_LIBS)
IF (NOT INTERNAL_CREATE_DISTRIBUTABLE_MSVC_PROJECTFILES)
#FILES_MATCHING requires CMake 2.6
IF (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 2.5)
IF (APPLE AND BUILD_SHARED_LIBS AND FRAMEWORK)
INSTALL(TARGETS LinearMath DESTINATION .)
ELSE (APPLE AND BUILD_SHARED_LIBS AND FRAMEWORK)
INSTALL(TARGETS LinearMath
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib${LIB_SUFFIX}
ARCHIVE DESTINATION lib${LIB_SUFFIX})
INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
DESTINATION ${INCLUDE_INSTALL_DIR} FILES_MATCHING PATTERN "*.h" PATTERN
".svn" EXCLUDE PATTERN "CMakeFiles" EXCLUDE)
ENDIF (APPLE AND BUILD_SHARED_LIBS AND FRAMEWORK)
ENDIF (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 2.5)
IF (APPLE AND BUILD_SHARED_LIBS AND FRAMEWORK)
SET_TARGET_PROPERTIES(LinearMath PROPERTIES FRAMEWORK true)
SET_TARGET_PROPERTIES(LinearMath PROPERTIES PUBLIC_HEADER "${LinearMath_HDRS}")
ENDIF (APPLE AND BUILD_SHARED_LIBS AND FRAMEWORK)
ENDIF (NOT INTERNAL_CREATE_DISTRIBUTABLE_MSVC_PROJECTFILES)
ENDIF (INSTALL_LIBS)