I did not change the error handling. I do not get crashes. The loader should just return a NULL if it was unable to load a model. Sometimes this happens, sometimes it does not.
There are several features that still need to be added/fixed before the loader can be considered "done", but as a work-in-progress, the couple of tweaks I had added should allow us to load more files than previously. There are three obvious "to-do" items: 1. Reject binary files/return NULL It should be easy enough to pick the type out of the header (looks like 16 chars, with either bin or txt in it) and instantly return NULL for binary files. 2. Handle FrameTransformMatrix The .x Frame node can have associated matrices, "FrameTransformMatrix", a 16 number float array. As-is, the loader skips over these. So, any Frames with a non-identity FrameTransformMatrix will load in the wrong place. Adding this functionality would require properly implementing ParseFrame as well as adding a push/pop matrix system. 3. Handle nodes with the open brace not on the same line as the type and name. The current loader reads a line at a time, and if the line ends in an open brace, it reads the type off the front of the same line. This works for most DirectX exporters since they put the type of section and the open brace on the same line, but some sample .x files I've seen have the open brace on a line by itself. I haven't read the .x spec (or even looked to see if there is one), but there are probably more node types that should or could be handled as well. Thanks, Aric ________________________________ From: Ulrich Hertlein <[email protected]> To: OpenSceneGraph Submissions <[email protected]> Sent: Friday, March 20, 2009 7:05:34 PM Subject: Re: [osg-submissions] DirectX plugin minor fixes Hi Aric, On 20/3/09 9:02 AM, Aric Aumann wrote: > I ran into some issues with the directX loader plugin, here's some minor > tweaks that > helped. >... > In directx.cpp: > > Changed a call from "parseFrame" to "parseSection". The call to the > parseFrame function > was breaking the recursive brace-tracking mechanism in parseSection, so it > was kicking > out of nested braces too early. > > In ReaderWriterDirectX.cpp: > > Changed behaviour of convertFromDX from "return null if no texture coords" to > "don't > copy texture coords if no texture coords". The tweaks are fine with my collection of .x models (all contain texcoords). > I still am unable to load about half of Microsoft's .x files from the DirectX > SDK, but > some do load. The ones that don't are either binary or they use some > non-simple > geometry descriptions. Does the loader handle this robustly? I.e. not crash but report FILE_NOT_HANDLED or whatever? Cheers, /ulrich _______________________________________________ osg-submissions mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
_______________________________________________ osg-submissions mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
