diff --git a/VisualStudio/OpenSceneGraph.dsw b/VisualStudio/OpenSceneGraph.dsw index 48de406e8..713ab81d3 100644 --- a/VisualStudio/OpenSceneGraph.dsw +++ b/VisualStudio/OpenSceneGraph.dsw @@ -369,6 +369,9 @@ Package=<4> Project_Dep_Name Core osgProducer End Project Dependency Begin Project Dependency + Project_Dep_Name Core osgViewer + End Project Dependency + Begin Project Dependency Project_Dep_Name Core osgUtil End Project Dependency }}} diff --git a/applications/osgviewer/GNUmakefile b/applications/osgviewer/GNUmakefile index e6ae462f3..cd327bb67 100644 --- a/applications/osgviewer/GNUmakefile +++ b/applications/osgviewer/GNUmakefile @@ -4,7 +4,7 @@ include $(TOPDIR)/Make/makedefs CXXFILES =\ osgviewer.cpp\ -LIBS += -losgProducer -lProducer -losgText -losgGA -losgDB -losgUtil -losg $(GL_LIBS) $(X_LIBS) $(OTHER_LIBS) +LIBS += -losgViewer -losgProducer -lProducer -losgText -losgGA -losgDB -losgUtil -losg $(GL_LIBS) $(X_LIBS) $(OTHER_LIBS) INSTFILES = \ $(CXXFILES)\ diff --git a/applications/osgviewer/GNUmakefile.inst b/applications/osgviewer/GNUmakefile.inst index 11834bc69..74794f7a9 100644 --- a/applications/osgviewer/GNUmakefile.inst +++ b/applications/osgviewer/GNUmakefile.inst @@ -4,7 +4,7 @@ include $(TOPDIR)/Make/makedefs CXXFILES =\ osgviewer.cpp\ -LIBS += -losgProducer -lProducer -losgDB -losgText -losgUtil -losg $(GL_LIBS) $(X_LIBS) $(OTHER_LIBS) +LIBS += -losgViewer -losgProducer -lProducer -losgDB -losgText -losgUtil -losg $(GL_LIBS) $(X_LIBS) $(OTHER_LIBS) EXEC = osgviewer diff --git a/applications/osgviewer/osgviewer.cpp b/applications/osgviewer/osgviewer.cpp index cede0dbe5..4a19d8052 100644 --- a/applications/osgviewer/osgviewer.cpp +++ b/applications/osgviewer/osgviewer.cpp @@ -11,15 +11,11 @@ #include #include -#include #include -int main( int argc, char **argv ) +#include +int main_osgProducer(osg::ArgumentParser& arguments) { - - // 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()->setApplicationName(arguments.getApplicationName()); arguments.getApplicationUsage()->setDescription(arguments.getApplicationName()+" is the standard OpenSceneGraph example which loads and visualises 3d models."); @@ -128,3 +124,29 @@ int main( int argc, char **argv ) return 0; } +#include +int main_osgViewer(osg::ArgumentParser& arguments) +{ + osgViewer::Viewer viewer; + + viewer.setSceneData( osgDB::readNodeFiles(arguments)); + + return viewer.run(); +} + +int main( int argc, char **argv ) +{ + // use an ArgumentParser object to manage the program arguments. + osg::ArgumentParser arguments(&argc,argv); + + if (arguments.read("--osgProducer")) + { + return main_osgProducer(arguments); + } + else + { + return main_osgViewer(arguments); + } + +} +