Exemple #1
0
        public static Root LoadModel(string inputPath, ExportFormat format)
        {
            switch (format)
            {
            case ExportFormat.GR2:
            {
                using (var fs = new FileStream(inputPath, FileMode.Open, System.IO.FileAccess.Read, FileShare.ReadWrite))
                {
                    var root = new LSLib.Granny.Model.Root();
                    var gr2  = new LSLib.Granny.GR2.GR2Reader(fs);
                    gr2.Read(root);
                    root.PostLoad();
                    return(root);
                }
            }

            case ExportFormat.DAE:
            {
                var root = new LSLib.Granny.Model.Root();
                root.ImportFromCollada(inputPath);
                return(root);
            }

            default:
                throw new ArgumentException("Invalid model format");
            }
        }
Exemple #2
0
        public static Root LoadModel(string inputPath, ExportFormat format)
        {
            switch (format)
            {
                case ExportFormat.GR2:
                    {
                        using (var fs = new FileStream(inputPath, FileMode.Open, System.IO.FileAccess.Read, FileShare.ReadWrite))
                        {
                            var root = new LSLib.Granny.Model.Root();
                            var gr2 = new LSLib.Granny.GR2.GR2Reader(fs);
                            gr2.Read(root);
                            root.PostLoad();
                            return root;
                        }
                    }

                case ExportFormat.DAE:
                    {
                        var root = new LSLib.Granny.Model.Root();
                        root.ImportFromCollada(inputPath);
                        return root;
                    }

                default:
                    throw new ArgumentException("Invalid model format");
            }
        }