private static PMXFormat.MorphData ConvertMorphData(PMDFormat.SkinData pmd_skin, string pmd_eg_skin_name, Dictionary <uint, uint> morph_vertex_index_dictionary) { PMXFormat.MorphData result = new PMXFormat.MorphData(); result.morph_name = pmd_skin.skin_name; result.morph_english_name = pmd_eg_skin_name; result.handle_panel = (PMXFormat.MorphData.Panel)pmd_skin.skin_type; result.morph_type = PMXFormat.MorphData.MorphType.Vertex; result.morph_offset = pmd_skin.skin_vert_data.Select(x => ConvertVertexMorphOffset(x, morph_vertex_index_dictionary)).ToArray(); return(result); }
private PMXFormat.MorphData ReadMorphData() { PMXFormat.MorphData result = new PMXFormat.MorphData(); result.morph_name = ReadString(); result.morph_english_name = ReadString(); result.handle_panel = (PMXFormat.MorphData.Panel)binary_reader_.ReadByte(); result.morph_type = (PMXFormat.MorphData.MorphType)binary_reader_.ReadByte(); uint morph_offset_count = binary_reader_.ReadUInt32(); result.morph_offset = new PMXFormat.MorphOffset[morph_offset_count]; for (uint i = 0, i_max = (uint)result.morph_offset.Length; i < i_max; ++i) { switch (result.morph_type) { case PMXFormat.MorphData.MorphType.Group: case PMXFormat.MorphData.MorphType.Flip: result.morph_offset[i] = ReadGroupMorphOffset(); break; case PMXFormat.MorphData.MorphType.Vertex: result.morph_offset[i] = ReadVertexMorphOffset(); break; case PMXFormat.MorphData.MorphType.Bone: result.morph_offset[i] = ReadBoneMorphOffset(); break; case PMXFormat.MorphData.MorphType.Uv: case PMXFormat.MorphData.MorphType.Adduv1: case PMXFormat.MorphData.MorphType.Adduv2: case PMXFormat.MorphData.MorphType.Adduv3: case PMXFormat.MorphData.MorphType.Adduv4: result.morph_offset[i] = ReadUVMorphOffset(); break; case PMXFormat.MorphData.MorphType.Material: result.morph_offset[i] = ReadMaterialMorphOffset(); break; case PMXFormat.MorphData.MorphType.Impulse: result.morph_offset[i] = ReadImpulseMorphOffset(); break; default: throw new System.FormatException(); } } return(result); }
private PMXFormat.MorphData ReadMorphData() { PMXFormat.MorphData result = new PMXFormat.MorphData(); result.morph_name = ReadString(); result.morph_english_name = ReadString(); result.handle_panel = (PMXFormat.MorphData.Panel)binary_reader_.ReadByte(); result.morph_type = (PMXFormat.MorphData.MorphType)binary_reader_.ReadByte(); uint morph_offset_count = binary_reader_.ReadUInt32(); result.morph_offset = new PMXFormat.MorphOffset[morph_offset_count]; for (uint i = 0, i_max = (uint)result.morph_offset.Length; i < i_max; ++i) { switch(result.morph_type) { case PMXFormat.MorphData.MorphType.Group: case PMXFormat.MorphData.MorphType.Flip: result.morph_offset[i] = ReadGroupMorphOffset(); break; case PMXFormat.MorphData.MorphType.Vertex: result.morph_offset[i] = ReadVertexMorphOffset(); break; case PMXFormat.MorphData.MorphType.Bone: result.morph_offset[i] = ReadBoneMorphOffset(); break; case PMXFormat.MorphData.MorphType.Uv: case PMXFormat.MorphData.MorphType.Adduv1: case PMXFormat.MorphData.MorphType.Adduv2: case PMXFormat.MorphData.MorphType.Adduv3: case PMXFormat.MorphData.MorphType.Adduv4: result.morph_offset[i] = ReadUVMorphOffset(); break; case PMXFormat.MorphData.MorphType.Material: result.morph_offset[i] = ReadMaterialMorphOffset(); break; case PMXFormat.MorphData.MorphType.Impulse: result.morph_offset[i] = ReadImpulseMorphOffset(); break; default: throw new System.FormatException(); } } return result; }
private static PMXFormat.MorphData ConvertMorphData(PMDFormat.SkinData pmd_skin, string pmd_eg_skin_name, Dictionary<uint, uint> morph_vertex_index_dictionary) { PMXFormat.MorphData result = new PMXFormat.MorphData(); result.morph_name = pmd_skin.skin_name; result.morph_english_name = pmd_eg_skin_name; result.handle_panel = (PMXFormat.MorphData.Panel)pmd_skin.skin_type; result.morph_type = PMXFormat.MorphData.MorphType.Vertex; result.morph_offset = pmd_skin.skin_vert_data.Select(x=>ConvertVertexMorphOffset(x, morph_vertex_index_dictionary)).ToArray(); return result; }