Implement Mat4x4::LookAt

This commit is contained in:
2024-02-01 17:27:32 -05:00
parent c858d3b889
commit 69ca7c5c05
2 changed files with 40 additions and 0 deletions

View File

@@ -419,4 +419,13 @@ namespace LinearAlgebra {
Vector3 Matrix4x4::GetTranslatePart() const {
return GetColumn3(3);
}
Matrix4x4
Matrix4x4::LookAt(const Vector3 &localFwd, const Vector3 &targetDir, const Vector3 &localUp, const Vector3 &worldUp) {
Matrix4x4 m;
m.Set3x3Part(Matrix3x3::LookAt(localFwd, targetDir, localUp, worldUp));
m.SetTranslatePart(0,0,0);
m.SetRow(3, 0,0,0,1);
return m;
}
}