From 77cd3a0538d342e25010132317734f27af4bed8e Mon Sep 17 00:00:00 2001 From: vimene Date: Fri, 3 Jan 2025 04:02:23 +0100 Subject: improved keyboard and mouse controls --- src/math/tform.h | 3 +-- src/math/vector.h | 6 ++++++ 2 files changed, 7 insertions(+), 2 deletions(-) (limited to 'src/math') diff --git a/src/math/tform.h b/src/math/tform.h index 2a654b8..74186f8 100644 --- a/src/math/tform.h +++ b/src/math/tform.h @@ -14,8 +14,7 @@ class Transform { Quaternion rot; Vector3 scale; - constexpr Transform(Vector3 loc, Quaternion rot, Vector3 scale) : loc{loc}, rot{rot}, scale{scale} { - } + constexpr Transform(Vector3 loc, Quaternion rot, Vector3 scale) : loc{loc}, rot{rot}, scale{scale} {} constexpr Transform opposite() const & { return {-loc, rot.conjugate(), 1.f / scale}; diff --git a/src/math/vector.h b/src/math/vector.h index d755c89..fcfc5bd 100644 --- a/src/math/vector.h +++ b/src/math/vector.h @@ -33,6 +33,12 @@ struct Vector2 { return *this + (-other); } + constexpr Vector2 operator+=(const Vector2& other) & { + x += other.x; + y += other.y; + return *this; + } + constexpr float det(const Vector2& other) const & { return this->x * other.y - other.x * this->y; } -- cgit v1.2.3