本文整理汇总了C++中GLUI_Spinner::set_int_limits方法的典型用法代码示例。如果您正苦于以下问题:C++ GLUI_Spinner::set_int_limits方法的具体用法?C++ GLUI_Spinner::set_int_limits怎么用?C++ GLUI_Spinner::set_int_limits使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GLUI_Spinner
的用法示例。
在下文中一共展示了GLUI_Spinner::set_int_limits方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: initGLUI
void initGLUI(int window) {
GLUI *gluiSide = GLUI_Master.create_glui_subwindow(window, GLUI_SUBWINDOW_RIGHT);
gluiSide->set_main_gfx_window(window);
gluiSide->add_button("New Curve", NEW_CURVE, gluiHandler);
gluiSide->add_button("New Surface", NEW_SURFACE, gluiHandler);
surfPanel = gluiSide->add_panel("Surface Parms", GLUI_PANEL_EMBOSSED);
GLUI_Spinner *xS = gluiSide->add_spinner_to_panel(surfPanel, "X Pts.",
GLUI_SPINNER_INT, &surf_x, SURF_X, gluiHandler);
xS->set_int_limits(3, 10);
GLUI_Spinner *yS = gluiSide->add_spinner_to_panel(surfPanel, "Y Pts.",
GLUI_SPINNER_INT, &surf_y, SURF_Y, gluiHandler);
yS->set_int_limits(3, 10);
gluiSide->add_button_to_panel(surfPanel, "Ok", SURF_OK, gluiHandler);
surfPanel->disable();
gluiSide->add_button("Modify Points", MODIFY, gluiHandler);
gluiSide->add_button("Clear Screen", CLEAR, gluiHandler);
gluiSide->add_button("Camera Mode", CAMERA, gluiHandler);
gluiSide->add_separator();
GLUI_Spinner *uS = gluiSide->add_spinner("U", GLUI_SPINNER_FLOAT, &u, U, gluiHandler);
uS->set_float_limits(0.0f, 1.0f);
uS->set_speed(50);
GLUI_Spinner *vS = gluiSide->add_spinner("V", GLUI_SPINNER_FLOAT, &v, V, gluiHandler);
vS->set_float_limits(0.0f, 1.0f);
vS->set_speed(50);
gluiSide->add_separator();
gluiSide->add_button("Quit", QUIT, gluiHandler);
}
示例2: create_glui_ui
//! This function creates all the GLUI gui elements
void create_glui_ui(void)
{
GLUI *glui = GLUI_Master.create_glui_subwindow( main_window, GLUI_SUBWINDOW_RIGHT );
glui->add_statictext("Group 11 Simulation");
new GLUI_Separator(glui);
glui->add_statictext("Simulation Timesteps");
GLUI_Spinner* velocityIterationSpinner =
glui->add_spinner("Velocity Iterations", GLUI_SPINNER_INT, &settings.velocity_iterations);
velocityIterationSpinner->set_int_limits(1, 500);
GLUI_Spinner* positionIterationSpinner =
glui->add_spinner("Position Iterations", GLUI_SPINNER_INT, &settings.position_iterations);
positionIterationSpinner->set_int_limits(0, 100);
GLUI_Spinner* hertzSpinner =
glui->add_spinner("Sim steps per frame", GLUI_SPINNER_FLOAT, &settings.hz);
hertzSpinner->set_float_limits(5.0f, 200.0f);
new GLUI_Separator(glui);
//new GLUI_Column( glui, false );
glui->add_statictext("Simulation Parameters");
glui->add_checkbox("Warm Starting", &settings.enable_warm_starting);
glui->add_checkbox("Time of Impact", &settings.enable_continuous);
glui->add_checkbox("Sub-Stepping", &settings.enable_sub_stepping);
//new GLUI_Column( glui, false );
new GLUI_Separator(glui);
glui->add_statictext("Display Options");
GLUI_Panel* drawPanel = glui->add_panel("Draw");
glui->add_checkbox_to_panel(drawPanel, "Shapes", &settings.draw_shapes);
glui->add_checkbox_to_panel(drawPanel, "Joints", &settings.draw_joints);
glui->add_checkbox_to_panel(drawPanel, "AABBs", &settings.draw_AABBs);
glui->add_checkbox_to_panel(drawPanel, "Statistics", &settings.draw_stats);
glui->add_checkbox_to_panel(drawPanel, "Profile", &settings.draw_profile);
//new GLUI_Column( glui, false );
new GLUI_Separator(glui);
glui->add_button("Pause", 0, callbacks_t::pause_cb);
glui->add_button("Single Step", 0, callbacks_t::single_step_cb);
glui->add_button("Restart", 0, callbacks_t::restart_cb);
glui->add_button("Quit", 0,(GLUI_Update_CB)callbacks_t::exit_cb);
glui->set_main_gfx_window( main_window );
new GLUI_Separator(glui);
glui->add_statictext("Mayank Meghwanshi");
glui->add_statictext("Divyam Bansal");
glui->add_statictext("Jaswant Kumar");
}
示例3: initGlui
// Initialize GLUI and the user interface
void initGlui()
{
GLUI_Master.set_glutIdleFunc(NULL);
// Create GLUI window
glui = GLUI_Master.create_glui("Glui Window", 0, Win[0]+10, 0);
/*
* Add spinners and checkboxes for each degree of freedom.
* The checkboxes determine whether or not that part should rotate
* when the "animate" checkbox is on.
*
*/
addFloatSpinner("Leg 1", &leg1Rotation, 0.1, LIMB_MIN, LIMB_MAX);
glui->add_checkbox("Animate Leg 1", &animateLeg1, 0, doNothing);
addFloatSpinner("Leg 2", &leg2Rotation, 0.1, LIMB_MIN, LIMB_MAX);
glui->add_checkbox("Animate Leg 2", &animateLeg2, 0, doNothing);
addFloatSpinner("Foot 1", &foot1Rotation, 0.1, FOOT_MIN, FOOT_MAX);
glui->add_checkbox("Animate Foot 1", &animateFoot1, 0, doNothing);
addFloatSpinner("Foot 2", &foot2Rotation, 0.1, FOOT_MIN, FOOT_MAX);
glui->add_checkbox("Animate Foot 2", &animateFoot2, 0, doNothing);
addFloatSpinner("Arm", &armRotation, 0.1, LIMB_MIN, LIMB_MAX);
glui->add_checkbox("Animate Arm", &animateArm, 0, doNothing);
addFloatSpinner("Head", &headRotation, 0.1, HEAD_MIN, HEAD_MAX);
glui->add_checkbox("Animate Head", &animateHead, 0, doNothing);
/*
* The beak spinner is an int value of the distance
* between the top and bottom beaks
*
* The beak is also controlled by a checkbox
*/
GLUI_Spinner *beakSpinner
= glui->add_spinner("Beak", GLUI_SPINNER_INT, &beakDistance);
beakSpinner->set_speed(1);
beakSpinner->set_int_limits(BEAK_MIN, BEAK_MAX, GLUI_LIMIT_CLAMP);
glui->add_checkbox("Animate Beak", &animateBeak, 0, doNothing);
// Add button to specify animation mode
glui->add_separator();
glui->add_checkbox("Animate Parts", &animate_mode, 0, animateButton);
glui->add_checkbox("Play Animation", &animation_mode, 0, animationButton);
// Add "Quit" button
glui->add_separator();
glui->add_button("Quit", 0, quitButton);
// Set the main window to be the "active" window
glui->set_main_gfx_window(windowID);
}
示例4: main
int main(int argc, char **argv) {
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
glutInitWindowSize(650, 650);
glutInitWindowPosition(50, 50);
main_window = glutCreateWindow("Ferris Wheel");
glEnable(GL_DEPTH_TEST);
glEnable(GL_LIGHTING);
glEnable(GL_NORMALIZE);
p = gluNewQuadric();
q = gluNewQuadric();
glutReshapeFunc(reshape);
glutDisplayFunc(display);
init();
glEnable(GL_LIGHT0);
setMaterial( &redPlasticMaterials );
currentLighting = &whiteLighting;
glLightfv(GL_LIGHT0, GL_AMBIENT, currentLighting->ambient);
glLightfv(GL_LIGHT0, GL_DIFFUSE, currentLighting->diffuse);
glLightfv(GL_LIGHT0, GL_SPECULAR, currentLighting->specular);
glLightfv(GL_LIGHT0, GL_POSITION, light0_pos);
GLUI *control_panel = GLUI_Master.create_glui( "Controls",0, 50, 700 );
new GLUI_Button(control_panel, "Quit", 0, (GLUI_Update_CB)exit);
new GLUI_Column(control_panel, true);
GLUI_Rollout *eyePosRollout = new GLUI_Rollout(control_panel, "Camera Position", false);
GLUI_Rollout *lookAtRollout = new GLUI_Rollout(control_panel, "Lookat Point", false);
GLUI_Spinner *epxSpin = new GLUI_Spinner(eyePosRollout, "Camera X", GLUI_SPINNER_FLOAT, &EyeX, 0, look);
GLUI_Spinner *epySpin = new GLUI_Spinner(eyePosRollout, "Camera Y", GLUI_SPINNER_FLOAT, &EyeY, 0, look);
GLUI_Spinner *epzSpin = new GLUI_Spinner(eyePosRollout, "Camera Z", GLUI_SPINNER_FLOAT, &EyeZ, 0, look);
GLUI_Spinner *laxSpin = new GLUI_Spinner(lookAtRollout, "Lookat X", GLUI_SPINNER_FLOAT, &LookAtX, 0, look);
GLUI_Spinner *laySpin = new GLUI_Spinner(lookAtRollout, "Lookat Y", GLUI_SPINNER_FLOAT, &LookAtY, 0, look);
GLUI_Spinner *lazSpin = new GLUI_Spinner(lookAtRollout, "Lookat Z", GLUI_SPINNER_FLOAT, &LookAtZ, 0, look);
new GLUI_Column(control_panel, true);
GLUI_Spinner *speedSpin = new GLUI_Spinner(control_panel, "Rotation Speed", GLUI_SPINNER_FLOAT, &Speed, 0, (GLUI_Update_CB)NULL);
speedSpin->set_float_limits(-5.0f, 5.0f, GLUI_LIMIT_CLAMP);
GLUI_Spinner *recSpin = new GLUI_Spinner(control_panel, "Recursive Depth", GLUI_SPINNER_INT, &RecursiveDepth, 0, (GLUI_Update_CB)NULL);
recSpin->set_int_limits(0, 5, GLUI_LIMIT_CLAMP);
control_panel->set_main_gfx_window(main_window);
GLUI_Master.set_glutIdleFunc(update);
glutMainLoop();
}
示例5: main
int main(int argc, char* argv[])
{
/****************************************/
/* Initialize GLUT and create window */
/****************************************/
glutInit(&argc, argv);
glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH );
glutInitWindowPosition( 50, 50 );
glutInitWindowSize( 800, 600 );
main_window = glutCreateWindow( "GLUI Example 5" );
glutDisplayFunc( myGlutDisplay );
GLUI_Master.set_glutReshapeFunc( myGlutReshape );
GLUI_Master.set_glutKeyboardFunc( myGlutKeyboard );
GLUI_Master.set_glutSpecialFunc( NULL );
GLUI_Master.set_glutMouseFunc( myGlutMouse );
glutMotionFunc( myGlutMotion );
/****************************************/
/* Set up OpenGL lights */
/****************************************/
glEnable(GL_LIGHTING);
glEnable( GL_NORMALIZE );
glEnable(GL_LIGHT0);
glLightfv(GL_LIGHT0, GL_AMBIENT, light0_ambient);
glLightfv(GL_LIGHT0, GL_DIFFUSE, light0_diffuse);
glLightfv(GL_LIGHT0, GL_POSITION, light0_position);
glEnable(GL_LIGHT1);
glLightfv(GL_LIGHT1, GL_AMBIENT, light1_ambient);
glLightfv(GL_LIGHT1, GL_DIFFUSE, light1_diffuse);
glLightfv(GL_LIGHT1, GL_POSITION, light1_position);
/****************************************/
/* Enable z-buferring */
/****************************************/
glEnable(GL_DEPTH_TEST);
/****************************************/
/* Here's the GLUI code */
/****************************************/
printf( "GLUI version: %3.2f\n", GLUI_Master.get_version() );
/*** Create the side subwindow ***/
glui = GLUI_Master.create_glui_subwindow( main_window,
GLUI_SUBWINDOW_RIGHT );
obj_panel = new GLUI_Rollout(glui, "Properties", false );
/***** Control for object params *****/
new GLUI_Checkbox( obj_panel, "Wireframe", &wireframe, 1, control_cb );
GLUI_Spinner *spinner =
new GLUI_Spinner( obj_panel, "Segments:", &segments);
spinner->set_int_limits( 3, 60 );
spinner->set_alignment( GLUI_ALIGN_RIGHT );
GLUI_Spinner *scale_spinner =
new GLUI_Spinner( obj_panel, "Scale:", &scale);
scale_spinner->set_float_limits( .2f, 4.0 );
scale_spinner->set_alignment( GLUI_ALIGN_RIGHT );
/******** Add some controls for lights ********/
GLUI_Rollout *roll_lights = new GLUI_Rollout(glui, "Lights", false );
GLUI_Panel *light0 = new GLUI_Panel( roll_lights, "Light 1" );
GLUI_Panel *light1 = new GLUI_Panel( roll_lights, "Light 2" );
new GLUI_Checkbox( light0, "Enabled", &light0_enabled,
LIGHT0_ENABLED_ID, control_cb );
light0_spinner =
new GLUI_Spinner( light0, "Intensity:",
&light0_intensity, LIGHT0_INTENSITY_ID,
control_cb );
light0_spinner->set_float_limits( 0.0, 1.0 );
GLUI_Scrollbar *sb;
sb = new GLUI_Scrollbar( light0, "Red",GLUI_SCROLL_HORIZONTAL,
&light0_diffuse[0],LIGHT0_INTENSITY_ID,control_cb);
sb->set_float_limits(0,1);
sb = new GLUI_Scrollbar( light0, "Green",GLUI_SCROLL_HORIZONTAL,
&light0_diffuse[1],LIGHT0_INTENSITY_ID,control_cb);
sb->set_float_limits(0,1);
sb = new GLUI_Scrollbar( light0, "Blue",GLUI_SCROLL_HORIZONTAL,
&light0_diffuse[2],LIGHT0_INTENSITY_ID,control_cb);
sb->set_float_limits(0,1);
new GLUI_Checkbox( light1, "Enabled", &light1_enabled,
LIGHT1_ENABLED_ID, control_cb );
light1_spinner =
new GLUI_Spinner( light1, "Intensity:",
&light1_intensity, LIGHT1_INTENSITY_ID,
control_cb );
light1_spinner->set_float_limits( 0.0, 1.0 );
sb = new GLUI_Scrollbar( light1, "Red",GLUI_SCROLL_HORIZONTAL,
//.........这里部分代码省略.........
示例6: initGUI
void Interface::initGUI()
{
GLUI_Panel *geral =addPanel("Opcoes", 1);
addColumnToPanel(geral);
GLUI_Panel *luzesPanel = addPanelToPanel(geral,"Luzes", 1);
for(unsigned int i=0;i<((ANFScene *) scene)->parser.lights.size();i++){
string str=((ANFScene *) scene)->parser.lights[i]->id;
char * writable = new char[str.size() + 1];
copy(str.begin(), str.end(), writable);
writable[str.size()] = '\0';
if(((ANFScene *) scene)->parser.lights[i]->enabled==true){
addCheckboxToPanel(luzesPanel,writable,NULL,i)->set_int_val(1);
}
else{
addCheckboxToPanel(luzesPanel,writable,NULL,i)->set_int_val(0);
}
delete[] writable;
}
addColumnToPanel(geral);
GLUI_Panel *camerasPanel = addPanelToPanel(geral,"Camaras", 1);
GLUI_RadioGroup *cameraList = addRadioGroupToPanel(camerasPanel,&(((ANFScene *) scene)->parser.activeCam));
for(unsigned int i=0;i<((ANFScene *) scene)->parser.cameras.size();i++){
string str=((ANFScene *) scene)->parser.cameras[i]->id;
char * writable = new char[str.size() + 1];
copy(str.begin(), str.end(), writable);
writable[str.size()] = '\0';
if(i == ((ANFScene *) scene)->parser.activeCam)
addRadioButtonToGroup(cameraList, writable)->set_int_val(1);
else
addRadioButtonToGroup(cameraList, writable);
delete[] writable;
}
addRadioButtonToGroup(cameraList, "Default");
addColumnToPanel(geral);
GLUI_Panel *drawPanel = addPanelToPanel(geral,"Draw Mode", 1);
GLUI_RadioGroup *drawList = addRadioGroupToPanel(drawPanel,&(((ANFScene *) scene)->parser.globals->drawing.mode));
addRadioButtonToGroup(drawList, "Fill");
addRadioButtonToGroup(drawList, "Line");
addRadioButtonToGroup(drawList, "Point");
addColumnToPanel(geral);
GLUI_Panel *windPanel = addPanelToPanel(geral,"Wind Value", 1);
GLUI_Spinner *spinner = addSpinnerToPanel(windPanel, "windScale",GLUI_SPINNER_INT,&(((ANFScene *) scene)->parser.wind),9);
spinner->set_speed(0.5);
spinner->set_int_limits(0,10,GLUI_LIMIT_WRAP);
GLUI_Panel *varPanel= addPanelToPanel(geral,"Animations", 1);
addButtonToPanel(varPanel, "Reset", 8);
}
示例7: createInterface
void createInterface() {
GLUI *glui = GLUI_Master.create_glui("RGBD Effects", 0, 1050, 100);
//Effect Selection
GLUI_Panel *effectSelectionPanel = glui->add_panel("Effect");
GLUI_RadioGroup *effectRadioGroup = glui->add_radiogroup_to_panel(effectSelectionPanel, &selectedEffect, -1, gluiCallback);
glui->add_radiobutton_to_group(effectRadioGroup, "Maps");
glui->add_radiobutton_to_group(effectRadioGroup, "Fog");
glui->add_radiobutton_to_group(effectRadioGroup, "Depth of Field");
glui->add_radiobutton_to_group(effectRadioGroup, "Relighting");
glui->add_radiobutton_to_group(effectRadioGroup, "Cartoon Shading");
//Depth range
glui->add_statictext("");
GLUI_Panel *depthRangePanel = glui->add_panel("Depth Range");
GLUI_Checkbox *adaptiveDepthRangeCheckBox = glui->add_checkbox_to_panel(depthRangePanel, "Adaptive ", &adaptiveDepthRange, -1, gluiCallback);
GLUI_Spinner *nearPlaneSpinner = glui->add_spinner_to_panel(depthRangePanel, "Near Plane ", GLUI_SPINNER_FLOAT, &nearPlane, -1, gluiCallback);
nearPlaneSpinner->set_float_limits(10, 2000);
GLUI_Spinner *farPlaneSpinner = glui->add_spinner_to_panel(depthRangePanel, "Far Plane ", GLUI_SPINNER_FLOAT, &farPlane, -1, gluiCallback);
farPlaneSpinner->set_float_limits(10, 2000);
//View maps
GLUI_Rollout *mapRollout = glui->add_rollout("Maps", 0);
mapRollout->set_w(218);
glui->add_statictext_to_panel(mapRollout, "")->set_w(200);
GLUI_RadioGroup *mapRadioGroup = glui->add_radiogroup_to_panel(mapRollout, &mapEffect->selectedMap, -1, gluiCallback);
glui->add_radiobutton_to_group(mapRadioGroup, "Colour");
glui->add_radiobutton_to_group(mapRadioGroup, "Depth");
glui->add_radiobutton_to_group(mapRadioGroup, "Normals");
GLUI_Panel* mapPreblurPanel = glui->add_panel_to_panel(mapRollout, "Pre-processing");
GLUI_RadioGroup *mapPreblurRadioGroup = glui->add_radiogroup_to_panel(mapPreblurPanel, &mapEffect->selectedPreFilter, -1, gluiCallback);
glui->add_radiobutton_to_group(mapPreblurRadioGroup, "None");
glui->add_radiobutton_to_group(mapPreblurRadioGroup, "Blur");
glui->add_radiobutton_to_group(mapPreblurRadioGroup, "Bilateral");
GLUI_Spinner *mapPreblurPassesSpinner = glui->add_spinner_to_panel(mapPreblurPanel, "Filter Passes ", GLUI_SPINNER_INT, &mapEffect->preblurFilterPasses, -1, gluiCallback);
mapPreblurPassesSpinner->set_int_limits(0, 10);
GLUI_Spinner *mapPreblurKernelSizeSpinner = glui->add_spinner_to_panel(mapPreblurPanel, "Kernel Size ", GLUI_SPINNER_INT, &mapEffect->preblurKernelSize, -1, gluiCallback);
mapPreblurKernelSizeSpinner->set_int_limits(1, 100);
GLUI_Spinner *mapPreblurSigmaSpinner = glui->add_spinner_to_panel(mapPreblurPanel, "Sample Deviation ", GLUI_SPINNER_FLOAT, &mapEffect->preblurSigma, -1, gluiCallback);
mapPreblurSigmaSpinner->set_float_limits(0.001, 0.15);
//FOG
GLUI_Rollout *fogRollout = glui->add_rollout("Fog", 0);
fogRollout->set_w(218);
glui->add_statictext_to_panel(fogRollout, "")->set_w(200);
GLUI_Spinner *fogDensitySpinner = glui->add_spinner_to_panel(fogRollout, "Density ", GLUI_SPINNER_FLOAT, &fogEffect->fogDensity, -1, gluiCallback);
fogDensitySpinner->set_float_limits(0.0, 20.0);
GLUI_Spinner *fogAmountSpinner = glui->add_spinner_to_panel(fogRollout, "Amount ", GLUI_SPINNER_FLOAT, &fogEffect->fogAmount, -1, gluiCallback);
fogAmountSpinner->set_float_limits(0.0, 1);
glui->add_statictext_to_panel(fogRollout, "");
GLUI_Panel* fogPreblurPanel = glui->add_panel_to_panel(fogRollout, "Preblur");
GLUI_Spinner *fogPreblurPassesSpinner = glui->add_spinner_to_panel(fogPreblurPanel, "Filter Passes ", GLUI_SPINNER_INT, &fogEffect->preblurFilterPasses, -1, gluiCallback);
fogPreblurPassesSpinner->set_int_limits(0, 10);
GLUI_Spinner *fogPreblurKernelSizeSpinner = glui->add_spinner_to_panel(fogPreblurPanel, "Kernel Size ", GLUI_SPINNER_INT, &fogEffect->preblurKernelSize, -1, gluiCallback);
fogPreblurKernelSizeSpinner->set_int_limits(1, 100);
GLUI_Spinner *fogPreblurSigmaSpinner = glui->add_spinner_to_panel(fogPreblurPanel, "Sample Deviation ", GLUI_SPINNER_FLOAT, &fogEffect->preblurSigma, -1, gluiCallback);
fogPreblurSigmaSpinner->set_float_limits(0.001, 0.15);
glui->add_statictext_to_panel(fogRollout, "");
GLUI_Panel* fogColourPanel = glui->add_panel_to_panel(fogRollout, "Colour", GLUI_PANEL_EMBOSSED);
GLUI_Spinner *fogColourRedSpinner = glui->add_spinner_to_panel(fogColourPanel, "Red ", GLUI_SPINNER_FLOAT, &fogEffect->fogColourRed, -1, gluiCallback);
fogColourRedSpinner->set_float_limits(0.0, 1);
GLUI_Spinner *fogColourGreenSpinner = glui->add_spinner_to_panel(fogColourPanel, "Green ", GLUI_SPINNER_FLOAT, &fogEffect->fogColourGreen, -1, gluiCallback);
fogColourGreenSpinner->set_float_limits(0.0, 1);
GLUI_Spinner *fogColourBlueSpinner = glui->add_spinner_to_panel(fogColourPanel, "Blue ", GLUI_SPINNER_FLOAT, &fogEffect->fogColourBlue, -1, gluiCallback);
fogColourBlueSpinner->set_float_limits(0.0, 1);
//DEPTH OF FIELD
GLUI_Rollout *DOFRollout = glui->add_rollout("Depth of Field", 0);
DOFRollout->set_w(218);
glui->add_statictext_to_panel(DOFRollout, "")->set_w(200);
GLUI_Spinner *distributionSigmaSpinner = glui->add_spinner_to_panel(DOFRollout, "Sample Deviation ", GLUI_SPINNER_FLOAT, &dofEffect->distributionSigma, -1, gluiCallback);
distributionSigmaSpinner->set_float_limits(0.001, 0.15);
GLUI_Spinner *sampleRadiusSpinner = glui->add_spinner_to_panel(DOFRollout, "Sample Radius ", GLUI_SPINNER_INT, &dofEffect->sampleRadius, -1, gluiCallback);
sampleRadiusSpinner->set_int_limits(1, 40);
GLUI_Spinner *lensDiameterSpinner = glui->add_spinner_to_panel(DOFRollout, "Aperture Size ", GLUI_SPINNER_FLOAT, &dofEffect->lensDiameter, -1, gluiCallback);
lensDiameterSpinner->set_float_limits(0.001, 1);
GLUI_Spinner *focalLengthSpinner = glui->add_spinner_to_panel(DOFRollout, "Focal Length ", GLUI_SPINNER_FLOAT, &dofEffect->focalLength, -1, gluiCallback);
focalLengthSpinner->set_float_limits(0.001, 1);
GLUI_Spinner *focalDepthSpinner = glui->add_spinner_to_panel(DOFRollout, "Focal Depth ", GLUI_SPINNER_FLOAT, &dofEffect->focalPlaneDepth, -1, gluiCallback);
focalDepthSpinner->set_float_limits(0.0, 1);
glui->add_statictext_to_panel(DOFRollout, "");
GLUI_Panel* DOFPreblurPanel = glui->add_panel_to_panel(DOFRollout, "Preblur");
GLUI_Spinner *DOFPreblurPassesSpinner = glui->add_spinner_to_panel(DOFPreblurPanel, "Filter Passes ", GLUI_SPINNER_INT, &dofEffect->preblurFilterPasses, -1, gluiCallback);
DOFPreblurPassesSpinner->set_int_limits(0, 10);
//.........这里部分代码省略.........
示例8: main
int main(int argc, char** argv)
{
//#define CHECK_FPU_EXCEPTIONS 1
#ifdef CHECK_FPU_EXCEPTIONS
int cw = _control87(0, 0);
// Set the exception masks off, turn exceptions on
cw &= ~(EM_ZERODIVIDE | EM_INVALID);
printf("control87 = %#x\n", cw);
// Set the control word
_control87(cw, MCW_EM);
#endif //CHECK_FPU_EXCEPTIONS
setDefaultSettings();
int bulletVersion = btGetVersion();
printf("Bullet version %d\n",bulletVersion);
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE |GLUT_DEPTH | GLUT_STENCIL);
glutInitWindowSize(width, height);
mainWindow = glutCreateWindow("http://bulletphysics.com");
#ifdef BT_USE_FREEGLUT
glutSetOption (GLUT_ACTION_ON_WINDOW_CLOSE, GLUT_ACTION_GLUTMAINLOOP_RETURNS);
#endif
entry = g_demoEntries + testIndex;
demo = CreatDemo(entry);
glutDisplayFunc(SimulationLoop);
GLUI_Master.set_glutReshapeFunc(Resize);
GLUI_Master.set_glutKeyboardFunc(Keyboard);
GLUI_Master.set_glutSpecialFunc(KeyboardSpecial);
GLUI_Master.set_glutSpecialUpFunc(KeyboardSpecialUp);
GLUI_Master.set_glutMouseFunc(Mouse);
glutMotionFunc(MouseMotion);
glui = GLUI_Master.create_glui_subwindow( mainWindow,
GLUI_SUBWINDOW_RIGHT );
glui->add_statictext("Tests");
GLUI_Listbox* testList =
glui->add_listbox("", &testSelection);
glui->add_button("Next Scene", 0,(GLUI_Update_CB)NextScene);
glui->add_separator();
GLUI_Spinner* iterationSpinner =
glui->add_spinner("Iterations", GLUI_SPINNER_INT, &iterationCount);
iterationSpinner->set_int_limits(1, 250);
/* GLUI_Spinner* hertzSpinner =
glui->add_spinner("Hertz", GLUI_SPINNER_FLOAT, &hz);
hertzSpinner->set_float_limits(5.0f, 200.0f);
*/
glui->add_checkbox("DisableDeactivation", &gDebugNoDeactivation);
glui->add_checkbox("Split Impulse", &gUseSplitImpulse);
GLUI_Spinner* spinner = 0;
spinner = glui->add_spinner("ERP", GLUI_SPINNER_FLOAT, &gErp);
// spinner->set_float_limits(0.f,1.f);
// spinner = glui->add_spinner("ERP2", GLUI_SPINNER_FLOAT, &gErp2);
spinner->set_float_limits(0.f,1.f);
spinner = glui->add_spinner("Slop", GLUI_SPINNER_FLOAT, &gSlop);
spinner->set_float_limits(0.f,1.f);
// spinner = glui->add_spinner("WSP", GLUI_SPINNER_FLOAT,&gWarmStartingParameter);
// spinner->set_float_limits (0.f,1.0);
glui->add_checkbox("Warmstarting", &gUseWarmstarting);
glui->add_checkbox("Randomize Constraints", &gRandomizeConstraints);
glui->add_button("Reset Defaults", 0,(GLUI_Update_CB)setDefaultSettingsAndSync);
glui->add_separator();
GLUI_Panel* drawPanel = glui->add_panel("Debug Draw");
glui->add_checkbox_to_panel(drawPanel, "AABBs", &gDrawAabb);
glui->add_checkbox_to_panel(drawPanel, "Wireframe", &gWireFrame);
glui->add_checkbox_to_panel(drawPanel, "Contacts", &gDebugContacts);
glui->add_checkbox_to_panel(drawPanel, "Textures", &gDrawTextures);
glui->add_checkbox_to_panel(drawPanel, "Shadows", &gDrawShadows);
glui->add_checkbox_to_panel(drawPanel, "Clusters", &gDrawClusters);
int testCount = 0;
btDemoEntry* e = g_demoEntries;
while (e->createFcn)
{
testList->add_item(testCount, e->name);
++testCount;
++e;
}
//.........这里部分代码省略.........
示例9: Initialize
virtual bool Initialize()
{
cur_link=0;
cur_driver=0;
link_value = 0;
driver_value = 0;
draw_geom = 1;
draw_bbs = 0;
draw_com = 0;
draw_frame = 0;
draw_expanded = 0;
draw_self_collision_tests = 0;
hoverLink=hoverWidget=-1;
hoverPt.setZero();
pose_ik = 0;
if(!RobotViewProgram::Initialize()) return false;
self_colliding.resize(robot->links.size(),false);
UpdateConfig();
/*
//TEST: robot-to-robot IK test. only works for AL5Dx2
IKGoal test;
test.link = 8;
test.destLink = 16;
test.localPosition.set(0,0,0.05);
test.endPosition.set(0,0,0.05);
//test.SetFixedPosition(test.endPosition);
Matrix3 R;
R.setRotateZ(120);
test.SetFixedRotation(R);
vector<IKGoal> problem(1,test);
int iters=100;
bool res=SolveIK(*robot,problem,1e-3,iters);
printf("Solved IK: %d, %d iters, error %g\n",(int)res,iters,RobotIKError(*robot,test));
UpdateConfig();
*/
//setup GUI
glui = GLUI_Master.create_glui_subwindow(main_window,GLUI_SUBWINDOW_RIGHT);
glui->set_main_gfx_window(main_window);
GLUI_Panel* panel = glui->add_panel("Link controls");
link_spinner = glui->add_spinner_to_panel(panel,"Index",GLUI_SPINNER_INT,&cur_link,LINK_SPINNER_ID,ControlFunc);
link_spinner->set_int_limits(0,robot->links.size()-1,GLUI_LIMIT_WRAP);
link_listbox = glui->add_listbox_to_panel(panel,"Name",&cur_link,LINK_LISTBOX_ID,ControlFunc);
for(size_t i=0;i<robot->links.size();i++) {
char buf[256];
strcpy(buf,robot->linkNames[i].c_str());
link_listbox->add_item(i,buf);
}
link_value_spinner = glui->add_spinner_to_panel(panel,"Angle",GLUI_SPINNER_FLOAT,&link_value,LINK_VALUE_SPINNER_ID,ControlFunc);
link_info = glui->add_statictext_to_panel(panel,"Info");
UpdateLinkValueGUI();
UpdateLinkInfoGUI();
panel = glui->add_panel("Driver controls");
glui->add_checkbox_to_panel(panel,"Pose by IK",&pose_ik);
driver_spinner = glui->add_spinner_to_panel(panel,"Index",GLUI_SPINNER_INT,&cur_driver,DRIVER_SPINNER_ID,ControlFunc);
driver_spinner->set_int_limits(0,(int)robot->drivers.size()-1,GLUI_LIMIT_WRAP);
driver_listbox = glui->add_listbox_to_panel(panel,"Name",&cur_driver,DRIVER_LISTBOX_ID,ControlFunc);
for(size_t i=0;i<robot->drivers.size();i++) {
char buf[256];
strcpy(buf,robot->driverNames[i].c_str());
driver_listbox->add_item(i,buf);
}
driver_value_spinner = glui->add_spinner_to_panel(panel,"Angle",GLUI_SPINNER_FLOAT,&driver_value,DRIVER_VALUE_SPINNER_ID,ControlFunc);
driver_info = glui->add_statictext_to_panel(panel,"Info");
glui->add_checkbox("Draw geometry",&draw_geom);
glui->add_checkbox("Draw COM",&draw_com);
glui->add_checkbox("Draw frame",&draw_frame);
glui->add_checkbox("Draw bboxes",&draw_bbs);
glui->add_checkbox("Draw expanded",&draw_expanded,DRAW_EXPANDED_CHECKBOX_ID,ControlFunc);
glui->add_checkbox("Draw collision tests",&draw_self_collision_tests);
UpdateDriverValueGUI();
UpdateDriverInfoGUI();
return true;
}
示例10: main
int main(int argc, char** argv)
{
/* standard GLUT initialization */
glutInit(&argc,argv);
// Set up model Window
glutInitDisplayMode (GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH); /* default, not needed */
glutInitWindowSize(W_MODEL, H_MODEL);
glutInitWindowPosition(X_MODEL, Y_MODEL);
modelWindow = glutCreateWindow("Mimicry"); /* window title */
glClearColor(0.5, 0.5, 0.5, 1);
glutDisplayFunc(displayModel);
glutReshapeFunc(reshapeModel);
glutIdleFunc(0);
// Set up statistics Window
/*
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB);
glutInitWindowSize(W_STATS, H_STATS);
glutInitWindowPosition(X_STATS, Y_STATS);
statsWindow = glutCreateWindow("Statistics");
glClearColor(0, 0, 0, 1);
glutDisplayFunc(displayStats);
glutReshapeFunc(reshapeStats);
*/
glutKeyboardFunc(keyboard);
// GLUI initialization
glui = GLUI_Master.create_glui("Controls", 0, X_GLUI, Y_GLUI);
// Initialization panel
GLUI_Panel *initializationPanel = glui->add_panel("Initialization");
ctlGeneBankName = glui->add_edittext_to_panel(initializationPanel, "File ", GLUI_EDITTEXT_TEXT);
ctlGeneBankName->set_w(150);
ctlGeneBankName->enable();
ctlGeneBankName->set_text("initialconfig.xml");
glui->add_column_to_panel(initializationPanel, true);
ctlStart = glui->add_button_to_panel(initializationPanel, "Start", START, control);
ctlStop = glui->add_button_to_panel(initializationPanel, "Stop", STOP, control);
ctlStop->disable();
ctlPause = glui->add_button_to_panel(initializationPanel, "Pause/Continue", PAUSE, control);
ctlPause->disable();
// Run-time controls panel
GLUI_Panel *runtimePanel = glui->add_panel("Runtime Parameters");
// Prey Runtime configuration panel
GLUI_Panel *preyConfigPanel = glui->add_panel_to_panel(runtimePanel, "Prey Configuration");
GLUI_Spinner *preySize = glui->add_spinner_to_panel(
preyConfigPanel,
"Prey Size",
GLUI_SPINNER_INT,
&System::PREY_SIZE,
PREY_SIZE,
control);
preySize->set_int_limits(1, 5);
GLUI_Panel *preyReprodConfigPanel = glui->add_panel_to_panel(preyConfigPanel, "Reproduction");
GLUI_Spinner *preyReproductionAgeLimit = glui->add_spinner_to_panel(
preyReprodConfigPanel,
"Age Limit",
GLUI_SPINNER_INT,
&System::PREY_REPRODUCTION_AGE_LIMIT,
PREY_REPRODUCTION_AGE_LIMIT,
control);
preyReproductionAgeLimit->set_int_limits(100, 10000);
GLUI_Spinner *preyReproductionInterval = glui->add_spinner_to_panel(
preyReprodConfigPanel,
"Interval",
GLUI_SPINNER_INT,
&System::PREY_REPRODUCTION_INTERVAL,
PREY_REPRODUCTION_INTERVAL,
control);
preyReproductionInterval->set_int_limits(100, 10000);
GLUI_Panel *preyMutationRatePanel = glui->add_panel_to_panel(preyConfigPanel, "Mutation Rate");
GLUI_Spinner *patternMutationRate = glui->add_spinner_to_panel(
preyMutationRatePanel,
"Pattern",
GLUI_SPINNER_FLOAT,
&System::PATTERN_MUTATION_RATE,
PATTERN_MUTATION_RATE,
control);
patternMutationRate->set_int_limits(0.01, 1.0);
GLUI_Spinner *preyGenomeMutationRate = glui->add_spinner_to_panel(
preyMutationRatePanel,
"Genome",
GLUI_SPINNER_FLOAT,
&System::PREY_GENOME_MUTATION_RATE,
PREY_GENOME_MUTATION_RATE,
//.........这里部分代码省略.........
示例11: main
int main(int argc, char **argv)
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
glutInitWindowPosition(50, 50);
glutInitWindowSize(WIN_WIDTH, WIN_HEIGHT);
main_window = glutCreateWindow("OBJ Loader");
glutDisplayFunc(myGlutDisplay);
glutReshapeFunc(myGlutReshape);
glutMouseFunc(myGlutMouse);
glutMotionFunc(myGlutMotion);
initScene();
Objects.push_back(Object());
glui = GLUI_Master.create_glui("OBJ Loader GUI", 0, 600, 50);
GLUI_Panel *objPanel = glui->add_panel("");
GLUI_Panel *objPanel2 = glui->add_panel_to_panel(objPanel, "", 0);
objFileNameTextField = glui->add_edittext_to_panel(objPanel2, "Filename:",GLUI_EDITTEXT_TEXT,NULL,OBJ_TEXTFIELD,textCB);
objFileNameTextField->set_text("cow");
glui->add_button_to_panel(objPanel2, "Load", LOAD_BUTTON, buttonCB);
glui->add_button_to_panel(objPanel2, "Screenshot (or it didn't happen)", SCREENSHOT, buttonCB);
glui->add_column_to_panel(objPanel, 0);
GLUI_Panel *projPanel = glui->add_panel_to_panel(objPanel, "", 0);
GLUI_RadioGroup *projGroup = glui->add_radiogroup_to_panel(projPanel, (int*) &projType, -1, projCB);
glui->add_radiobutton_to_group(projGroup, "Orthographic");
glui->add_radiobutton_to_group(projGroup, "Perspective");
projGroup->set_int_val(ORTHO);
GLUI_Spinner *fovSpinner = glui->add_spinner_to_panel(projPanel, "FOV", GLUI_SPINNER_INT, &fov, FOV, projCB);
fovSpinner->set_int_limits(FOVMIN, FOVMAX);
fovSpinner->set_int_val(30);
glui->add_column_to_panel(projPanel, 0);
GLUI_Translation *scale = glui->add_translation_to_panel(projPanel, "Scale", GLUI_TRANSLATION_Y , &scaleFactor, -1, (GLUI_Update_CB) projCB);
scale->set_speed(0.005f);
GLUI_Panel *lightingPanel = glui->add_panel("", 0);
GLUI_Panel *objMaterialPanel = glui->add_panel_to_panel(lightingPanel, "Object material");
GLUI_Panel *objDiffusePanel = glui->add_panel_to_panel(objMaterialPanel, "Diffuse");
GLUI_Spinner *kdRedValue = glui->add_spinner_to_panel(objDiffusePanel, "Red", GLUI_SPINNER_FLOAT, &objectMat.diffuse[0], 0, colorCB);
kdRedValue->set_float_limits(0.f, 1.f);
kdRedValue->set_float_val(1.f);
GLUI_Spinner *kdGreenValue = glui->add_spinner_to_panel(objDiffusePanel, "Green", GLUI_SPINNER_FLOAT, &objectMat.diffuse[1], 0, colorCB);
kdGreenValue->set_float_limits(0.f, 1.f);
kdGreenValue->set_float_val(1.f);
GLUI_Spinner *kdBlueValue = glui->add_spinner_to_panel(objDiffusePanel, "Blue", GLUI_SPINNER_FLOAT, &objectMat.diffuse[2], 0, colorCB);
kdBlueValue->set_float_limits(0.f, 1.f);
kdBlueValue->set_float_val(1.f);
GLUI_Panel *objAmbientPanel = glui->add_panel_to_panel(objMaterialPanel, "Ambient");
GLUI_Spinner *kaRedValue = glui->add_spinner_to_panel(objAmbientPanel, "Red", GLUI_SPINNER_FLOAT, &objectMat.ambient[0], 0, colorCB);
kaRedValue->set_float_limits(0.f, 1.f);
kaRedValue->set_float_val(1.f);
GLUI_Spinner *kaGreenValue = glui->add_spinner_to_panel(objAmbientPanel, "Green", GLUI_SPINNER_FLOAT, &objectMat.ambient[1], 0, colorCB);
kaGreenValue->set_float_limits(0.f, 1.f);
kaGreenValue->set_float_val(1.f);
GLUI_Spinner *kaBlueValue = glui->add_spinner_to_panel(objAmbientPanel, "Blue", GLUI_SPINNER_FLOAT, &objectMat.ambient[2], 0, colorCB);
kaBlueValue->set_float_limits(0.f, 1.f);
kaBlueValue->set_float_val(1.f);
GLUI_Panel *objSpecularPanel = glui->add_panel_to_panel(objMaterialPanel, "Specular");
GLUI_Spinner *ksRedValue = glui->add_spinner_to_panel(objSpecularPanel, "Red", GLUI_SPINNER_FLOAT, &objectMat.specular[0], 0, colorCB);
ksRedValue->set_float_limits(0.f, 1.f);
ksRedValue->set_float_val(1.f);
GLUI_Spinner *ksGreenValue = glui->add_spinner_to_panel(objSpecularPanel, "Green", GLUI_SPINNER_FLOAT, &objectMat.specular[1], 0, colorCB);
ksGreenValue->set_float_limits(0.f, 1.f);
ksGreenValue->set_float_val(1.f);
GLUI_Spinner *ksBlueValue = glui->add_spinner_to_panel(objSpecularPanel, "Blue", GLUI_SPINNER_FLOAT, &objectMat.specular[2], 0, colorCB);
ksBlueValue->set_float_limits(0.f, 1.f);
ksBlueValue->set_float_val(1.f);
glui->add_column_to_panel(lightingPanel,0);
GLUI_Panel *lightPanel = glui->add_panel_to_panel(lightingPanel, "Light source");
GLUI_Panel *lightDiffusePanel = glui->add_panel_to_panel(lightPanel, "Diffuse");
GLUI_Spinner *ldRedValue = glui->add_spinner_to_panel(lightDiffusePanel, "Red", GLUI_SPINNER_FLOAT, &lightCoeffs.diffuse[0], -1, colorCB);
ldRedValue->set_float_limits(0.f, 1.f);
ldRedValue->set_float_val(1.f);
GLUI_Spinner *ldGreenValue = glui->add_spinner_to_panel(lightDiffusePanel, "Green", GLUI_SPINNER_FLOAT, &lightCoeffs.diffuse[1], -1, colorCB);
ldGreenValue->set_float_limits(0.f, 1.f);
ldGreenValue->set_float_val(1.f);
GLUI_Spinner *ldBlueValue = glui->add_spinner_to_panel(lightDiffusePanel, "Blue", GLUI_SPINNER_FLOAT, &lightCoeffs.diffuse[2], -1, colorCB);
ldBlueValue->set_float_limits(0.f, 1.f);
ldBlueValue->set_float_val(1.f);
GLUI_Panel *lightAmbientPanel = glui->add_panel_to_panel(lightPanel, "Ambient");
GLUI_Spinner *laRedValue = glui->add_spinner_to_panel(lightAmbientPanel, "Red", GLUI_SPINNER_FLOAT, &lightCoeffs.ambient[0], -1, colorCB);
laRedValue->set_float_limits(0.f, 1.f);
laRedValue->set_float_val(1.f);
GLUI_Spinner *laGreenValue = glui->add_spinner_to_panel(lightAmbientPanel, "Green", GLUI_SPINNER_FLOAT, &lightCoeffs.ambient[1], -1, colorCB);
laGreenValue->set_float_limits(0.f, 1.f);
laGreenValue->set_float_val(1.f);
//.........这里部分代码省略.........
示例12: main
//.........这里部分代码省略.........
mesh.MergeVertices(meshPrecision);
mesh.GenPerVertexNormal();
//mesh.Write("data\\rh.trans_wnormal.pial.obj");
mesh.CompileShader();
mesh.mTexture = gTex;
mesh.Build();
//glEnable(GL_BLEND);
//glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
#endif
/****************************************/
/* Here's the GLUI code */
/****************************************/
printf("GLUI version: %3.2f\n", GLUI_Master.get_version());
GLUI_Master.set_glutDisplayFunc(myGlutDisplay);
GLUI_Master.set_glutReshapeFunc(myGlutReshape);
GLUI_Master.set_glutKeyboardFunc(myGlutKeyboard);
GLUI_Master.set_glutSpecialFunc(NULL);
GLUI_Master.set_glutMouseFunc(myGlutMouse);
glui = GLUI_Master.create_glui_subwindow(main_window,
GLUI_SUBWINDOW_RIGHT);
glui->set_main_gfx_window(main_window);
// add panels for parameter tunning
panel[0] = new GLUI_Panel(glui, "Rendering Mode");
GLUI_Spinner* dsrSpinner = new GLUI_Spinner(
panel[0], "DSR Index", GLUI_SPINNER_INT,
&dsrIndex, -1, changeDsr);
dsrSpinner->set_int_limits(1, 4);
GLUI_RadioGroup* radioGroup = new GLUI_RadioGroup(panel[0],
&renderIdx, 0, switchRenderMode);
new GLUI_RadioButton(radioGroup, "Geometry Pass");
new GLUI_RadioButton(radioGroup, "SSAO Pass");
new GLUI_RadioButton(radioGroup, "Blur Pass");
new GLUI_RadioButton(radioGroup, "Lighting Pass");
new GLUI_Button(panel[0], "Reset All", -1, resetRenderingParameters);
new GLUI_Button(panel[0], "Reset Shaders", -1, resetShaders);
// geometry pass
panel[1] = new GLUI_Panel(glui, "Geometry Pass");
new GLUI_Button(panel[1], "Reset", 0, resetRenderingParameters);
new GLUI_Checkbox(panel[1], "Cull Backface",
&cullface, -1, changeCullface);
new GLUI_Checkbox(panel[1], "Draw Tracts",
&bdrawTracks, -1, reRender);
new GLUI_Checkbox(panel[1], "Draw Axes",
&bdrawAxes, -1, reRender);
#ifdef MESH
GLUI_Spinner* meshPrecisionSpinner = new GLUI_Spinner
(panel[1], "Mesh Detail", GLUI_SPINNER_FLOAT,
&meshPrecision, -1, changeMeshPrecision);
meshPrecisionSpinner->set_float_limits(0.01, 10);
#endif
#ifdef TRACK
GLUI_RadioGroup* shapeRadioGroup = new GLUI_RadioGroup(panel[1],
&trackShape, 0, changeTrackShape);
new GLUI_RadioButton(shapeRadioGroup, "Line");
new GLUI_RadioButton(shapeRadioGroup, "Tube");
new GLUI_RadioButton(shapeRadioGroup, "Superquadric");
示例13: InitGlui
//.........这里部分代码省略.........
spinMaxVector = TestGlui->add_spinner_to_panel(ArrowSettings, "Vector Magnitude Max", GLUI_SPINNER_FLOAT, &Framework::instance()->spinVecMax);
spinMaxVector->set_float_limits(0.0, 1000.0);
spinMaxVector->set_speed(0.05);
/*
alphaVector = TestGlui->add_spinner_to_panel(ArrowSettings, "Arrow Alpha", GLUI_SPINNER_FLOAT, &Framework::instance()->vecAlphaVal);
alphaVector->set_float_limits(0.0, 1.0);
alphaVector->set_speed(0.05);
*/
//Streamline & Probe Settings:
spinNumStreamlines = TestGlui->add_spinner_to_panel(StreamlineSettings, "Cubed Number of Streamlines", GLUI_SPINNER_INT, &Framework::instance()->NumStreamlines, 0, SpinnerCallback);
spinNumStreamlines -> set_float_limits(1, 10);
spinNumStreamlines -> set_speed(0.1);
TestGlui->add_checkbox_to_panel(StreamlineSettings, "Use Probe", &Framework::instance()->useProbe);
ProbeX = TestGlui->add_spinner_to_panel(StreamlineSettings, "XProbeValue", GLUI_SPINNER_FLOAT, &Framework::instance()->ProbeXVal);
ProbeX->set_float_limits(-1.0, 1.0);
ProbeX->set_speed(0.1);
ProbeY = TestGlui->add_spinner_to_panel(StreamlineSettings, "YProbeValue", GLUI_SPINNER_FLOAT, &Framework::instance()->ProbeYVal);
ProbeY->set_float_limits(-1.0, 1.0);
ProbeY->set_speed(0.1);
ProbeZ = TestGlui->add_spinner_to_panel(StreamlineSettings, "ZProbeValue", GLUI_SPINNER_FLOAT, &Framework::instance()->ProbeZVal);
ProbeZ->set_float_limits(-1.0, 1.0);
ProbeZ->set_speed(0.1);
//Point Settings:
TestGlui->add_checkbox_to_panel(PointsSettings, "Use Jitter", &Framework::instance()->useJitter);
//Isosurface Settings:
spinNumContours = TestGlui->add_spinner_to_panel(IsosurfaceSettings, "NumContours", GLUI_SPINNER_INT, &Framework::instance()->numContours, 3, SpinnerCallback);
spinNumContours->set_int_limits(1, 30);
spinNumContours->set_speed(0.5);
float tempMin = Framework::instance()->GetVectorMin();
float tempMax = Framework::instance()->GetVectorMax();
printf("IsoMin is %f, IsoMax is %f\n", tempMin, tempMax);
spinIsoValue = TestGlui->add_spinner_to_panel(IsosurfaceSettings, "IsoValue", GLUI_SPINNER_FLOAT, &Framework::instance()->IsosurfacesVal, 3, SpinnerCallback);
spinIsoValue->set_float_limits(tempMin, tempMax);
spinIsoValue->set_speed(0.5);
spinIsoResolution = TestGlui->add_spinner_to_panel(IsosurfaceSettings, "IsoResolution", GLUI_SPINNER_INT, &Framework::instance()->IsoResolution, 3, SpinnerCallback);
spinIsoResolution->set_int_limits(10, 100);
spinIsoResolution->set_speed(0.1);
//VectorBlob Settings:
VectorBlobTime = TestGlui->add_spinner_to_panel(VectorBlobSettings, "Time Value", GLUI_SPINNER_INT, &Framework::instance()->VectorBlobTimeVal, 2, SpinnerCallback);
VectorBlobTime->set_int_limits(0, 100);
VectorBlobTime->set_speed(0.5);
VectorBlobXLoc = TestGlui->add_spinner_to_panel(VectorBlobSettings, "XVectorBlobLocation", GLUI_SPINNER_FLOAT, &Framework::instance()->VectorBlobXLoc, 1, SpinnerCallback);
VectorBlobXLoc->set_float_limits(-1.0, 1.0);
VectorBlobXLoc->set_speed(0.2);
VectorBlobYLoc = TestGlui->add_spinner_to_panel(VectorBlobSettings, "YVectorBlobLocation", GLUI_SPINNER_FLOAT, &Framework::instance()->VectorBlobYLoc, 1, SpinnerCallback);
VectorBlobYLoc->set_float_limits(-1.0, 1.0);
VectorBlobYLoc->set_speed(0.2);
VectorBlobZLoc = TestGlui->add_spinner_to_panel(VectorBlobSettings, "ZVectorBlobLocation", GLUI_SPINNER_FLOAT, &Framework::instance()->VectorBlobZLoc, 1, SpinnerCallback);
VectorBlobZLoc->set_float_limits(-1.0, 1.0);
VectorBlobZLoc->set_speed(0.2);
VectorBlobXVec = TestGlui->add_spinner_to_panel(VectorBlobSettings, "XVectorBlobVector", GLUI_SPINNER_FLOAT, &Framework::instance()->VectorBlobXVec, 1, SpinnerCallback);
VectorBlobXVec->set_float_limits(-1.0, 1.0);
VectorBlobXVec->set_speed(0.2);
示例14: main
int main(int argc, char** argv)
{
using namespace TestMain;
testCount = 0;
while (g_testEntries[testCount].createFcn != NULL)
{
++testCount;
}
testIndex = b2Clamp(testIndex, 0, testCount-1);
testSelection = testIndex;
entry = g_testEntries + testIndex;
if (entry && entry->createFcn) {
test = entry->createFcn();
testSelection = testIndex;
testIndex = -1;
}
glutInit(&argc, argv);
glutInitContextVersion(2, 0);
glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE);
glutInitWindowSize(width, height);
char title[32];
sprintf(title, "Box2D Version %d.%d.%d", b2_version.major, b2_version.minor, b2_version.revision);
mainWindow = glutCreateWindow(title);
//glutSetOption (GLUT_ACTION_ON_WINDOW_CLOSE, GLUT_ACTION_GLUTMAINLOOP_RETURNS);
glutDisplayFunc(SimulationLoop);
#if ENABLE_GLUI
GLUI_Master.set_glutReshapeFunc(Resize);
GLUI_Master.set_glutKeyboardFunc(Keyboard);
GLUI_Master.set_glutSpecialFunc(KeyboardSpecial);
GLUI_Master.set_glutMouseFunc(Mouse);
#else
{
glutReshapeFunc(Resize);
glutKeyboardFunc(Keyboard);
glutSpecialUpFunc(KeyboardSpecial);
glutMouseFunc(Mouse);
}
#endif // ENABLE_GLUI
#ifdef FREEGLUT
glutMouseWheelFunc(MouseWheel);
#endif
glutMotionFunc(MouseMotion);
glutKeyboardUpFunc(KeyboardUp);
#if ENABLE_GLUI
glui = GLUI_Master.create_glui_subwindow( mainWindow,
GLUI_SUBWINDOW_RIGHT );
glui->add_statictext("Tests");
GLUI_Listbox* testList =
glui->add_listbox("", &testSelection);
glui->add_separator();
GLUI_Spinner* velocityIterationSpinner =
glui->add_spinner("Vel Iters", GLUI_SPINNER_INT, &settings.velocityIterations);
velocityIterationSpinner->set_int_limits(1, 500);
GLUI_Spinner* positionIterationSpinner =
glui->add_spinner("Pos Iters", GLUI_SPINNER_INT, &settings.positionIterations);
positionIterationSpinner->set_int_limits(0, 100);
GLUI_Spinner* particleIterationSpinner =
glui->add_spinner("Pcl Iters", GLUI_SPINNER_INT, &settings.particleIterations);
particleIterationSpinner->set_int_limits(1, 100);
GLUI_Spinner* hertzSpinner =
glui->add_spinner("Hertz", GLUI_SPINNER_FLOAT, &settingsHz);
hertzSpinner->set_float_limits(5.0f, 200.0f);
glui->add_checkbox("Sleep", &settings.enableSleep);
glui->add_checkbox("Warm Starting", &settings.enableWarmStarting);
glui->add_checkbox("Time of Impact", &settings.enableContinuous);
glui->add_checkbox("Sub-Stepping", &settings.enableSubStepping);
glui->add_checkbox("Strict Particle/Body Contacts", &settings.strictContacts);
//glui->add_separator();
GLUI_Panel* drawPanel = glui->add_panel("Draw");
glui->add_checkbox_to_panel(drawPanel, "Shapes", &settings.drawShapes);
glui->add_checkbox_to_panel(drawPanel, "Particles", &settings.drawParticles);
glui->add_checkbox_to_panel(drawPanel, "Joints", &settings.drawJoints);
glui->add_checkbox_to_panel(drawPanel, "AABBs", &settings.drawAABBs);
glui->add_checkbox_to_panel(drawPanel, "Contact Points", &settings.drawContactPoints);
glui->add_checkbox_to_panel(drawPanel, "Contact Normals", &settings.drawContactNormals);
glui->add_checkbox_to_panel(drawPanel, "Contact Impulses", &settings.drawContactImpulse);
glui->add_checkbox_to_panel(drawPanel, "Friction Impulses", &settings.drawFrictionImpulse);
glui->add_checkbox_to_panel(drawPanel, "Center of Masses", &settings.drawCOMs);
glui->add_checkbox_to_panel(drawPanel, "Statistics", &settings.drawStats);
glui->add_checkbox_to_panel(drawPanel, "Profile", &settings.drawProfile);
//.........这里部分代码省略.........
示例15: main
int main(int argc, char** argv)
{
testCount = 0;
while (g_testEntries[testCount].createFcn != NULL)
{
++testCount;
}
testIndex = b2Clamp(testIndex, 0, testCount-1);
testSelection = testIndex;
entry = g_testEntries + testIndex;
test = entry->createFcn();
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE);
glutInitWindowSize(width, height);
char title[32];
sprintf(title, "Box2D Version %d.%d.%d", b2_version.major, b2_version.minor, b2_version.revision);
mainWindow = glutCreateWindow(title);
//glutSetOption (GLUT_ACTION_ON_WINDOW_CLOSE, GLUT_ACTION_GLUTMAINLOOP_RETURNS);
glutDisplayFunc(SimulationLoop);
/* int theConnection=0;
theConnection=setup_rlglue_network();
runEnvironmentEventLoop(theConnection);*/
GLUI_Master.set_glutReshapeFunc(Resize);
GLUI_Master.set_glutKeyboardFunc(Keyboard);
GLUI_Master.set_glutSpecialFunc(KeyboardSpecial);
GLUI_Master.set_glutMouseFunc(Mouse);
#ifdef FREEGLUT
glutMouseWheelFunc(MouseWheel);
#endif
glutMotionFunc(MouseMotion);
glui = GLUI_Master.create_glui_subwindow( mainWindow,
GLUI_SUBWINDOW_RIGHT );
glui->add_statictext("Tests");
GLUI_Listbox* testList =
glui->add_listbox("", &testSelection);
glui->add_separator();
GLUI_Spinner* velocityIterationSpinner =
glui->add_spinner("Vel Iters", GLUI_SPINNER_INT, &settings.velocityIterations);
velocityIterationSpinner->set_int_limits(1, 500);
GLUI_Spinner* positionIterationSpinner =
glui->add_spinner("Pos Iters", GLUI_SPINNER_INT, &settings.positionIterations);
positionIterationSpinner->set_int_limits(0, 100);
GLUI_Spinner* hertzSpinner =
glui->add_spinner("Hertz", GLUI_SPINNER_FLOAT, &settingsHz);
hertzSpinner->set_float_limits(5.0f, 200.0f);
glui->add_checkbox("Warm Starting", &settings.enableWarmStarting);
glui->add_checkbox("Time of Impact", &settings.enableContinuous);
//glui->add_separator();
GLUI_Panel* drawPanel = glui->add_panel("Draw");
glui->add_checkbox_to_panel(drawPanel, "Shapes", &settings.drawShapes);
glui->add_checkbox_to_panel(drawPanel, "Joints", &settings.drawJoints);
glui->add_checkbox_to_panel(drawPanel, "AABBs", &settings.drawAABBs);
glui->add_checkbox_to_panel(drawPanel, "Pairs", &settings.drawPairs);
glui->add_checkbox_to_panel(drawPanel, "Contact Points", &settings.drawContactPoints);
glui->add_checkbox_to_panel(drawPanel, "Contact Normals", &settings.drawContactNormals);
glui->add_checkbox_to_panel(drawPanel, "Contact Forces", &settings.drawContactForces);
glui->add_checkbox_to_panel(drawPanel, "Friction Forces", &settings.drawFrictionForces);
glui->add_checkbox_to_panel(drawPanel, "Center of Masses", &settings.drawCOMs);
glui->add_checkbox_to_panel(drawPanel, "Statistics", &settings.drawStats);
int32 testCount = 0;
TestEntry* e = g_testEntries;
while (e->createFcn)
{
testList->add_item(testCount, e->name);
++testCount;
++e;
}
glui->add_button("Pause", 0, Pause);
glui->add_button("Single Step", 0, SingleStep);
glui->add_button("Restart", 0, Restart);
glui->add_button("Quit", 0,(GLUI_Update_CB)exit);
glui->set_main_gfx_window( mainWindow );
// Use a timer to control the frame rate.
glutTimerFunc(framePeriod, Timer, 0);
////////////////////////////////////////////////////////////////////////////////////////////
/*const char *task_spec;
printf("\nThis is a RL Test program(Start)\n");
task_spec = RL_init();
//.........这里部分代码省略.........