From 9c94bf2fdcfbe8108108cc376ea1770e2538bfd6 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Fri, 28 Oct 2005 10:11:12 +0000 Subject: [PATCH] Added command line option --overlay to turn on the use of an OverlayNode. --- examples/osganimate/osganimate.cpp | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/examples/osganimate/osganimate.cpp b/examples/osganimate/osganimate.cpp index ec3919ecf..c6d9f5fae 100644 --- a/examples/osganimate/osganimate.cpp +++ b/examples/osganimate/osganimate.cpp @@ -174,7 +174,7 @@ osg::Node* createMovingModel(const osg::Vec3& center, float radius) return model; } -osg::Node* createModel() +osg::Node* createModel(bool overlay) { osg::Vec3 center(0.0f,0.0f,0.0f); float radius = 100.0f; @@ -184,15 +184,20 @@ osg::Node* createModel() osg::Node* baseModel = createBase(center-osg::Vec3(0.0f,0.0f,radius*0.5),radius); osg::Node* movingModel = createMovingModel(center,radius*0.8f); -#if 1 - osgSim::OverlayNode* overlayNode = new osgSim::OverlayNode; - overlayNode->setOverlaySubgraph(movingModel); - overlayNode->addChild(baseModel); - root->addChild(overlayNode); -#else - root->addChild(baseModel); -#endif - + if (overlay) + { + osgSim::OverlayNode* overlayNode = new osgSim::OverlayNode; + overlayNode->setContinousUpdate(true); + overlayNode->setOverlaySubgraph(movingModel); + overlayNode->addChild(baseModel); + root->addChild(overlayNode); + } + else + { + + root->addChild(baseModel); + } + root->addChild(movingModel); return root; @@ -224,6 +229,9 @@ int main( int argc, char **argv ) arguments.getApplicationUsage()->write(std::cout); return 1; } + + bool overlay = false; + while (arguments.read("--overlay")) overlay = true; // any option left unread are converted into errors to write out later. arguments.reportRemainingOptionsAsUnrecognized(); @@ -236,7 +244,7 @@ int main( int argc, char **argv ) } // load the nodes from the commandline arguments. - osg::Node* model = createModel(); + osg::Node* model = createModel(overlay); if (!model) { return 1;