From: Mikko Rasa Date: Wed, 30 Dec 2020 15:09:15 +0000 (+0200) Subject: Add multiplication operators between Matrix and float X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=0c4ddd58454437a8fec95eca64cdcf08085a0a5d;p=libs%2Fgl.git Add multiplication operators between Matrix and float Newer gcc versions are complaining about an ambiguity between the vector multiplication operators in GL::Matrix and the scalar multiplication for LinAl::Matrix. --- diff --git a/source/matrix.h b/source/matrix.h index 971d2b36..cb61e292 100644 --- a/source/matrix.h +++ b/source/matrix.h @@ -38,6 +38,8 @@ public: Matrix operator*(const Matrix &m) const { return static_cast(*this)*static_cast(m); } Matrix &operator*=(const Matrix &m) { Base::operator*=(m); return *this; } + Matrix operator*(float s) const { return static_cast(*this)*s; } + Matrix &operator*=(float s) { Base::operator*=(s); return *this; } Vector4 operator*(const Vector4 &v) const { return static_cast(*this)*v; } Vector3 operator*(const Vector3 &v) const { return ((*this)*compose(v, 1.0f)).slice<3>(0); } float operator[](unsigned) const;