private PMXFormat.Header ReadHeader() { PMXFormat.Header result = new PMXFormat.Header(); result.magic = binary_reader_.ReadBytes(4); if (Encoding.ASCII.GetString(result.magic) != "PMX ") { throw new System.FormatException(); } result.version = binary_reader_.ReadSingle(); binary_reader_.ReadByte(); result.encodeMethod = (PMXFormat.Header.StringCode)binary_reader_.ReadByte(); result.additionalUV = binary_reader_.ReadByte(); result.vertexIndexSize = (PMXFormat.Header.IndexSize)binary_reader_.ReadByte(); result.textureIndexSize = (PMXFormat.Header.IndexSize)binary_reader_.ReadByte(); result.materialIndexSize = (PMXFormat.Header.IndexSize)binary_reader_.ReadByte(); result.boneIndexSize = (PMXFormat.Header.IndexSize)binary_reader_.ReadByte(); result.morphIndexSize = (PMXFormat.Header.IndexSize)binary_reader_.ReadByte(); result.rigidbodyIndexSize = (PMXFormat.Header.IndexSize)binary_reader_.ReadByte(); string_code_ = result.encodeMethod; result.model_name = ReadString(); result.model_english_name = ReadString(); result.comment = ReadString(); result.english_comment = ReadString(); return result; }
private PMXFormat.Header ReadHeader() { PMXFormat.Header result = new PMXFormat.Header(); result.magic = binary_reader_.ReadBytes(4); if (Encoding.ASCII.GetString(result.magic) != "PMX ") { throw new System.FormatException(); } result.version = binary_reader_.ReadSingle(); binary_reader_.ReadByte(); result.encodeMethod = (PMXFormat.Header.StringCode)binary_reader_.ReadByte(); result.additionalUV = binary_reader_.ReadByte(); result.vertexIndexSize = (PMXFormat.Header.IndexSize)binary_reader_.ReadByte(); result.textureIndexSize = (PMXFormat.Header.IndexSize)binary_reader_.ReadByte(); result.materialIndexSize = (PMXFormat.Header.IndexSize)binary_reader_.ReadByte(); result.boneIndexSize = (PMXFormat.Header.IndexSize)binary_reader_.ReadByte(); result.morphIndexSize = (PMXFormat.Header.IndexSize)binary_reader_.ReadByte(); result.rigidbodyIndexSize = (PMXFormat.Header.IndexSize)binary_reader_.ReadByte(); string_code_ = result.encodeMethod; result.model_name = ReadString(); result.model_english_name = ReadString(); result.comment = ReadString(); result.english_comment = ReadString(); return(result); }
private static PMDFormat.Header ConvertHeader(PMXFormat.Header pmx_header) { PMDFormat.Header result = new PMDFormat.Header(); result.magic = pmx_header.magic; result.version = pmx_header.version; result.model_name = pmx_header.model_name; result.comment = pmx_header.comment; return(result); }
private static PMXFormat.Header ConvertHeader(PMDFormat.Header pmd_header, PMDFormat.EnglishHeader pmd_english_header, PMDFormat pmd) { PMXFormat.Header result = new PMXFormat.Header(); result.magic = pmd_header.magic; result.version = pmd_header.version; result.dataSize = 0; result.encodeMethod = PMXFormat.Header.StringCode.Utf16le; result.additionalUV = 0; result.vertexIndexSize = PMXFormat.Header.IndexSize.Byte1; result.textureIndexSize = PMXFormat.Header.IndexSize.Byte1; result.materialIndexSize = PMXFormat.Header.IndexSize.Byte1; result.boneIndexSize = PMXFormat.Header.IndexSize.Byte1; result.morphIndexSize = PMXFormat.Header.IndexSize.Byte1; result.rigidbodyIndexSize = PMXFormat.Header.IndexSize.Byte1; if (null != pmd) { result.vertexIndexSize = GetIndexSize(pmd.vertex_list.vertex.Length); result.textureIndexSize = GetIndexSize(pmd.toon_texture_list.toon_texture_file.Length); result.materialIndexSize = GetIndexSize(pmd.material_list.material.Length); result.boneIndexSize = GetIndexSize(pmd.bone_list.bone.Length); result.morphIndexSize = GetIndexSize(pmd.skin_list.skin_data.Length); result.rigidbodyIndexSize = GetIndexSize(pmd.rigidbody_list.rigidbody.Length); } result.model_name = pmd_header.model_name; result.comment = pmd_header.comment; result.model_english_name = ""; result.english_comment = ""; if (null != pmd_english_header) { result.model_english_name = pmd_english_header.model_name_eg; result.english_comment = pmd_english_header.comment_eg; } else if (null != pmd) { result.model_english_name = pmd.eg_head.model_name_eg; result.english_comment = pmd.eg_head.comment_eg; } return(result); }
private static PMXFormat.Header ConvertHeader(PMDFormat.Header pmd_header, PMDFormat.EnglishHeader pmd_english_header, PMDFormat pmd) { PMXFormat.Header result = new PMXFormat.Header(); result.magic = pmd_header.magic; result.version = pmd_header.version; result.dataSize = 0; result.encodeMethod = PMXFormat.Header.StringCode.Utf16le; result.additionalUV = 0; result.vertexIndexSize = PMXFormat.Header.IndexSize.Byte1; result.textureIndexSize = PMXFormat.Header.IndexSize.Byte1; result.materialIndexSize = PMXFormat.Header.IndexSize.Byte1; result.boneIndexSize = PMXFormat.Header.IndexSize.Byte1; result.morphIndexSize = PMXFormat.Header.IndexSize.Byte1; result.rigidbodyIndexSize = PMXFormat.Header.IndexSize.Byte1; if (null != pmd) { result.vertexIndexSize = GetIndexSize(pmd.vertex_list.vertex.Length); result.textureIndexSize = GetIndexSize(pmd.toon_texture_list.toon_texture_file.Length); result.materialIndexSize = GetIndexSize(pmd.material_list.material.Length); result.boneIndexSize = GetIndexSize(pmd.bone_list.bone.Length); result.morphIndexSize = GetIndexSize(pmd.skin_list.skin_data.Length); result.rigidbodyIndexSize = GetIndexSize(pmd.rigidbody_list.rigidbody.Length); } result.model_name = pmd_header.model_name; result.comment = pmd_header.comment; result.model_english_name = ""; result.english_comment = ""; if (null != pmd_english_header) { result.model_english_name = pmd_english_header.model_name_eg; result.english_comment = pmd_english_header.comment_eg; } else if (null != pmd) { result.model_english_name = pmd.eg_head.model_name_eg; result.english_comment = pmd.eg_head.comment_eg; } return result; }
/// <summary> /// PMDファイルのヘッダー取得 /// </summary> /// <param name='pmx_header'>PMXヘッダー</param> /// <returns>ヘッダー</returns> public static PMDFormat.Header PMX2PMD(PMXFormat.Header pmx_header) { PMDFormat.Header pmd_header = ConvertHeader(pmx_header); return(pmd_header); }