So I have this function:
D3DXMATRIX ToD3DXMATRIX() const
{
D3DXMATRIX m;
m._11 = _11; m._12 = _12; m._13 = _13; m._14 = 0.0f;
m._21 = _21; m._22 = _22; m._23 = _23; m._24 = 0.0f;
m._31 = _31; m._32 = _32; m._33 = _33; m._34 = 0.0f;
m._41 = 0.0f; m._42 = 0.0f; m._43 = 0.0f; m._44 = 1.0f;
return m;
}
Which works fine for scaling & rotation, but it acts really strange for translation.
So I tried this:
D3DXMATRIX ToD3DXMATRIX() const
{
D3DXMATRIX m;
m._11 = _11; m._12 = _12; m._13 = _13; m._14 = 0.0f;
m._21 = _21; m._22 = _22; m._23 = _23; m._24 = 0.0f;
m._31 = 0.0f; m._32 = 0.0f; m._33 = 1.0f; m._34 = 0.0f;
m._41 = _31; m._42 = _32; m._43 = 0.0f; m._44 = 1.0f;
return m;
}
But it behaves similar.
Anyone see what I'm doing wrong?
EDIT: It might be worthwile to mention that both the 3x3 matrix and the 4x4 matrix are row major matrices, and I'm using the DirectX Left Handed coordinate system (x = width(right), y = height(top), z = depth ('in' the screen))












