4 #include "GlutDemoApplication.h"
8 #include "BulletDynamics/Dynamics/btDiscreteDynamicsWorld.h"
9 #include "BulletDynamics/Dynamics/btRigidBody.h"
11 void GlutDemoApplication::updateModifierKeys()
14 if (glutGetModifiers() & GLUT_ACTIVE_ALT
)
15 m_modifierKeys
|= BT_ACTIVE_ALT
;
17 if (glutGetModifiers() & GLUT_ACTIVE_CTRL
)
18 m_modifierKeys
|= BT_ACTIVE_CTRL
;
20 if (glutGetModifiers() & GLUT_ACTIVE_SHIFT
)
21 m_modifierKeys
|= BT_ACTIVE_SHIFT
;
24 void GlutDemoApplication::specialKeyboard(int key
, int x
, int y
)
46 int numObj
= getDynamicsWorld()->getNumCollisionObjects();
49 btCollisionObject
* obj
= getDynamicsWorld()->getCollisionObjectArray()[numObj
-1];
51 getDynamicsWorld()->removeCollisionObject(obj
);
52 btRigidBody
* body
= btRigidBody::upcast(obj
);
53 if (body
&& body
->getMotionState())
55 delete body
->getMotionState();
63 case GLUT_KEY_LEFT
: stepLeft(); break;
64 case GLUT_KEY_RIGHT
: stepRight(); break;
65 case GLUT_KEY_UP
: stepFront(); break;
66 case GLUT_KEY_DOWN
: stepBack(); break;
67 case GLUT_KEY_PAGE_UP
: zoomIn(); break;
68 case GLUT_KEY_PAGE_DOWN
: zoomOut(); break;
69 case GLUT_KEY_HOME
: toggleIdle(); break;
71 //std::cout << "unused (special) key : " << key << std::endl;
79 void GlutDemoApplication::swapBuffers()