Hi, I am implementing Collada support into my engine. I have an XML parser running, and I am able to go through the Collada nodes. I want to start by loading the model hierarchy, and matrix information, to make sure I have the model limb orientations all correct.
Please explain how. I have looked at the tutorials and if there is any useful information in there, it is extremely well-hidden. I am programming in BlitzMax, by the way.
Here is what I have so far:
Import bah.libxml
LoadDAE("duck.dae")
Global COLLADA_UpAxis
Function LoadDAE(file$)
Local doc:TxmlDoc
doc = TxmlDoc.parseFile(file)
If Not doc
Notify "Failed to load file.",1
End
EndIf
Local root:TxmlNode = doc.getRootElement()
Notify root.GetName()
For Cur_node:TxmlNode = EachIn root.Getchildren()
Select Cur_Node.GetName()
Case "asset" ParseAsset(doc,Cur_node)
Case "library_materials"
Case "library_geometries"
Case "library_visual_scenes"
Case "scene"
Case "library_images"
Case "library_cameras" 'don't care
Case "library_lights" 'don't care
Case "library_effects" 'don't care
Default 'unknown
EndSelect
Next
Function ParseAsset(doc:TxmlDoc,Cur_node:TxmlNode)
Local ch:TxmlNode
Local ch_list:TList
ch_list= Cur_node.GetChildren()
If ch_list
For ch=EachIn ch_list
Select ch.GetName().toLower()
Case "up_axis"
Select ch.GetContent()
Case "X_UP"
COLLADA_UpAxis=0
Case "Y_UP"
COLLADA_UpAxis=1
Case "Z_UP"
COLLADA_UpAxis=2
EndSelect
End Select
Next
EndIf
Notify COLLADA_UpAxis
EndFunction
EndFunction