コード例 #1
0
        static void ConvertModel(string[] args)
        {
            Root r = new Root(args, true);

            FileSystemNode models = r.FileSystem.Get("models");

            FileSystemNode model = (FileSystemNode)models[args[0]];

            Hashtable ht = new Hashtable();


            //collect submeshes to convert
            foreach (DictionaryEntry de in model)
            {
                string name = (string)de.Key;

                if (name.EndsWith(".submesh") && !model.ContainsKey(name + ".bin"))
                {
                    ht.Add(de.Key, de.Value);
                }
            }

            //convert all files in ht
            foreach (DictionaryEntry de in ht)
            {
                string name = (string)de.Key;

                FileSystemNode submeshnode = (FileSystemNode)de.Value;

                SubMesh sm = (SubMesh)r.ResourceManager.Load(submeshnode, typeof(SubMesh));

                FileSystemNode newnode = model.CreateFile(name + ".bin");

                SubMeshSaver sms = new SubMeshSaver();
                sms.Save(sm, newnode.getStream());
            }
        }