Hi,
I want to submit a fix for the plugin to load .x model files (Direct X).
The current version crashes when encountering global materials, as also
reported in the forum by the author of the plugin.
The problem in mesh.cpp (app. ln 247) is, that references to global materials
that are given in curly brackets {} are not supported by the reader. However,
curly brackets seem to be common, according to Bourke. Unfortunately, I found
no specification. However, also the DirectX model viewer that comes with the
DirectX-SDK (August 2009) expects curly brackets and refuses models without
them.
My fix checks 2 more cases ("{ aMaterial }" -> 3 tokens and "{aMaterial}" -> 1
token), and extracts the material name for the lookup. I don't know if this is
the most elegant solution, but the tokenizer seems to split based on white
spaces.
You can reproduce the bug with the attached model (box.x), which loads fine in
other tools, such as 3DSmax, DeepExploration or the DirectX model viewer. When
I remove the curly brackets at the reference of "myGlobalMaterial", it loads in
osgviewer, but is not standard conform.
Thank you!
Cheers,
Tassilo
PS: sorry, not allowed to post hyperlinks, yet
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=30879#30879
Attachments:
http://forum.openscenegraph.org//files/fix_x_plugin_142.zip
_______________________________________________
osg-submissions mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org