XML Document creation routine. Useful lowerlevel routine for when you want to keep a reference to the created doc.
doc | Reference to XML doc to be written. | |
mesh | Mesh to be serialized. | |
points | Node coordinates will be read from this container. |
template<typename skin_type> void skin_xml_embed_extra(skin_type const & skin, TiXmlDocument & doc) { // iterate over 'POINT' nodes and add normals TiXmlElement * point = TiXmlHandle(&doc).FirstChild("T4MESH").FirstChild("POINT").Element(); for( int i = 0; point; point=point->NextSiblingElement("POINT"), ++i ) { skin_type::const_node_iterator n = skin.const_node(i); std::stringstream normal; normal << n->m_original_normal; point->SetAttribute("normal", normal.str()); } } // write the tetrahedral mesh mesh_type skin; TiXmlDocument doc; t4mesh::xml_make_doc(doc, skin, default_point_container<mesh_type>(&skin)); skin_xml_embed_extra(skin, doc); doc.SaveFile("skin.xml");