Traversal strategy - Start at 'Scene' ?
I am working on an importer.
What is the recommended strategy for parsing - should I start at the 'Scene' tag and then work my way down from there, populating the local scene graph?
This seems logical and works well for the 'Duck' and 'Cube' test files.
However, when I try this with the 'Seymour' test file no Geometry is imported since there doesn't seem to be an instance of geometry in the scene.
Any pointers would be greatly appreciated.
Seymour animated, you should import skin/morph controllers.
For parsing imo.
First load libraries. (animation, light, camera, geometry, controller... etc),
then parse scenenodes, and link instances to source elements.
Thank you for a fast response! You're quite right of course - the skin source references the geometry.
I was worried for a moment that traversal of the 'Scene' would not result in everything being displayed, but clearly that's not the case - he should display fine once I have completed support for controllers.
I'm very impressed with the Collada format - it's very powerful and flexible. Thank you to everybody involved.
Keep in mind that there can be things in the COLLADA document that are not referenced in the scene. If your application's goal is just to display the scene, basing your parse on the scene it is probably ok. If you are planning on editing the document and writing it back out, you may want to be more careful.
For example, a document that's a work-in-progress might contain materials or even whole sets of vertices that have been defined for future use but are not bound to any objects yet.
Plus, of course, if you are writing the document back out you want to hang onto all the asset information, authorship data...etc.
Generally, it's safer to parse all the libraries and such first as "noncopyable" suggests, at least that way you're sure to capture all the information.
Thank you. It didn't occur to me that there may be information in the .dae that isn't intended to be displayed, but now that you mention it it seems perfectly reasonable.
Fortunately, I do read everything into memory first as objects. Only after that do I begin to iterate through the 'Scene' object to populate the graph of the 3D engine.
However, my requirements are modest - I only need to import the data thankfully!