Make mat4x3 binary operators for scalars consistent with other types

This commit is contained in:
Roger Leigh 2022-09-19 21:10:58 +01:00
parent 7da7f7c887
commit bdf26d258d
2 changed files with 38 additions and 38 deletions

View File

@ -37,7 +37,7 @@ namespace glm
template<qualifier P>
GLM_FUNC_DECL GLM_CONSTEXPR mat(mat<4, 3, T, P> const& m);
GLM_FUNC_DECL explicit GLM_CONSTEXPR mat(T const& x);
GLM_FUNC_DECL explicit GLM_CONSTEXPR mat(T s);
GLM_FUNC_DECL GLM_CONSTEXPR mat(
T const& x0, T const& y0, T const& z0,
T const& x1, T const& y1, T const& z1,
@ -119,22 +119,22 @@ namespace glm
// -- Binary operators --
template<typename T, qualifier Q>
GLM_FUNC_DECL mat<4, 3, T, Q> operator+(mat<4, 3, T, Q> const& m, T const& s);
GLM_FUNC_DECL mat<4, 3, T, Q> operator+(mat<4, 3, T, Q> const& m, T scalar);
template<typename T, qualifier Q>
GLM_FUNC_DECL mat<4, 3, T, Q> operator+(mat<4, 3, T, Q> const& m1, mat<4, 3, T, Q> const& m2);
template<typename T, qualifier Q>
GLM_FUNC_DECL mat<4, 3, T, Q> operator-(mat<4, 3, T, Q> const& m, T const& s);
GLM_FUNC_DECL mat<4, 3, T, Q> operator-(mat<4, 3, T, Q> const& m, T scalar);
template<typename T, qualifier Q>
GLM_FUNC_DECL mat<4, 3, T, Q> operator-(mat<4, 3, T, Q> const& m1, mat<4, 3, T, Q> const& m2);
template<typename T, qualifier Q>
GLM_FUNC_DECL mat<4, 3, T, Q> operator*(mat<4, 3, T, Q> const& m, T const& s);
GLM_FUNC_DECL mat<4, 3, T, Q> operator*(mat<4, 3, T, Q> const& m, T scalar);
template<typename T, qualifier Q>
GLM_FUNC_DECL mat<4, 3, T, Q> operator*(T const& s, mat<4, 3, T, Q> const& m);
GLM_FUNC_DECL mat<4, 3, T, Q> operator*(T scalar, mat<4, 3, T, Q> const& m);
template<typename T, qualifier Q>
GLM_FUNC_DECL typename mat<4, 3, T, Q>::col_type operator*(mat<4, 3, T, Q> const& m, typename mat<4, 3, T, Q>::row_type const& v);
@ -152,10 +152,10 @@ namespace glm
GLM_FUNC_DECL mat<4, 3, T, Q> operator*(mat<4, 3, T, Q> const& m1, mat<4, 4, T, Q> const& m2);
template<typename T, qualifier Q>
GLM_FUNC_DECL mat<4, 3, T, Q> operator/(mat<4, 3, T, Q> const& m, T const& s);
GLM_FUNC_DECL mat<4, 3, T, Q> operator/(mat<4, 3, T, Q> const& m, T scalar);
template<typename T, qualifier Q>
GLM_FUNC_DECL mat<4, 3, T, Q> operator/(T const& s, mat<4, 3, T, Q> const& m);
GLM_FUNC_DECL mat<4, 3, T, Q> operator/(T scalar, mat<4, 3, T, Q> const& m);
// -- Boolean operators --

View File

@ -34,7 +34,7 @@ namespace glm
}
template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<4, 3, T, Q>::mat(T const& s)
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<4, 3, T, Q>::mat(T s)
# if GLM_HAS_INITIALIZER_LISTS
: value{col_type(s, 0, 0), col_type(0, s, 0), col_type(0, 0, s), col_type(0, 0, 0)}
# endif
@ -406,13 +406,13 @@ namespace glm
// -- Binary arithmetic operators --
template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER mat<4, 3, T, Q> operator+(mat<4, 3, T, Q> const& m, T const& s)
GLM_FUNC_QUALIFIER mat<4, 3, T, Q> operator+(mat<4, 3, T, Q> const& m, T scalar)
{
return mat<4, 3, T, Q>(
m[0] + s,
m[1] + s,
m[2] + s,
m[3] + s);
m[0] + scalar,
m[1] + scalar,
m[2] + scalar,
m[3] + scalar);
}
template<typename T, qualifier Q>
@ -426,13 +426,13 @@ namespace glm
}
template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER mat<4, 3, T, Q> operator-(mat<4, 3, T, Q> const& m, T const& s)
GLM_FUNC_QUALIFIER mat<4, 3, T, Q> operator-(mat<4, 3, T, Q> const& m, T scalar)
{
return mat<4, 3, T, Q>(
m[0] - s,
m[1] - s,
m[2] - s,
m[3] - s);
m[0] - scalar,
m[1] - scalar,
m[2] - scalar,
m[3] - scalar);
}
template<typename T, qualifier Q>
@ -446,23 +446,23 @@ namespace glm
}
template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER mat<4, 3, T, Q> operator*(mat<4, 3, T, Q> const& m, T const& s)
GLM_FUNC_QUALIFIER mat<4, 3, T, Q> operator*(mat<4, 3, T, Q> const& m, T scalar)
{
return mat<4, 3, T, Q>(
m[0] * s,
m[1] * s,
m[2] * s,
m[3] * s);
m[0] * scalar,
m[1] * scalar,
m[2] * scalar,
m[3] * scalar);
}
template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER mat<4, 3, T, Q> operator*(T const& s, mat<4, 3, T, Q> const& m)
GLM_FUNC_QUALIFIER mat<4, 3, T, Q> operator*(T scalar, mat<4, 3, T, Q> const& m)
{
return mat<4, 3, T, Q>(
m[0] * s,
m[1] * s,
m[2] * s,
m[3] * s);
m[0] * scalar,
m[1] * scalar,
m[2] * scalar,
m[3] * scalar);
}
template<typename T, qualifier Q>
@ -563,23 +563,23 @@ namespace glm
}
template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER mat<4, 3, T, Q> operator/(mat<4, 3, T, Q> const& m, T const& s)
GLM_FUNC_QUALIFIER mat<4, 3, T, Q> operator/(mat<4, 3, T, Q> const& m, T scalar)
{
return mat<4, 3, T, Q>(
m[0] / s,
m[1] / s,
m[2] / s,
m[3] / s);
m[0] / scalar,
m[1] / scalar,
m[2] / scalar,
m[3] / scalar);
}
template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER mat<4, 3, T, Q> operator/(T const& s, mat<4, 3, T, Q> const& m)
GLM_FUNC_QUALIFIER mat<4, 3, T, Q> operator/(T scalar, mat<4, 3, T, Q> const& m)
{
return mat<4, 3, T, Q>(
s / m[0],
s / m[1],
s / m[2],
s / m[3]);
scalar / m[0],
scalar / m[1],
scalar / m[2],
scalar / m[3]);
}
// -- Boolean operators --