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

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

            Assert.That(model, Is.Not.Null);
        }
예제 #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);
            }
        }
예제 #3
0
파일: Program.cs 프로젝트: Xalcon/LibMMD
        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);
                    }
        }