Hi David,
On Mon, Nov 24, 2008 at 9:26 PM, David Spilling
<[EMAIL PROTECTED]> wrote:
> Only just caught this thread. I'm happy to update the OBJ plugin (reader
> only, presumably) if you want to lose the sscanf, as it's only recently I
> was looking at it anyway.
This would be very helpful, as I'm rather stretched right now trying
to manage all the submissions, fix bugs...
> I assume that you want all sscanf(blah, "%f", &my_float); to be replaced by
> sscanf(blah, "%s", my_char); my_float=atof(my_char), more or less, or did
> you want the whole thing done with std::string or something?
I was wondering if we might be able to reuse the osgDB ascii parsing
code. In particular I add a set of osgDB::Input::read(...) methods
that work like osg::ArgumentParser does in adapting generic
parameters. It means that you can do:
if (fin.read("mat",myFloat1,myFloat2)) { ... }
Or:
if (fin.read("texture",myTextureString)) { ... }
This functionality was added to osgDB in the last six months, so its
usage doesn't appear too widely in the .osg plugins yet, but it
certainly makes the task of parsing much more sane. osgDB::Input
already uses asciiToFloat/asciiToDouble.
> Was the original problem (top of the thread) a recent one, as I seem to have
> missed it if it was...
The .obj plugin not working when the locale is set was what pushed me
to raise this topic. Earlier I had to fix the .osg plugin to handle
this issue - but I didn't look at this as a general issue.
> And sorry to be dense, but is the issue also whether OBJ writers (modelling
> programs) are locale specific, and how a user might choose the OSG .obj
> plugin to respect locale or assume a default?
For file formats my guess is that none will use a non default locale,
i.e. '.' will always be the decimal place. The only way for this to
not be the case would be where file formats explicitly declare the
locale that the format is in, but I don't know of any formats that we
load that do this.
Robert.
Robert.
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org