private void ReadNodes(SceneNode pParent, XmlElement scene)
 {
     XmlNodeList xnl = scene.GetElementsByTagName("node");
     foreach(XmlNode pNodeNode in xnl)
     {
         ReadNode(pParent, (XmlElement)pNodeNode);
     }
 }
        private void ReadNode(SceneNode pParent, XmlElement nodeNode)
        {
            string pNameNode = nodeNode.GetAttribute("name");
            string pMeshNode = nodeNode.GetAttribute("mesh");
            string pProgNode = nodeNode.GetAttribute("prog");

            PARSE_THROW(pNameNode, "Node found with no `name` name specified.");
            PARSE_THROW(pMeshNode, "Node found with no `mesh` name specified.");
            PARSE_THROW(pProgNode, "Node found with no `prog` name specified.");

            string pPositionNode = nodeNode.GetAttribute("pos");
            string pOrientNode = nodeNode.GetAttribute("orient");
            string pScaleNode = nodeNode.GetAttribute("scale");

            PARSE_THROW(pPositionNode, "Node found with no `pos` specified.");

            if(m_nodes.Keys.Contains(pNameNode))
            {
                MessageBox.Show("The node named " + pNameNode + " already exist.");
            }

            if(!m_meshes.Keys.Contains(pMeshNode))
            {
                MessageBox.Show("The node named " + pNameNode + " references the mesh " + pMeshNode + " which does not exist.");
            }

            if(!m_progs.Keys.Contains(pProgNode))
            {
                MessageBox.Show("The node named " + pNameNode + " references the program " + pProgNode + " which does not exist.");
            }

            Vector3 nodePos = ParseVec3(pPositionNode);

            SceneNode pNode = new SceneNode(m_meshes[pMeshNode], m_progs[pProgNode], nodePos, ReadNodeTextures(nodeNode));
            m_nodes[pNameNode] = pNode;

            //parent/child nodes.
            if(pParent == null)
                m_rootNodes.Add(pNode);

            if(pOrientNode != "")
                pNode.SetNodeOrient(ParseQuaternion(pOrientNode));

            if(pScaleNode != "")
            {
                try
                {
                    Vector3 result = ParseVec3(pScaleNode);
                    pNode.SetNodeScale(result);
                }
                catch
                {
                    float unifScale = float.Parse(pScaleNode);
                    pNode.SetNodeScale(new Vector3(unifScale));
                }
            }
            ReadNodeNotes(nodeNode);
        }