MatrixLookAt function
Implementation
Matrix4 MatrixLookAt(Vector3 eye, Vector3 target, Vector3 up) {
final f = (target - eye).normalized();
final r = f.cross(up).normalized();
final u = r.cross(f);
return Matrix4(
r.x,
u.x,
-f.x,
0,
r.y,
u.y,
-f.y,
0,
r.z,
u.z,
-f.z,
0,
-r.dot(eye),
-u.dot(eye),
f.dot(eye),
1,
);
}