I thought I had this working correctly, and it seemed to, but when I payed closer attention as the shape rotated, I noticed that the axes are getting messed up as the rotation increases.
This is how I'm setting my world matrix
Code:
D3DXMatrixRotationX(&matRotationX,fRotationX);
D3DXMatrixRotationY(&matRotationY,fRotationY);
D3DXMatrixRotationZ(&matRotationZ,fRotationZ);
D3DXMatrixTranslation(&matTranslation,fTranslationX,fTranslationY,fTranslationZ);
g_App.GetDevice()->SetTransform(D3DTS_WORLD,&(matRotationX*matRotationY*matRotationZ*matTranslation));
I think this is wrong because I'm multiplying the rotation matrices one at a time, so the rotation is being done on partially-transformed axes... not sure how to word that.
Do I need to be building one composite matrix from fRotationX, fRotationY, fRotationZ, fTranslationX, fTranslationY, and fTranslation in one step? Is there a function for doing this?
edit: is this perhaps gimbal lock?