Monday, December 6, 2010

JAXB + Collada 1.4 Schema = Messy method names

Collada Reference ModelNASA WorldWind Java has recently added extensive KML support. They use neither SAX nor DOM, but a very creative solution with an XML pull parser. The events of interest i.e. implemented KML features only are responded to and corresponding objects created. So the pull based methodology is more flexible - faster than SAX and less memory hungry than DOM. One of the planned things is models, and given the interest in KML shown at the CSIRO Cop meeting I decided to have a shot at extending the worldwind KML support.

Collada Box in WorldWind3D models have been around on the forums in a mega thread for a while now, but never truly integrated into the worldwind core. With KML model support proposed this might finally be on the way. I got my feet wet in Collada parsing by creating annotated Java classes from the Schema using JAXB. I have to admit I made some primitive attempts with DOM + XPATH parsing and quickly gave it up in favour of pure JAXB magic. Parsing a simplistic Blender cube took some effort, I have the vertices, faces and normals done. Just need to set up some materials to get it to render.

No comments: