Add the GPU rigid body pipeline from https://github.com/erwincoumans/experiments as a Bullet 3.x preview for Bullet 2.80

This commit is contained in:
erwin.coumans
2012-03-05 00:54:32 +00:00
parent 73c4646b40
commit 571af41cf6
257 changed files with 55106 additions and 0 deletions

View File

@@ -0,0 +1,88 @@
/*
Bullet Continuous Collision Detection and Physics Library
Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/
This software is provided 'as-is', without any express or implied warranty.
In no event will the authors be held liable for any damages arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it freely,
subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#ifndef DEBUG_CAST_RESULT_H
#define DEBUG_CAST_RESULT_H
#include "BulletCollision/NarrowPhaseCollision/btConvexCast.h"
#include "LinearMath/btTransform.h"
#include "GL_ShapeDrawer.h"
#include "GlutStuff.h"
#ifdef WIN32
#include <windows.h>
#endif
//think different
#if defined(__APPLE__) && !defined (VMDMESA)
#include <OpenGL/gl.h>
#include <OpenGL/glu.h>
#else
#include <GL/gl.h>
#endif
struct btDebugCastResult : public btConvexCast::CastResult
{
btTransform m_fromTrans;
const btPolyhedralConvexShape* m_shape;
btVector3 m_linVel;
btVector3 m_angVel;
GL_ShapeDrawer* m_shapeDrawer;
btDebugCastResult(const btTransform& fromTrans,const btPolyhedralConvexShape* shape,
const btVector3& linVel,const btVector3& angVel,GL_ShapeDrawer* drawer)
:m_fromTrans(fromTrans),
m_shape(shape),
m_linVel(linVel),
m_angVel(angVel),
m_shapeDrawer(drawer)
{
}
virtual void drawCoordSystem(const btTransform& tr)
{
btScalar m[16];
tr.getOpenGLMatrix(m);
glPushMatrix();
btglLoadMatrix(m);
glBegin(GL_LINES);
btglColor3(1, 0, 0);
btglVertex3(0, 0, 0);
btglVertex3(1, 0, 0);
btglColor3(0, 1, 0);
btglVertex3(0, 0, 0);
btglVertex3(0, 1, 0);
btglColor3(0, 0, 1);
btglVertex3(0, 0, 0);
btglVertex3(0, 0, 1);
glEnd();
glPopMatrix();
}
virtual void DebugDraw(btScalar fraction)
{
btVector3 worldBoundsMin(-1000,-1000,-1000);
btVector3 worldBoundsMax(1000,1000,1000);
btScalar m[16];
btTransform hitTrans;
btTransformUtil::integrateTransform(m_fromTrans,m_linVel,m_angVel,fraction,hitTrans);
hitTrans.getOpenGLMatrix(m);
if (m_shapeDrawer)
m_shapeDrawer->drawOpenGL(m,m_shape,btVector3(1,0,0),btIDebugDraw::DBG_NoDebug,worldBoundsMin,worldBoundsMax);
}
};
#endif //DEBUG_CAST_RESULT_H

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,257 @@
/*
Bullet Continuous Collision Detection and Physics Library
Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/
This software is provided 'as-is', without any express or implied warranty.
In no event will the authors be held liable for any damages arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it freely,
subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#ifndef DEMO_APPLICATION_H
#define DEMO_APPLICATION_H
#include "GlutStuff.h"
#include "GL_ShapeDrawer.h"
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include "LinearMath/btVector3.h"
#include "LinearMath/btMatrix3x3.h"
#include "LinearMath/btTransform.h"
#include "LinearMath/btQuickprof.h"
#include "LinearMath/btAlignedObjectArray.h"
class btCollisionShape;
class btDynamicsWorld;
class btRigidBody;
class btTypedConstraint;
class DemoApplication
{
protected:
void displayProfileString(int xOffset,int yStart,char* message);
class CProfileIterator* m_profileIterator;
protected:
#ifdef USE_BT_CLOCK
btClock m_clock;
#endif //USE_BT_CLOCK
///this is the most important class
btDynamicsWorld* m_dynamicsWorld;
///constraint for mouse picking
btTypedConstraint* m_pickConstraint;
virtual void removePickingConstraint();
btCollisionShape* m_shootBoxShape;
float m_cameraDistance;
int m_debugMode;
float m_ele;
float m_azi;
btVector3 m_cameraPosition;
btVector3 m_cameraTargetPosition;//look at
int m_mouseOldX;
int m_mouseOldY;
int m_mouseButtons;
public:
int m_modifierKeys;
protected:
float m_scaleBottom;
float m_scaleFactor;
btVector3 m_cameraUp;
int m_forwardAxis;
int m_glutScreenWidth;
int m_glutScreenHeight;
float m_frustumZNear;
float m_frustumZFar;
int m_ortho;
float m_ShootBoxInitialSpeed;
bool m_stepping;
bool m_singleStep;
bool m_idle;
int m_lastKey;
virtual float showProfileInfo(int& xOffset,int& yStart, int yIncr);
void renderscene(int pass);
GL_ShapeDrawer* m_shapeDrawer;
bool m_enableshadows;
btVector3 m_sundirection;
btScalar m_defaultContactProcessingThreshold;
public:
DemoApplication();
virtual ~DemoApplication();
btDynamicsWorld* getDynamicsWorld()
{
return m_dynamicsWorld;
}
virtual void initPhysics() = 0;
virtual void setDrawClusters(bool drawClusters)
{
}
void overrideGLShapeDrawer (GL_ShapeDrawer* shapeDrawer);
void setOrthographicProjection();
void resetPerspectiveProjection();
bool setTexturing(bool enable) { return(m_shapeDrawer->enableTexture(enable)); }
bool setShadows(bool enable) { bool p=m_enableshadows;m_enableshadows=enable;return(p); }
bool getTexturing() const
{
return m_shapeDrawer->hasTextureEnabled();
}
bool getShadows() const
{
return m_enableshadows;
}
int getDebugMode()
{
return m_debugMode ;
}
void setDebugMode(int mode);
void setAzi(float azi)
{
m_azi = azi;
}
void setCameraUp(const btVector3& camUp)
{
m_cameraUp = camUp;
}
void setCameraForwardAxis(int axis)
{
m_forwardAxis = axis;
}
virtual void myinit();
void toggleIdle();
virtual void updateCamera();
btVector3 getCameraPosition()
{
return m_cameraPosition;
}
btVector3 getCameraTargetPosition()
{
return m_cameraTargetPosition;
}
btScalar getDeltaTimeMicroseconds()
{
#ifdef USE_BT_CLOCK
btScalar dt = (btScalar)m_clock.getTimeMicroseconds();
m_clock.reset();
return dt;
#else
return btScalar(16666.);
#endif
}
void setFrustumZPlanes(float zNear, float zFar)
{
m_frustumZNear = zNear;
m_frustumZFar = zFar;
}
///glut callbacks
float getCameraDistance();
void setCameraDistance(float dist);
void moveAndDisplay();
virtual void clientMoveAndDisplay() = 0;
virtual void clientResetScene();
///Demo functions
virtual void setShootBoxShape ();
virtual void shootBox(const btVector3& destination);
btVector3 getRayTo(int x,int y);
btRigidBody* localCreateRigidBody(float mass, const btTransform& startTransform,btCollisionShape* shape);
///callback methods by glut
virtual void keyboardCallback(unsigned char key, int x, int y);
virtual void keyboardUpCallback(unsigned char key, int x, int y) {}
virtual void specialKeyboard(int key, int x, int y){}
virtual void specialKeyboardUp(int key, int x, int y){}
virtual void reshape(int w, int h);
virtual void mouseFunc(int button, int state, int x, int y);
virtual void mouseMotionFunc(int x,int y);
virtual void displayCallback();
virtual void renderme();
virtual void swapBuffers() = 0;
virtual void updateModifierKeys() = 0;
void stepLeft();
void stepRight();
void stepFront();
void stepBack();
void zoomIn();
void zoomOut();
bool isIdle() const
{
return m_idle;
}
void setIdle(bool idle)
{
m_idle = idle;
}
};
#endif //DEMO_APPLICATION_H

View File

@@ -0,0 +1,139 @@
#include "GLDebugDrawer.h"
#include "GLDebugFont.h"
#include "GlutStuff.h"
#include <stdio.h> //printf debugging
GLDebugDrawer::GLDebugDrawer()
:m_debugMode(0)
{
}
void GLDebugDrawer::drawLine(const btVector3& from,const btVector3& to,const btVector3& fromColor, const btVector3& toColor)
{
glBegin(GL_LINES);
glColor3f(fromColor.getX(), fromColor.getY(), fromColor.getZ());
glVertex3d(from.getX(), from.getY(), from.getZ());
glColor3f(toColor.getX(), toColor.getY(), toColor.getZ());
glVertex3d(to.getX(), to.getY(), to.getZ());
glEnd();
}
void GLDebugDrawer::drawLine(const btVector3& from,const btVector3& to,const btVector3& color)
{
drawLine(from,to,color,color);
}
void GLDebugDrawer::drawSphere (const btVector3& p, btScalar radius, const btVector3& color)
{
glColor4f (color.getX(), color.getY(), color.getZ(), btScalar(1.0f));
glPushMatrix ();
glTranslatef (p.getX(), p.getY(), p.getZ());
int lats = 5;
int longs = 5;
int i, j;
for(i = 0; i <= lats; i++) {
btScalar lat0 = SIMD_PI * (-btScalar(0.5) + (btScalar) (i - 1) / lats);
btScalar z0 = radius*sin(lat0);
btScalar zr0 = radius*cos(lat0);
btScalar lat1 = SIMD_PI * (-btScalar(0.5) + (btScalar) i / lats);
btScalar z1 = radius*sin(lat1);
btScalar zr1 = radius*cos(lat1);
glBegin(GL_QUAD_STRIP);
for(j = 0; j <= longs; j++) {
btScalar lng = 2 * SIMD_PI * (btScalar) (j - 1) / longs;
btScalar x = cos(lng);
btScalar y = sin(lng);
glNormal3f(x * zr0, y * zr0, z0);
glVertex3f(x * zr0, y * zr0, z0);
glNormal3f(x * zr1, y * zr1, z1);
glVertex3f(x * zr1, y * zr1, z1);
}
glEnd();
}
glPopMatrix();
}
void GLDebugDrawer::drawBox (const btVector3& boxMin, const btVector3& boxMax, const btVector3& color, btScalar alpha)
{
btVector3 halfExtent = (boxMax - boxMin) * btScalar(0.5f);
btVector3 center = (boxMax + boxMin) * btScalar(0.5f);
//glEnable(GL_BLEND); // Turn blending On
//glBlendFunc(GL_SRC_ALPHA, GL_ONE);
glColor4f (color.getX(), color.getY(), color.getZ(), alpha);
glPushMatrix ();
glTranslatef (center.getX(), center.getY(), center.getZ());
glScaled(2*halfExtent[0], 2*halfExtent[1], 2*halfExtent[2]);
// glutSolidCube(1.0);
glPopMatrix ();
//glDisable(GL_BLEND);
}
void GLDebugDrawer::drawTriangle(const btVector3& a,const btVector3& b,const btVector3& c,const btVector3& color,btScalar alpha)
{
// if (m_debugMode > 0)
{
const btVector3 n=btCross(b-a,c-a).normalized();
glBegin(GL_TRIANGLES);
glColor4f(color.getX(), color.getY(), color.getZ(),alpha);
glNormal3d(n.getX(),n.getY(),n.getZ());
glVertex3d(a.getX(),a.getY(),a.getZ());
glVertex3d(b.getX(),b.getY(),b.getZ());
glVertex3d(c.getX(),c.getY(),c.getZ());
glEnd();
}
}
void GLDebugDrawer::setDebugMode(int debugMode)
{
m_debugMode = debugMode;
}
void GLDebugDrawer::draw3dText(const btVector3& location,const char* textString)
{
glRasterPos3f(location.x(), location.y(), location.z());
//BMF_DrawString(BMF_GetFont(BMF_kHelvetica10),textString);
}
void GLDebugDrawer::reportErrorWarning(const char* warningString)
{
printf("%s\n",warningString);
}
void GLDebugDrawer::drawContactPoint(const btVector3& pointOnB,const btVector3& normalOnB,btScalar distance,int lifeTime,const btVector3& color)
{
{
btVector3 to=pointOnB+normalOnB*1;//distance;
const btVector3&from = pointOnB;
glColor4f(color.getX(), color.getY(), color.getZ(),1.f);
//glColor4f(0,0,0,1.f);
glBegin(GL_LINES);
glVertex3d(from.getX(), from.getY(), from.getZ());
glVertex3d(to.getX(), to.getY(), to.getZ());
glEnd();
// glRasterPos3f(from.x(), from.y(), from.z());
// char buf[12];
// sprintf(buf," %d",lifeTime);
//BMF_DrawString(BMF_GetFont(BMF_kHelvetica10),buf);
}
}

View File

@@ -0,0 +1,38 @@
#ifndef GL_DEBUG_DRAWER_H
#define GL_DEBUG_DRAWER_H
#include "LinearMath/btIDebugDraw.h"
class GLDebugDrawer : public btIDebugDraw
{
int m_debugMode;
public:
GLDebugDrawer();
virtual void drawLine(const btVector3& from,const btVector3& to,const btVector3& fromColor, const btVector3& toColor);
virtual void drawLine(const btVector3& from,const btVector3& to,const btVector3& color);
virtual void drawSphere (const btVector3& p, btScalar radius, const btVector3& color);
virtual void drawBox (const btVector3& boxMin, const btVector3& boxMax, const btVector3& color, btScalar alpha);
virtual void drawTriangle(const btVector3& a,const btVector3& b,const btVector3& c,const btVector3& color,btScalar alpha);
virtual void drawContactPoint(const btVector3& PointOnB,const btVector3& normalOnB,btScalar distance,int lifeTime,const btVector3& color);
virtual void reportErrorWarning(const char* warningString);
virtual void draw3dText(const btVector3& location,const char* textString);
virtual void setDebugMode(int debugMode);
virtual int getDebugMode() const { return m_debugMode;}
};
#endif//GL_DEBUG_DRAWER_H

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,29 @@
/*
Bullet Continuous Collision Detection and Physics Library
Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.org
This software is provided 'as-is', without any express or implied warranty.
In no event will the authors be held liable for any damages arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it freely,
subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#ifndef BT_DEBUG_FONT_H
#define BT_DEBUG_FONT_H
#include "LinearMath/btVector3.h"
void GLDebugDrawStringInternal(int x,int y,const char* string,const btVector3& rgb, bool enableBlend, int spacing);
void GLDebugDrawStringInternal(int x,int y,const char* string,const btVector3& rgb);
void GLDebugDrawString(int x,int y,const char* string);
void GLDebugResetFont(int screenWidth,int screenHeight);
#endif //BT_DEBUG_FONT_H

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,70 @@
/*
Bullet Continuous Collision Detection and Physics Library
Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/
This software is provided 'as-is', without any express or implied warranty.
In no event will the authors be held liable for any damages arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it freely,
subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#ifndef GL_SHAPE_DRAWER_H
#define GL_SHAPE_DRAWER_H
class btCollisionShape;
class btShapeHull;
#include "LinearMath/btAlignedObjectArray.h"
#include "LinearMath/btVector3.h"
#include "BulletCollision/CollisionShapes/btShapeHull.h"
/// OpenGL shape drawing
class GL_ShapeDrawer
{
protected:
struct ShapeCache
{
struct Edge { btVector3 n[2];int v[2]; };
ShapeCache(btConvexShape* s) : m_shapehull(s) {}
btShapeHull m_shapehull;
btAlignedObjectArray<Edge> m_edges;
};
//clean-up memory of dynamically created shape hulls
btAlignedObjectArray<ShapeCache*> m_shapecaches;
unsigned int m_texturehandle;
bool m_textureenabled;
bool m_textureinitialized;
ShapeCache* cache(btConvexShape*);
public:
GL_ShapeDrawer();
virtual ~GL_ShapeDrawer();
///drawOpenGL might allocate temporary memoty, stores pointer in shape userpointer
virtual void drawOpenGL(btScalar* m, const btCollisionShape* shape, const btVector3& color,int debugMode,const btVector3& worldBoundsMin,const btVector3& worldBoundsMax);
virtual void drawShadow(btScalar* m, const btVector3& extrusion,const btCollisionShape* shape,const btVector3& worldBoundsMin,const btVector3& worldBoundsMax);
bool enableTexture(bool enable) { bool p=m_textureenabled;m_textureenabled=enable;return(p); }
bool hasTextureEnabled() const
{
return m_textureenabled;
}
static void drawCylinder(float radius,float halfHeight, int upAxis);
void drawSphere(btScalar r, int lats, int longs);
static void drawCoordSystem();
};
void OGL_displaylist_register_shape(btCollisionShape * shape);
void OGL_displaylist_clean();
#endif //GL_SHAPE_DRAWER_H

View File

@@ -0,0 +1,76 @@
/*
Bullet Continuous Collision Detection and Physics Library
Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/
This software is provided 'as-is', without any express or implied warranty.
In no event will the authors be held liable for any damages arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it freely,
subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#include "GL_Simplex1to4.h"
#include "BulletCollision/NarrowPhaseCollision/btSimplexSolverInterface.h"
#include "GL_ShapeDrawer.h"
#ifdef _WIN32
#include <windows.h>
#endif
//think different
#if defined(__APPLE__) && !defined (VMDMESA)
#include <OpenGL/gl.h>
#include <OpenGL/glu.h>
#else
#include <GL/gl.h>
#endif
#include "GlutStuff.h"
#include "LinearMath/btTransform.h"
GL_Simplex1to4::GL_Simplex1to4()
:m_simplexSolver(0)
{
}
///
/// Debugging method calcClosest calculates the closest point to the origin, using m_simplexSolver
///
void GL_Simplex1to4::calcClosest(btScalar* m)
{
btTransform tr;
tr.setFromOpenGLMatrix(m);
GL_ShapeDrawer::drawCoordSystem();
if (m_simplexSolver)
{
m_simplexSolver->reset();
bool res;
btVector3 v;
for (int i=0;i<m_numVertices;i++)
{
v = tr(m_vertices[i]);
m_simplexSolver->addVertex(v,v,btVector3(0.f,0.f,0.f));
res = m_simplexSolver->closest(v);
}
//draw v?
glDisable(GL_LIGHTING);
glBegin(GL_LINES);
btglColor3(1.f, 0.f, 0.f);
btglVertex3(0.f, 0.f, 0.f);
btglVertex3(v.x(),v.y(),v.z());
glEnd();
glEnable(GL_LIGHTING);
}
}

View File

@@ -0,0 +1,40 @@
/*
Bullet Continuous Collision Detection and Physics Library
Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/
This software is provided 'as-is', without any express or implied warranty.
In no event will the authors be held liable for any damages arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it freely,
subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#ifndef GL_SIMPLEX_1TO4_H
#define GL_SIMPLEX_1TO4_H
#include "BulletCollision/CollisionShapes/btTetrahedronShape.h"
#include "BulletCollision/NarrowPhaseCollision/btSimplexSolverInterface.h"
///GL_Simplex1to4 is a class to debug a Simplex Solver with 1 to 4 points.
///Can be used by GJK.
class GL_Simplex1to4 : public btBU_Simplex1to4
{
btSimplexSolverInterface* m_simplexSolver;
public:
GL_Simplex1to4();
void calcClosest(btScalar* m);
void setSimplexSolver(btSimplexSolverInterface* simplexSolver) {
m_simplexSolver = simplexSolver;
}
};
#endif //GL_SIMPLEX_1TO4_H

View File

@@ -0,0 +1,87 @@
#ifndef _WINDOWS
#include "GlutDemoApplication.h"
#include "GlutStuff.h"
#include "BulletDynamics/Dynamics/btDiscreteDynamicsWorld.h"
#include "BulletDynamics/Dynamics/btRigidBody.h"
void GlutDemoApplication::updateModifierKeys()
{
m_modifierKeys = 0;
if (glutGetModifiers() & GLUT_ACTIVE_ALT)
m_modifierKeys |= BT_ACTIVE_ALT;
if (glutGetModifiers() & GLUT_ACTIVE_CTRL)
m_modifierKeys |= BT_ACTIVE_CTRL;
if (glutGetModifiers() & GLUT_ACTIVE_SHIFT)
m_modifierKeys |= BT_ACTIVE_SHIFT;
}
void GlutDemoApplication::specialKeyboard(int key, int x, int y)
{
(void)x;
(void)y;
switch (key)
{
case GLUT_KEY_F1:
{
break;
}
case GLUT_KEY_F2:
{
break;
}
case GLUT_KEY_END:
{
int numObj = getDynamicsWorld()->getNumCollisionObjects();
if (numObj)
{
btCollisionObject* obj = getDynamicsWorld()->getCollisionObjectArray()[numObj-1];
getDynamicsWorld()->removeCollisionObject(obj);
btRigidBody* body = btRigidBody::upcast(obj);
if (body && body->getMotionState())
{
delete body->getMotionState();
}
delete obj;
}
break;
}
case GLUT_KEY_LEFT : stepLeft(); break;
case GLUT_KEY_RIGHT : stepRight(); break;
case GLUT_KEY_UP : stepFront(); break;
case GLUT_KEY_DOWN : stepBack(); break;
case GLUT_KEY_PAGE_UP : zoomIn(); break;
case GLUT_KEY_PAGE_DOWN : zoomOut(); break;
case GLUT_KEY_HOME : toggleIdle(); break;
default:
// std::cout << "unused (special) key : " << key << std::endl;
break;
}
glutPostRedisplay();
}
void GlutDemoApplication::swapBuffers()
{
glutSwapBuffers();
}
#endif //_WINDOWS

View File

@@ -0,0 +1,34 @@
/*
Bullet Continuous Collision Detection and Physics Library
Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.org
This software is provided 'as-is', without any express or implied warranty.
In no event will the authors be held liable for any damages arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it freely,
subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#ifndef GLUT_DEMO_APPLICATION_H
#define GLUT_DEMO_APPLICATION_H
#include "DemoApplication.h"
class GlutDemoApplication : public DemoApplication
{
public:
void specialKeyboard(int key, int x, int y);
virtual void swapBuffers();
virtual void updateModifierKeys();
};
#endif //GLUT_DEMO_APPLICATION_H

View File

@@ -0,0 +1,119 @@
/*
Bullet Continuous Collision Detection and Physics Library
Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/
This software is provided 'as-is', without any express or implied warranty.
In no event will the authors be held liable for any damages arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it freely,
subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#ifndef _WINDOWS
#include "DemoApplication.h"
//glut is C code, this global gDemoApplication links glut to the C++ demo
static DemoApplication* gDemoApplication = 0;
#include "GlutStuff.h"
static void glutKeyboardCallback(unsigned char key, int x, int y)
{
gDemoApplication->keyboardCallback(key,x,y);
}
static void glutKeyboardUpCallback(unsigned char key, int x, int y)
{
gDemoApplication->keyboardUpCallback(key,x,y);
}
static void glutSpecialKeyboardCallback(int key, int x, int y)
{
gDemoApplication->specialKeyboard(key,x,y);
}
static void glutSpecialKeyboardUpCallback(int key, int x, int y)
{
gDemoApplication->specialKeyboardUp(key,x,y);
}
static void glutReshapeCallback(int w, int h)
{
gDemoApplication->reshape(w,h);
}
static void glutMoveAndDisplayCallback()
{
gDemoApplication->moveAndDisplay();
}
static void glutMouseFuncCallback(int button, int state, int x, int y)
{
gDemoApplication->mouseFunc(button,state,x,y);
}
static void glutMotionFuncCallback(int x,int y)
{
gDemoApplication->mouseMotionFunc(x,y);
}
static void glutDisplayCallback(void)
{
gDemoApplication->displayCallback();
}
int glutmain(int argc, char **argv,int width,int height,const char* title,DemoApplication* demoApp) {
gDemoApplication = demoApp;
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH | GLUT_STENCIL);
glutInitWindowPosition(0, 0);
glutInitWindowSize(width, height);
glutCreateWindow(title);
#ifdef BT_USE_FREEGLUT
glutSetOption (GLUT_ACTION_ON_WINDOW_CLOSE, GLUT_ACTION_GLUTMAINLOOP_RETURNS);
#endif
gDemoApplication->myinit();
glutKeyboardFunc(glutKeyboardCallback);
glutKeyboardUpFunc(glutKeyboardUpCallback);
glutSpecialFunc(glutSpecialKeyboardCallback);
glutSpecialUpFunc(glutSpecialKeyboardUpCallback);
glutReshapeFunc(glutReshapeCallback);
//createMenu();
glutIdleFunc(glutMoveAndDisplayCallback);
glutMouseFunc(glutMouseFuncCallback);
glutPassiveMotionFunc(glutMotionFuncCallback);
glutMotionFunc(glutMotionFuncCallback);
glutDisplayFunc( glutDisplayCallback );
glutMoveAndDisplayCallback();
//enable vsync to avoid tearing on Apple (todo: for Windows)
#if defined(__APPLE__) && !defined (VMDMESA)
int swap_interval = 1;
CGLContextObj cgl_context = CGLGetCurrentContext();
CGLSetParameter(cgl_context, kCGLCPSwapInterval, &swap_interval);
#endif
return 0;
}
#endif //_WINDOWS

View File

@@ -0,0 +1,86 @@
/*
Bullet Continuous Collision Detection and Physics Library
Copyright (c) 2003-2012 Erwin Coumans http://continuousphysics.com/Bullet/
This software is provided 'as-is', without any express or implied warranty.
In no event will the authors be held liable for any damages arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it freely,
subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#ifndef GLUT_STUFF_H
#define GLUT_STUFF_H
#ifdef _WIN32//for glut.h
#include <windows.h>
#endif
//think different
#if defined(__APPLE__) && !defined (VMDMESA)
#include <OpenGL/OpenGL.h>
#include <OpenGL/gl.h>
#include <OpenGL/glu.h>
#include <GLUT/glut.h>
#else
#ifdef _WINDOWS
#include <windows.h>
#include <GL/gl.h>
#include <GL/glu.h>
#else
#include <GL/gl.h>
#include <GL/glut.h>
#endif //_WINDOWS
#endif //APPLE
#ifdef _WINDOWS
#define BT_ACTIVE_ALT VK_LMENU
#else
#define BT_KEY_K 'k'
#define BT_KEY_LEFT GLUT_KEY_LEFT
#define BT_KEY_RIGHT GLUT_KEY_RIGHT
#define BT_KEY_UP GLUT_KEY_UP
#define BT_KEY_DOWN GLUT_KEY_DOWN
#define BT_KEY_F1 GLUT_KEY_F1
#define BT_KEY_F2 GLUT_KEY_F2
#define BT_KEY_F3 GLUT_KEY_F3
#define BT_KEY_F4 GLUT_KEY_F4
#define BT_KEY_F5 GLUT_KEY_F5
#define BT_KEY_PAGEUP GLUT_KEY_PAGE_UP
#define BT_KEY_PAGEDOWN GLUT_KEY_PAGE_DOWN
#define BT_KEY_END GLUT_KEY_END
#define BT_KEY_HOME GLUT_KEY_HOME
#define BT_ACTIVE_ALT GLUT_ACTIVE_ALT
#define BT_ACTIVE_CTRL GLUT_ACTIVE_ALT
#define BT_ACTIVE_SHIFT GLUT_ACTIVE_SHIFT
#endif
#if BT_USE_FREEGLUT
#include "GL/freeglut_ext.h" //to be able to return from glutMainLoop()
#endif
class DemoApplication;
int glutmain(int argc, char **argv,int width,int height,const char* title,DemoApplication* demoApp);
#if defined(BT_USE_DOUBLE_PRECISION)
#define btglLoadMatrix glLoadMatrixd
#define btglMultMatrix glMultMatrixd
#define btglColor3 glColor3d
#define btglVertex3 glVertex3d
#else
#define btglLoadMatrix glLoadMatrixf
#define btglMultMatrix glMultMatrixf
#define btglColor3 glColor3f
#define btglVertex3 glVertex3d
#endif
#endif //GLUT_STUFF_H

View File

@@ -0,0 +1,86 @@
/*
Bullet Continuous Collision Detection and Physics Library
Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/
This software is provided 'as-is', without any express or implied warranty.
In no event will the authors be held liable for any damages arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it freely,
subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#include "RenderTexture.h"
#include <memory.h>
renderTexture::renderTexture(int width,int height)
:m_height(height),m_width(width)
{
m_buffer = new unsigned char[m_width*m_height*4];
//clear screen
memset(m_buffer,0,m_width*m_height*4);
//clear screen version 2
for (int x=0;x<m_width;x++)
{
for (int y=0;y<m_height;y++)
{
setPixel(x,y,btVector4(float(x),float(y),0.f,1.f));
}
}
}
void renderTexture::grapicalPrintf(char* str, void* fontData, int rasterposx,int rasterposy)
{
unsigned char c;
int x=0;
int xx=0;
while ((c = (unsigned char) *str++)) {
x=xx;
unsigned char* fontPtr = (unsigned char*) fontData;
char ch = c-32;
int sx=ch%16;
int sy=ch/16;
for (int i=sx*16;i<(sx*16+16);i++)
{
int y=0;
for (int j=sy*16;j<(sy*16+16);j++)
{
unsigned char packedColor = (fontPtr[i*3+255*256*3-(256*j)*3]);
//float colorf = packedColor ? 0.f : 1.f;
float colorf = packedColor/255.f;// ? 0.f : 1.f;
btVector4 rgba(colorf,colorf,colorf,1.f);
//if (colorf)
{
//setPixel(rasterposx+x,rasterposy+y,rgba);
addPixel(rasterposx+x,rasterposy+y,rgba);
}
//bit >>=1;
y++;
}
x++;
}
//xx+=16;
xx+=10;
}
}
renderTexture::~renderTexture()
{
delete [] m_buffer;
}

View File

@@ -0,0 +1,73 @@
/*
Bullet Continuous Collision Detection and Physics Library
Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/
This software is provided 'as-is', without any express or implied warranty.
In no event will the authors be held liable for any damages arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it freely,
subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#ifndef RENDER_TEXTURE_H
#define RENDER_TEXTURE_H
#include "LinearMath/btVector3.h"
#include "GLDebugFont.h"
///
///renderTexture provides a software-render context (setpixel/printf)
///
class renderTexture
{
int m_height;
int m_width;
unsigned char* m_buffer;
public:
renderTexture(int width,int height);
~renderTexture();
///rgba input is in range [0..1] for each component
inline void setPixel(int x,int y,const btVector4& rgba)
{
unsigned char* pixel = &m_buffer[ (x+y*m_width) * 4];
pixel[0] = (unsigned char)(255.*rgba.getX());
pixel[1] = (unsigned char)(255.*rgba.getY());
pixel[2] = (unsigned char)(255.*rgba.getZ());
pixel[3] = (unsigned char)(255.*rgba.getW());
}
inline void addPixel(int x,int y,const btVector4& rgba)
{
unsigned char* pixel = &m_buffer[ (x+y*m_width) * 4];
pixel[0] = (unsigned char)btMin(btScalar(255.f),((btScalar)pixel[0] + btScalar(255.f)*rgba.getX()));
pixel[1] = (unsigned char)btMin(btScalar(255.f),((btScalar)pixel[1] + btScalar(255.f)*rgba.getY()));
pixel[2] = (unsigned char)btMin(btScalar(255.f),((btScalar)pixel[2] + btScalar(255.f)*rgba.getZ()));
// pixel[3] = (unsigned char)btMin(btScalar(255.f),((btScalar)pixel[3] + btScalar(255.f)*rgba.getW()));
}
inline btVector4 getPixel(int x,int y)
{
unsigned char* pixel = &m_buffer[ (x+y*m_width) * 4];
return btVector4(pixel[0]*1.f/255.f,
pixel[1]*1.f/255.f,
pixel[2]*1.f/255.f,
pixel[3]*1.f/255.f);
}
const unsigned char* getBuffer() const { return m_buffer;}
int getWidth() const { return m_width;}
int getHeight() const { return m_height;}
void grapicalPrintf(char* str, void* fontData, int startx = 0,int starty=0);
};
#endif //RENDER_TEXTURE_H

View File

@@ -0,0 +1,405 @@
#ifdef _WINDOWS
/*
Bullet Continuous Collision Detection and Physics Library
Copyright (c) 2003-2010 Erwin Coumans http://bulletphysics.org
This software is provided 'as-is', without any express or implied warranty.
In no event will the authors be held liable for any damages arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it freely,
subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#include <windows.h>
#include <gl/gl.h>
#include "DemoApplication.h"
#include "GLDebugDrawer.h"
#include "GLDebugFont.h"
#include "BulletDynamics/Dynamics/btDynamicsWorld.h"
/// This Win32AppMain is shared code between all demos.
/// The actual demo, derived from DemoApplication is created using 'createDemo', in a separate .cpp file
DemoApplication* gDemoApplication = 0;
DemoApplication* createDemo();
// Function Declarations
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
void EnableOpenGL(HWND hWnd, HDC * hDC, HGLRC * hRC);
void DisableOpenGL(HWND hWnd, HDC hDC, HGLRC hRC);
static bool sOpenGLInitialized = false;
static int sWidth = 0;
static int sHeight =0;
static int quitRequest = 0;
// WinMain
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpCmdLine, int iCmdShow)
{
WNDCLASS wc;
HWND hWnd;
HDC hDC;
HGLRC hRC;
MSG msg;
BOOL quit = FALSE;
float theta = 0.0f;
gDemoApplication = createDemo();
// register window class
wc.style = CS_OWNDC;
wc.lpfnWndProc = WndProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = hInstance;
wc.hIcon = LoadIcon( NULL, IDI_APPLICATION );
wc.hCursor = LoadCursor( NULL, IDC_ARROW );
wc.hbrBackground = (HBRUSH)GetStockObject( BLACK_BRUSH );
wc.lpszMenuName = NULL;
wc.lpszClassName = "BulletPhysics";
RegisterClass( &wc );
// create main window
hWnd = CreateWindow(
"BulletPhysics", "Bullet Physics Sample. http://bulletphysics.org",
WS_CAPTION | WS_VISIBLE | WS_OVERLAPPEDWINDOW,
// 0, 0, 640, 480,
0, 0, 1024, 768,
NULL, NULL, hInstance, NULL );
// enable OpenGL for the window
EnableOpenGL( hWnd, &hDC, &hRC );
GLDebugDrawer debugDraw;
gDemoApplication->myinit();
//gDemoApplication->reshape(1024, 768);
gDemoApplication->initPhysics();
if (gDemoApplication->getDynamicsWorld())
gDemoApplication->getDynamicsWorld()->setDebugDrawer(&debugDraw);
gDemoApplication->reshape(sWidth,sHeight);
// program main loop
while ( !quit )
{
// check for messages
if ( PeekMessage( &msg, NULL, 0, 0, PM_REMOVE ) )
{
// handle or dispatch messages
if ( msg.message == WM_QUIT )
{
quit = TRUE;
}
else
{
TranslateMessage( &msg );
DispatchMessage( &msg );
}
// gDemoApplication->displayCallback();
};
// OpenGL animation code goes here
glClearColor( .7f, 0.7f, 0.7f, 1.f );
gDemoApplication->moveAndDisplay();
SwapBuffers( hDC );
theta += 1.0f;
}
// shutdown OpenGL
DisableOpenGL( hWnd, hDC, hRC );
// destroy the window explicitly
DestroyWindow( hWnd );
delete gDemoApplication;
return msg.wParam;
}
// Window Procedure
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{
case WM_SYSKEYDOWN:
{
if (lParam & 1<<29)
{
gDemoApplication->m_modifierKeys = VK_LMENU;
}
break;
}
case WM_SYSKEYUP:
{
if (lParam & 1<<29)
{
gDemoApplication->m_modifierKeys = VK_LMENU;
} else
{
gDemoApplication->m_modifierKeys = 0;
}
break;
}
case WM_SIZE: // Size Action Has Taken Place
switch (wParam) // Evaluate Size Action
{
case SIZE_MINIMIZED: // Was Window Minimized?
return 0; // Return
case SIZE_MAXIMIZED: // Was Window Maximized?
sWidth = LOWORD (lParam);
sHeight = HIWORD (lParam);
if (sOpenGLInitialized)
{
gDemoApplication->reshape(sWidth,sHeight);
}
return 0; // Return
case SIZE_RESTORED: // Was Window Restored?
sWidth = LOWORD (lParam);
sHeight = HIWORD (lParam);
if (sOpenGLInitialized)
{
gDemoApplication->reshape(sWidth,sHeight);
}
return 0; // Return
}
break;
case WM_CREATE:
return 0;
case WM_MBUTTONUP:
{
int xPos = LOWORD(lParam);
int yPos = HIWORD(lParam);
gDemoApplication->mouseFunc(1,1,xPos,yPos);
break;
}
case WM_MBUTTONDOWN:
{
int xPos = LOWORD(lParam);
int yPos = HIWORD(lParam);
gDemoApplication->mouseFunc(1,0,xPos,yPos);
break;
}
case WM_LBUTTONUP:
{
int xPos = LOWORD(lParam);
int yPos = HIWORD(lParam);
gDemoApplication->mouseFunc(0,1,xPos,yPos);
break;
}
case 0x020A://WM_MOUSEWHEEL:
{
int zDelta = (short)HIWORD(wParam);
int xPos = LOWORD(lParam);
int yPos = HIWORD(lParam);
if (zDelta>0)
gDemoApplication->zoomIn();
else
gDemoApplication->zoomOut();
break;
}
case WM_MOUSEMOVE:
{
int xPos = LOWORD(lParam);
int yPos = HIWORD(lParam);
gDemoApplication->mouseMotionFunc(xPos,yPos);
break;
}
case WM_RBUTTONUP:
{
int xPos = LOWORD(lParam);
int yPos = HIWORD(lParam);
gDemoApplication->mouseFunc(2,1,xPos,yPos);
break;
}
case WM_RBUTTONDOWN:
{
int xPos = LOWORD(lParam);
int yPos = HIWORD(lParam);
gDemoApplication->mouseFunc(2,0,xPos,yPos);
break;
}
case WM_LBUTTONDOWN:
{
int xPos = LOWORD(lParam);
int yPos = HIWORD(lParam);
gDemoApplication->mouseFunc(0,0,xPos,yPos);
break;
}
/*#define WM_LBUTTONUP 0x0202
#define WM_LBUTTONDBLCLK 0x0203
#define WM_RBUTTONDOWN 0x0204
#define WM_RBUTTONUP 0x0205
#define WM_RBUTTONDBLCLK 0x0206
#define WM_MBUTTONDOWN 0x0207
#define WM_MBUTTONUP 0x0208
#define WM_MBUTTONDBLCLK 0x0209
*/
case WM_CLOSE:
PostQuitMessage( 0 );
return 0;
case WM_DESTROY:
return 0;
case WM_KEYUP:
switch ( wParam )
{
case VK_PRIOR:
case VK_NEXT:
case VK_END:
case VK_HOME:
case VK_LEFT:
case VK_UP:
case VK_RIGHT:
case VK_DOWN:
{
if (gDemoApplication)
gDemoApplication->specialKeyboardUp(wParam,0,0);
return 0;
}
default:
{
gDemoApplication->keyboardUpCallback(tolower(wParam),0,0);
}
return DefWindowProc( hWnd, message, wParam, lParam );
}
case WM_KEYDOWN:
printf("bla\n");
switch ( wParam )
{
case VK_CONTROL:
case VK_PRIOR:
case VK_NEXT:
case VK_END:
case VK_HOME:
case VK_LEFT:
case VK_UP:
case VK_RIGHT:
case VK_DOWN:
{
if (gDemoApplication)
gDemoApplication->specialKeyboard(wParam,0,0);
break;
}
case ' ':
{
if (gDemoApplication)
gDemoApplication->clientResetScene();
break;
}
case 'Q':
case VK_ESCAPE:
{
quitRequest = 1;
PostQuitMessage(0);
}
return 0;
}
return 0;
case WM_CHAR:
if (!quitRequest)
gDemoApplication->keyboardCallback(wParam,0,0);
break;
default:
return DefWindowProc( hWnd, message, wParam, lParam );
}
return 0;
}
// Enable OpenGL
void EnableOpenGL(HWND hWnd, HDC * hDC, HGLRC * hRC)
{
PIXELFORMATDESCRIPTOR pfd;
int format;
// get the device context (DC)
*hDC = GetDC( hWnd );
// set the pixel format for the DC
ZeroMemory( &pfd, sizeof( pfd ) );
pfd.nSize = sizeof( pfd );
pfd.nVersion = 1;
pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER;
pfd.iPixelType = PFD_TYPE_RGBA;
pfd.cColorBits = 24;
pfd.cDepthBits = 16;
pfd.cStencilBits = 1;
pfd.iLayerType = PFD_MAIN_PLANE;
format = ChoosePixelFormat( *hDC, &pfd );
SetPixelFormat( *hDC, format, &pfd );
// create and enable the render context (RC)
*hRC = wglCreateContext( *hDC );
wglMakeCurrent( *hDC, *hRC );
sOpenGLInitialized = true;
}
// Disable OpenGL
void DisableOpenGL(HWND hWnd, HDC hDC, HGLRC hRC)
{
sOpenGLInitialized = false;
wglMakeCurrent( NULL, NULL );
wglDeleteContext( hRC );
ReleaseDC( hWnd, hDC );
}
#endif //_WINDOWS

View File

@@ -0,0 +1,79 @@
/*
Bullet Continuous Collision Detection and Physics Library
Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.org
This software is provided 'as-is', without any express or implied warranty.
In no event will the authors be held liable for any damages arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it freely,
subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#ifdef _WINDOWS
#include "Win32DemoApplication.h"
#if 0
void Win32DemoApplication::renderme()
{
}
void Win32DemoApplication::setTexturing(bool useTexture)
{
}
void Win32DemoApplication::setShadows(bool useShadows)
{
}
void Win32DemoApplication::setCameraDistance(float camDist)
{
}
void Win32DemoApplication::clientResetScene()
{
}
#endif
void Win32DemoApplication::updateModifierKeys()
{
//not yet
}
void Win32DemoApplication::specialKeyboard(int key, int x, int y)
{
(void)x;
(void)y;
switch (key)
{
case VK_LEFT : stepLeft(); break;
case VK_RIGHT : stepRight(); break;
case VK_UP : stepFront(); break;
case VK_DOWN : stepBack(); break;
// case GLUT_KEY_PAGE_UP : zoomIn(); break;
// case GLUT_KEY_PAGE_DOWN : zoomOut(); break;
// case GLUT_KEY_HOME : toggleIdle(); break;
default:
// std::cout << "unused (special) key : " << key << std::endl;
break;
}
}
void Win32DemoApplication::swapBuffers()
{
}
#endif

View File

@@ -0,0 +1,40 @@
/*
Bullet Continuous Collision Detection and Physics Library
Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.org
This software is provided 'as-is', without any express or implied warranty.
In no event will the authors be held liable for any damages arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it freely,
subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#ifndef WIN32_DEMO_APPLICATION_H
#define WIN32_DEMO_APPLICATION_H
#include "DemoApplication.h"
class Win32DemoApplication : public DemoApplication
{
protected:
public:
virtual void swapBuffers();
void specialKeyboard(int key, int x, int y);
virtual void updateModifierKeys();
};
#endif //WIN32_DEMO_APPLICATION_H

View File

@@ -0,0 +1,18 @@
project "testbed"
kind "StaticLib"
targetdir "../../build/lib"
includedirs {
".",
"../../bullet2"
}
configuration {"Windows"}
includedirs {
"../../rendering/GlutGlewWindows"
}
configuration{}
files {
"**.cpp",
"**.h"
}