feat(matrix): add C44Matrix::Translate

This commit is contained in:
fallenoak 2022-12-24 17:22:29 -06:00
parent 3dd32515fe
commit b0a37c4e5e
No known key found for this signature in database
GPG key ID: 7628F8E61AEA070D
2 changed files with 7 additions and 0 deletions

View file

@ -93,6 +93,12 @@ void C44Matrix::Scale(float scale) {
this->c2 *= scale; this->c2 *= scale;
} }
void C44Matrix::Translate(const C3Vector& move) {
this->d0 = this->a0 * move.x + this->b0 * move.y + this->c0 * move.z + this->d0;
this->d1 = this->a1 * move.x + this->b1 * move.y + this->c1 * move.z + this->d1;
this->d2 = this->a2 * move.x + this->b2 * move.y + this->c2 * move.z + this->d2;
}
C44Matrix operator*(const C44Matrix& l, float a) { C44Matrix operator*(const C44Matrix& l, float a) {
float a0 = l.a0 * a; float a0 = l.a0 * a;
float a1 = l.a1 * a; float a1 = l.a1 * a;

View file

@ -51,6 +51,7 @@ class C44Matrix {
void RotateAroundZ(float angle); void RotateAroundZ(float angle);
void Scale(const C3Vector& scale); void Scale(const C3Vector& scale);
void Scale(float scale); void Scale(float scale);
void Translate(const C3Vector& move);
}; };
C44Matrix operator*(const C44Matrix& l, float a); C44Matrix operator*(const C44Matrix& l, float a);