Esempio n. 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();
        }
Esempio n. 2
0
        public static void SeperateTriangles(PMXModel model, bool ignoreSmallParts, bool combineVertexLocations)
        {
            TriangleClearance clearModel = new TriangleClearance(model, ignoreSmallParts, combineVertexLocations);
            int i = 0;

            for (i = 0; i < clearModel._model.Vertices.Count; i++)
            {
                ((PMXExtendedVertex)clearModel._model.Vertices[i]).EasySlashIndex = i;
            }

            List <PMXMaterial> resultMaterials = new List <PMXMaterial>();

            foreach (PMXMaterial mat in clearModel._model.Materials)
            {
                List <PMXMaterial> splittedMaterials = clearModel.SplitTriangles(mat);
                resultMaterials.AddRange(splittedMaterials);
            }

            clearModel._model.Materials.Clear();
            clearModel._model.Materials.AddRange(resultMaterials);
        }