public static void Export(string FileName, ExportSettings settings, IModelFormat model) { var genericModel = model.ToGeneric(); Export(FileName, settings, genericModel.Meshes, genericModel.GetMaterials(), genericModel.Textures, genericModel.Skeleton); }
public void RemoveModel(IModelFormat model) { if (Models.Contains(model)) { Models.Remove(model); } }
public void AddModel(IModelFormat model) { Models.Add(new ModelEntry() { Renderer = model.Renderer, GenericModel = model.ToGeneric(), }); }
public void RemoveModel(IModelFormat modelFormat) { List <ModelEntry> removedModels = new List <ModelEntry>(); foreach (var model in Models) { if (modelFormat.Renderer == model.Renderer) { removedModels.Add(model); } } foreach (var model in removedModels) { Models.Remove(model); } removedModels.Clear(); }
static ObjectTreeNode LoadModelFormat(IModelFormat modelFormat) { IFileFormat fileFormat = (IFileFormat)modelFormat; var model = modelFormat.ToGeneric(); ObjectTreeNode root = new ObjectTreeNode(fileFormat.FileInfo.FileName) { Tag = modelFormat }; ObjectTreeNode meshFolder = new ObjectTreeNode("Meshes"); ObjectTreeNode textureFolder = new ObjectTreeNode("Textures"); ObjectTreeNode skeletonFolder = new ObjectTreeNode("Skeleton"); foreach (var mesh in model.Meshes) { meshFolder.AddChild(LoadMesh(mesh)); } foreach (var tex in model.Textures) { textureFolder.AddChild(LoadTextureFormat(tex)); } if (model.Skeleton != null) { skeletonFolder.Children.AddRange(model.Skeleton.CreateBoneTree()); } if (meshFolder.ChildCount > 0) { root.AddChild(meshFolder); } if (textureFolder.ChildCount > 0) { root.AddChild(textureFolder); } if (skeletonFolder.ChildCount > 0) { root.AddChild(skeletonFolder); } return(root); }
public void LoadModelFormat(IModelFormat modelFormat) { if (Formats.Contains(modelFormat)) { activeModelCB.SelectedItem = modelFormat.Renderer.Name; return; } Formats.Add(modelFormat); var container = new ModelContainer(); container.AddModel(modelFormat); Runtime.ModelContainers.Add(container); ModelContainers.Add(container); var drawableContainer = new DrawContainer(); drawableContainer.Name = modelFormat.Renderer.Name; var drawable = new GenericModelRender(modelFormat.Renderer); foreach (var model in modelFormat.Renderer.Scene.Models) { var skeleton = new GenericSkeletonRenderer(model.Skeleton); drawableContainer.Drawables.Add(skeleton); } drawableContainer.Drawables.Add(drawable); Containers.Add(drawableContainer); if (Viewport3D.Scene != null) { ReloadScene(); } activeModelCB.Items.Add(modelFormat.Renderer.Name); activeModelCB.SelectedItem = modelFormat.Renderer.Name; }
public void AddModel(IModelFormat model) { Models.Add(model); }
public void LoadFileFormat(IModelFormat fileFormat) { Viewport.LoadModelFormat(fileFormat); }