Added specialKeyboardUp handler to GLUI (why was it missing?)
Some cleanup for ForkLiftDemo Enable textures for ConcavePhysicsDemo, Added scaling to BasicDemo to show small objects (20 centimeter) Removed demos from 'AllBulletDemos': less (clutter) = more
This commit is contained in:
@@ -103,48 +103,51 @@ public:
|
|||||||
btDemoEntry g_demoEntries[] =
|
btDemoEntry g_demoEntries[] =
|
||||||
{
|
{
|
||||||
|
|
||||||
{"SoftBody Cloth",SoftDemo0::Create},
|
|
||||||
{"SoftBody Pressure",SoftDemo1::Create},
|
{"ForkLiftDemo",ForkLiftDemo::Create},
|
||||||
{"SoftBody Volume",SoftDemo2::Create},
|
{"RagdollDemo",RagdollDemo::Create},
|
||||||
{"SoftBody Ropes",SoftDemo3::Create},
|
{"BasicDemo", BasicDemo::Create},
|
||||||
|
{"ConvexDecomposition",ConvexDecompositionDemo::Create},
|
||||||
|
{"Concave Moving", GimpactConcaveDemo::Create},
|
||||||
|
{"DynamicControlDemo",MotorDemo::Create},
|
||||||
|
{"ConcaveDemo",ConcaveDemo::Create},
|
||||||
|
// {"SoftBody Cloth",SoftDemo0::Create},
|
||||||
|
// {"SoftBody Pressure",SoftDemo1::Create},
|
||||||
{"SoftBody Ropes Attach",SoftDemo4::Create},
|
{"SoftBody Ropes Attach",SoftDemo4::Create},
|
||||||
{"SoftBody Cloth Attach",SoftDemo5::Create},
|
{"SoftBody Cloth Attach",SoftDemo5::Create},
|
||||||
{"SoftBody Sticks",SoftDemo6::Create},
|
|
||||||
{"SoftBody Collide",SoftDemo7::Create},
|
|
||||||
{"SoftBody Collide2",SoftDemo8::Create},
|
|
||||||
{"SoftBody Collide3",SoftDemo9::Create},
|
|
||||||
{"SoftBody Impact",SoftDemo10::Create},
|
|
||||||
{"SoftBody Aero",SoftDemo11::Create},
|
|
||||||
{"SoftBody Friction",SoftDemo12::Create},
|
|
||||||
{"SoftBody Torus",SoftDemo13::Create},
|
|
||||||
{"SoftBody Torus Match",SoftDemo14::Create},
|
|
||||||
{"SoftBody Bunny",SoftDemo15::Create},
|
|
||||||
{"SoftBody Bunny Match",SoftDemo16::Create},
|
|
||||||
{"SoftBody Init Cutting",SoftDemo17::Create},
|
|
||||||
{"SoftBody Cluster Deform",SoftDemo18::Create},
|
|
||||||
{"SoftBody Cluster Collide1",SoftDemo19::Create},
|
{"SoftBody Cluster Collide1",SoftDemo19::Create},
|
||||||
{"SoftBody Cluster Collide2",SoftDemo20::Create},
|
{"SoftBody Volume",SoftDemo2::Create},
|
||||||
{"SoftBody Cluster Socket",SoftDemo21::Create},
|
|
||||||
{"SoftBody Cluster Hinge",SoftDemo22::Create},
|
|
||||||
{"SoftBody Cluster Combine",SoftDemo23::Create},
|
|
||||||
{"SoftBody Cluster Car",SoftDemo24::Create},
|
{"SoftBody Cluster Car",SoftDemo24::Create},
|
||||||
{"SoftBody Cluster Robot",SoftDemo25::Create},
|
{"SoftBody Cluster Robot",SoftDemo25::Create},
|
||||||
{"SoftBody Cluster Stack Soft",SoftDemo26::Create},
|
// {"SoftBody Ropes",SoftDemo3::Create},
|
||||||
|
{"SoftBody Sticks",SoftDemo6::Create},
|
||||||
|
// {"SoftBody Collide",SoftDemo7::Create},
|
||||||
|
// {"SoftBody Collide2",SoftDemo8::Create},
|
||||||
|
// {"SoftBody Collide3",SoftDemo9::Create},
|
||||||
|
// {"SoftBody Impact",SoftDemo10::Create},
|
||||||
|
{"SoftBody Aero",SoftDemo11::Create},
|
||||||
|
// {"SoftBody Friction",SoftDemo12::Create},
|
||||||
|
// {"SoftBody Torus",SoftDemo13::Create},
|
||||||
|
// {"SoftBody Torus Match",SoftDemo14::Create},
|
||||||
|
// {"SoftBody Bunny",SoftDemo15::Create},
|
||||||
|
// {"SoftBody Bunny Match",SoftDemo16::Create},
|
||||||
|
{"SoftBody Init Cutting",SoftDemo17::Create},
|
||||||
|
// {"SoftBody Cluster Deform",SoftDemo18::Create},
|
||||||
|
|
||||||
|
// {"SoftBody Cluster Collide2",SoftDemo20::Create},
|
||||||
|
// {"SoftBody Cluster Socket",SoftDemo21::Create},
|
||||||
|
// {"SoftBody Cluster Hinge",SoftDemo22::Create},
|
||||||
|
// {"SoftBody Cluster Combine",SoftDemo23::Create},
|
||||||
|
// {"SoftBody Cluster Stack Soft",SoftDemo26::Create},
|
||||||
{"SoftBody Cluster Stack Mixed",SoftDemo27::Create},
|
{"SoftBody Cluster Stack Mixed",SoftDemo27::Create},
|
||||||
{"DynamicControlDemo",MotorDemo::Create},
|
|
||||||
{"RagdollDemo",RagdollDemo::Create},
|
// {"SliderConstraint",SliderConstraintDemo::Create},
|
||||||
{"SliderConstraint",SliderConstraintDemo::Create},
|
// {"CcdPhysicsDemo", CcdPhysicsDemo::Create},
|
||||||
{"BasicDemo", BasicDemo::Create},
|
// {"ConcaveRaycastDemo",ConcaveRaycastDemo::Create},
|
||||||
{"CcdPhysicsDemo", CcdPhysicsDemo::Create},
|
// {"ConcaveConvexcastDemo",ConcaveConvexcastDemo::Create},
|
||||||
{"ConcaveDemo",ConcaveDemo::Create},
|
//{"BspDemo", BspDemo::Create},
|
||||||
{"ConcaveRaycastDemo",ConcaveRaycastDemo::Create},
|
// {"Raytracer Test",Raytracer::Create},
|
||||||
{"ConcaveConvexcastDemo",ConcaveConvexcastDemo::Create},
|
// {"GjkConvexCast",LinearConvexCastDemo::Create},
|
||||||
{"ConvexDecomposition",ConvexDecompositionDemo::Create},
|
|
||||||
{"BspDemo", BspDemo::Create},
|
|
||||||
{"Gimpact Test", GimpactConcaveDemo::Create},
|
|
||||||
{"Raytracer Test",Raytracer::Create},
|
|
||||||
{"GjkConvexCast",LinearConvexCastDemo::Create},
|
|
||||||
{"ForkLiftDemo",ForkLiftDemo::Create},
|
|
||||||
{"Benchmark 3000 FALL",BenchmarkDemo1::Create},
|
{"Benchmark 3000 FALL",BenchmarkDemo1::Create},
|
||||||
{"Benchmark 1000 STACK",BenchmarkDemo2::Create},
|
{"Benchmark 1000 STACK",BenchmarkDemo2::Create},
|
||||||
{"Benchmark 136 RAGDOLLS",BenchmarkDemo3::Create},
|
{"Benchmark 136 RAGDOLLS",BenchmarkDemo3::Create},
|
||||||
|
|||||||
@@ -34,8 +34,8 @@
|
|||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
int testIndex=0;
|
int testIndex=1;
|
||||||
int testSelection=24;
|
int testSelection=0;
|
||||||
btDemoEntry* entry;
|
btDemoEntry* entry;
|
||||||
DemoApplication* demo;
|
DemoApplication* demo;
|
||||||
int iterationCount;
|
int iterationCount;
|
||||||
@@ -66,14 +66,15 @@ namespace
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void setDefaultSettings()
|
void setDefaultSettings()
|
||||||
{
|
{
|
||||||
viewX = 0.0f;
|
viewX = 0.0f;
|
||||||
viewY = 0.0f;
|
viewY = 0.0f;
|
||||||
framePeriod = 16;//todo: test if this value should be 0
|
framePeriod = 16;//16;//todo: test if this value should be 0
|
||||||
|
|
||||||
width = 640;
|
width = 800;//640;
|
||||||
height = 480;
|
height = 600;//1024;//480;
|
||||||
iterationCount = 10;
|
iterationCount = 10;
|
||||||
gDrawAabb=0;
|
gDrawAabb=0;
|
||||||
gWireFrame=0;
|
gWireFrame=0;
|
||||||
@@ -87,7 +88,7 @@ void setDefaultSettings()
|
|||||||
gUseWarmstarting = 1;
|
gUseWarmstarting = 1;
|
||||||
gRandomizeConstraints = 1;
|
gRandomizeConstraints = 1;
|
||||||
gErp = 0.2f;
|
gErp = 0.2f;
|
||||||
gSlop=0.0f;
|
gSlop=0.01f;
|
||||||
gErp2 = 0.1f;
|
gErp2 = 0.1f;
|
||||||
gWarmStartingParameter = 0.85f;
|
gWarmStartingParameter = 0.85f;
|
||||||
|
|
||||||
@@ -317,6 +318,18 @@ void Keyboard(unsigned char key, int x, int y)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void KeyboardSpecialUp(int key, int x, int y)
|
||||||
|
{
|
||||||
|
if (demo)
|
||||||
|
{
|
||||||
|
demo->specialKeyboardUp(key,x,y);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void KeyboardSpecial(int key, int x, int y)
|
void KeyboardSpecial(int key, int x, int y)
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -380,6 +393,7 @@ int main(int argc, char** argv)
|
|||||||
GLUI_Master.set_glutReshapeFunc(Resize);
|
GLUI_Master.set_glutReshapeFunc(Resize);
|
||||||
GLUI_Master.set_glutKeyboardFunc(Keyboard);
|
GLUI_Master.set_glutKeyboardFunc(Keyboard);
|
||||||
GLUI_Master.set_glutSpecialFunc(KeyboardSpecial);
|
GLUI_Master.set_glutSpecialFunc(KeyboardSpecial);
|
||||||
|
GLUI_Master.set_glutSpecialUpFunc(KeyboardSpecialUp);
|
||||||
GLUI_Master.set_glutMouseFunc(Mouse);
|
GLUI_Master.set_glutMouseFunc(Mouse);
|
||||||
glutMotionFunc(MouseMotion);
|
glutMotionFunc(MouseMotion);
|
||||||
|
|
||||||
@@ -410,14 +424,13 @@ int main(int argc, char** argv)
|
|||||||
GLUI_Spinner* spinner = 0;
|
GLUI_Spinner* spinner = 0;
|
||||||
|
|
||||||
spinner = glui->add_spinner("ERP", GLUI_SPINNER_FLOAT, &gErp);
|
spinner = glui->add_spinner("ERP", GLUI_SPINNER_FLOAT, &gErp);
|
||||||
spinner->set_float_limits(0.f,1.f);
|
// spinner->set_float_limits(0.f,1.f);
|
||||||
spinner = glui->add_spinner("ERP2", GLUI_SPINNER_FLOAT, &gErp2);
|
// spinner = glui->add_spinner("ERP2", GLUI_SPINNER_FLOAT, &gErp2);
|
||||||
spinner->set_float_limits(0.f,1.f);
|
spinner->set_float_limits(0.f,1.f);
|
||||||
spinner = glui->add_spinner("Slop", GLUI_SPINNER_FLOAT, &gSlop);
|
spinner = glui->add_spinner("Slop", GLUI_SPINNER_FLOAT, &gSlop);
|
||||||
spinner->set_float_limits(0.f,1.f);
|
spinner->set_float_limits(0.f,1.f);
|
||||||
|
// spinner = glui->add_spinner("WSP", GLUI_SPINNER_FLOAT,&gWarmStartingParameter);
|
||||||
spinner = glui->add_spinner("WSP", GLUI_SPINNER_FLOAT,&gWarmStartingParameter);
|
// spinner->set_float_limits (0.f,1.0);
|
||||||
spinner->set_float_limits (0.f,1.0);
|
|
||||||
glui->add_checkbox("Warmstarting", &gUseWarmstarting);
|
glui->add_checkbox("Warmstarting", &gUseWarmstarting);
|
||||||
glui->add_checkbox("Randomize Constraints", &gRandomizeConstraints);
|
glui->add_checkbox("Randomize Constraints", &gRandomizeConstraints);
|
||||||
|
|
||||||
@@ -434,14 +447,6 @@ int main(int argc, char** argv)
|
|||||||
glui->add_checkbox_to_panel(drawPanel, "Shadows", &gDrawShadows);
|
glui->add_checkbox_to_panel(drawPanel, "Shadows", &gDrawShadows);
|
||||||
glui->add_checkbox_to_panel(drawPanel, "Clusters", &gDrawClusters);
|
glui->add_checkbox_to_panel(drawPanel, "Clusters", &gDrawClusters);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// glui->add_checkbox_to_panel(drawPanel, "Impulses", &settings.drawImpulses);
|
|
||||||
// glui->add_checkbox_to_panel(drawPanel, "Statistics", &settings.drawStats);
|
|
||||||
|
|
||||||
|
|
||||||
int testCount = 0;
|
int testCount = 0;
|
||||||
btDemoEntry* e = g_demoEntries;
|
btDemoEntry* e = g_demoEntries;
|
||||||
while (e->createFcn)
|
while (e->createFcn)
|
||||||
@@ -456,12 +461,12 @@ int main(int argc, char** argv)
|
|||||||
glui->add_button("Toggle Pause", 0,(GLUI_Update_CB)TogglePause);
|
glui->add_button("Toggle Pause", 0,(GLUI_Update_CB)TogglePause);
|
||||||
|
|
||||||
glui->add_button("Single Step", 0,(GLUI_Update_CB)SingleSimulationStep);
|
glui->add_button("Single Step", 0,(GLUI_Update_CB)SingleSimulationStep);
|
||||||
glui->add_button("Reset Scene", 0,(GLUI_Update_CB)ResetScene);
|
// glui->add_button("Reset Scene", 0,(GLUI_Update_CB)ResetScene);
|
||||||
glui->add_button("Restart Scene", 0,(GLUI_Update_CB)RestartScene);
|
glui->add_button("Restart Scene", 0,(GLUI_Update_CB)RestartScene);
|
||||||
|
|
||||||
glui->add_separator();
|
glui->add_separator();
|
||||||
|
|
||||||
glui->add_button("Exit", 0,(GLUI_Update_CB)exit);
|
// glui->add_button("Exit", 0,(GLUI_Update_CB)exit);
|
||||||
|
|
||||||
glui->set_main_gfx_window( mainWindow );
|
glui->set_main_gfx_window( mainWindow );
|
||||||
|
|
||||||
|
|||||||
@@ -21,6 +21,8 @@ subject to the following restrictions:
|
|||||||
//maximum number of objects (and allow user to shoot additional boxes)
|
//maximum number of objects (and allow user to shoot additional boxes)
|
||||||
#define MAX_PROXIES (ARRAY_SIZE_X*ARRAY_SIZE_Y*ARRAY_SIZE_Z + 1024)
|
#define MAX_PROXIES (ARRAY_SIZE_X*ARRAY_SIZE_Y*ARRAY_SIZE_Z + 1024)
|
||||||
|
|
||||||
|
///scaling of the objects (0.1 = 20 centimeter boxes )
|
||||||
|
#define SCALING 0.1
|
||||||
#define START_POS_X -5
|
#define START_POS_X -5
|
||||||
#define START_POS_Y -5
|
#define START_POS_Y -5
|
||||||
#define START_POS_Z -3
|
#define START_POS_Z -3
|
||||||
@@ -80,7 +82,7 @@ void BasicDemo::initPhysics()
|
|||||||
setTexturing(true);
|
setTexturing(true);
|
||||||
setShadows(true);
|
setShadows(true);
|
||||||
|
|
||||||
setCameraDistance(btScalar(50.));
|
setCameraDistance(btScalar(SCALING*50.));
|
||||||
|
|
||||||
///collision configuration contains default setup for memory, collision setup
|
///collision configuration contains default setup for memory, collision setup
|
||||||
m_collisionConfiguration = new btDefaultCollisionConfiguration();
|
m_collisionConfiguration = new btDefaultCollisionConfiguration();
|
||||||
@@ -106,7 +108,7 @@ void BasicDemo::initPhysics()
|
|||||||
|
|
||||||
btTransform groundTransform;
|
btTransform groundTransform;
|
||||||
groundTransform.setIdentity();
|
groundTransform.setIdentity();
|
||||||
groundTransform.setOrigin(btVector3(0,-56,0));
|
groundTransform.setOrigin(btVector3(0,-50,0));
|
||||||
|
|
||||||
//We can also use DemoApplication::localCreateRigidBody, but for clarity it is provided here:
|
//We can also use DemoApplication::localCreateRigidBody, but for clarity it is provided here:
|
||||||
{
|
{
|
||||||
@@ -133,7 +135,7 @@ void BasicDemo::initPhysics()
|
|||||||
//create a few dynamic rigidbodies
|
//create a few dynamic rigidbodies
|
||||||
// Re-using the same collision is better for memory usage and performance
|
// Re-using the same collision is better for memory usage and performance
|
||||||
|
|
||||||
btCollisionShape* colShape = new btBoxShape(btVector3(1,1,1));
|
btCollisionShape* colShape = new btBoxShape(btVector3(SCALING*1,SCALING*1,SCALING*1));
|
||||||
//btCollisionShape* colShape = new btSphereShape(btScalar(1.));
|
//btCollisionShape* colShape = new btSphereShape(btScalar(1.));
|
||||||
m_collisionShapes.push_back(colShape);
|
m_collisionShapes.push_back(colShape);
|
||||||
|
|
||||||
@@ -160,9 +162,9 @@ void BasicDemo::initPhysics()
|
|||||||
{
|
{
|
||||||
for(int j = 0;j<ARRAY_SIZE_Z;j++)
|
for(int j = 0;j<ARRAY_SIZE_Z;j++)
|
||||||
{
|
{
|
||||||
startTransform.setOrigin(btVector3(
|
startTransform.setOrigin(SCALING*btVector3(
|
||||||
2.0*i + start_x,
|
2.0*i + start_x,
|
||||||
10+2.0*k + start_y,
|
20+2.0*k + start_y,
|
||||||
2.0*j + start_z));
|
2.0*j + start_z));
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -140,7 +140,7 @@ void ConcaveDemo::initPhysics()
|
|||||||
{
|
{
|
||||||
|
|
||||||
setTexturing(true);
|
setTexturing(true);
|
||||||
setShadows(false);
|
setShadows(true);
|
||||||
|
|
||||||
#define TRISIZE 10.f
|
#define TRISIZE 10.f
|
||||||
|
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ const int maxOverlap = 65535;
|
|||||||
float gEngineForce = 0.f;
|
float gEngineForce = 0.f;
|
||||||
|
|
||||||
float defaultBreakingForce = 10.f;
|
float defaultBreakingForce = 10.f;
|
||||||
float gBreakingForce = 10.f;
|
float gBreakingForce = 100.f;
|
||||||
|
|
||||||
float maxEngineForce = 1000.f;//this should be engine/velocity dependent
|
float maxEngineForce = 1000.f;//this should be engine/velocity dependent
|
||||||
float maxBreakingForce = 100.f;
|
float maxBreakingForce = 100.f;
|
||||||
@@ -116,6 +116,9 @@ m_vertices(0)
|
|||||||
m_vehicle = 0;
|
m_vehicle = 0;
|
||||||
m_cameraPosition = btVector3(30,30,30);
|
m_cameraPosition = btVector3(30,30,30);
|
||||||
m_useDefaultCamera = false;
|
m_useDefaultCamera = false;
|
||||||
|
setTexturing(true);
|
||||||
|
setShadows(true);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -131,9 +134,19 @@ void ForkLiftDemo::termPhysics()
|
|||||||
btRigidBody* body = btRigidBody::upcast(obj);
|
btRigidBody* body = btRigidBody::upcast(obj);
|
||||||
if (body && body->getMotionState())
|
if (body && body->getMotionState())
|
||||||
{
|
{
|
||||||
|
|
||||||
|
while (body->getNumConstraintRefs())
|
||||||
|
{
|
||||||
|
btTypedConstraint* constraint = body->getConstraintRef(0);
|
||||||
|
m_dynamicsWorld->removeConstraint(constraint);
|
||||||
|
delete constraint;
|
||||||
|
}
|
||||||
delete body->getMotionState();
|
delete body->getMotionState();
|
||||||
|
m_dynamicsWorld->removeRigidBody(body);
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
m_dynamicsWorld->removeCollisionObject( obj );
|
||||||
}
|
}
|
||||||
m_dynamicsWorld->removeCollisionObject( obj );
|
|
||||||
delete obj;
|
delete obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -348,7 +361,6 @@ const float TRIANGLE_SIZE=20.f;
|
|||||||
|
|
||||||
{
|
{
|
||||||
btCollisionShape* suppShape = new btBoxShape(btVector3(0.5f,0.1f,0.5f));
|
btCollisionShape* suppShape = new btBoxShape(btVector3(0.5f,0.1f,0.5f));
|
||||||
m_collisionShapes.push_back(chassisShape);
|
|
||||||
btTransform suppLocalTrans;
|
btTransform suppLocalTrans;
|
||||||
suppLocalTrans.setIdentity();
|
suppLocalTrans.setIdentity();
|
||||||
//localTrans effectively shifts the center of mass with respect to the chassis
|
//localTrans effectively shifts the center of mass with respect to the chassis
|
||||||
@@ -666,6 +678,9 @@ void ForkLiftDemo::displayCallback(void)
|
|||||||
void ForkLiftDemo::clientResetScene()
|
void ForkLiftDemo::clientResetScene()
|
||||||
{
|
{
|
||||||
gVehicleSteering = 0.f;
|
gVehicleSteering = 0.f;
|
||||||
|
gBreakingForce = defaultBreakingForce;
|
||||||
|
gEngineForce = 0.f;
|
||||||
|
|
||||||
m_carChassis->setCenterOfMassTransform(btTransform::getIdentity());
|
m_carChassis->setCenterOfMassTransform(btTransform::getIdentity());
|
||||||
m_carChassis->setLinearVelocity(btVector3(0,0,0));
|
m_carChassis->setLinearVelocity(btVector3(0,0,0));
|
||||||
m_carChassis->setAngularVelocity(btVector3(0,0,0));
|
m_carChassis->setAngularVelocity(btVector3(0,0,0));
|
||||||
|
|||||||
@@ -113,6 +113,7 @@ enum GLUI_Glut_CB_Types
|
|||||||
GLUI_GLUT_MOUSE,
|
GLUI_GLUT_MOUSE,
|
||||||
GLUI_GLUT_MOTION,
|
GLUI_GLUT_MOTION,
|
||||||
GLUI_GLUT_SPECIAL,
|
GLUI_GLUT_SPECIAL,
|
||||||
|
GLUI_GLUT_SPECIAL_UP,
|
||||||
GLUI_GLUT_PASSIVE_MOTION,
|
GLUI_GLUT_PASSIVE_MOTION,
|
||||||
GLUI_GLUT_ENTRY,
|
GLUI_GLUT_ENTRY,
|
||||||
GLUI_GLUT_VISIBILITY
|
GLUI_GLUT_VISIBILITY
|
||||||
@@ -581,6 +582,8 @@ public:
|
|||||||
void set_glutReshapeFunc (void (*f)(int width, int height));
|
void set_glutReshapeFunc (void (*f)(int width, int height));
|
||||||
void set_glutKeyboardFunc(void (*f)(unsigned char key, int x, int y));
|
void set_glutKeyboardFunc(void (*f)(unsigned char key, int x, int y));
|
||||||
void set_glutSpecialFunc (void (*f)(int key, int x, int y));
|
void set_glutSpecialFunc (void (*f)(int key, int x, int y));
|
||||||
|
void set_glutSpecialUpFunc(void (*f)(int key, int x, int y));
|
||||||
|
|
||||||
void set_glutMouseFunc (void (*f)(int, int, int, int ));
|
void set_glutMouseFunc (void (*f)(int, int, int, int ));
|
||||||
|
|
||||||
void set_glutDisplayFunc(void (*f)(void)) {glutDisplayFunc(f);}
|
void set_glutDisplayFunc(void (*f)(void)) {glutDisplayFunc(f);}
|
||||||
@@ -649,6 +652,7 @@ public:
|
|||||||
/*********** Pointers to GLUT callthrough functions *****/
|
/*********** Pointers to GLUT callthrough functions *****/
|
||||||
void (*glut_keyboard_CB)(unsigned char, int, int);
|
void (*glut_keyboard_CB)(unsigned char, int, int);
|
||||||
void (*glut_special_CB)(int, int, int);
|
void (*glut_special_CB)(int, int, int);
|
||||||
|
void (*glut_special_up_CB)(int, int, int);
|
||||||
void (*glut_reshape_CB)(int, int);
|
void (*glut_reshape_CB)(int, int);
|
||||||
void (*glut_passive_motion_CB)(int,int);
|
void (*glut_passive_motion_CB)(int,int);
|
||||||
void (*glut_mouse_CB)(int,int,int,int);
|
void (*glut_mouse_CB)(int,int,int,int);
|
||||||
@@ -692,6 +696,7 @@ class GLUI_Main : public GLUI_Node
|
|||||||
friend void glui_mouse_func(int button, int state, int x, int y);
|
friend void glui_mouse_func(int button, int state, int x, int y);
|
||||||
friend void glui_keyboard_func(unsigned char key, int x, int y);
|
friend void glui_keyboard_func(unsigned char key, int x, int y);
|
||||||
friend void glui_special_func(int key, int x, int y);
|
friend void glui_special_func(int key, int x, int y);
|
||||||
|
friend void glui_special_up_func(int key, int x, int y);
|
||||||
friend void glui_passive_motion_func(int x, int y);
|
friend void glui_passive_motion_func(int x, int y);
|
||||||
friend void glui_reshape_func( int w, int h );
|
friend void glui_reshape_func( int w, int h );
|
||||||
friend void glui_visibility_func(int state);
|
friend void glui_visibility_func(int state);
|
||||||
@@ -740,6 +745,7 @@ protected:
|
|||||||
void mouse(int button, int state, int x, int y);
|
void mouse(int button, int state, int x, int y);
|
||||||
void keyboard(unsigned char key, int x, int y);
|
void keyboard(unsigned char key, int x, int y);
|
||||||
void special(int key, int x, int y);
|
void special(int key, int x, int y);
|
||||||
|
void special_up(int key, int x, int y);
|
||||||
void passive_motion(int x, int y);
|
void passive_motion(int x, int y);
|
||||||
void reshape( int w, int h );
|
void reshape( int w, int h );
|
||||||
void visibility(int state);
|
void visibility(int state);
|
||||||
@@ -905,6 +911,7 @@ public:
|
|||||||
virtual int mouse_held_down_handler( int local_x, int local_y, bool inside) { (void)local_x; (void)local_y; (void)inside; return false; }
|
virtual int mouse_held_down_handler( int local_x, int local_y, bool inside) { (void)local_x; (void)local_y; (void)inside; return false; }
|
||||||
virtual int key_handler( unsigned char key, int modifiers ) { (void)key; (void)modifiers; return false; }
|
virtual int key_handler( unsigned char key, int modifiers ) { (void)key; (void)modifiers; return false; }
|
||||||
virtual int special_handler( int key,int modifiers ) { (void)key; (void)modifiers; return false; }
|
virtual int special_handler( int key,int modifiers ) { (void)key; (void)modifiers; return false; }
|
||||||
|
virtual int special_up_handler( int key,int modifiers ) { (void)key; (void)modifiers; return false; }
|
||||||
|
|
||||||
virtual void update_size( void ) { }
|
virtual void update_size( void ) { }
|
||||||
virtual void idle( void ) { }
|
virtual void idle( void ) { }
|
||||||
|
|||||||
@@ -310,6 +310,48 @@ void glui_keyboard_func(unsigned char key, int x, int y)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void glui_special_up_func(int key, int x, int y)
|
||||||
|
{
|
||||||
|
GLUI *glui;
|
||||||
|
int current_window;
|
||||||
|
GLUI_Glut_Window *glut_window;
|
||||||
|
|
||||||
|
current_window = glutGetWindow();
|
||||||
|
glut_window = GLUI_Master.find_glut_window( current_window );
|
||||||
|
|
||||||
|
if (glut_window) /** Was event in a GLUT window? **/
|
||||||
|
{
|
||||||
|
if ( GLUI_Master.active_control_glui AND GLUI_Master.active_control )
|
||||||
|
{
|
||||||
|
glutSetWindow( GLUI_Master.active_control_glui->get_glut_window_id() );
|
||||||
|
|
||||||
|
GLUI_Master.active_control_glui->special_up(key,x,y);
|
||||||
|
finish_drawing();
|
||||||
|
|
||||||
|
glutSetWindow( current_window );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (glut_window->glut_special_up_CB)
|
||||||
|
glut_window->glut_special_up_CB( key, x, y );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else /*** Nope, event was in a standalone GLUI window **/
|
||||||
|
{
|
||||||
|
glui = GLUI_Master.find_glui_by_window_id(glutGetWindow());
|
||||||
|
|
||||||
|
if ( glui )
|
||||||
|
{
|
||||||
|
glui->special_up(key,x,y);
|
||||||
|
finish_drawing();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/************************************************ glui_special_func() ********/
|
/************************************************ glui_special_func() ********/
|
||||||
|
|
||||||
void glui_special_func(int key, int x, int y)
|
void glui_special_func(int key, int x, int y)
|
||||||
@@ -731,6 +773,17 @@ void GLUI_Main::keyboard(unsigned char key, int x, int y)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void GLUI_Main::special_up(int key, int x, int y)
|
||||||
|
{
|
||||||
|
curr_modifiers = glutGetModifiers();
|
||||||
|
|
||||||
|
/*** Pass the keystroke onto the active control, if any ***/
|
||||||
|
if ( active_control != NULL )
|
||||||
|
active_control->special_up_handler( key, glutGetModifiers() );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/****************************** GLUI_Main::special() **************/
|
/****************************** GLUI_Main::special() **************/
|
||||||
|
|
||||||
void GLUI_Main::special(int key, int x, int y)
|
void GLUI_Main::special(int key, int x, int y)
|
||||||
@@ -1665,6 +1718,16 @@ void GLUI_Master_Object::set_glutKeyboardFunc(void (*f)(unsigned char key,
|
|||||||
|
|
||||||
/*********************** GLUI_Master_Object::set_glutSpecialFunc() **********/
|
/*********************** GLUI_Master_Object::set_glutSpecialFunc() **********/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void GLUI_Master_Object::set_glutSpecialUpFunc(void (*f)(int key,
|
||||||
|
int x, int y))
|
||||||
|
{
|
||||||
|
glutSpecialUpFunc( glui_special_up_func );
|
||||||
|
add_cb_to_glut_window( glutGetWindow(), GLUI_GLUT_SPECIAL_UP, (void*) f);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void GLUI_Master_Object::set_glutSpecialFunc(void (*f)(int key,
|
void GLUI_Master_Object::set_glutSpecialFunc(void (*f)(int key,
|
||||||
int x, int y))
|
int x, int y))
|
||||||
{
|
{
|
||||||
@@ -1865,6 +1928,9 @@ void GLUI_Master_Object::add_cb_to_glut_window(int window_id,
|
|||||||
case GLUI_GLUT_SPECIAL:
|
case GLUI_GLUT_SPECIAL:
|
||||||
window->glut_special_CB = (void(*)(int,int,int)) cb;
|
window->glut_special_CB = (void(*)(int,int,int)) cb;
|
||||||
break;
|
break;
|
||||||
|
case GLUI_GLUT_SPECIAL_UP:
|
||||||
|
window->glut_special_up_CB = (void(*)(int,int,int)) cb;
|
||||||
|
break;
|
||||||
case GLUI_GLUT_MOUSE:
|
case GLUI_GLUT_MOUSE:
|
||||||
window->glut_mouse_CB = (void(*)(int,int,int,int)) cb;
|
window->glut_mouse_CB = (void(*)(int,int,int,int)) cb;
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user