/// <summary> /// /// </summary> /// <param name="scene"></param> /// <param name="filePath"></param> public void ExportScene(IOScene scene, string filePath, ExportSettings settings) { // create collada document _collada = new IONET.Collada.Collada(); _settings = settings; _collada.Version = "1.4.1"; // export materials foreach (var mat in scene.Materials) { ProcessMaterial(mat); } // initialize scene var visscene = new Visual_Scene { Name = scene.Name }; visscene.ID = scene.Name; // export models nodes List <Node> nodes = new List <Node>(); foreach (var mod in scene.Models) { nodes.AddRange(ProcessModel(mod)); } visscene.Node = nodes.ToArray(); // instance the scene var scene_instance = new Instance_Visual_Scene(); scene_instance.URL = "#" + visscene.Name; _collada.Library_Visual_Scene = new Library_Visual_Scenes(); _collada.Library_Visual_Scene.Visual_Scene = new Visual_Scene[] { visscene }; _collada.Scene = new Scene(); _collada.Scene.Visual_Scene = scene_instance; // initialize asset InitAsset(); // save to file _collada.SaveToFile(filePath); // cleanup _usedIDs.Clear(); _collada = null; }
public Scene(XPathNodeIterator iterator, string uri) { XPathNodeIterator nodeIterator = iterator.Current.SelectChildren(XmlCollada.Instance_Visual_Scene.root, uri); if (nodeIterator.MoveNext()) { _instanceVisualScene = new Instance_Visual_Scene(nodeIterator, uri); } }
public Scene(Instance_Visual_Scene instanceVisualScene) { _instanceVisualScene = instanceVisualScene; }