From 90bd49100ff890b7f4997478d2563f08734e7460 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Wed, 25 Nov 2009 16:20:25 +0000 Subject: [PATCH] Added support for repeating viewer construction --- examples/osgcamera/osgcamera.cpp | 56 ++++++++++++++++++-------------- 1 file changed, 31 insertions(+), 25 deletions(-) diff --git a/examples/osgcamera/osgcamera.cpp b/examples/osgcamera/osgcamera.cpp index 138689450..c2d61ec34 100644 --- a/examples/osgcamera/osgcamera.cpp +++ b/examples/osgcamera/osgcamera.cpp @@ -16,8 +16,6 @@ * THE SOFTWARE. */ -#if 1 - #include #include #include @@ -186,6 +184,37 @@ int main( int argc, char **argv ) return 1; } + unsigned int numRepeats = 2; + if (arguments.read("--repeat",numRepeats) || arguments.read("-r",numRepeats) || arguments.read("--repeat") || arguments.read("-r")) + { + bool sharedModel = arguments.read("--shared"); + osg::ref_ptr model; + if (sharedModel) model = osgDB::readNodeFiles(arguments); + + osgViewer::Viewer::ThreadingModel threadingModel = osgViewer::Viewer::AutomaticSelection; + while (arguments.read("-s")) { threadingModel = osgViewer::Viewer::SingleThreaded; } + while (arguments.read("-g")) { threadingModel = osgViewer::Viewer::CullDrawThreadPerContext; } + while (arguments.read("-d")) { threadingModel = osgViewer::Viewer::DrawThreadPerContext; } + while (arguments.read("-c")) { threadingModel = osgViewer::Viewer::CullThreadPerCameraDrawThreadPerContext; } + + for(unsigned int i=0; i apm = 0; @@ -277,26 +306,3 @@ int main( int argc, char **argv ) return 0; } -#else - -#include -#include -#include - -int main( int, char **) -{ - osg::ref_ptr model = osgDB::readNodeFile("cow.osg"); - - for(unsigned int i=0; i<5; ++i) - { - osg::notify(osg::NOTICE)<<"New frame *******************************"<