diff options
author | ejcoumans <ejcoumans@08e121b0-ae19-0410-a57b-3be3395fd4fd> | 2006-12-16 05:51:30 +0000 |
---|---|---|
committer | ejcoumans <ejcoumans@08e121b0-ae19-0410-a57b-3be3395fd4fd> | 2006-12-16 05:51:30 +0000 |
commit | df9230327cbac30c05132c128fa9df47d5c9cd57 (patch) | |
tree | 351f9d29e75f8cb9f622376c17397524e8102900 /Demos/EPAPenDepthDemo | |
parent | 39f223fd65511179e06990b241f08704bc5d5746 (diff) | |
download | bullet3-df9230327cbac30c05132c128fa9df47d5c9cd57.tar.gz |
Contribution to add optional double precision floating point support. Define BT_USE_DOUBLE_PRECISION for all involved libraries/apps.
Diffstat (limited to 'Demos/EPAPenDepthDemo')
-rw-r--r-- | Demos/EPAPenDepthDemo/PenetrationTestBullet.cpp | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/Demos/EPAPenDepthDemo/PenetrationTestBullet.cpp b/Demos/EPAPenDepthDemo/PenetrationTestBullet.cpp index 59fb272a5..2c2694ebf 100644 --- a/Demos/EPAPenDepthDemo/PenetrationTestBullet.cpp +++ b/Demos/EPAPenDepthDemo/PenetrationTestBullet.cpp @@ -70,7 +70,11 @@ static void DrawLine(const btVector3& p0, const btVector3& p1, const btVector3& glColor4f(color.x(), color.y(), color.z(), 1.0f);
btVector3 tmp[] = {p0, p1};
glEnableClientState(GL_VERTEX_ARRAY);
+#ifndef BT_USE_DOUBLE_PRECISION
glVertexPointer(3, GL_FLOAT, sizeof(btVector3), &tmp[0].x());
+#else
+ glVertexPointer(3, GL_DOUBLE, sizeof(btVector3), &tmp[0].x());
+#endif
glDrawArrays(GL_LINES, 0, 2);
glDisableClientState(GL_VERTEX_ARRAY);
glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
@@ -83,7 +87,11 @@ void DrawTriangle(const btVector3& p0, const btVector3& p1, const btVector3& p2, glColor4f(color.x(), color.y(), color.z(), 1.0f);
btVector3 tmp[] = {p0, p1, p2};
glEnableClientState(GL_VERTEX_ARRAY);
+#ifndef BT_USE_DOUBLE_PRECISION
glVertexPointer(3, GL_FLOAT, sizeof(btVector3), &tmp[0].x());
+#else
+ glVertexPointer(3, GL_DOUBLE, sizeof(btVector3), &tmp[0].x());
+#endif
glDrawArrays(GL_TRIANGLES, 0, 3);
glDisableClientState(GL_VERTEX_ARRAY);
// glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
@@ -199,10 +207,13 @@ void MyConvex::Render(bool only_wireframe, const btVector3& wire_color) const const float Scale = 1.0f;
glPushMatrix();
- float glmat[16]; //4x4 column major matrix for OpenGL.
+ btScalar glmat[16]; //4x4 column major matrix for OpenGL.
mTransform.getOpenGLMatrix(glmat);
+#ifndef BT_USE_DOUBLE_PRECISION
glMultMatrixf(&(glmat[0]));
-
+#else
+ glMultMatrixd(&(glmat[0]));
+#endif
if(!only_wireframe)
{
btVector3 color(0.0f, 0.5f, 1.0f);
@@ -273,7 +284,7 @@ static float gDepth; {
}
- virtual void addContactPoint(const btVector3& normalOnBInWorld, const btVector3& pointInWorld, float depth)
+ virtual void addContactPoint(const btVector3& normalOnBInWorld, const btVector3& pointInWorld, btScalar depth)
{
gNormal = normalOnBInWorld;
gPoint = pointInWorld;
@@ -293,8 +304,8 @@ static bool TestEPA(const MyConvex& hull0, const MyConvex& hull1) simplexSolver.reset();
- btConvexHullShape convexA((float*)hull0.mVerts, hull0.mNbVerts, sizeof(btVector3));
- btConvexHullShape convexB((float*)hull1.mVerts, hull1.mNbVerts, sizeof(btVector3));
+ btConvexHullShape convexA((btScalar*)hull0.mVerts, hull0.mNbVerts, sizeof(btVector3));
+ btConvexHullShape convexB((btScalar*)hull1.mVerts, hull1.mNbVerts, sizeof(btVector3));
static btGjkEpaPenetrationDepthSolver Solver0;
static btMinkowskiPenetrationDepthSolver Solver1;
|