Пример #1
0
        static void Main(string[] args)
        {
            /*string folder = @"F:\Steam\SteamApps\common\Megadimension Neptunia VII\CONTENTS\GAME\model\map\0500\001";
             *
             * string[] textureFolders = new string[2]
             * {
             *  @"F:\Steam\SteamApps\common\Megadimension Neptunia VII\CONTENTS\GAME\model\map\texture",
             *  @"F:\Steam\SteamApps\common\Megadimension Neptunia VII\CONTENTS\GAME\model\map\texture2"
             * };*/

            string folder = @"F:\Steam\SteamApps\common\Megadimension Neptunia VII\CONTENTS\GAME\model\chara\011";

            string[] textureFolders = new string[2]
            {
                @"F:\Steam\SteamApps\common\Megadimension Neptunia VII\CONTENTS\GAME\model\chara\011\texture\001",
                @"F:\Steam\SteamApps\common\Megadimension Neptunia VII\CONTENTS\GAME\model\chara\011\face\001"
            };

            Stopwatch sw = Stopwatch.StartNew();

            string[] ism2Files = Directory.GetFiles(folder, "*.ism2");

            foreach (string ism2 in ism2Files)
            {
                if (ism2.IndexOf("col_") != -1)
                {
                    continue; //Don't export collission data
                }

                string outputDir = Path.GetDirectoryName(ism2) + Path.DirectorySeparatorChar.ToString() + "pmx";
                if (!Directory.Exists(outputDir))
                {
                    Directory.CreateDirectory(outputDir);
                }

                string pmx = outputDir + Path.DirectorySeparatorChar.ToString() + Path.GetFileName(Path.ChangeExtension(ism2, ".pmx"));
                Console.WriteLine("Importing " + Path.GetFileNameWithoutExtension(ism2));
                PMXModel md = ISMModel.ImportISM(ism2);
                CleanUpModel(md);
                TriangleClearance.SeperateTriangles(md, false, true);
                MirrorX(md);
                FindTextures(md, textureFolders, outputDir);
                md.SaveToFile(pmx);
                Console.WriteLine("");
            }

            sw.Stop();
            Console.WriteLine("Import complete - " + (int)Math.Round(sw.Elapsed.TotalSeconds) + " seconds");

            Console.ReadLine();
        }
Пример #2
0
        public static PMXModel ImportISM(string filename)
        {
            ISMModel im  = new ISMModel(filename);
            PMXModel ret = im.pmxModel;

            //Rotate model by 180°

            foreach (PMXVertex vtx in ret.Vertices)
            {
                vtx.Position.X *= -1;
                vtx.Position.Z *= -1;
                vtx.Normals.X  *= -1;
                vtx.Normals.Z  *= -1;
            }
            foreach (PMXBone bn in ret.Bones)
            {
                bn.Position.X *= -1;
                bn.Position.Z *= -1;
            }

            im = null;
            return(ret);
        }