fixes in Jam msvcgen -> use SSE instead of SSE2 to stay compatible with older AMD Athlon XP processors, updated build files, minor compile fixes for GPU experimental code
This commit is contained in:
32
Demos/Box2dDemo/CMakeLists.txt
Normal file
32
Demos/Box2dDemo/CMakeLists.txt
Normal file
@@ -0,0 +1,32 @@
|
||||
# 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.
|
||||
|
||||
|
||||
# This is the variable for Windows. I use this to define the root of my directory structure.
|
||||
SET(GLUT_ROOT ${BULLET_PHYSICS_SOURCE_DIR}/Glut)
|
||||
|
||||
# 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(AppBox2dDemo
|
||||
main.cpp
|
||||
Box2dDemo.cpp
|
||||
btBox2dBox2dCollisionAlgorithm.h
|
||||
Box2dDemo.h
|
||||
btBox2dShape.cpp
|
||||
btBox2dBox2dCollisionAlgorithm.cpp
|
||||
btBox2dShape.h
|
||||
)
|
||||
|
||||
|
||||
3
Demos/Box2dDemo/Jamfile
Normal file
3
Demos/Box2dDemo/Jamfile
Normal file
@@ -0,0 +1,3 @@
|
||||
SubDir TOP Demos Box2dDemo ;
|
||||
|
||||
BulletDemo Box2dDemo : [ Wildcard *.h *.cpp ] ;
|
||||
@@ -1,7 +1,7 @@
|
||||
if (CMAKE_SIZEOF_VOID_P MATCHES "8")
|
||||
SUBDIRS( OpenGL AllBulletDemos ConvexDecompositionDemo Benchmarks HelloWorld
|
||||
CcdPhysicsDemo ConstraintDemo SliderConstraintDemo GenericJointDemo Raytracer
|
||||
RagdollDemo ForkLiftDemo BasicDemo BspDemo MovingConcaveDemo VehicleDemo
|
||||
RagdollDemo ForkLiftDemo BasicDemo Box2dDemo Gpu2dDemo BspDemo MovingConcaveDemo VehicleDemo
|
||||
ColladaDemo UserCollisionAlgorithm CharacterDemo SoftDemo HeightFieldFluidDemo
|
||||
CollisionInterfaceDemo ConcaveConvexcastDemo SimplexDemo DynamicControlDemo
|
||||
DoublePrecisionDemo ConcaveDemo CollisionDemo
|
||||
@@ -10,7 +10,7 @@ MultiMaterialDemo)
|
||||
else (CMAKE_SIZEOF_VOID_P MATCHES "8")
|
||||
SUBDIRS( OpenGL AllBulletDemos ConvexDecompositionDemo Benchmarks HelloWorld
|
||||
MultiThreadedDemo CcdPhysicsDemo ConstraintDemo SliderConstraintDemo Raytracer
|
||||
GenericJointDemo RagdollDemo ForkLiftDemo BasicDemo BspDemo MovingConcaveDemo
|
||||
GenericJointDemo RagdollDemo ForkLiftDemo BasicDemo Box2dDemo Gpu2dDemo BspDemo MovingConcaveDemo
|
||||
VehicleDemo ColladaDemo UserCollisionAlgorithm CharacterDemo SoftDemo
|
||||
HeightFieldFluidDemo
|
||||
CollisionInterfaceDemo ConcaveConvexcastDemo SimplexDemo DynamicControlDemo
|
||||
|
||||
@@ -19,8 +19,20 @@ LINK_LIBRARIES(
|
||||
OpenGLSupport BulletDynamics BulletCollision LinearMath ${GLUT_glut_LIBRARY} ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY}
|
||||
)
|
||||
|
||||
ADD_EXECUTABLE(AppBasicDemo
|
||||
ADD_EXECUTABLE(AppGpu2dDemo
|
||||
main.cpp
|
||||
BasicDemo.cpp
|
||||
BasicDemo.cpp
|
||||
BasicDemo.h
|
||||
btGpuDemoPairCache.cpp
|
||||
btGpuDemoPairCache.h
|
||||
btGpuDemo2dSharedTypes.h
|
||||
btGpuDemo2dCpuFunc.cpp
|
||||
btGpuDemoDynamicsWorld.cpp
|
||||
btGpuDemoDynamicsWorld.h
|
||||
oecakeLoader.cpp
|
||||
oecakeLoader.h
|
||||
btGpuDemo2dSharedCode.h
|
||||
btGpuDemo2dSharedDefs.h
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
SubDir TOP Demos BasicDemo ;
|
||||
SubDir TOP Demos Gpu2dDemo ;
|
||||
|
||||
BulletDemo BasicDemo : [ Wildcard *.h *.cpp ] ;
|
||||
BulletDemo Gpu2dDemo : [ Wildcard *.h *.cpp ] ;
|
||||
|
||||
@@ -19,6 +19,7 @@ subject to the following restrictions:
|
||||
#define FRICTION_BOX_GROUND_FACT 0.05f
|
||||
#define FRICTION_BOX_BOX_FACT 0.05f
|
||||
#define USE_CENTERS 1
|
||||
#include "LinearMath/btMinMax.h"
|
||||
|
||||
//------------------------------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------------------------
|
||||
@@ -58,6 +59,7 @@ BT_GPU___device__ void testSphSph(float3 aPos, float3 bPos, float radA, float ra
|
||||
float dist = BT_GPU_dot(del, del);
|
||||
dist = sqrtf(dist);
|
||||
float maxD = radA + radB;
|
||||
|
||||
if(dist > maxD)
|
||||
{
|
||||
return;
|
||||
@@ -76,7 +78,9 @@ BT_GPU___device__ void testSphSph(float3 aPos, float3 bPos, float radA, float ra
|
||||
normal = BT_GPU_make_float3(1.f, 0.f, 0.f);
|
||||
}
|
||||
// float3 contact = (bPos + aPos + normal * (radB - radA)) * 0.5f;
|
||||
float3 contact = aPos - normal * radA;
|
||||
float3 tmp = (normal * radA);
|
||||
float3 contact = aPos - tmp;
|
||||
|
||||
// now add point
|
||||
int numPoints = 0;
|
||||
for(int i = 0; i < MAX_VTX_PER_OBJ; i++)
|
||||
@@ -143,14 +147,20 @@ BT_GPU___global__ void setConstraintDataD(int2 *constraints,
|
||||
for(i = 0; i < numSphA; i++)
|
||||
{
|
||||
float3 va = aPos;
|
||||
va += ai * shapeA[i].x;
|
||||
va += aj * shapeA[i].y;
|
||||
float3 tmp = ai * shapeA[i].x;
|
||||
float3 tmp2 = aj * shapeA[i].y;
|
||||
|
||||
va += tmp;
|
||||
va += tmp2;
|
||||
|
||||
float radA = shapeA[i].w;
|
||||
for(j = 0; j < numSphB; j++)
|
||||
{
|
||||
float3 vb = bPos;
|
||||
vb += bi * shapeB[j].x;
|
||||
vb += bj * shapeB[j].y;
|
||||
float3 tmp =bi * shapeB[j].x;
|
||||
float3 tmp2 = bj * shapeB[j].y;
|
||||
vb += tmp;
|
||||
vb += tmp2;
|
||||
float radB = shapeB[j].w;
|
||||
testSphSph(va, vb, radA, radB, pOut);
|
||||
}
|
||||
@@ -174,7 +184,7 @@ BT_GPU___device__ float computeImpulse1(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)*(1+collisionConstant));
|
||||
lambdaDt -= (baumgarteConstant/dt*positionConstraint);
|
||||
@@ -216,7 +226,8 @@ BT_GPU___global__ void collisionWithWallBoxD(float4 *pos,
|
||||
float3 aVel = BT_GPU_make_float3(vel[idx].x, vel[idx].y, vel[idx].z);
|
||||
float aAngVel = angVel[idx];
|
||||
float3 rerVertex = ai * shape[iVtx].x;
|
||||
rerVertex += aj * shape[iVtx].y;
|
||||
float3 tmp = aj * shape[iVtx].y;
|
||||
rerVertex += tmp;
|
||||
float3 vPos = aPos + rerVertex;
|
||||
float rad = shape[iVtx].w;
|
||||
float3 vVel =aVel+BT_GPU_cross(BT_GPU_make_float3(0.0f,0.0f,aAngVel),rerVertex);
|
||||
@@ -239,11 +250,14 @@ BT_GPU___global__ void collisionWithWallBoxD(float4 *pos,
|
||||
{
|
||||
lat_vel_len = sqrtf(lat_vel_len);
|
||||
lat_vel *= 1.f/lat_vel_len;
|
||||
impulse -= lat_vel * BT_GPU_dot(lat_vel, vVel) * FRICTION_BOX_GROUND_FACT;
|
||||
float3 tmp = lat_vel * BT_GPU_dot(lat_vel, vVel) * FRICTION_BOX_GROUND_FACT;
|
||||
impulse -= tmp;
|
||||
}
|
||||
#endif //USE_FRICTION
|
||||
vel[idx] += BT_GPU_make_float42(impulse,0.0f);
|
||||
angVel[idx] += BT_GPU_cross(rerVertex,impulse).z;
|
||||
float4 tmp = BT_GPU_make_float42(impulse,0.0f);
|
||||
vel[idx] += tmp;
|
||||
float tmp2 = BT_GPU_cross(rerVertex,impulse).z;
|
||||
angVel[idx] += tmp2;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -257,7 +271,8 @@ BT_GPU___global__ void collisionWithWallBoxD(float4 *pos,
|
||||
BT_GPU_make_float3(1.0f,0.0f,0.0f),
|
||||
dt);
|
||||
|
||||
vel[idx] += BT_GPU_make_float42(impulse,0.0f);
|
||||
float4 tmp = BT_GPU_make_float42(impulse,0.0f);
|
||||
vel[idx] += tmp;
|
||||
angVel[idx] += BT_GPU_cross(rerVertex,impulse).z;
|
||||
}
|
||||
}
|
||||
@@ -272,7 +287,8 @@ BT_GPU___global__ void collisionWithWallBoxD(float4 *pos,
|
||||
BT_GPU_make_float3(-1.0f,0.0f,0.0f),
|
||||
dt);
|
||||
|
||||
vel[idx] += BT_GPU_make_float42(impulse,0.0f);
|
||||
float4 tmp = BT_GPU_make_float42(impulse,0.0f);
|
||||
vel[idx] += tmp;
|
||||
angVel[idx] += BT_GPU_cross(rerVertex,impulse).z;
|
||||
}
|
||||
}
|
||||
@@ -326,7 +342,7 @@ BT_GPU___device__ void collisionResolutionBox( int constrId,
|
||||
{
|
||||
float rLambdaDt=lambdaDtBox[(MAX_VTX_PER_OBJ)*(2*constrId)+iVtx];
|
||||
float pLambdaDt=rLambdaDt;
|
||||
rLambdaDt=max(pLambdaDt+lambdaDt,0.0f);
|
||||
rLambdaDt=btMax(pLambdaDt+lambdaDt,0.0f);
|
||||
lambdaDt=rLambdaDt-pLambdaDt;
|
||||
lambdaDtBox[(MAX_VTX_PER_OBJ)*(2*constrId)+iVtx]=rLambdaDt;
|
||||
}
|
||||
@@ -340,7 +356,8 @@ BT_GPU___device__ void collisionResolutionBox( int constrId,
|
||||
{
|
||||
lat_vel_len = sqrtf(lat_vel_len);
|
||||
lat_vel *= 1.f/lat_vel_len;
|
||||
impulse -= lat_vel * BT_GPU_dot(lat_vel , relVel) * FRICTION_BOX_BOX_FACT;
|
||||
float3 tmp = lat_vel * BT_GPU_dot(lat_vel , relVel) * FRICTION_BOX_BOX_FACT;
|
||||
impulse -= tmp;
|
||||
}
|
||||
}
|
||||
#endif //USE_FRICTION
|
||||
|
||||
@@ -81,6 +81,8 @@ SubInclude TOP Demos EPAPenDepthDemo ;
|
||||
SubInclude TOP Demos HelloWorld ;
|
||||
SubInclude TOP Demos BspDemo ;
|
||||
SubInclude TOP Demos BasicDemo ;
|
||||
SubInclude TOP Demos Box2dDemo ;
|
||||
SubInclude TOP Demos Gpu2dDemo ;
|
||||
SubInclude TOP Demos ConvexDecompositionDemo ;
|
||||
SubInclude TOP Demos ColladaDemo ;
|
||||
SubInclude TOP Demos CharacterDemo ;
|
||||
|
||||
@@ -16,8 +16,9 @@ subject to the following restrictions:
|
||||
#include "GLDebugFont.h"
|
||||
#include "GlutStuff.h"
|
||||
#include <stdio.h>
|
||||
#include <string>
|
||||
|
||||
unsigned char sFontData[];
|
||||
extern unsigned char sFontData[];
|
||||
static GLuint sTexture = -1;
|
||||
static int sScreenWidth = 0;
|
||||
static int sScreenHeight = 0;
|
||||
|
||||
@@ -368,7 +368,7 @@ void renderSquareA(float x, float y, float z)
|
||||
glEnd();
|
||||
}
|
||||
|
||||
inline void glDrawVector(btVector3& v) { glVertex3d(v[0], v[1], v[2]); }
|
||||
inline void glDrawVector(const btVector3& v) { glVertex3d(v[0], v[1], v[2]); }
|
||||
|
||||
|
||||
void GL_ShapeDrawer::drawOpenGL(btScalar* m, const btCollisionShape* shape, const btVector3& color,int debugMode,const btVector3& worldBoundsMin,const btVector3& worldBoundsMax)
|
||||
|
||||
Reference in New Issue
Block a user