The people here will gladly help you solve problems for free. You having offered money makes me feel uneasy about replying to this.
vector<D3DXMATRIX> matrices; // Create matrix array. matrices.resize(bones.size()); // Resize matrix array to fit all bone actors
Your comments are redundant, but you can better write this like so:
vector<D3DXMATRIX> matrices( bones.size() );
bones[mesh->root_bone]->getGlobalPose().getColumnMajor44( rb_world); // Get root bone matrix.
It's more idiomatic to have that return something rather than using references. It took a lot of staring before I understood. This is the only reason I'm not complaining about a redundant comment again.
D3DXMatrixInverse( &inv_rb_world, NULL, &rb_world); // Inverse root bone matrix. D3DXMatrixMultiply( &inv_world, &inv_rb_world, &mesh->bones[mesh->root_bone].matrix ); // Get inversed world matrix. D3DXMatrixInverse( &world, NULL, &inv_world); // Get world matrix
Again, the comments are redundant, but here's where some good ones could really help someone like me who doesn't know much about graphics understand what's happening. It can also help knowledgeable people understand what you're doing better, sometimes. Why are you doing this? To what end? The answers would be in good commenting. The comments that are the are redundant because one can deduce WHAT you're doing without any real effort by looking at the names of the functions and arguments, but WHY is not so obvious.
for(UINT i = 0; i < bones.size(); i++ ) { bones->getGlobalPose().getColumnMajor44( matrices ); // Get world space bone matrix. if( mesh->bones.size() > 0) // Check if there are any bones in this mesh, if not then this bone actor was created from the mesh and should be in world space.
This is just confusing. I don't know the difference between bones and mesh->bones and even if you explained it, the name collision, unless actually very meaningful, will be hard to understand.
// I thought the code below would give the matrix the correct center of rotation but it's still at the origin. D3DXMatrixTranslation( &pos, mesh->bones.matrix._41, mesh->bones.matrix._42, mesh->bones.matrix._43 );
Now, we're getting somewhere. My googling says that this function inputs an output, x, y, and z. What's this 41, 42, 43 crap? I mean, 41, 2, and 3 are A, B, and C on the hex ASCII table (again, googled), but why?
So it's still at the origin? Through debugging, have you determined that pos is zero when it goes into and comes our of this function? Then, the logical conclusion would be that mesh->bones
.matrix._41, 2, and 3 are zero as well. Your problem then is with how they are initialized.
matrices.clear(); // Delete the list of matrices.
This is done for you by the std::vector's destructor.
Ironically, there's no commenting in your shader source, but I don't know shader and don't have the patience to read it right now (sorry).