internal void ReadExpantion(BinaryReader reader, float CoordZ, float scale) { Name = MMDModel1.GetString(reader.ReadBytes(20)); RelatedBoneIndex = BitConverter.ToUInt16(reader.ReadBytes(2), 0); GroupIndex = reader.ReadByte(); GroupTarget = BitConverter.ToUInt16(reader.ReadBytes(2), 0); ShapeType = reader.ReadByte(); ShapeWidth = BitConverter.ToSingle(reader.ReadBytes(4), 0) * scale; ShapeHeight = BitConverter.ToSingle(reader.ReadBytes(4), 0) * scale; ShapeDepth = BitConverter.ToSingle(reader.ReadBytes(4), 0) * scale; for (int i = 0; i < Position.Length; i++) { Position[i] = BitConverter.ToSingle(reader.ReadBytes(4), 0) * scale; } for (int i = 0; i < Rotation.Length; i++) { Rotation[i] = BitConverter.ToSingle(reader.ReadBytes(4), 0); } Weight = BitConverter.ToSingle(reader.ReadBytes(4), 0); LinerDamping = BitConverter.ToSingle(reader.ReadBytes(4), 0); AngularDamping = BitConverter.ToSingle(reader.ReadBytes(4), 0); Restitution = BitConverter.ToSingle(reader.ReadBytes(4), 0); Friction = BitConverter.ToSingle(reader.ReadBytes(4), 0); Type = reader.ReadByte(); Position[2] *= CoordZ; //メモ:左手→右手では位置が変換される際に一緒に回転成分が変換されるため、回転の変換は必要ない……のだが //剛体はモデルと違い、位置と回転情報だけなので、回転を変換する必要がある Rotation[0] *= CoordZ; Rotation[1] *= CoordZ; }
internal void Read(BinaryReader reader) { //モデル名 ModelName = MMDModel1.GetString(reader.ReadBytes(20)); //コメント Comment = MMDModel1.GetString(reader.ReadBytes(256)); }
} //表示名(char[20]、英語)(拡張) internal void Read(BinaryReader reader, float CoordZ, float scale) { SkinName = MMDModel1.GetString(reader.ReadBytes(20)); DWORD skin_vert_count = BitConverter.ToUInt32(reader.ReadBytes(4), 0); SkinType = reader.ReadByte(); SkinVertDatas = new ModelSkinVertexData[skin_vert_count]; for (int i = 0; i < SkinVertDatas.Length; i++) { SkinVertDatas[i] = new ModelSkinVertexData(); SkinVertDatas[i].Read(reader, CoordZ, scale); } SkinNameEnglish = null; }
internal void Read(BinaryReader reader, float CoordZ, float scale) { BoneHeadPos = new float[3]; BoneName = MMDModel1.GetString(reader.ReadBytes(20)); ParentBoneIndex = BitConverter.ToUInt16(reader.ReadBytes(2), 0); TailPosBoneIndex = BitConverter.ToUInt16(reader.ReadBytes(2), 0); BoneType = reader.ReadByte(); IKParentBoneIndex = BitConverter.ToUInt16(reader.ReadBytes(2), 0); for (int i = 0; i < BoneHeadPos.Length; i++) { BoneHeadPos[i] = BitConverter.ToSingle(reader.ReadBytes(4), 0) * scale; } //英名拡張はReadではnullにする(あるならReadEngilishで上書きされる) BoneNameEnglish = null; BoneHeadPos[2] = BoneHeadPos[2] * CoordZ; }
internal void ReadExpantion(BinaryReader reader, float CoordZ, float scale) { Name = MMDModel1.GetString(reader.ReadBytes(20)); RigidBodyA = BitConverter.ToUInt32(reader.ReadBytes(4), 0); RigidBodyB = BitConverter.ToUInt32(reader.ReadBytes(4), 0); for (int i = 0; i < Position.Length; i++) { Position[i] = BitConverter.ToSingle(reader.ReadBytes(4), 0) * scale; } for (int i = 0; i < Rotation.Length; i++) { Rotation[i] = BitConverter.ToSingle(reader.ReadBytes(4), 0); } for (int i = 0; i < ConstrainPosition1.Length; i++) { ConstrainPosition1[i] = BitConverter.ToSingle(reader.ReadBytes(4), 0) * scale; } for (int i = 0; i < ConstrainPosition2.Length; i++) { ConstrainPosition2[i] = BitConverter.ToSingle(reader.ReadBytes(4), 0) * scale; } for (int i = 0; i < ConstrainRotation1.Length; i++) { ConstrainRotation1[i] = BitConverter.ToSingle(reader.ReadBytes(4), 0); } for (int i = 0; i < ConstrainRotation2.Length; i++) { ConstrainRotation2[i] = BitConverter.ToSingle(reader.ReadBytes(4), 0); } for (int i = 0; i < SpringPosition.Length; i++) { SpringPosition[i] = BitConverter.ToSingle(reader.ReadBytes(4), 0); } for (int i = 0; i < SpringRotation.Length; i++) { SpringRotation[i] = BitConverter.ToSingle(reader.ReadBytes(4), 0); } Position[2] *= CoordZ; //メモ:左手→右手では位置が変換される際に一緒に回転成分が変換されるため、回転の変換は必要ない //ただし、ジョイントの回転(使用してないっぽい)は変換しておく ConstrainRotation1[0] *= CoordZ; ConstrainRotation1[1] *= CoordZ; ConstrainRotation2[0] *= CoordZ; ConstrainRotation2[1] *= CoordZ; ConstrainPosition1[2] *= CoordZ; ConstrainPosition2[2] *= CoordZ; }
internal void Read(BinaryReader reader) { DiffuseColor = new float[3]; SpecularColor = new float[3]; MirrorColor = new float[3]; for (int i = 0; i < DiffuseColor.Length; i++) { DiffuseColor[i] = BitConverter.ToSingle(reader.ReadBytes(4), 0); } Alpha = BitConverter.ToSingle(reader.ReadBytes(4), 0); Specularity = BitConverter.ToSingle(reader.ReadBytes(4), 0); for (int i = 0; i < SpecularColor.Length; i++) { SpecularColor[i] = BitConverter.ToSingle(reader.ReadBytes(4), 0); } for (int i = 0; i < MirrorColor.Length; i++) { MirrorColor[i] = BitConverter.ToSingle(reader.ReadBytes(4), 0); } ToonIndex = reader.ReadByte(); EdgeFlag = reader.ReadByte(); FaceVertCount = BitConverter.ToUInt32(reader.ReadBytes(4), 0); string FileName = MMDModel1.GetString(reader.ReadBytes(20)); string[] FileNames = FileName.Split('*'); TextureFileName = ""; SphereTextureFileName = ""; foreach (string s in FileNames) { string ext = Path.GetExtension(s).ToLower(); if (ext == ".sph" || ext == ".spa") { SphereTextureFileName = s.Trim(); } else { TextureFileName = s.Trim(); } } }
internal void ReadExpantion(BinaryReader reader) { SkinNameEnglish = MMDModel1.GetString(reader.ReadBytes(20)); }
internal void ReadExpantion(BinaryReader reader) { BoneDispNameEnglish = MMDModel1.GetString(reader.ReadBytes(50)); }
} //ボーン枠用枠名(英語、拡張) internal void Read(BinaryReader reader) { BoneDispName = MMDModel1.GetString(reader.ReadBytes(50)); BoneDispNameEnglish = null; }
internal void ReadExpantion(BinaryReader reader) { ModelNameEnglish = MMDModel1.GetString(reader.ReadBytes(20)); CommentEnglish = MMDModel1.GetString(reader.ReadBytes(256)); }