DOM integration classes: Difference between revisions

From COLLADA Public Wiki
Jump to navigation Jump to search
Elf (talk | contribs)
copy in Andy's text from word doc
 
Elf (talk | contribs)
move entire content to guide chapter, hence #REDIRECT DOM guide: Integration templates
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
This is some internal notes about [[COLLADA DOM]] integration classes.
#REDIRECT [[DOM guide: Integration templates]]
 
Integration classes provide a SAX-like approach to using the DOM. My problem with this is that the interdependent links between COLLADA elements has gotten really complex. Parsing a DOM structure lends itself better to handle these problems. Creating an integration class to process, for example, materials may the same amount of work as accessing the DOM structures itself.
Integration Class:
Create class that inherits from daeIntegrationObject
Implement the fromCOLLADA code to do the conversion
Implement the fromCOLLADAPostProcess code to do the processing needed to resolve links to other elements, i.e. effect
Make your integration library register with the DOM.
 
DOM access:
Get dom by calling getDOM() or getDOMRoot from the daeDocument.
For each material library
For each material
Call your conversion function (which would be the same as your fromCOLLADA). You conversion function can even do the post processing linking needed since all the data required by the other element’s would be available.
 
Also it is a lot harder to go from custom classes do COLLADA DOM with the integration objects than it would be just with the DOM structures.
 
DOM structures give you finer grained control over what to convert, i.e. you can spend time converting only the geometries in the scene and not the possible dozens/hundreds/thousands of others which the integration classes convert every single one. This is especially useful to know if you have documents that cross reference to other documents. For example, a document that only contains a visual scene where all instance_geometry elements reference a geometry in a document that contains only a library_geometry with all geometries you ever create. That could be a lot of geometries that could take a lot of time to process them all.
 
[[Category:DOM project|Integration classes

Latest revision as of 03:03, 12 April 2007