Implement Matrix4x4::Scale

This commit is contained in:
2024-02-27 01:56:54 -05:00
parent 405800dbc5
commit c50719de36
2 changed files with 11 additions and 0 deletions

View File

@@ -128,6 +128,7 @@ namespace J3ML::LinearAlgebra {
{
}
Matrix4x4 Scale(const Vector3&);
float &At(int row, int col);
float At(int x, int y) const;

View File

@@ -420,6 +420,16 @@ namespace J3ML::LinearAlgebra {
return GetColumn3(3);
}
Matrix4x4 Matrix4x4::Scale(const Vector3& scale)
{
auto mat = *this;
mat.At(3, 0) *= scale.x;
mat.At(3, 1) *= scale.y;
mat.At(3, 2) *= scale.z;
return mat;
}
Matrix4x4
Matrix4x4::LookAt(const Vector3 &localFwd, const Vector3 &targetDir, const Vector3 &localUp, const Vector3 &worldUp) {
Matrix4x4 m;