Merge pull request #1118 from rleigh-codelibre/float-sig-consistency

Make vec4, mat4x3 and mat4x4 binary operators and contructors for scalars consistent with other types #1118
This commit is contained in:
Christophe 2023-08-18 14:46:24 +02:00 committed by GitHub
commit b3a6570096
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 96 additions and 96 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 --

View File

@ -36,7 +36,7 @@ namespace glm
template<qualifier P>
GLM_FUNC_DECL GLM_CONSTEXPR mat(mat<4, 4, 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& w0,
T const& x1, T const& y1, T const& z1, T const& w1,
@ -122,28 +122,28 @@ namespace glm
// -- Binary operators --
template<typename T, qualifier Q>
GLM_FUNC_DECL mat<4, 4, T, Q> operator+(mat<4, 4, T, Q> const& m, T const& s);
GLM_FUNC_DECL mat<4, 4, T, Q> operator+(mat<4, 4, T, Q> const& m, T scalar);
template<typename T, qualifier Q>
GLM_FUNC_DECL mat<4, 4, T, Q> operator+(T const& s, mat<4, 4, T, Q> const& m);
GLM_FUNC_DECL mat<4, 4, T, Q> operator+(T scalar, mat<4, 4, T, Q> const& m);
template<typename T, qualifier Q>
GLM_FUNC_DECL mat<4, 4, T, Q> operator+(mat<4, 4, T, Q> const& m1, mat<4, 4, T, Q> const& m2);
template<typename T, qualifier Q>
GLM_FUNC_DECL mat<4, 4, T, Q> operator-(mat<4, 4, T, Q> const& m, T const& s);
GLM_FUNC_DECL mat<4, 4, T, Q> operator-(mat<4, 4, T, Q> const& m, T scalar);
template<typename T, qualifier Q>
GLM_FUNC_DECL mat<4, 4, T, Q> operator-(T const& s, mat<4, 4, T, Q> const& m);
GLM_FUNC_DECL mat<4, 4, T, Q> operator-(T scalar, mat<4, 4, T, Q> const& m);
template<typename T, qualifier Q>
GLM_FUNC_DECL mat<4, 4, T, Q> operator-(mat<4, 4, T, Q> const& m1, mat<4, 4, T, Q> const& m2);
template<typename T, qualifier Q>
GLM_FUNC_DECL mat<4, 4, T, Q> operator*(mat<4, 4, T, Q> const& m, T const& s);
GLM_FUNC_DECL mat<4, 4, T, Q> operator*(mat<4, 4, T, Q> const& m, T scalar);
template<typename T, qualifier Q>
GLM_FUNC_DECL mat<4, 4, T, Q> operator*(T const& s, mat<4, 4, T, Q> const& m);
GLM_FUNC_DECL mat<4, 4, T, Q> operator*(T scalar, mat<4, 4, T, Q> const& m);
template<typename T, qualifier Q>
GLM_FUNC_DECL typename mat<4, 4, T, Q>::col_type operator*(mat<4, 4, T, Q> const& m, typename mat<4, 4, T, Q>::row_type const& v);
@ -161,10 +161,10 @@ namespace glm
GLM_FUNC_DECL mat<4, 4, T, Q> operator*(mat<4, 4, T, Q> const& m1, mat<4, 4, T, Q> const& m2);
template<typename T, qualifier Q>
GLM_FUNC_DECL mat<4, 4, T, Q> operator/(mat<4, 4, T, Q> const& m, T const& s);
GLM_FUNC_DECL mat<4, 4, T, Q> operator/(mat<4, 4, T, Q> const& m, T scalar);
template<typename T, qualifier Q>
GLM_FUNC_DECL mat<4, 4, T, Q> operator/(T const& s, mat<4, 4, T, Q> const& m);
GLM_FUNC_DECL mat<4, 4, T, Q> operator/(T scalar, mat<4, 4, T, Q> const& m);
template<typename T, qualifier Q>
GLM_FUNC_DECL typename mat<4, 4, T, Q>::col_type operator/(mat<4, 4, T, Q> const& m, typename mat<4, 4, T, Q>::row_type const& v);

View File

@ -36,7 +36,7 @@ namespace glm
}
template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<4, 4, T, Q>::mat(T const& s)
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<4, 4, T, Q>::mat(T s)
# if GLM_HAS_INITIALIZER_LISTS
: value{col_type(s, 0, 0, 0), col_type(0, s, 0, 0), col_type(0, 0, s, 0), col_type(0, 0, 0, s)}
# endif
@ -453,23 +453,23 @@ namespace glm
// -- Binary arithmetic operators --
template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER mat<4, 4, T, Q> operator+(mat<4, 4, T, Q> const& m, T const& s)
GLM_FUNC_QUALIFIER mat<4, 4, T, Q> operator+(mat<4, 4, T, Q> const& m, T scalar)
{
return mat<4, 4, 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, 4, T, Q> operator+(T const& s, mat<4, 4, T, Q> const& m)
GLM_FUNC_QUALIFIER mat<4, 4, T, Q> operator+(T scalar, mat<4, 4, T, Q> const& m)
{
return mat<4, 4, 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>
@ -483,23 +483,23 @@ namespace glm
}
template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER mat<4, 4, T, Q> operator-(mat<4, 4, T, Q> const& m, T const& s)
GLM_FUNC_QUALIFIER mat<4, 4, T, Q> operator-(mat<4, 4, T, Q> const& m, T scalar)
{
return mat<4, 4, 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, 4, T, Q> operator-(T const& s, mat<4, 4, T, Q> const& m)
GLM_FUNC_QUALIFIER mat<4, 4, T, Q> operator-(T scalar, mat<4, 4, T, Q> const& m)
{
return mat<4, 4, 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]);
}
template<typename T, qualifier Q>
@ -513,23 +513,23 @@ namespace glm
}
template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER mat<4, 4, T, Q> operator*(mat<4, 4, T, Q> const& m, T const & s)
GLM_FUNC_QUALIFIER mat<4, 4, T, Q> operator*(mat<4, 4, T, Q> const& m, T scalar)
{
return mat<4, 4, 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, 4, T, Q> operator*(T const& s, mat<4, 4, T, Q> const& m)
GLM_FUNC_QUALIFIER mat<4, 4, T, Q> operator*(T scalar, mat<4, 4, T, Q> const& m)
{
return mat<4, 4, 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>
@ -648,23 +648,23 @@ namespace glm
}
template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER mat<4, 4, T, Q> operator/(mat<4, 4, T, Q> const& m, T const& s)
GLM_FUNC_QUALIFIER mat<4, 4, T, Q> operator/(mat<4, 4, T, Q> const& m, T scalar)
{
return mat<4, 4, 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, 4, T, Q> operator/(T const& s, mat<4, 4, T, Q> const& m)
GLM_FUNC_QUALIFIER mat<4, 4, T, Q> operator/(T scalar, mat<4, 4, T, Q> const& m)
{
return mat<4, 4, 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]);
}
template<typename T, qualifier Q>

View File

@ -336,7 +336,7 @@ namespace glm
// -- Binary operators --
template<typename T, qualifier Q>
GLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator+(vec<4, T, Q> const& v, T const & scalar);
GLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator+(vec<4, T, Q> const& v, T scalar);
template<typename T, qualifier Q>
GLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator+(vec<4, T, Q> const& v1, vec<1, T, Q> const& v2);
@ -351,7 +351,7 @@ namespace glm
GLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator+(vec<4, T, Q> const& v1, vec<4, T, Q> const& v2);
template<typename T, qualifier Q>
GLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator-(vec<4, T, Q> const& v, T const & scalar);
GLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator-(vec<4, T, Q> const& v, T scalar);
template<typename T, qualifier Q>
GLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator-(vec<4, T, Q> const& v1, vec<1, T, Q> const& v2);
@ -366,7 +366,7 @@ namespace glm
GLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator-(vec<4, T, Q> const& v1, vec<4, T, Q> const& v2);
template<typename T, qualifier Q>
GLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator*(vec<4, T, Q> const& v, T const & scalar);
GLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator*(vec<4, T, Q> const& v, T scalar);
template<typename T, qualifier Q>
GLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator*(vec<4, T, Q> const& v1, vec<1, T, Q> const& v2);
@ -381,7 +381,7 @@ namespace glm
GLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator*(vec<4, T, Q> const& v1, vec<4, T, Q> const& v2);
template<typename T, qualifier Q>
GLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator/(vec<4, T, Q> const& v, T const & scalar);
GLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator/(vec<4, T, Q> const& v, T scalar);
template<typename T, qualifier Q>
GLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator/(vec<4, T, Q> const& v1, vec<1, T, Q> const& v2);

View File

@ -803,7 +803,7 @@ namespace detail
// -- Binary arithmetic operators --
template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<4, T, Q> operator+(vec<4, T, Q> const& v, T const & scalar)
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<4, T, Q> operator+(vec<4, T, Q> const& v, T scalar)
{
return vec<4, T, Q>(v) += scalar;
}
@ -833,7 +833,7 @@ namespace detail
}
template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<4, T, Q> operator-(vec<4, T, Q> const& v, T const & scalar)
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<4, T, Q> operator-(vec<4, T, Q> const& v, T scalar)
{
return vec<4, T, Q>(v) -= scalar;
}
@ -863,7 +863,7 @@ namespace detail
}
template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<4, T, Q> operator*(vec<4, T, Q> const& v, T const & scalar)
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<4, T, Q> operator*(vec<4, T, Q> const& v, T scalar)
{
return vec<4, T, Q>(v) *= scalar;
}
@ -893,7 +893,7 @@ namespace detail
}
template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<4, T, Q> operator/(vec<4, T, Q> const& v, T const & scalar)
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<4, T, Q> operator/(vec<4, T, Q> const& v, T scalar)
{
return vec<4, T, Q>(v) /= scalar;
}