From Wojciech Leandowski, "I removed few lines of code that were setting Threading mode and Screen mode. I believe they are now not neccessary because the same does osgViewer::Viewer argument parser. In fact argument list does not contain these args after they were parsed by osgViewer::Viewer constructor.

I also allowed myself to add ThreadingHandler to the example."
This commit is contained in:
Robert Osfield 2008-03-25 11:50:28 +00:00
parent 600dbf5470
commit 920554c4f7

View File

@ -514,7 +514,6 @@ int main(int argc, char** argv)
arguments.getApplicationUsage()->addCommandLineOption("--two-sided", "Use two-sided stencil extension for shadow volumes."); arguments.getApplicationUsage()->addCommandLineOption("--two-sided", "Use two-sided stencil extension for shadow volumes.");
arguments.getApplicationUsage()->addCommandLineOption("--two-pass", "Use two-pass stencil for shadow volumes."); arguments.getApplicationUsage()->addCommandLineOption("--two-pass", "Use two-pass stencil for shadow volumes.");
// construct the viewer. // construct the viewer.
osgViewer::Viewer viewer(arguments); osgViewer::Viewer viewer(arguments);
@ -525,15 +524,6 @@ int main(int argc, char** argv)
return 1; return 1;
} }
// default to single threaded during dev work.
viewer.setThreadingModel(osgViewer::Viewer::SingleThreaded);
while (arguments.read("--SingleThreaded")) viewer.setThreadingModel(osgViewer::Viewer::SingleThreaded);
while (arguments.read("--CullDrawThreadPerContext")) viewer.setThreadingModel(osgViewer::Viewer::CullDrawThreadPerContext);
while (arguments.read("--DrawThreadPerContext")) viewer.setThreadingModel(osgViewer::Viewer::DrawThreadPerContext);
while (arguments.read("--CullThreadPerCameraDrawThreadPerContext")) viewer.setThreadingModel(osgViewer::Viewer::CullThreadPerCameraDrawThreadPerContext);
bool postionalLight = true; bool postionalLight = true;
while (arguments.read("--positionalLight")) postionalLight = true; while (arguments.read("--positionalLight")) postionalLight = true;
while (arguments.read("--directionalLight")) postionalLight = false; while (arguments.read("--directionalLight")) postionalLight = false;
@ -541,10 +531,6 @@ int main(int argc, char** argv)
bool updateLightPosition = true; bool updateLightPosition = true;
while (arguments.read("--noUpdate")) updateLightPosition = false; while (arguments.read("--noUpdate")) updateLightPosition = false;
int screenNum = -1;
while (arguments.read("--screen", screenNum)) viewer.setUpViewOnSingleScreen(screenNum);
// set up the camera manipulators. // set up the camera manipulators.
{ {
osg::ref_ptr<osgGA::KeySwitchMatrixManipulator> keyswitchManipulator = new osgGA::KeySwitchMatrixManipulator; osg::ref_ptr<osgGA::KeySwitchMatrixManipulator> keyswitchManipulator = new osgGA::KeySwitchMatrixManipulator;
@ -580,13 +566,14 @@ int main(int argc, char** argv)
// add the record camera path handler // add the record camera path handler
viewer.addEventHandler(new osgViewer::RecordCameraPathHandler); viewer.addEventHandler(new osgViewer::RecordCameraPathHandler);
// add the threading handler
viewer.addEventHandler( new osgViewer::ThreadingHandler() );
osg::ref_ptr<osgShadow::ShadowedScene> shadowedScene = new osgShadow::ShadowedScene; osg::ref_ptr<osgShadow::ShadowedScene> shadowedScene = new osgShadow::ShadowedScene;
shadowedScene->setReceivesShadowTraversalMask(ReceivesShadowTraversalMask); shadowedScene->setReceivesShadowTraversalMask(ReceivesShadowTraversalMask);
shadowedScene->setCastsShadowTraversalMask(CastsShadowTraversalMask); shadowedScene->setCastsShadowTraversalMask(CastsShadowTraversalMask);
if (arguments.read("--sv")) if (arguments.read("--sv"))
{ {
// hint to tell viewer to request stencil buffer when setting up windows // hint to tell viewer to request stencil buffer when setting up windows