diff --git a/include/vsg/maths/vec2.h b/include/vsg/maths/vec2.h index de514bdf3..b39e5ff9f 100644 --- a/include/vsg/maths/vec2.h +++ b/include/vsg/maths/vec2.h @@ -118,6 +118,16 @@ namespace vsg return *this; } + friend constexpr t_vec2 operator*(const t_vec2& lhs, T rhs) + { + return t_vec2(lhs[0] * rhs, lhs[1] * rhs); + } + + friend constexpr t_vec2 operator*(T lhs, const t_vec2& rhs) + { + return t_vec2(lhs * rhs[0], lhs * rhs[1]); + } + inline t_vec2& operator/=(value_type rhs) { if constexpr (std::is_floating_point_v) @@ -194,12 +204,6 @@ namespace vsg return t_vec2(lhs[0] + rhs[0], lhs[1] + rhs[1]); } - template - constexpr t_vec2 operator*(const t_vec2& lhs, T rhs) - { - return t_vec2(lhs[0] * rhs, lhs[1] * rhs); - } - template constexpr t_vec2 operator*(const t_vec2& lhs, const t_vec2& rhs) { diff --git a/include/vsg/maths/vec3.h b/include/vsg/maths/vec3.h index c3c779cc5..0aa38a3c3 100644 --- a/include/vsg/maths/vec3.h +++ b/include/vsg/maths/vec3.h @@ -115,6 +115,16 @@ namespace vsg return *this; } + friend constexpr t_vec3 operator*(const t_vec3& lhs, T rhs) + { + return t_vec3(lhs[0] * rhs, lhs[1] * rhs, lhs[2] * rhs); + } + + friend constexpr t_vec3 operator*(T lhs, const t_vec3& rhs) + { + return t_vec3(lhs * rhs[0], lhs * rhs[1], lhs * rhs[2]); + } + inline t_vec3& operator*=(const t_vec3& rhs) { value[0] *= rhs.value[0]; @@ -204,12 +214,6 @@ namespace vsg return t_vec3(lhs[0] + rhs[0], lhs[1] + rhs[1], lhs[2] + rhs[2]); } - template - constexpr t_vec3 operator*(const t_vec3& lhs, T rhs) - { - return t_vec3(lhs[0] * rhs, lhs[1] * rhs, lhs[2] * rhs); - } - template constexpr t_vec3 operator*(const t_vec3& lhs, const t_vec3& rhs) { diff --git a/include/vsg/maths/vec4.h b/include/vsg/maths/vec4.h index 13a15906e..f50289622 100644 --- a/include/vsg/maths/vec4.h +++ b/include/vsg/maths/vec4.h @@ -149,6 +149,16 @@ namespace vsg return *this; } + friend constexpr t_vec4 operator*(const t_vec4& lhs, T rhs) + { + return t_vec4(lhs[0] * rhs, lhs[1] * rhs, lhs[2] * rhs, lhs[3] * rhs); + } + + friend constexpr t_vec4 operator*(T lhs, const t_vec4& rhs) + { + return t_vec4(lhs * rhs[0], lhs * rhs[1], lhs * rhs[2], lhs * rhs[3]); + } + inline t_vec4& operator/=(value_type rhs) { if constexpr (std::is_floating_point_v) @@ -236,12 +246,6 @@ namespace vsg return t_vec4(lhs[0] + rhs[0], lhs[1] + rhs[1], lhs[2] + rhs[2], lhs[3] + rhs[3]); } - template - constexpr t_vec4 operator*(const t_vec4& lhs, T rhs) - { - return t_vec4(lhs[0] * rhs, lhs[1] * rhs, lhs[2] * rhs, lhs[3] * rhs); - } - template constexpr t_vec4 operator*(const t_vec4& lhs, const t_vec4& rhs) {