summary refs log tree commit diff
path: root/src/Math/Matrix.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Math/Matrix.hpp')
-rw-r--r--src/Math/Matrix.hpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/Math/Matrix.hpp b/src/Math/Matrix.hpp
index d51d171..41d3661 100644
--- a/src/Math/Matrix.hpp
+++ b/src/Math/Matrix.hpp
@@ -37,6 +37,15 @@ struct Matrix {
         };
     }
 
+    static Matrix<4, 4, T> scale(Vector<3> factor) {
+        return {
+            factor.x(), 0.0, 0.0, 0.0,
+            0.0, factor.y(), 0.0, 0.0,
+            0.0, 0.0, factor.z(), 0.0,
+            0.0, 0.0, 0.0, 1.0
+        };
+    }
+
     static Matrix<4, 4, T> rotation(Rotation angles) {
         auto radians = angles.vector.map([](auto a) { return Math::radians(a); });