From 31d3bf770093de039854551aac81949d7ed018a4 Mon Sep 17 00:00:00 2001 From: "erwin.coumans" Date: Sat, 23 May 2009 01:40:27 +0000 Subject: [PATCH] compile fixes for trunk on OSX --- Demos/Gpu3dDemo/Jamfile | 17 ++++++++++++++++- Demos/Gpu3dDemo/btGpuDemo3dSharedCode.h | 7 +++++-- src/BulletDynamics/CMakeLists.txt | 8 ++++++++ src/BulletMultiThreaded/btGpuDefines.h | 6 +++--- 4 files changed, 32 insertions(+), 6 deletions(-) diff --git a/Demos/Gpu3dDemo/Jamfile b/Demos/Gpu3dDemo/Jamfile index f3b11c844..9d7987937 100644 --- a/Demos/Gpu3dDemo/Jamfile +++ b/Demos/Gpu3dDemo/Jamfile @@ -1,3 +1,18 @@ SubDir TOP Demos Gpu3dDemo ; -BulletDemo Gpu3dDemo : [ Wildcard *.h *.cpp ] ; + + rule BulletMTDemo + { + Application $(<) : $(>) : noinstall console nomanifest ; + LinkWith $(<) : bulletopenglsupport bulletmultithreaded bulletdynamics bulletcollision bulletmath ; + CFlags $(<) : [ FIncludes $(TOP)/Demos/OpenGL ] + [ FIncludes $(TOP)/Extras/ConvexHull ] + ; + MsvcIncDirs $(<) : + "../../Demos/OpenGL" + "../../src" ; + } + + + +BulletMTDemo Gpu3dDemo : [ Wildcard *.h *.cpp ] ; diff --git a/Demos/Gpu3dDemo/btGpuDemo3dSharedCode.h b/Demos/Gpu3dDemo/btGpuDemo3dSharedCode.h index d7868d968..e1350ac88 100644 --- a/Demos/Gpu3dDemo/btGpuDemo3dSharedCode.h +++ b/Demos/Gpu3dDemo/btGpuDemo3dSharedCode.h @@ -13,6 +13,8 @@ subject to the following restrictions: 3. This notice may not be removed or altered from any source distribution. */ +#include "LinearMath/btMinMax.h" + //---------------------------------------------------------------------------------------- #define USE_FRICTION 1 @@ -57,7 +59,7 @@ BT_GPU___device__ float computeImpulse3D(float3 rVel, if(positionConstraint >= 0) return lambdaDt; - positionConstraint = min(0.0f,positionConstraint+penetrationError); + positionConstraint = btMin(0.0f,positionConstraint+penetrationError); lambdaDt = -(BT_GPU_dot(cNormal,rVel)*(collisionConstant)); lambdaDt -= (baumgarteConstant/dt*positionConstraint); @@ -104,6 +106,7 @@ BT_GPU___global__ void collisionWithWallBox3DD(float4 *trans, float3 dy = BT_GPU_make_float34(trans[idx * 4 + 1]); float3 dz = BT_GPU_make_float34(trans[idx * 4 + 2]); float3 rerVertex = ((iVtx & 1) ? dx : dx * (-1.f)); + rerVertex += ((iVtx & 2) ? dy : dy * (-1.f)); rerVertex += ((iVtx & 4) ? dz : dz * (-1.f)); float3 vPos = aPos + rerVertex; @@ -227,7 +230,7 @@ BT_GPU___global__ void collisionBatchResolutionBox3DD(int2 *constraints, { float rLambdaDt=lambdaDtBox[idx * 4 + iVtx]; float pLambdaDt=rLambdaDt; - rLambdaDt=max(pLambdaDt+lambdaDt,0.0f); + rLambdaDt=btMax(pLambdaDt+lambdaDt,0.0f); lambdaDt=rLambdaDt-pLambdaDt; lambdaDtBox[idx * 4 + iVtx]=rLambdaDt; } diff --git a/src/BulletDynamics/CMakeLists.txt b/src/BulletDynamics/CMakeLists.txt index ecfcbfef9..ecbfe87d0 100644 --- a/src/BulletDynamics/CMakeLists.txt +++ b/src/BulletDynamics/CMakeLists.txt @@ -1,6 +1,11 @@ INCLUDE_DIRECTORIES( ${BULLET_PHYSICS_SOURCE_DIR}/src } ) + + SET(BulletDynamics_SRCS + ConstraintSolver/btGeneric6DofSpringConstraint.cpp + ConstraintSolver/btHinge2Constraint.cpp + ConstraintSolver/btUniversalConstraint.cpp ConstraintSolver/btContactConstraint.cpp ConstraintSolver/btConeTwistConstraint.cpp ConstraintSolver/btGeneric6DofConstraint.cpp @@ -24,6 +29,9 @@ SET(Root_HDRS ../btBulletCollisionCommon.h ) SET(ConstraintSolver_HDRS + ConstraintSolver/btGeneric6DofSpringConstraint.h + ConstraintSolver/btHinge2Constraint.h + ConstraintSolver/btUniversalConstraint.h ConstraintSolver/btConstraintSolver.h ConstraintSolver/btContactConstraint.h ConstraintSolver/btContactSolverInfo.h diff --git a/src/BulletMultiThreaded/btGpuDefines.h b/src/BulletMultiThreaded/btGpuDefines.h index 521f539e2..3b5eac028 100644 --- a/src/BulletMultiThreaded/btGpuDefines.h +++ b/src/BulletMultiThreaded/btGpuDefines.h @@ -130,7 +130,7 @@ inline float4& operator*=(float4& a, float fact) a = fact * a; return a; } -inline float4& operator+=(float4& a, float4& b) +inline float4& operator+=(float4& a, const float4& b) { a = a + b; return a; @@ -169,12 +169,12 @@ inline float3 operator*(const float3& a, float fact) } -inline float3& operator+=(float3& a, float3& b) +inline float3& operator+=(float3& a, const float3& b) { a = a + b; return a; } -inline float3& operator-=(float3& a, float3& b) +inline float3& operator-=(float3& a, const float3& b) { a = a - b; return a;