summary refs log tree commit diff
path: root/src/Math/Rotation.hpp
diff options
context:
space:
mode:
authorMel <einebeere@gmail.com>2022-10-06 02:48:43 +0200
committerMel <einebeere@gmail.com>2022-10-06 02:48:43 +0200
commitfdbfa8e36f85eee051fc562f1a8588970257a20f (patch)
treee861a56c50b1e8532bd71a21064d76d0c148ed3a /src/Math/Rotation.hpp
parent731846a0c654b39e23c26f611470e401df404c9d (diff)
downloadmeowcraft-fdbfa8e36f85eee051fc562f1a8588970257a20f.tar.zst
meowcraft-fdbfa8e36f85eee051fc562f1a8588970257a20f.zip
Rotating camera with mouse
Diffstat (limited to 'src/Math/Rotation.hpp')
-rw-r--r--src/Math/Rotation.hpp16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/Math/Rotation.hpp b/src/Math/Rotation.hpp
index 73a8219..0c5c606 100644
--- a/src/Math/Rotation.hpp
+++ b/src/Math/Rotation.hpp
@@ -11,8 +11,8 @@ public:
 
     Rotation(float angles[3]) : Rotation(angles[0], angles[1], angles[2]) {};
 
-    Rotation(float x, float y, float z) {
-        vector = wrap({ x, y, z });
+    Rotation(float pitch, float yaw, float roll) {
+        vector = wrap({pitch, yaw, roll });
     };
 
     Rotation operator+(Rotation other) const {
@@ -27,5 +27,17 @@ public:
         return v.map([](auto a) { return fmod(a, 360.0f); });
     }
 
+    float& pitch() {
+        return vector[0];
+    }
+
+    float& yaw() {
+        return vector[1];
+    }
+
+    float& roll() {
+        return vector[2];
+    }
+
     Vector<3> vector;
 };
\ No newline at end of file