From b0a37c4e5ec69d4c2cbfff3db59964b2b3eb79b5 Mon Sep 17 00:00:00 2001 From: fallenoak Date: Sat, 24 Dec 2022 17:22:29 -0600 Subject: [PATCH] feat(matrix): add C44Matrix::Translate --- tempest/matrix/C44Matrix.cpp | 6 ++++++ tempest/matrix/C44Matrix.hpp | 1 + 2 files changed, 7 insertions(+) diff --git a/tempest/matrix/C44Matrix.cpp b/tempest/matrix/C44Matrix.cpp index ce637a4..c8272be 100644 --- a/tempest/matrix/C44Matrix.cpp +++ b/tempest/matrix/C44Matrix.cpp @@ -93,6 +93,12 @@ void C44Matrix::Scale(float 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) { float a0 = l.a0 * a; float a1 = l.a1 * a; diff --git a/tempest/matrix/C44Matrix.hpp b/tempest/matrix/C44Matrix.hpp index fb92df1..20364ae 100644 --- a/tempest/matrix/C44Matrix.hpp +++ b/tempest/matrix/C44Matrix.hpp @@ -51,6 +51,7 @@ class C44Matrix { void RotateAroundZ(float angle); void Scale(const C3Vector& scale); void Scale(float scale); + void Translate(const C3Vector& move); }; C44Matrix operator*(const C44Matrix& l, float a);