Original Post
I made my own matrix lookat method that functions just like D3DXMatrixLookAtLH. Yet when I use it in place of that directx method I end up seeing nothing but black in the game viewport. Is there an obvious flaw in this code?
I am doing this for a left handed, row major matrix. In the method, the matrix dest is intended to be initialized as a lookat transform matrix. Thanks for any help!
I am doing this for a left handed, row major matrix. In the method, the matrix dest is intended to be initialized as a lookat transform matrix. Thanks for any help!
INLINE void MatrixLookAtLH (Matrix& dest, Vector3D& eye, Vector3D& at, Vector3D up)
{
Vector3D tmp;
Vector3D xAxis;
Vector3D yAxis;
Vector3D zAxis;
tmp = at - eye;
tmp.Normalize ();
zAxis = tmp;
tmp = up;
tmp.Cross (zAxis, tmp);
tmp.Normalize ();
xAxis = tmp;
tmp = zAxis;
tmp.Cross (xAxis, tmp);
yAxis = tmp;
dest.Init (xAxis.x, yAxis.x, zAxis.x, 0,
xAxis.y, yAxis.y, zAxis.y, 0,
xAxis.z, yAxis.z, zAxis.z, 0,
-xAxis.Dot (eye), -yAxis.Dot (eye), -zAxis.Dot (eye), 1);
}