Are you sure you're getting the same FLT file in both cases? Echo the full path
returned by osgDB::findDataFile().
-Paul
On 11/8/2012 7:55 PM, Chris Hanson wrote:
I've encountered a strange behavior when loading a client-supplied FLT file
and I haven't been able to drill down and find an explanation. I think I know
what must be happening, but I can't find any mechanism to explain how.
The customer has a TXP database which refers to a FLT model. The FLT model
has a named MultiSwitch node, which controls some LightPointNodes.
The symptom is that if the FLT file is loaded by itself (into osgViewer.exe
for example) a NodeVisitor of ours is able to locate the MultiSwitch by name. If
the FLT file is loaded via the DataBasePager from the TXP file, the FLT loads,
but the visitor is unable to locate the MultiSwitch.
Further investigation (adding debug code in a readfilecallback to save out a
temporary .OSG file) reveals that somehow the MultiSwitch is not even in the
resulting graph that gets produced from the FLT file. Converting the FLT file to
OSG via osgconv, or a simple readNodeFile+writeNodeFile at the beginning of
main() however produces an .OSG file that does contain the missing MultiSwitch.
I've gone so far as to add this debug code at the beginning of main(), as
well as in the readfilecallback that is invoked when the databasepager loads the
FLT file:
osgDB::ReaderWriter::ReadResult result =
osgDB::Registry::instance()->readNodeImplementation("foo.flt",NULL);
osgDB::writeNodeFile(*(result.getNode()), "foo.osg");
I use readNodeImplementation to ensure we're avoiding any callbacks.
When execute from main(), this code produces a OSG file containing the
MultiSwitch. When copy & pasted to the readfilecallback, it produces a OSG file
lacking the MultiSwitch.
.
I don't believe the osgUtil Optimizer is in play here, as the databasepager
runs that after the load returns. I don't think any of the FLT loader options (
http://www.openscenegraph.org/projects/osg/wiki/Support/KnowledgeBase/OpenFlight
)like
preserveObject are affecting things, because I'm passing a NULL options pointer
in both cases.
What else could be different between these two cases that could lead to a
different graph being produced from the same FLT file, and how do I unify this
to one (correct) behavior? (I wouldn't think preserveObject or other FLT loader
options would be optimizing out a MultiSwitch as redundant anyway, but perhaps
it's misguided.)
Please grant me some sanity.
--
Chris 'Xenon' Hanson, omo sanza lettere. [email protected]
http://www.alphapixel.com/
Training • Consulting • Contracting
3D • Scene Graphs (Open Scene Graph/OSG) • OpenGL 2 • OpenGL 3 • OpenGL 4 • GLSL
• OpenGL ES 1 • OpenGL ES 2 • OpenCL
Digital Imaging • GIS • GPS • Telemetry • Cryptography • Digital Audio • LIDAR •
Kinect • Embedded • Mobile • iPhone/iPad/iOS • Android
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org