예제 #1
0
        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);
        }
예제 #2
0
 public void AddModel(IModelFormat model)
 {
     Models.Add(new ModelEntry()
     {
         Renderer     = model.Renderer,
         GenericModel = model.ToGeneric(),
     });
 }
        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);
        }