//FIN OBB //guardar private void guardarObbs(List <TgcObb> obbs) { try { //Crear XML XmlDocument doc = new XmlDocument(); XmlNode root = doc.CreateElement("tgcScene"); //name XmlElement nameNode = doc.CreateElement("name"); nameNode.InnerText = "pistaObbs"; root.AppendChild(nameNode); //obbs XmlElement obbsNode = doc.CreateElement("obbs"); obbsNode.SetAttribute("count", obbs.Count.ToString()); foreach (TgcObb unObb in obbs) { XmlElement obbNode = doc.CreateElement("obb"); obbNode.SetAttribute("center", TgcParserUtils.printFloat3Array(TgcParserUtils.vector3ToFloat3Array(unObb.Center))); obbNode.SetAttribute("extents", TgcParserUtils.printFloat3Array(TgcParserUtils.vector3ToFloat3Array(unObb.Extents))); obbNode.SetAttribute("orientation0", TgcParserUtils.printFloat3Array(TgcParserUtils.vector3ToFloat3Array(unObb.Orientation[0]))); obbNode.SetAttribute("orientation1", TgcParserUtils.printFloat3Array(TgcParserUtils.vector3ToFloat3Array(unObb.Orientation[1]))); obbNode.SetAttribute("orientation2", TgcParserUtils.printFloat3Array(TgcParserUtils.vector3ToFloat3Array(unObb.Orientation[2]))); obbsNode.AppendChild(obbNode); } root.AppendChild(obbsNode); //Guardar XML, borrar si ya existe doc.AppendChild(root); string sceneFileName = "pistaObbs-TgcScene.xml"; string sceneFilePath = GuiController.Instance.AlumnoEjemplosMediaDir + "TheC#\\Auto\\" + sceneFileName; if (File.Exists(sceneFileName)) { File.Delete(sceneFileName); } doc.Save(sceneFilePath); } catch (Exception ex) { throw new Exception("Error al crear XML de escena: pistaObbs", ex);; } }