internal void Convert() { pmd = new PMD(InputFile); pmd.SetupShellSurface(); pmf = new PMF(pmd); pmf.Save(OutputFile); Log.Debug("RMC", "finish saving file."); Log.Debug("RMC", "verification..."); var p = new PMF(); p.Load(OutputFile); }
public PMF(PMD pmd) { CreateFromPMD(pmd); }
private void CreateFromPMD(PMD pmd) { VertNormUv = new float[pmd.Vertex.Length / 3 * 8]; for (int i = 0; i < pmd.Vertex.Length / 3; i++) { VertNormUv[i * 8 + 0] = pmd.Vertex[i * 3 + 0]; VertNormUv[i * 8 + 1] = pmd.Vertex[i * 3 + 1]; VertNormUv[i * 8 + 2] = pmd.Vertex[i * 3 + 2]; VertNormUv[i * 8 + 3] = pmd.Normal[i * 3 + 0]; VertNormUv[i * 8 + 4] = pmd.Normal[i * 3 + 1]; VertNormUv[i * 8 + 5] = pmd.Normal[i * 3 + 2]; VertNormUv[i * 8 + 6] = pmd.Uv[i * 2 + 0]; VertNormUv[i * 8 + 7] = pmd.Uv[i * 2 + 1]; } Index = new ushort[pmd.Index.Length]; for (int i = 0; i < pmd.Index.Length; i++) { Index[i] = (ushort)pmd.Index[i]; } Materials = new FMaterial[pmd.RenderLists.Count()]; for (int i = 0; i < pmd.RenderLists.Count(); i++) { Materials[i] = new FMaterial(); Materials[i].diffuse_color = pmd.RenderLists[i].material.diffuse_color; Materials[i].power = pmd.RenderLists[i].material.power; Materials[i].specular_color = pmd.RenderLists[i].material.specular_color; Materials[i].emmisive_color = pmd.RenderLists[i].material.emmisive_color; Materials[i].toon_index = pmd.RenderLists[i].material.toon_index; Materials[i].edge_flag = pmd.RenderLists[i].material.edge_flag; Materials[i].face_vert_count = pmd.RenderLists[i].face_vert_count; Materials[i].texture = pmd.RenderLists[i].material.texture; Materials[i].sphere = ""; // ad-hock Materials[i].face_vert_offset = pmd.RenderLists[i].face_vert_offset; Materials[i].bone_num = pmd.RenderLists[i].bone_num; Materials[i].weight = pmd.RenderLists[i].weight; Materials[i].bone_inv_map = pmd.RenderLists[i].bone_inv_map; } Bones = new Bone[pmd.RenderBones.Count()]; for (int i = 0; i < pmd.RenderBones.Count(); i++) { Bones[i] = pmd.RenderBones[i].bone; } IKs = pmd.IK; ToonNames = pmd.toon_name; is_pmf = true; }