From fdbfa8e36f85eee051fc562f1a8588970257a20f Mon Sep 17 00:00:00 2001 From: Mel Date: Thu, 6 Oct 2022 02:48:43 +0200 Subject: Rotating camera with mouse --- src/Math/Rotation.hpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'src/Math/Rotation.hpp') 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 -- cgit 1.4.1