Here is my replacement code for gluLootat()
void lsMatrix4x4::LookAt( const lsVector3& eyePosition, const lsVector3& lookAt, const lsVector3& upVector )
{
lsMath math;
lsVector3 e, l, u;
lsVector3 forward, side, up;
lsMatrix4x4 matrix2, mat2;
e = eyePosition;
l = lookAt;
u = upVector;
// make sure up is normalized
up = upVector;
up.normalize();
// forward vector
forward = l - e;
forward.normalize();
// side vector
side = math.Cross( forward, up );
side.normalize();
// recalc up vector
up = math.Cross( forward, side );
up.normalize();
matrix2.matrix[0] = side.x;
matrix2.matrix[4] = side.y;
matrix2.matrix[8] = side.z;
matrix2.matrix[1] = up.x;
matrix2.matrix[5] = up.y;
matrix2.matrix[9] = up.z;
matrix2.matrix[2] = -forward.x;
matrix2.matrix[6] = -forward.y;
matrix2.matrix[10] = -forward.z;
mat2 *= matrix2;
mat2.TranslateMatrix( -e.x, -e.y, -e.z );
*this = mat2;
}
And here is the output from both OpenGL and my engine.
Camera Matrix : FPS_Camera Matrix : OpenGL -1 0 0 6.54721e-07 0 1 0 -1.76 0 0 -1 2.76058e-05 0 0 0 1 Matrix : vortxGE -1 0 0 -6.54721e-07 0 -1 0 -1.76 0 0 -1 -2.76058e-05 0 0 0 1
I'm bashing my head against a wall, LOL.. It looks like a simple fix.
Any ideas anyone?






