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)
some editing
Line 1: Line 1:
This is some internal notes about [[COLLADA DOM]] integration classes.
This is some internal notes about [[COLLADA DOM]] '''integration classes'''.


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 classes provide a SAX-like approach to using the DOM. My problem with this is that the interdependent links between COLLADA elements has become very complex. Parsing a DOM structure lends itself better to handle these problems. Creating an integration class to process, for example, materials may take the same amount of work as accessing the DOM structures itself. Here's a comparison.
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:
To do with Integration Class:
Get dom by calling getDOM() or getDOMRoot from the daeDocument.
#Create class that inherits from '''daeIntegrationObject'''.
For each material library
#Implement the '''fromCOLLADA''' code to do the conversion.
For each material
#Implement the '''fromCOLLADAPostProcess''' code to do the processing needed to resolve links to other elements, for example, effect.
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.
#Make your integration library register with the DOM.


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.
To do with 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). Your conversion function can even do the post-processing linking needed since all the data required by the other elements would be available.


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.
Also it is a lot harder to go from custom classes to COLLADA DOM with the integration objects than it would be just with the DOM structures.


[[Category:DOM project|Integration classes
DOM structures give you finer-grained control over what to convert; for example, 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. ''((ANDY: Ack, I couldn't parse that last sentence at all!))'' That could be a lot of geometries that could take a lot of time to process.
 
[[Category:DOM project|Integration classes]]

Revision as of 23:23, 23 March 2007

This is some internal notes about COLLADA DOM integration classes.

Integration classes provide a SAX-like approach to using the DOM. My problem with this is that the interdependent links between COLLADA elements has become very complex. Parsing a DOM structure lends itself better to handle these problems. Creating an integration class to process, for example, materials may take the same amount of work as accessing the DOM structures itself. Here's a comparison.

To do with Integration Class:

  1. Create class that inherits from daeIntegrationObject.
  2. Implement the fromCOLLADA code to do the conversion.
  3. Implement the fromCOLLADAPostProcess code to do the processing needed to resolve links to other elements, for example, effect.
  4. Make your integration library register with the DOM.

To do with DOM access:

  1. Get DOM by calling getDOM() or getDOMRoot from the daeDocument.
    • For each material library
    • For each material
  2. Call your conversion function (which would be the same as your fromCOLLADA). Your conversion function can even do the post-processing linking needed since all the data required by the other elements would be available.

Also it is a lot harder to go from custom classes to 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; for example, 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. ((ANDY: Ack, I couldn't parse that last sentence at all!)) That could be a lot of geometries that could take a lot of time to process.