diff options
| author | Mel <einebeere@gmail.com> | 2022-10-06 02:48:43 +0200 |
|---|---|---|
| committer | Mel <einebeere@gmail.com> | 2022-10-06 02:48:43 +0200 |
| commit | fdbfa8e36f85eee051fc562f1a8588970257a20f (patch) | |
| tree | e861a56c50b1e8532bd71a21064d76d0c148ed3a /src/Math/Matrix.hpp | |
| parent | 731846a0c654b39e23c26f611470e401df404c9d (diff) | |
| download | meowcraft-fdbfa8e36f85eee051fc562f1a8588970257a20f.tar.zst meowcraft-fdbfa8e36f85eee051fc562f1a8588970257a20f.zip | |
Rotating camera with mouse
Diffstat (limited to 'src/Math/Matrix.hpp')
| -rw-r--r-- | src/Math/Matrix.hpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/Math/Matrix.hpp b/src/Math/Matrix.hpp index d77760a..545b6a5 100644 --- a/src/Math/Matrix.hpp +++ b/src/Math/Matrix.hpp @@ -4,6 +4,7 @@ #include <cstddef> #include <iostream> #include "Rotation.hpp" +#include "Trig.hpp" template <size_t R, size_t C, typename T = float> struct Matrix { @@ -39,8 +40,10 @@ public: } static Matrix<4, 4> rotation(Rotation angles) { - auto c = angles.vector.map([](auto a) { return cos(a); }); - auto s = angles.vector.map([](auto a) { return sin(a); }); + auto radians = angles.vector.map([](auto a) { return Math::radians(a); }); + + auto c = radians.map([](auto a) { return cos(a); }); + auto s = radians.map([](auto a) { return sin(a); }); Matrix<4, 4> rotation_x{ 1.0f, 0.0f, 0.0f, 0.0f, |
