void Animation::ReadXml(const char* filename) { m_animationParts.clear(); // clear our parts list first // create a new xml document XmlDocument doc; doc.Load(filename); TiXmlHandle * hdoc = doc.Handle(); TiXmlElement * root = hdoc->FirstChildElement().Element(); if(root != 0) { TiXmlElement * child = root->FirstChildElement(); // loop through children while(child) { // whats the name of this part string partName = (string)child->Value(); // add this part to the part map m_animationParts[partName] = new AnimationPart(child); // move to the next game object child = child->NextSiblingElement(); } } }
void MaterialManager::Initialise(char *materialXMLFile) { // read through the xml file and load all materials XmlDocument doc; doc.Load(materialXMLFile); TiXmlHandle * hdoc = doc.Handle(); TiXmlElement * root = hdoc->FirstChildElement().Element(); TiXmlElement * child = root->FirstChildElement(); // loop through our materials while(child) { // get the name of the material const char * matName = XmlUtilities::ReadAttributeAsString(child, "", "name"); // create the new material Material* mat = new Material(matName); mat->ReadXml(child); // read the properties m_materialMap[matName] = mat; // add to the material map // move to the next material child = child->NextSiblingElement(); } }