Added new osg::ApplicationUsage and osg::ArgumentParser to help streamline

application/example developement.
This commit is contained in:
Robert Osfield
2003-02-18 16:36:42 +00:00
parent 6184ecba3f
commit c10d5f2d6f
22 changed files with 1008 additions and 84 deletions

View File

@@ -96,3 +96,52 @@ Node* osgDB::readNodeFiles(std::vector<std::string>& commandLine)
}
}
Node* osgDB::readNodeFiles(osg::ArgumentParser& arguments)
{
osgDB::readCommandLine(arguments);
typedef std::vector<osg::Node*> NodeList;
NodeList nodeList;
// note currently doesn't delete the loaded file entries from the command line yet...
for(int pos=1;pos<arguments.argc();++pos)
{
if (!arguments.isOption(pos))
{
// not an option so assume string is a filename.
osg::Node *node = osgDB::readNodeFile( arguments[pos] );
if(node)
{
if (node->getName().empty()) node->setName( arguments[pos] );
nodeList.push_back(node);
}
}
}
if (nodeList.empty())
{
return NULL;
}
if (nodeList.size()==1)
{
return nodeList.front();
}
else // size >1
{
osg::Group* group = new osg::Group;
for(NodeList::iterator itr=nodeList.begin();
itr!=nodeList.end();
++itr)
{
group->addChild(*itr);
}
return group;
}
}