Changeset 8306
- Timestamp:
- 05/12/08 12:55:55
- Files:
-
- OpenSceneGraph/trunk/applications/osgviewer/osgviewer.cpp (modified) (1 diff)
- OpenSceneGraph/trunk/include/osg/ApplicationUsage (modified) (1 diff)
- OpenSceneGraph/trunk/include/osg/ArgumentParser (modified) (1 diff)
- OpenSceneGraph/trunk/src/osg/ArgumentParser.cpp (modified) (1 diff)
- OpenSceneGraph/trunk/src/osgViewer/Viewer.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
OpenSceneGraph/trunk/applications/osgviewer/osgviewer.cpp
r7895 r8306 40 40 arguments.getApplicationUsage()->addCommandLineOption("--image <filename>","Load an image and render it on a quad"); 41 41 arguments.getApplicationUsage()->addCommandLineOption("--dem <filename>","Load an image/DEM and render it on a HeightField"); 42 arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display command line parameters");43 arguments.getApplicationUsage()->addCommandLineOption("--help-env","Display environmental variables available");44 arguments.getApplicationUsage()->addCommandLineOption("--help-keys","Display keyboard & mouse bindings available");45 arguments.getApplicationUsage()->addCommandLineOption("--help-all","Display all command line, env vars and keyboard & mouse bindings.");46 arguments.getApplicationUsage()->addCommandLineOption("--SingleThreaded","Select SingleThreaded threading model for viewer.");47 arguments.getApplicationUsage()->addCommandLineOption("--CullDrawThreadPerContext","Select CullDrawThreadPerContext threading model for viewer.");48 arguments.getApplicationUsage()->addCommandLineOption("--DrawThreadPerContext","Select DrawThreadPerContext threading model for viewer.");49 arguments.getApplicationUsage()->addCommandLineOption("--CullThreadPerCameraDrawThreadPerContext","Select CullThreadPerCameraDrawThreadPerContext threading model for viewer.");50 42 51 // if user request help write it out to cout. 52 bool helpAll = arguments.read("--help-all"); 53 unsigned int helpType = ((helpAll || arguments.read("-h") || arguments.read("--help"))? osg::ApplicationUsage::COMMAND_LINE_OPTION : 0 ) | 54 ((helpAll || arguments.read("--help-env"))? osg::ApplicationUsage::ENVIRONMENTAL_VARIABLE : 0 ) | 55 ((helpAll || arguments.read("--help-keys"))? osg::ApplicationUsage::KEYBOARD_MOUSE_BINDING : 0 ); 56 if (helpType) 43 osgViewer::Viewer viewer(arguments); 44 45 unsigned int helpType = 0; 46 if ((helpType = arguments.readHelpType())) 57 47 { 58 48 arguments.getApplicationUsage()->write(std::cout, helpType); 59 49 return 1; 60 50 } 61 62 osgViewer::Viewer viewer(arguments);63 51 64 52 // report any errors if they have occurred when parsing the program arguments. OpenSceneGraph/trunk/include/osg/ApplicationUsage
r7648 r8306 44 44 enum Type 45 45 { 46 NO_HELP = 0x0, 46 47 COMMAND_LINE_OPTION = 0x1, 47 48 ENVIRONMENTAL_VARIABLE = 0x2, 48 KEYBOARD_MOUSE_BINDING = 0x4 49 KEYBOARD_MOUSE_BINDING = 0x4, 50 HELP_ALL = KEYBOARD_MOUSE_BINDING|ENVIRONMENTAL_VARIABLE|COMMAND_LINE_OPTION 49 51 }; 50 52 OpenSceneGraph/trunk/include/osg/ArgumentParser
r7648 r8306 191 191 void writeErrorMessages(std::ostream& output,ErrorSeverity sevrity=BENIGN); 192 192 193 194 /** This convinience method handles help requests on the command line. 195 * Return the type(s) of help requested. The return value of this 196 * function is suitable for passing into getApplicationUsage()->write(). 197 * If ApplicationUsage::NO_HELP is returned then no help commandline option 198 * was found on the command line. */ 199 ApplicationUsage::Type readHelpType(); 200 193 201 194 202 protected: OpenSceneGraph/trunk/src/osg/ArgumentParser.cpp
r7442 r8306 631 631 } 632 632 } 633 634 ApplicationUsage::Type ArgumentParser::readHelpType() 635 { 636 getApplicationUsage()->addCommandLineOption("-h or --help","Display command line parameters"); 637 getApplicationUsage()->addCommandLineOption("--help-env","Display environmental variables available"); 638 getApplicationUsage()->addCommandLineOption("--help-keys","Display keyboard & mouse bindings available"); 639 getApplicationUsage()->addCommandLineOption("--help-all","Display all command line, env vars and keyboard & mouse bindings."); 640 641 // if user request help write it out to cout. 642 if (read("--help-all")) return ApplicationUsage::HELP_ALL; 643 if (read("-h") || read("--help")) return ApplicationUsage::COMMAND_LINE_OPTION; 644 if (read("--help-env")) return ApplicationUsage::ENVIRONMENTAL_VARIABLE; 645 if (read("--help-keys")) return ApplicationUsage::KEYBOARD_MOUSE_BINDING; 646 647 return ApplicationUsage::NO_HELP; 648 } OpenSceneGraph/trunk/src/osgViewer/Viewer.cpp
r8276 r8306 44 44 45 45 constructorInit(); 46 47 // Add help for command-line options read here 48 arguments.getApplicationUsage()->addCommandLineOption("--SingleThreaded","Select SingleThreaded threading model for viewer."); 49 arguments.getApplicationUsage()->addCommandLineOption("--CullDrawThreadPerContext","Select CullDrawThreadPerContext threading model for viewer."); 50 arguments.getApplicationUsage()->addCommandLineOption("--DrawThreadPerContext","Select DrawThreadPerContext threading model for viewer."); 51 arguments.getApplicationUsage()->addCommandLineOption("--CullThreadPerCameraDrawThreadPerContext","Select CullThreadPerCameraDrawThreadPerContext threading model for viewer."); 52 arguments.getApplicationUsage()->addCommandLineOption("--clear-color <color>","Set the background color of the viewer in the form \"r,g,b[,a]\"."); 53 arguments.getApplicationUsage()->addCommandLineOption("--screen <num>","Set the screen to use when multiple screens are present."); 54 arguments.getApplicationUsage()->addCommandLineOption("--window <x y w h>","Set the position (x,y) and size (w,h) of the viewer window."); 55 // FIXME: Uncomment these lines when the options have been documented properly 56 //arguments.getApplicationUsage()->addCommandLineOption("--3d-sd",""); 57 //arguments.getApplicationUsage()->addCommandLineOption("--panoramic-sd",""); 58 //arguments.getApplicationUsage()->addCommandLineOption("--radius",""); 59 //arguments.getApplicationUsage()->addCommandLineOption("--collar",""); 60 //arguments.getApplicationUsage()->addCommandLineOption("--im",""); 46 61 47 62 std::string filename;
