Ported following examples to osgViewer:

osggeodemo
    osggeometry
    osghud
    osgimpostor
    osgkeyboard
    osglauncher
    osglight
    osglightpoint
    osglogicop
    osglogo
    osgmovie
    osgmultiplecameras
    osgmultitexture
    osgoccluder
    osgparametric
    osgparticle
This commit is contained in:
Robert Osfield
2007-01-08 10:00:16 +00:00
parent e041f08b73
commit dfb21cb81a
79 changed files with 259 additions and 1191 deletions

View File

@@ -13,7 +13,9 @@
#include <osgUtil/Optimizer>
#include <osgUtil/TriStripVisitor>
#include <osgProducer/Viewer>
#include <osgViewer/Viewer>
#include <iostream>
// for the grid data..
#include "../osghangglide/terrain_coords.h"
@@ -511,11 +513,8 @@ int main(int argc, char *argv[])
arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information");
// construct the viewer.
osgProducer::Viewer viewer(arguments);
osgViewer::Viewer viewer;
// set up the value with sensible default event handlers.
viewer.setUpViewer(osgProducer::Viewer::STANDARD_SETTINGS);
std::string shader("simple");
while(arguments.read("-s",shader)) {}
@@ -540,9 +539,6 @@ int main(int argc, char *argv[])
bool joinStrips = false;
while(arguments.read("--join")) { joinStrips = true; }
// get details on keyboard and mouse bindings used by the viewer.
viewer.getUsage(*arguments.getApplicationUsage());
// if user request help write it out to cout.
if (arguments.read("-h") || arguments.read("--help"))
{
@@ -550,51 +546,14 @@ int main(int argc, char *argv[])
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;
}
// load the nodes from the commandline arguments.
osg::Node* model = createModel(shader,textureFileName,terrainFileName,terrainFileName2, cacheSize, maxSize, joinStrips,mesh);
if (!model)
{
return 1;
}
// add a viewport to the viewer and attach the scene graph.
viewer.setSceneData(model);
// create the windows and run the threads.
viewer.realize();
while( !viewer.done() )
{
// wait for all cull and draw threads to complete.
viewer.sync();
// update the scene by traversing it with the the update visitor which will
// call all node update callbacks and animations.
viewer.update();
// fire off the cull and draw traversals of the scene.
viewer.frame();
}
// wait for all cull and draw threads to complete.
viewer.sync();
// run a clean up frame to delete all OpenGL objects.
viewer.cleanup_frame();
// wait for all the clean up frame to complete.
viewer.sync();
return 0;
return viewer.run();
}