diff --git a/Demos/CMakeLists.txt b/Demos/CMakeLists.txt index cdf36bd9e..56eace1e5 100644 --- a/Demos/CMakeLists.txt +++ b/Demos/CMakeLists.txt @@ -1,12 +1,20 @@ if (CMAKE_SIZEOF_VOID_P MATCHES "8") SUBDIRS( OpenGL AllBulletDemos ConvexDecompositionDemo Benchmarks HelloWorld -CcdPhysicsDemo ConstraintDemo SliderConstraintDemo GenericJointDemo +CcdPhysicsDemo ConstraintDemo SliderConstraintDemo GenericJointDemo Raytracer RagdollDemo ForkLiftDemo BasicDemo BspDemo MovingConcaveDemo VehicleDemo -ColladaDemo UserCollisionAlgorithm CharacterDemo SoftDemo HeightFieldFluidDemo) +ColladaDemo UserCollisionAlgorithm CharacterDemo SoftDemo HeightFieldFluidDemo +CollisionInterfaceDemo ConcaveConvexcastDemo SimplexDemo DynamicControlDemo +DoublePrecisionDemo ConcaveDemo CollisionDemo +ContinuousConvexCollision ConcaveRaycastDemo GjkConvexCastDemo +MultiMaterialDemo) else (CMAKE_SIZEOF_VOID_P MATCHES "8") SUBDIRS( OpenGL AllBulletDemos ConvexDecompositionDemo Benchmarks HelloWorld -MultiThreadedDemo CcdPhysicsDemo ConstraintDemo SliderConstraintDemo +MultiThreadedDemo CcdPhysicsDemo ConstraintDemo SliderConstraintDemo Raytracer GenericJointDemo RagdollDemo ForkLiftDemo BasicDemo BspDemo MovingConcaveDemo VehicleDemo ColladaDemo UserCollisionAlgorithm CharacterDemo SoftDemo - HeightFieldFluidDemo) + HeightFieldFluidDemo +CollisionInterfaceDemo ConcaveConvexcastDemo SimplexDemo DynamicControlDemo +DoublePrecisionDemo ConcaveDemo CollisionDemo +ContinuousConvexCollision ConcaveRaycastDemo GjkConvexCastDemo +MultiMaterialDemo) endif (CMAKE_SIZEOF_VOID_P MATCHES "8") diff --git a/Demos/CollisionDemo/CMakeLists.txt b/Demos/CollisionDemo/CMakeLists.txt new file mode 100644 index 000000000..bafd17f2c --- /dev/null +++ b/Demos/CollisionDemo/CMakeLists.txt @@ -0,0 +1,24 @@ +# This is basically the overall name of the project in Visual Studio this is the name of the Solution File + + +# For every executable you have with a main method you should have an add_executable line below. +# For every add executable line you should list every .cpp and .h file you have associated with that executable. + + + +# You shouldn't have to modify anything below this line +######################################################## + + +INCLUDE_DIRECTORIES( +${BULLET_PHYSICS_SOURCE_DIR}/src ${BULLET_PHYSICS_SOURCE_DIR}/Demos/OpenGL } +) + +LINK_LIBRARIES( +OpenGLSupport BulletDynamics BulletCollision LinearMath ${GLUT_glut_LIBRARY} ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY} +) + +ADD_EXECUTABLE(AppCollisionDemo + CollisionDemo.cpp +) + diff --git a/Demos/CollisionInterfaceDemo/CMakeLists.txt b/Demos/CollisionInterfaceDemo/CMakeLists.txt new file mode 100644 index 000000000..58ef2150e --- /dev/null +++ b/Demos/CollisionInterfaceDemo/CMakeLists.txt @@ -0,0 +1,24 @@ +# This is basically the overall name of the project in Visual Studio this is the name of the Solution File + + +# For every executable you have with a main method you should have an add_executable line below. +# For every add executable line you should list every .cpp and .h file you have associated with that executable. + + + +# You shouldn't have to modify anything below this line +######################################################## + + +INCLUDE_DIRECTORIES( +${BULLET_PHYSICS_SOURCE_DIR}/src ${BULLET_PHYSICS_SOURCE_DIR}/Demos/OpenGL } +) + +LINK_LIBRARIES( +OpenGLSupport BulletDynamics BulletCollision LinearMath ${GLUT_glut_LIBRARY} ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY} +) + +ADD_EXECUTABLE(AppCollisionInterfaceDemo + CollisionInterfaceDemo.cpp +) + diff --git a/Demos/ConcaveConvexcastDemo/CMakeLists.txt b/Demos/ConcaveConvexcastDemo/CMakeLists.txt new file mode 100644 index 000000000..65f5c8669 --- /dev/null +++ b/Demos/ConcaveConvexcastDemo/CMakeLists.txt @@ -0,0 +1,25 @@ +# This is basically the overall name of the project in Visual Studio this is the name of the Solution File + + +# For every executable you have with a main method you should have an add_executable line below. +# For every add executable line you should list every .cpp and .h file you have associated with that executable. + + + +# You shouldn't have to modify anything below this line +######################################################## + + +INCLUDE_DIRECTORIES( +${BULLET_PHYSICS_SOURCE_DIR}/src ${BULLET_PHYSICS_SOURCE_DIR}/Demos/OpenGL } +) + +LINK_LIBRARIES( +OpenGLSupport BulletDynamics BulletCollision LinearMath ${GLUT_glut_LIBRARY} ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY} +) + +ADD_EXECUTABLE(AppConcaveConvexCastDemo + ConcaveConvexcastDemo.cpp + main.cpp +) + diff --git a/Demos/ConcaveDemo/CMakeLists.txt b/Demos/ConcaveDemo/CMakeLists.txt new file mode 100644 index 000000000..33696264e --- /dev/null +++ b/Demos/ConcaveDemo/CMakeLists.txt @@ -0,0 +1,25 @@ +# This is basically the overall name of the project in Visual Studio this is the name of the Solution File + + +# For every executable you have with a main method you should have an add_executable line below. +# For every add executable line you should list every .cpp and .h file you have associated with that executable. + + + +# You shouldn't have to modify anything below this line +######################################################## + + +INCLUDE_DIRECTORIES( +${BULLET_PHYSICS_SOURCE_DIR}/src ${BULLET_PHYSICS_SOURCE_DIR}/Demos/OpenGL } +) + +LINK_LIBRARIES( +OpenGLSupport BulletDynamics BulletCollision LinearMath ${GLUT_glut_LIBRARY} ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY} +) + +ADD_EXECUTABLE(AppConcaveDemo + ConcavePhysicsDemo.cpp + main.cpp +) + diff --git a/Demos/ConcaveRaycastDemo/CMakeLists.txt b/Demos/ConcaveRaycastDemo/CMakeLists.txt new file mode 100644 index 000000000..10c136f69 --- /dev/null +++ b/Demos/ConcaveRaycastDemo/CMakeLists.txt @@ -0,0 +1,25 @@ +# This is basically the overall name of the project in Visual Studio this is the name of the Solution File + + +# For every executable you have with a main method you should have an add_executable line below. +# For every add executable line you should list every .cpp and .h file you have associated with that executable. + + + +# You shouldn't have to modify anything below this line +######################################################## + + +INCLUDE_DIRECTORIES( +${BULLET_PHYSICS_SOURCE_DIR}/src ${BULLET_PHYSICS_SOURCE_DIR}/Demos/OpenGL } +) + +LINK_LIBRARIES( +OpenGLSupport BulletDynamics BulletCollision LinearMath ${GLUT_glut_LIBRARY} ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY} +) + +ADD_EXECUTABLE(AppConcaveRayCastDemo + ConcaveRaycastDemo.cpp + main.cpp +) + diff --git a/Demos/ContinuousConvexCollision/CMakeLists.txt b/Demos/ContinuousConvexCollision/CMakeLists.txt new file mode 100644 index 000000000..e8af700d2 --- /dev/null +++ b/Demos/ContinuousConvexCollision/CMakeLists.txt @@ -0,0 +1,24 @@ +# This is basically the overall name of the project in Visual Studio this is the name of the Solution File + + +# For every executable you have with a main method you should have an add_executable line below. +# For every add executable line you should list every .cpp and .h file you have associated with that executable. + + + +# You shouldn't have to modify anything below this line +######################################################## + + +INCLUDE_DIRECTORIES( +${BULLET_PHYSICS_SOURCE_DIR}/src ${BULLET_PHYSICS_SOURCE_DIR}/Demos/OpenGL } +) + +LINK_LIBRARIES( +OpenGLSupport BulletDynamics BulletCollision LinearMath ${GLUT_glut_LIBRARY} ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY} +) + +ADD_EXECUTABLE(AppContinuousConvexCollisionDemo + ContinuousConvexCollisionDemo.cpp +) + diff --git a/Demos/DoublePrecisionDemo/CMakeLists.txt b/Demos/DoublePrecisionDemo/CMakeLists.txt new file mode 100644 index 000000000..34ba82089 --- /dev/null +++ b/Demos/DoublePrecisionDemo/CMakeLists.txt @@ -0,0 +1,24 @@ +# This is basically the overall name of the project in Visual Studio this is the name of the Solution File + + +# For every executable you have with a main method you should have an add_executable line below. +# For every add executable line you should list every .cpp and .h file you have associated with that executable. + + + +# You shouldn't have to modify anything below this line +######################################################## + + +INCLUDE_DIRECTORIES( +${BULLET_PHYSICS_SOURCE_DIR}/src ${BULLET_PHYSICS_SOURCE_DIR}/Demos/OpenGL } +) + +LINK_LIBRARIES( +OpenGLSupport BulletDynamics BulletCollision LinearMath ${GLUT_glut_LIBRARY} ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY} +) + +ADD_EXECUTABLE(AppDoublePrecisionDemo + DoublePrecisionDemo.cpp +) + diff --git a/Demos/DynamicControlDemo/CMakeLists.txt b/Demos/DynamicControlDemo/CMakeLists.txt new file mode 100644 index 000000000..a46b8426b --- /dev/null +++ b/Demos/DynamicControlDemo/CMakeLists.txt @@ -0,0 +1,25 @@ +# This is basically the overall name of the project in Visual Studio this is the name of the Solution File + + +# For every executable you have with a main method you should have an add_executable line below. +# For every add executable line you should list every .cpp and .h file you have associated with that executable. + + + +# You shouldn't have to modify anything below this line +######################################################## + + +INCLUDE_DIRECTORIES( +${BULLET_PHYSICS_SOURCE_DIR}/src ${BULLET_PHYSICS_SOURCE_DIR}/Demos/OpenGL } +) + +LINK_LIBRARIES( +OpenGLSupport BulletDynamics BulletCollision LinearMath ${GLUT_glut_LIBRARY} ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY} +) + +ADD_EXECUTABLE(AppMotorDemo + MotorDemo.cpp + main.cpp +) + diff --git a/Demos/GimpactTestDemo/CMakeLists.txt b/Demos/GimpactTestDemo/CMakeLists.txt new file mode 100644 index 000000000..03dc37146 --- /dev/null +++ b/Demos/GimpactTestDemo/CMakeLists.txt @@ -0,0 +1,25 @@ +# This is basically the overall name of the project in Visual Studio this is the name of the Solution File + + +# For every executable you have with a main method you should have an add_executable line below. +# For every add executable line you should list every .cpp and .h file you have associated with that executable. + + + +# You shouldn't have to modify anything below this line +######################################################## + + +INCLUDE_DIRECTORIES( +${BULLET_PHYSICS_SOURCE_DIR}/src ${BULLET_PHYSICS_SOURCE_DIR}/Demos/OpenGL } +) + +LINK_LIBRARIES( +OpenGLSupport BulletDynamics BulletCollision LinearMath GIMPACTUtils ConvexDecomposition ${GLUT_glut_LIBRARY} ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY} +) + +ADD_EXECUTABLE(AppGimpactTestDemo + GimpactTestDemo.cpp + main.cpp +) + diff --git a/Demos/GjkConvexCastDemo/CMakeLists.txt b/Demos/GjkConvexCastDemo/CMakeLists.txt new file mode 100644 index 000000000..57b6c8b22 --- /dev/null +++ b/Demos/GjkConvexCastDemo/CMakeLists.txt @@ -0,0 +1,25 @@ +# This is basically the overall name of the project in Visual Studio this is the name of the Solution File + + +# For every executable you have with a main method you should have an add_executable line below. +# For every add executable line you should list every .cpp and .h file you have associated with that executable. + + + +# You shouldn't have to modify anything below this line +######################################################## + + +INCLUDE_DIRECTORIES( +${BULLET_PHYSICS_SOURCE_DIR}/src ${BULLET_PHYSICS_SOURCE_DIR}/Demos/OpenGL } +) + +LINK_LIBRARIES( +OpenGLSupport BulletDynamics BulletCollision LinearMath ${GLUT_glut_LIBRARY} ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY} +) + +ADD_EXECUTABLE(AppLinearConvexCastDemo + LinearConvexCastDemo.cpp + main.cpp +) + diff --git a/Demos/MultiMaterialDemo/CMakeLists.txt b/Demos/MultiMaterialDemo/CMakeLists.txt new file mode 100644 index 000000000..5f5f3359a --- /dev/null +++ b/Demos/MultiMaterialDemo/CMakeLists.txt @@ -0,0 +1,25 @@ +# This is basically the overall name of the project in Visual Studio this is the name of the Solution File + + +# For every executable you have with a main method you should have an add_executable line below. +# For every add executable line you should list every .cpp and .h file you have associated with that executable. + + + +# You shouldn't have to modify anything below this line +######################################################## + + +INCLUDE_DIRECTORIES( +${BULLET_PHYSICS_SOURCE_DIR}/src ${BULLET_PHYSICS_SOURCE_DIR}/Demos/OpenGL } +) + +LINK_LIBRARIES( +OpenGLSupport BulletDynamics BulletCollision LinearMath ${GLUT_glut_LIBRARY} ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY} +) + +ADD_EXECUTABLE(AppMultiMaterialDemo + MultiMaterialDemo.cpp + main.cpp +) + diff --git a/Demos/Raytracer/CMakeLists.txt b/Demos/Raytracer/CMakeLists.txt new file mode 100644 index 000000000..de3790306 --- /dev/null +++ b/Demos/Raytracer/CMakeLists.txt @@ -0,0 +1,25 @@ +# This is basically the overall name of the project in Visual Studio this is the name of the Solution File + + +# For every executable you have with a main method you should have an add_executable line below. +# For every add executable line you should list every .cpp and .h file you have associated with that executable. + + + +# You shouldn't have to modify anything below this line +######################################################## + + +INCLUDE_DIRECTORIES( +${BULLET_PHYSICS_SOURCE_DIR}/src ${BULLET_PHYSICS_SOURCE_DIR}/Demos/OpenGL } +) + +LINK_LIBRARIES( +OpenGLSupport BulletDynamics BulletCollision LinearMath ${GLUT_glut_LIBRARY} ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY} +) + +ADD_EXECUTABLE(AppRaytracer + Raytracer.cpp + main.cpp +) + diff --git a/Demos/SimplexDemo/CMakeLists.txt b/Demos/SimplexDemo/CMakeLists.txt new file mode 100644 index 000000000..052fc8055 --- /dev/null +++ b/Demos/SimplexDemo/CMakeLists.txt @@ -0,0 +1,24 @@ +# This is basically the overall name of the project in Visual Studio this is the name of the Solution File + + +# For every executable you have with a main method you should have an add_executable line below. +# For every add executable line you should list every .cpp and .h file you have associated with that executable. + + + +# You shouldn't have to modify anything below this line +######################################################## + + +INCLUDE_DIRECTORIES( +${BULLET_PHYSICS_SOURCE_DIR}/src ${BULLET_PHYSICS_SOURCE_DIR}/Demos/OpenGL } +) + +LINK_LIBRARIES( +OpenGLSupport BulletDynamics BulletCollision LinearMath ${GLUT_glut_LIBRARY} ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY} +) + +ADD_EXECUTABLE(AppSimplexDemo + SimplexDemo.cpp +) + diff --git a/src/LinearMath/btQuaternion.h b/src/LinearMath/btQuaternion.h index cbeca2681..77cfb8c38 100644 --- a/src/LinearMath/btQuaternion.h +++ b/src/LinearMath/btQuaternion.h @@ -209,8 +209,17 @@ public: return s; } + /**@brief Return the axis of the rotation represented by this quaternion */ + btVector3 getAxis() const + { + btScalar s_squared = btScalar(1.) - btPow(m_floats[3], btScalar(2.)); + if (s_squared < btScalar(10.) * SIMD_EPSILON) //Check for divide by zero + return btVector3(1.0, 0.0, 0.0); // Arbitrary + btScalar s = btSqrt(s_squared); + return btVector3(m_floats[0] / s, m_floats[1] / s, m_floats[2] / s); + } - /**@brief Return the inverse of this quaternion */ + /**@brief Return the inverse of this quaternion */ btQuaternion inverse() const { return btQuaternion(-m_floats[0], -m_floats[1], -m_floats[2], m_floats[3]);