Original Post
I know that matrix multiplication is not commutative. So if I make a rotation matrix for x, y, and z and multiply them together, the order I multiply them will make some of the rotations dependent on others. It ends up looking like only the last rotation is around the "global" axis. So how do I rotate some amount around the global x, then some amount around the global z instead of some amount around the global x, then some amount around the new local z? I doubt there's anything particularly interesting about it, but here's the code I'm currently using:
//rotate the verts
Vector3f v3fRotatedVert;
Math3D::Matrix33 mat33X, mat33Y, mat33Z, mat33Rotation;
//First, build the rotation matrix:
//rotation about x
mat33X.f22 = cos(m_v3fRotation.x);
mat33X.f23 = sin(m_v3fRotation.x);
mat33X.f32 = -mat33X.f23;
mat33X.f33 = mat33X.f22;
//rotation about y
mat33Y.f11 = cos(m_v3fRotation.y);
mat33Y.f31 = sin(m_v3fRotation.y);
mat33Y.f13 = -mat33Y.f31;
mat33Y.f33 = mat33Y.f11;
//rotation about z
mat33Z.f11 = cos(m_v3fRotation.z);
mat33Z.f12 = sin(m_v3fRotation.z);
mat33Z.f21 = -mat33Z.f12;
mat33Z.f22 = mat33Z.f11;
//combine into final rotation matrix
Math3D::Matrix33Multiply(mat33X, mat33Y, mat33Rotation);
Math3D::Matrix33Multiply(mat33Rotation, mat33Z, mat33Rotation);
sf::Vector3f v3fVertCopy;
for (int i = 0; i < m_nNumVerts; ++i)
{
Math3D::RotatePoint(m_vVertices, mat33Rotation);
}