Hi Nate
Thanks for the quick reply. Some interesting information there. I've gone back to setting the bone's abcd params in, as like you said, I should be able to get this to work. The code I have looks like this...
float matrix[16];
GPU_MatrixIdentity(matrix);
GPU_MatrixTranslate(matrix, bone->worldX, bone->worldY, 0.0f);
matrix[0] = bone->a;
matrix[1] = bone->b;
matrix[4] = bone->c;
matrix[5] = bone->d;
GPU_LoadMatrix(matrix);
First thing wrong is that it is upside down (I have spBoneYUp = true). If I invert bone->c and bone->d it flips it the right way up - or if I multiply it with an invert matrix. When it comes to shearing I have nothing else affecting it except a 45 shearX value and it looks like the following image. It's like the shearX and Y are the wrong way around.
I've then broken everything out into its own matrix based on the code you linked and can replicate the above result. If I then swap the shearX and Y values it shears in the correct direction but the angles are no longer parallel, so it looks like this...
So that's two methods. I also tried what you suggested but must be doing something wrong. The code for that looks like...
float angleX = (spBone_getWorldRotationX(bone));
float angleY = (spBone_getWorldRotationY(bone));
float shear2[16];
GPU_MatrixIdentity(shear2);
shear2[4] = Maths_Deg2Rad(angleY-angleX);
GPU_MatrixScale(matrix, bone->scaleX, bone->scaleY, 1.0f);
GPU_MatrixRotate(matrix, angleX, 0.0f, 0.0f, 1.0f);
GPU_MultiplyAndAssign(matrix, shear2);
And this ends up with a permanent skew on it.
Thanks for your help on this!
Scott