[osg-submissions] osgconv: changes to handling of command line options

Max Langbein m_langbe at informatik.uni-kl.de
Sun Aug 19 06:57:53 PDT 2007


hello,
I have changed the handling of the command line options
passed to the reader/writer (with -O)

Until now, only one command line option
with no spaces in it
can be passed on to the reader/writer.
(in fact, always the last option given with -O is passed on)

With the change, all command line options given with -O
are concatenated (with spaces) to a string passed on to the reader/writer.

I needed this because I wanted to pass the options
PRECISION 10 (note: two words separated with spaces)
on to the .osg writer.


Testing done:

I compiled the new osgconv.cpp and executed

osgconv -O PRECISION -O 10 bplan_from3ds.dxf

(bplan_from3ds.dxf is a dxf file I wanted to have in a higher precision in
the .osg file)

The resulting file converted.osg
could be loaded into osgviewer without errors;

it had now 8 decimals per number instead of 6;
(only 8 and not 10 because float doesn't have more precision)


In the code, i made the following changes:

I Replaced

//----------------------------------------------------------
std::string str;
while (arguments.read("-O",str))
  {
  osgDB::ReaderWriter::Options* options = new osgDB::ReaderWriter::Options;
  options->setOptionString(str);
  osgDB::Registry::instance()->setOptions(options);
}
//----------------------------------------------------------

with:

//----------------------------------------------------------
std::string str,optstr="";
while(arguments.read("-O",str))
  optstr+=" "+str;

if(optstr!=""){
  osgDB::ReaderWriter::Options* options = new osgDB::ReaderWriter::Options;
  options->setOptionString(optstr);
  osgDB::Registry::instance()->setOptions(options);
}
//----------------------------------------------------------



Greetings,
  Max Langbein
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: osgconv.cpp
Url: http://lists.openscenegraph.org/pipermail/osg-submissions-openscenegraph.org/attachments/20070819/4160279d/attachment-0001.pot 


More information about the osg-submissions mailing list