From fa996d0745e432ccca2b67bddb4fd03a7afe922c Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Mon, 25 Apr 2005 20:34:23 +0000 Subject: [PATCH] From Mike Weiblen, added support for --clear-color r,g,b,a and --clear-color r,g,b to osgProducer::Viewer. --- src/osgProducer/Viewer.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/osgProducer/Viewer.cpp b/src/osgProducer/Viewer.cpp index dc5b37c26..59961400b 100644 --- a/src/osgProducer/Viewer.cpp +++ b/src/osgProducer/Viewer.cpp @@ -18,6 +18,8 @@ #include #include +#include + using namespace Producer; using namespace osgProducer; using namespace osg; @@ -327,6 +329,7 @@ Viewer::Viewer(osg::ArgumentParser& arguments): arguments.getApplicationUsage()->addCommandLineOption("-p ","Specify camera path file to animate the camera through the loaded scene"); arguments.getApplicationUsage()->addCommandLineOption("--run-till-frame-number ","Specify the number of frame to run"); arguments.getApplicationUsage()->addCommandLineOption("--run-till-elapsed-time","Specify the about of time to run"); + arguments.getApplicationUsage()->addCommandLineOption("--clear-color ,,[,]","Specify the clear color as RGB or RGBA"); } osg::DisplaySettings::instance()->readCommandLine(arguments); @@ -361,6 +364,16 @@ Viewer::Viewer(osg::ArgumentParser& arguments): setWriteImageWhenDone(true); setWriteImageFileName(filename); } + + std::string colorStr; + while (arguments.read("--clear-color",colorStr)) + { + float r, g, b; + float a = 1.0f; + int cnt = sscanf( colorStr.c_str(), "%f,%f,%f,%f", &r, &g, &b, &a ); + if( cnt==3 || cnt==4 ) setClearColor( osg::Vec4(r,g,b,a) ); + else osg::notify(osg::WARN)<<"Invalid clear color \""<