Added new osg::ApplicationUsage and osg::ArgumentParser to help streamline

application/example developement.
This commit is contained in:
Robert Osfield
2003-02-18 16:36:42 +00:00
parent 6184ecba3f
commit c10d5f2d6f
22 changed files with 1008 additions and 84 deletions

View File

@@ -6,6 +6,9 @@
#include <osgUtil/UpdateVisitor>
#include <osgDB/Registry>
#include <osgGA/AnimationPathManipulator>
#include <osgGA/TrackballManipulator>
#include <osgGA/FlightManipulator>
#include <osgGA/DriveManipulator>
@@ -13,6 +16,7 @@
using namespace osgProducer;
Viewer::Viewer():
_done(0),
_frameNumber(0),
@@ -36,6 +40,27 @@ Viewer::Viewer(const std::string& configFile):
{
}
Viewer::Viewer(osg::ArgumentParser& arguments):
CameraGroup(arguments),
_done(false),
_frameNumber(0),
_kbmcb(0)
{
osg::DisplaySettings::instance()->readCommandLine(arguments);
std::string pathfile;
while (arguments.read("-p",pathfile))
{
osg::ref_ptr<osgGA::AnimationPathManipulator> apm = new osgGA::AnimationPathManipulator(pathfile);
if( apm.valid() && apm->valid() )
{
unsigned int num = addCameraManipulator(apm.get());
selectCameraManipulator(num);
}
}
}
void Viewer::setUpViewer(unsigned int options)
{
@@ -108,7 +133,7 @@ void Viewer::setUpViewer(unsigned int options)
if (options&STATS_MANIPULATOR)
{
// register the drawing of stats to pipe 0.
Producer::FrameStatsHandler* fsh = new Producer::FrameStatsHandler;
FrameStatsHandler* fsh = new FrameStatsHandler;
setStatsHandler(fsh);
getCamera(0)->addPostDrawCallback(fsh);