From 57e20282deef3a1d0e1bed6bd3e4cd793f9922cf Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Fri, 5 Jan 2007 15:52:33 +0000 Subject: [PATCH] Simplified the osganimate and osgautotransform mains, removing most or all of the argument parser code. --- examples/osganimate/osganimate.cpp | 31 ++-------- .../osgautotransform/osgautotransform.cpp | 59 +------------------ 2 files changed, 6 insertions(+), 84 deletions(-) diff --git a/examples/osganimate/osganimate.cpp b/examples/osganimate/osganimate.cpp index 8677927de..e5a6b4b70 100644 --- a/examples/osganimate/osganimate.cpp +++ b/examples/osganimate/osganimate.cpp @@ -206,37 +206,14 @@ osg::Node* createModel(bool overlay) int main( int argc, char **argv ) { - // use an ArgumentParser object to manage the program arguments. + + bool overlay = false; osg::ArgumentParser arguments(&argc,argv); - - // set up the usage document, in case we need to print out how to use this program. - arguments.getApplicationUsage()->setDescription(arguments.getApplicationName()+" is the example which demonstrates use of osg::AnimationPath and UpdateCallbacks for adding animation to your scenes."); - arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName()+" [options] filename ..."); - arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information"); - + while (arguments.read("--overlay")) overlay = true; + // initialize the viewer. osgViewer::Viewer viewer; - // if user request help write it out to cout. - if (arguments.read("-h") || arguments.read("--help")) - { - arguments.getApplicationUsage()->write(std::cout); - return 1; - } - - bool overlay = false; - while (arguments.read("--overlay")) overlay = true; - - // any option left unread are converted into errors to write out later. - arguments.reportRemainingOptionsAsUnrecognized(); - - // report any errors if they have occured when parsing the program aguments. - if (arguments.errors()) - { - arguments.writeErrorMessages(std::cout); - return 1; - } - // load the nodes from the commandline arguments. osg::Node* model = createModel(overlay); if (!model) diff --git a/examples/osgautotransform/osgautotransform.cpp b/examples/osgautotransform/osgautotransform.cpp index 1160f459d..bcd187fc0 100644 --- a/examples/osgautotransform/osgautotransform.cpp +++ b/examples/osgautotransform/osgautotransform.cpp @@ -157,69 +157,14 @@ osg::Node* createScene() return root; } -int main( int argc, char **argv ) +int main(int, char**) { - - // use an ArgumentParser object to manage the program arguments. - osg::ArgumentParser arguments(&argc,argv); - - // set up the usage document, in case we need to print out how to use this program. - arguments.getApplicationUsage()->setDescription(arguments.getApplicationName()+" is the example which demonstrates how to do Head Up Displays."); - arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName()+" [options] [filename] ..."); - arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information"); - - // construct the viewer. osgViewer::Viewer viewer; - // if user request help write it out to cout. - if (arguments.read("-h") || arguments.read("--help")) - { - arguments.getApplicationUsage()->write(std::cout); - return 1; - } - - // any option left unread are converted into errors to write out later. - arguments.reportRemainingOptionsAsUnrecognized(); - - // report any errors if they have occured when parsing the program aguments. - if (arguments.errors()) - { - arguments.writeErrorMessages(std::cout); - return 1; - } - - // set the scene to render viewer.setSceneData(createScene()); + // run the viewers frame loop return viewer.run(); - - -// osg::Node* obj = new osg::Node; -// cout << "obj = "<