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 \""<