U need to call calc_inv_bind_transform( ) once at load time and in this function your bind_local_transform matrix needs to be set to your matrix_transposed (i.e. for each joint). I'm assuming that matrix_transposed is correct when u create it from file read.
This way each joint will have a correctly calculated inverse_bind_transform matrix.
So now, your entities_blabla.local_transforms should really be called blabla.final_transforms . It is these matrices that u send to the vshader (joint_transforms), they r the model space transforms of your joints which will transform vertices from their bind pose (where no animation is applied) to the desired/current/final animated pose.
To calculate these final transforms, u need this:
void apply_pose (joint, mat4 parent_m)
{
mat4 curr_m = parent_m * joint.local_m; // calculates the joint's model space transform
foreach (child : joint.children)
{
apply_pose (child, curr_m);
}
_blabla.final_transform [joint.index] = joint.inverse_bind_transform * curr_m;
}
call it:
apply_pose (root.joint, glm::mat4 (1));
joint.local_m == your bind_local_transform == your matrix_transposed (all the same thing). However when u create the animator class joint.local_m will be the new (rotation * translation) transform obtained/calculated in the interpolation function. This will be the bone space transform of your joint in relation to its parent.
Yes when u force final_transforms to identity matrices, what u see rendered is cowboy in its bind pose when no animation is applied. This apply_pose () function will do the same thing as well without having u to force identity matrices yr self. When no animation is applied and when joint.local_m is set to the matrix that was loaded from file (your matrix_transposed) then apply_pose () will set final_transforms[ ] to identity matrices. The rendering is then the bind pose.
Note also that in some case where the bind pose's root joint is a child of another global scene node then final_transforms becomes:
Balblab.final_transforms = global_scene_node_m * joint.inverse_bind_m * curr_m;
If global_scene_node_m is not in world or model space, then u will have to also invert it:
.... = inverse (global_scene_node_m) * joint.inverse_bind_m * curr_m;
If I remember well, this video tutorial did not have a global node attaching cowboy. So first try without this global node.
U can try all this without the animator class.
When u then get to animate poses, u then want a new function to calculate_current_pose ( ) then u want to call apply_pose ( ) again right after it. And this time, joint.local_m should be set to the new R * T transform.
I can't remember the exact name for calculate_current_pose () but it's all in the video tutorials 2 or 3. Or just check his accompanying code.
That's it. All the best.
Peace!