public void ReadBones(FileStream fs, ChunkHeader h) { byte[] buffer; data.Bones = new List <PSABone>(); for (int i = 0; i < h.count; i++) { PSABone b = new PSABone(); buffer = new byte[64]; fs.Read(buffer, 0, 64); b.name = ""; for (int j = 0; j < 64; j++) { if (buffer[j] != 0) { b.name += (char)buffer[j]; } } b.name = b.name.Trim(); buffer = new byte[4]; fs.Read(buffer, 0, 4); fs.Read(buffer, 0, 4); b.childs = BitConverter.ToInt32(buffer, 0); fs.Read(buffer, 0, 4); b.parent = BitConverter.ToInt32(buffer, 0); fs.Read(buffer, 0, 4); b.rotation.x = BitConverter.ToInt32(buffer, 0); fs.Read(buffer, 0, 4); b.rotation.y = BitConverter.ToInt32(buffer, 0); fs.Read(buffer, 0, 4); b.rotation.z = BitConverter.ToInt32(buffer, 0); fs.Read(buffer, 0, 4); b.rotation.w = BitConverter.ToInt32(buffer, 0); fs.Read(buffer, 0, 4); b.location.x = BitConverter.ToInt32(buffer, 0); fs.Read(buffer, 0, 4); b.location.y = BitConverter.ToInt32(buffer, 0); fs.Read(buffer, 0, 4); b.location.z = BitConverter.ToInt32(buffer, 0); fs.Read(buffer, 0, 4); fs.Read(buffer, 0, 4); fs.Read(buffer, 0, 4); fs.Read(buffer, 0, 4); data.Bones.Add(b); } }
public void ReadBones(FileStream fs,ChunkHeader h) { byte[] buffer; data.Bones= new List<PSABone>(); for (int i = 0; i < h.count; i++) { PSABone b = new PSABone(); buffer = new byte[64]; fs.Read(buffer, 0, 64); b.name = ""; for (int j = 0; j < 64; j++) if (buffer[j] != 0) b.name += (char)buffer[j]; b.name = b.name.Trim(); buffer = new byte[4]; fs.Read(buffer, 0, 4); fs.Read(buffer, 0, 4); b.childs = BitConverter.ToInt32(buffer, 0); fs.Read(buffer, 0, 4); b.parent = BitConverter.ToInt32(buffer, 0); fs.Read(buffer, 0, 4); b.rotation.x = BitConverter.ToInt32(buffer, 0); fs.Read(buffer, 0, 4); b.rotation.y = BitConverter.ToInt32(buffer, 0); fs.Read(buffer, 0, 4); b.rotation.z = BitConverter.ToInt32(buffer, 0); fs.Read(buffer, 0, 4); b.rotation.w = BitConverter.ToInt32(buffer, 0); fs.Read(buffer, 0, 4); b.location.x = BitConverter.ToInt32(buffer, 0); fs.Read(buffer, 0, 4); b.location.y = BitConverter.ToInt32(buffer, 0); fs.Read(buffer, 0, 4); b.location.z = BitConverter.ToInt32(buffer, 0); fs.Read(buffer, 0, 4); fs.Read(buffer, 0, 4); fs.Read(buffer, 0, 4); fs.Read(buffer, 0, 4); data.Bones.Add(b); } }