My programme reads a binary file. For that I made a Dictionary<int, float[]> where int is order number (ID) and float[] is an array of important values.
Here's my code how I read the binary file to my dictionary:
inv_bind_mats = new Dictionary<int, float[]>();
float[] Farr = new float[16];
string path2 = Application.StartupPath + "\\skeletons\\" + skeletonName + ".bone_inv_trans_mats";
using (BinaryReader inv_trans_mats = new BinaryReader(File.Open(path2, FileMode.Open, FileAccess.Read, FileShare.Read), Encoding.ASCII))
{
inv_trans_mats.BaseStream.Seek(4, SeekOrigin.Begin);
bonesCount = inv_trans_mats.ReadUInt32();
for (int i = 0; i < bonesCount; i++)
{
for (int j = 0; j < 16; j++)
{
if (j < 12)
{
Farr[j] = inv_trans_mats.ReadSingle();
}
else if (j >= 12)
{
Farr[j] = 0.0f;
}
}
inv_bind_mats.Add(i, Farr);
}
}
It doesn't matter which ID I choose all float[] values are same for each. This binary file is an inverse matrix of skeleton bones. Each bone has 12 float values when I need to get 16 so I just add 4 more '0' values to what I get from file.
But the problem is all float values from inv_bind_mats[i][0-16] to inv_bind_mats[i][0-16] are equal.
How I want it to work: each bone has it's own matrix (float array) instead of one matrix for all bones.