- Added missing vec1 based constructors

This commit is contained in:
Groove 2018-07-07 12:04:27 +02:00
parent ec261bd21b
commit 213a66f9bf
4 changed files with 146 additions and 0 deletions

View File

@ -143,18 +143,36 @@ namespace glm
GLM_FUNC_DECL GLM_CONSTEXPR_CTOR vec(vec<2, A, P> const& _xy, B _z, C _w); GLM_FUNC_DECL GLM_CONSTEXPR_CTOR vec(vec<2, A, P> const& _xy, B _z, C _w);
/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) /// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template<typename A, typename B, typename C, qualifier P> template<typename A, typename B, typename C, qualifier P>
GLM_FUNC_DECL GLM_CONSTEXPR_CTOR vec(vec<2, A, P> const& _xy, vec<1, B, P> const& _z, C _w);
/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template<typename A, typename B, typename C, qualifier P>
GLM_FUNC_DECL GLM_CONSTEXPR_CTOR vec(vec<2, A, P> const& _xy, B _z, vec<1, C, P> const& _w);
/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template<typename A, typename B, typename C, qualifier P>
GLM_FUNC_DECL GLM_CONSTEXPR_CTOR vec(vec<2, A, P> const& _xy, vec<1, B, P> const& _z, vec<1, C, P> const& _w); GLM_FUNC_DECL GLM_CONSTEXPR_CTOR vec(vec<2, A, P> const& _xy, vec<1, B, P> const& _z, vec<1, C, P> const& _w);
/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) /// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template<typename A, typename B, typename C, qualifier P> template<typename A, typename B, typename C, qualifier P>
GLM_FUNC_DECL GLM_CONSTEXPR_CTOR vec(A _x, vec<2, B, P> const& _yz, C _w); GLM_FUNC_DECL GLM_CONSTEXPR_CTOR vec(A _x, vec<2, B, P> const& _yz, C _w);
/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) /// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template<typename A, typename B, typename C, qualifier P> template<typename A, typename B, typename C, qualifier P>
GLM_FUNC_DECL GLM_CONSTEXPR_CTOR vec(vec<1, A, P> const& _x, vec<2, B, P> const& _yz, C _w);
/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template<typename A, typename B, typename C, qualifier P>
GLM_FUNC_DECL GLM_CONSTEXPR_CTOR vec(A _x, vec<2, B, P> const& _yz, vec<1, C, P> const& _w);
/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template<typename A, typename B, typename C, qualifier P>
GLM_FUNC_DECL GLM_CONSTEXPR_CTOR vec(vec<1, A, P> const& _x, vec<2, B, P> const& _yz, vec<1, C, P> const& _w); GLM_FUNC_DECL GLM_CONSTEXPR_CTOR vec(vec<1, A, P> const& _x, vec<2, B, P> const& _yz, vec<1, C, P> const& _w);
/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) /// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template<typename A, typename B, typename C, qualifier P> template<typename A, typename B, typename C, qualifier P>
GLM_FUNC_DECL GLM_CONSTEXPR_CTOR vec(A _x, B _y, vec<2, C, P> const& _zw); GLM_FUNC_DECL GLM_CONSTEXPR_CTOR vec(A _x, B _y, vec<2, C, P> const& _zw);
/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) /// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template<typename A, typename B, typename C, qualifier P> template<typename A, typename B, typename C, qualifier P>
GLM_FUNC_DECL GLM_CONSTEXPR_CTOR vec(vec<1, A, P> const& _x, B _y, vec<2, C, P> const& _zw);
/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template<typename A, typename B, typename C, qualifier P>
GLM_FUNC_DECL GLM_CONSTEXPR_CTOR vec(A _x, vec<1, B, P> const& _y, vec<2, C, P> const& _zw);
/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template<typename A, typename B, typename C, qualifier P>
GLM_FUNC_DECL GLM_CONSTEXPR_CTOR vec(vec<1, A, P> const& _x, vec<1, B, P> const& _y, vec<2, C, P> const& _zw); GLM_FUNC_DECL GLM_CONSTEXPR_CTOR vec(vec<1, A, P> const& _x, vec<1, B, P> const& _y, vec<2, C, P> const& _zw);
/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) /// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template<typename A, typename B, qualifier P> template<typename A, typename B, qualifier P>

View File

@ -349,6 +349,24 @@ namespace detail
, w(static_cast<T>(_w)) , w(static_cast<T>(_w))
{} {}
template<typename T, qualifier Q>
template<typename A, typename B, typename C, qualifier P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR vec<4, T, Q>::vec(vec<2, A, P> const& _xy, vec<1, B, P> const& _z, C _w)
: x(static_cast<T>(_xy.x))
, y(static_cast<T>(_xy.y))
, z(static_cast<T>(_z.x))
, w(static_cast<T>(_w))
{}
template<typename T, qualifier Q>
template<typename A, typename B, typename C, qualifier P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR vec<4, T, Q>::vec(vec<2, A, P> const& _xy, B _z, vec<1, C, P> const& _w)
: x(static_cast<T>(_xy.x))
, y(static_cast<T>(_xy.y))
, z(static_cast<T>(_z))
, w(static_cast<T>(_w.x))
{}
template<typename T, qualifier Q> template<typename T, qualifier Q>
template<typename A, typename B, typename C, qualifier P> template<typename A, typename B, typename C, qualifier P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR vec<4, T, Q>::vec(vec<2, A, P> const& _xy, vec<1, B, P> const& _z, vec<1, C, P> const& _w) GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR vec<4, T, Q>::vec(vec<2, A, P> const& _xy, vec<1, B, P> const& _z, vec<1, C, P> const& _w)
@ -367,6 +385,24 @@ namespace detail
, w(static_cast<T>(_w)) , w(static_cast<T>(_w))
{} {}
template<typename T, qualifier Q>
template<typename A, typename B, typename C, qualifier P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR vec<4, T, Q>::vec(vec<1, A, P> const& _x, vec<2, B, P> const& _yz, C _w)
: x(static_cast<T>(_x.x))
, y(static_cast<T>(_yz.x))
, z(static_cast<T>(_yz.y))
, w(static_cast<T>(_w))
{}
template<typename T, qualifier Q>
template<typename A, typename B, typename C, qualifier P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR vec<4, T, Q>::vec(A _x, vec<2, B, P> const& _yz, vec<1, C, P> const& _w)
: x(static_cast<T>(_x))
, y(static_cast<T>(_yz.x))
, z(static_cast<T>(_yz.y))
, w(static_cast<T>(_w.x))
{}
template<typename T, qualifier Q> template<typename T, qualifier Q>
template<typename A, typename B, typename C, qualifier P> template<typename A, typename B, typename C, qualifier P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR vec<4, T, Q>::vec(vec<1, A, P> const& _x, vec<2, B, P> const& _yz, vec<1, C, P> const& _w) GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR vec<4, T, Q>::vec(vec<1, A, P> const& _x, vec<2, B, P> const& _yz, vec<1, C, P> const& _w)
@ -385,6 +421,24 @@ namespace detail
, w(static_cast<T>(_zw.y)) , w(static_cast<T>(_zw.y))
{} {}
template<typename T, qualifier Q>
template<typename A, typename B, typename C, qualifier P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR vec<4, T, Q>::vec(vec<1, A, P> const& _x, B _y, vec<2, C, P> const& _zw)
: x(static_cast<T>(_x.x))
, y(static_cast<T>(_y))
, z(static_cast<T>(_zw.x))
, w(static_cast<T>(_zw.y))
{}
template<typename T, qualifier Q>
template<typename A, typename B, typename C, qualifier P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR vec<4, T, Q>::vec(A _x, vec<1, B, P> const& _y, vec<2, C, P> const& _zw)
: x(static_cast<T>(_x))
, y(static_cast<T>(_y.x))
, z(static_cast<T>(_zw.x))
, w(static_cast<T>(_zw.y))
{}
template<typename T, qualifier Q> template<typename T, qualifier Q>
template<typename A, typename B, typename C, qualifier P> template<typename A, typename B, typename C, qualifier P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR vec<4, T, Q>::vec(vec<1, A, P> const& _x, vec<1, B, P> const& _y, vec<2, C, P> const& _zw) GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR vec<4, T, Q>::vec(vec<1, A, P> const& _x, vec<1, B, P> const& _y, vec<2, C, P> const& _zw)

View File

@ -55,6 +55,9 @@ glm::mat4 camera(float Translate, glm::vec2 const& Rotate)
#### Features: #### Features:
- Added bitfieldDeinterleave to GTC_bitfield - Added bitfieldDeinterleave to GTC_bitfield
#### Improvements:
- Added missing vec1 based constructors
#### Fixes: #### Fixes:
- Fixed build problems due to printf and std::clock_t #778 - Fixed build problems due to printf and std::clock_t #778
- Fixed int mod - Fixed int mod

View File

@ -252,6 +252,77 @@ static int test_vec4_ctor()
Error += glm::all(glm::equal(V, O)) ? 0 : 1; Error += glm::all(glm::equal(V, O)) ? 0 : 1;
} }
{
glm::vec1 const v1_0(1.0f);
glm::vec1 const v1_1(2.0f);
glm::vec1 const v1_2(3.0f);
glm::vec1 const v1_3(4.0f);
glm::vec2 const v2_0(1.0f, 2.0f);
glm::vec2 const v2_1(2.0f, 3.0f);
glm::vec2 const v2_2(3.0f, 4.0f);
glm::vec3 const v3_0(1.0f, 2.0f, 3.0f);
glm::vec3 const v3_1(2.0f, 3.0f, 4.0f);
glm::vec4 const O(1.0f, 2.0, 3.0f, 4.0);
glm::vec4 const A(v1_0, v1_1, v2_2);
Error += glm::all(glm::equal(A, O)) ? 0 : 1;
glm::vec4 const B(1.0f, 2.0f, v2_2);
Error += glm::all(glm::equal(B, O)) ? 0 : 1;
glm::vec4 const C(v1_0, 2.0f, v2_2);
Error += glm::all(glm::equal(C, O)) ? 0 : 1;
glm::vec4 const D(1.0f, v1_1, v2_2);
Error += glm::all(glm::equal(D, O)) ? 0 : 1;
glm::vec4 const E(v2_0, v1_2, v1_3);
Error += glm::all(glm::equal(E, O)) ? 0 : 1;
glm::vec4 const F(v2_0, 3.0, v1_3);
Error += glm::all(glm::equal(F, O)) ? 0 : 1;
glm::vec4 const G(v2_0, v1_2, 4.0);
Error += glm::all(glm::equal(G, O)) ? 0 : 1;
glm::vec4 const H(v2_0, 3.0f, 4.0);
Error += glm::all(glm::equal(H, O)) ? 0 : 1;
}
{
glm::vec1 const v1_0(1.0f);
glm::vec1 const v1_1(2.0f);
glm::vec1 const v1_2(3.0f);
glm::vec1 const v1_3(4.0f);
glm::vec2 const v2_0(1.0f, 2.0f);
glm::vec2 const v2_1(2.0f, 3.0f);
glm::vec2 const v2_2(3.0f, 4.0f);
glm::vec3 const v3_0(1.0f, 2.0f, 3.0f);
glm::vec3 const v3_1(2.0f, 3.0f, 4.0f);
glm::vec4 const O(1.0f, 2.0, 3.0f, 4.0);
glm::vec4 const A(v1_0, v2_0, v1_3);
Error += glm::all(glm::equal(A, O)) ? 0 : 1;
glm::vec4 const B(v1_0, v2_0, 4.0);
Error += glm::all(glm::equal(B, O)) ? 0 : 1;
glm::vec4 const C(1.0, v2_0, v1_3);
Error += glm::all(glm::equal(C, O)) ? 0 : 1;
glm::vec4 const D(1.0f, v2_0, 4.0);
Error += glm::all(glm::equal(D, O)) ? 0 : 1;
glm::vec4 const E(1.0, v2_0, 4.0f);
Error += glm::all(glm::equal(E, O)) ? 0 : 1;
}
return Error; return Error;
} }