Exemple #1
0
        public void TestParsingModel(FileInfo modelFile)
        {
            PmxModel model;

            using (var stream = modelFile.OpenRead())
                model = PmxParser.Parse(stream);

            Assert.That(model, Is.Not.Null);
        }
Exemple #2
0
        public ShotTypePmx(string path, Vector3 size) : base()
        {
            path = Configuration.ResourceDirPath + "\\" + path;

            using (var inStream = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
            {
                PmxParser parser = new PmxParser(inStream);
                parser.Parse(Data);
            }

            for (int i = 0; i < Data.VertexArray.Length; i++)
            {
                var vertex = Data.VertexArray[i];
                vertex.Pos = Vector3.Scale(vertex.Pos, size);
            }
        }
Exemple #3
0
        private static void ExportWavefrontModel(WavefrontExportOptions obj)
        {
            var file = new FileInfo(obj.InputFilePath);

            if (!file.Exists)
            {
                Console.Error.WriteLine("File not found: " + file.FullName);
            }

            using (var stream = file.OpenRead())
                using (var outputStream = File.OpenWrite(file.FullName + ".obj"))
                    using (var mtlOutputStream = File.OpenWrite(file.FullName + ".mtl"))
                    {
                        var model = PmxParser.Parse(stream);
                        PmxToWavefrontExporter.ExportModel(model, outputStream, file.FullName + ".mtl");
                        PmxToWavefrontExporter.ExportMaterial(model, mtlOutputStream);
                    }
        }