/// <summary> /// Skeleton data section /// </summary> /// <param name="v"></param> /// <param name="ms"></param> /// <param name="br"></param> private void ReadSection1(uint v, BinaryReader br, string fileName) { br.BaseStream.Seek(v, SeekOrigin.Begin); #if _WINDOWS //looks like Linux Mono doesn't like marshalling structure with LPArray to Bone[] skeleton = Extended.ByteArrayToStructure <Skeleton>(br.ReadBytes(16)); #else skeleton = new Skeleton() { cBones = br.ReadUInt16(), scale = br.ReadUInt16(), unk2 = br.ReadUInt16(), unk3 = br.ReadUInt16(), unk4 = br.ReadUInt16(), unk5 = br.ReadUInt16(), unk6 = br.ReadUInt16(), unk7 = br.ReadUInt16() }; #endif skeleton.bones = new Bone[skeleton.cBones]; for (int i = 0; i < skeleton.cBones; i++) { skeleton.bones[i] = Extended.ByteArrayToStructure <Bone>(br.ReadBytes(48)); } //string debugBuffer = string.Empty; //for (int i = 0; i< skeleton.cBones; i++) // debugBuffer += $"{i}|{skeleton.bones[i].parentId}|{skeleton.bones[i].boneSize}|{skeleton.bones[i].Size}\n"; //Console.WriteLine(debugBuffer); return; }
private void ReadSkeleton() { ms.Seek(pBase + pBones, SeekOrigin.Begin); if (ms.Position > ms.Length) { return; //error handler } bones = new Bone[cSkeletonBones]; for (int i = 0; i < cSkeletonBones; i++) { bones[i] = Extended.ByteArrayToStructure <Bone>(br.ReadBytes(64)); } return; }
private void ReadGeometry() { ms.Seek(pBase + pVertices, SeekOrigin.Begin); if (ms.Position > ms.Length || pVertices + ms.Position > ms.Length) //pvert error handler { return; //error handler } vertices = new Vector4[cVertices]; for (int i = 0; i < vertices.Length; i++) { vertices[i] = new Vector4(br.ReadInt16(), br.ReadInt16(), br.ReadInt16(), br.ReadInt16()); } ms.Seek(pBase + pFaces, SeekOrigin.Begin); List <Face> face = new List <Face>(); for (int i = 0; i < cFaces; i++) { face.Add(Extended.ByteArrayToStructure <Face>(br.ReadBytes(64))); } faces = face.ToArray(); return; }
/// <summary> /// Information /// </summary> /// <param name="start"></param> /// <param name="br"></param> /// <param name="fileName"></param> private void ReadSection7(uint start) { br.BaseStream.Seek(start, SeekOrigin.Begin); information = Extended.ByteArrayToStructure <Information>(br.ReadBytes(Section7Size)); }
private void ReadSection7(uint v, BinaryReader br, string fileName) { br.BaseStream.Seek(v, SeekOrigin.Begin); information = Extended.ByteArrayToStructure <Information>(br.ReadBytes(Section7Size)); }
private void ReadSection7(uint v, MemoryStream ms, BinaryReader br) { ms.Seek(v, SeekOrigin.Begin); information = Extended.ByteArrayToStructure <Information>(br.ReadBytes(Section7Size)); }