Merge branch 'static-const' of https://github.com/g-truc/glm into static-const

This commit is contained in:
Christophe Riccio 2015-10-07 22:32:59 +02:00
commit 869caacac5
49 changed files with 627 additions and 10 deletions

View File

@ -61,6 +61,10 @@ namespace glm
static GLM_RELAXED_CONSTEXPR precision prec = P;
# endif//GLM_META_PROG_HELPERS
# ifdef GLM_STATIC_CONST_MEMBERS
static const type ZERO;
static const type IDENTITY;
# endif
private:
col_type value[2];

View File

@ -50,6 +50,13 @@ namespace detail
}
}//namespace detail
# ifdef GLM_STATIC_CONST_MEMBERS
template<typename T, precision P>
const tmat2x2<T, P> tmat2x2<T, P>::ZERO(static_cast<T>(0));
template<typename T, precision P>
const tmat2x2<T, P> tmat2x2<T, P>::IDENTITY(static_cast<T>(1));
# endif
// -- Constructors --
# if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT)

View File

@ -57,6 +57,11 @@ namespace glm
static GLM_RELAXED_CONSTEXPR precision prec = P;
# endif//GLM_META_PROG_HELPERS
# ifdef GLM_STATIC_CONST_MEMBERS
static const type ZERO;
static const type IDENTITY;
# endif
private:
col_type value[2];

View File

@ -32,6 +32,13 @@
namespace glm
{
# ifdef GLM_STATIC_CONST_MEMBERS
template<typename T, precision P>
const tmat2x3<T, P> tmat2x3<T, P>::ZERO(static_cast<T>(0));
template<typename T, precision P>
const tmat2x3<T, P> tmat2x3<T, P>::IDENTITY(static_cast<T>(1));
# endif
// -- Constructors --
# if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT)

View File

@ -57,6 +57,11 @@ namespace glm
static GLM_RELAXED_CONSTEXPR precision prec = P;
# endif//GLM_META_PROG_HELPERS
# ifdef GLM_STATIC_CONST_MEMBERS
static const type ZERO;
static const type IDENTITY;
# endif
private:
col_type value[2];

View File

@ -32,6 +32,13 @@
namespace glm
{
# ifdef GLM_STATIC_CONST_MEMBERS
template<typename T, precision P>
const tmat2x4<T, P> tmat2x4<T, P>::ZERO(static_cast<T>(0));
template<typename T, precision P>
const tmat2x4<T, P> tmat2x4<T, P>::IDENTITY(static_cast<T>(1));
# endif
// -- Constructors --
# if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT)

View File

@ -57,6 +57,11 @@ namespace glm
static GLM_RELAXED_CONSTEXPR precision prec = P;
# endif//GLM_META_PROG_HELPERS
# ifdef GLM_STATIC_CONST_MEMBERS
static const type ZERO;
static const type IDENTITY;
# endif
private:
col_type value[3];

View File

@ -32,6 +32,13 @@
namespace glm
{
# ifdef GLM_STATIC_CONST_MEMBERS
template<typename T, precision P>
const tmat3x2<T, P> tmat3x2<T, P>::ZERO(static_cast<T>(0));
template<typename T, precision P>
const tmat3x2<T, P> tmat3x2<T, P>::IDENTITY(static_cast<T>(1));
# endif
// -- Constructors --
# if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT)

View File

@ -56,6 +56,11 @@ namespace glm
static GLM_RELAXED_CONSTEXPR precision prec = P;
# endif//GLM_META_PROG_HELPERS
# ifdef GLM_STATIC_CONST_MEMBERS
static const type ZERO;
static const type IDENTITY;
# endif
template <typename U, precision Q>
friend tvec3<U, Q> operator/(tmat3x3<U, Q> const & m, tvec3<U, Q> const & v);
template <typename U, precision Q>

View File

@ -56,6 +56,14 @@ namespace detail
}
}//namespace detail
# ifdef GLM_STATIC_CONST_MEMBERS
template<typename T, precision P>
const tmat3x3<T, P> tmat3x3<T, P>::ZERO(static_cast<T>(0));
template<typename T, precision P>
const tmat3x3<T, P> tmat3x3<T, P>::IDENTITY(static_cast<T>(1));
# endif
// -- Constructors --
# if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT)

View File

@ -57,6 +57,11 @@ namespace glm
static GLM_RELAXED_CONSTEXPR precision prec = P;
# endif//GLM_META_PROG_HELPERS
# ifdef GLM_STATIC_CONST_MEMBERS
static const type ZERO;
static const type IDENTITY;
# endif
private:
col_type value[3];

View File

@ -32,6 +32,13 @@
namespace glm
{
# ifdef GLM_STATIC_CONST_MEMBERS
template<typename T, precision P>
const tmat3x4<T, P> tmat3x4<T, P>::ZERO(static_cast<T>(0));
template<typename T, precision P>
const tmat3x4<T, P> tmat3x4<T, P>::IDENTITY(static_cast<T>(1));
# endif
// -- Constructors --
# if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT)

View File

@ -57,6 +57,11 @@ namespace glm
static GLM_RELAXED_CONSTEXPR precision prec = P;
# endif//GLM_META_PROG_HELPERS
# ifdef GLM_STATIC_CONST_MEMBERS
static const type ZERO;
static const type IDENTITY;
# endif
private:
col_type value[4];

View File

@ -32,6 +32,13 @@
namespace glm
{
# ifdef GLM_STATIC_CONST_MEMBERS
template<typename T, precision P>
const tmat4x2<T, P> tmat4x2<T, P>::ZERO(static_cast<T>(0));
template<typename T, precision P>
const tmat4x2<T, P> tmat4x2<T, P>::IDENTITY(static_cast<T>(1));
# endif
// -- Constructors --
# if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT)

View File

@ -57,6 +57,11 @@ namespace glm
static GLM_RELAXED_CONSTEXPR precision prec = P;
# endif//GLM_META_PROG_HELPERS
# ifdef GLM_STATIC_CONST_MEMBERS
static const type ZERO;
static const type IDENTITY;
# endif
private:
col_type value[4];

View File

@ -32,6 +32,13 @@
namespace glm
{
# ifdef GLM_STATIC_CONST_MEMBERS
template<typename T, precision P>
const tmat4x3<T, P> tmat4x3<T, P>::ZERO(static_cast<T>(0));
template<typename T, precision P>
const tmat4x3<T, P> tmat4x3<T, P>::IDENTITY(static_cast<T>(1));
# endif
// -- Constructors --
# if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT)

View File

@ -56,6 +56,11 @@ namespace glm
static GLM_RELAXED_CONSTEXPR precision prec = P;
# endif//GLM_META_PROG_HELPERS
# ifdef GLM_STATIC_CONST_MEMBERS
static const type ZERO;
static const type IDENTITY;
# endif
template <typename U, precision Q>
friend tvec4<U, Q> operator/(tmat4x4<U, Q> const & m, tvec4<U, Q> const & v);
template <typename U, precision Q>

View File

@ -92,6 +92,13 @@ namespace detail
}
}//namespace detail
# ifdef GLM_STATIC_CONST_MEMBERS
template<typename T, precision P>
const tmat4x4<T, P> tmat4x4<T, P>::ZERO(static_cast<T>(0));
template<typename T, precision P>
const tmat4x4<T, P> tmat4x4<T, P>::IDENTITY(static_cast<T>(1));
# endif
// -- Constructors --
# if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT)

View File

@ -59,6 +59,10 @@ namespace glm
static GLM_RELAXED_CONSTEXPR precision prec = P;
# endif//GLM_META_PROG_HELPERS
# ifdef GLM_STATIC_CONST_MEMBERS
static const type ZERO;
static const type X;
# endif
// -- Data --
# if GLM_HAS_ANONYMOUS_UNION

View File

@ -32,6 +32,13 @@
namespace glm
{
# ifdef GLM_STATIC_CONST_MEMBERS
template<typename T, precision P>
const tvec1<T, P> tvec1<T, P>::X(static_cast<T>(1));
template<typename T, precision P>
const tvec1<T, P> tvec1<T, P>::ZERO(static_cast<T>(0));
# endif
// -- Implicit basic constructors --
# if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT)

View File

@ -58,6 +58,13 @@ namespace glm
static GLM_RELAXED_CONSTEXPR precision prec = P;
# endif//GLM_META_PROG_HELPERS
# ifdef GLM_STATIC_CONST_MEMBERS
static const type ZERO;
static const type X;
static const type Y;
static const type XY;
# endif
// -- Data --
# if GLM_HAS_ANONYMOUS_UNION

View File

@ -28,6 +28,19 @@
namespace glm
{
# ifdef GLM_STATIC_CONST_MEMBERS
template <typename T, precision P>
const tvec2<T, P> tvec2<T, P>::ZERO(static_cast<T>(0), static_cast<T>(0));
template <typename T, precision P>
const tvec2<T, P> tvec2<T, P>::X(static_cast<T>(1), static_cast<T>(0));
template <typename T, precision P>
const tvec2<T, P> tvec2<T, P>::Y(static_cast<T>(0), static_cast<T>(1));
template <typename T, precision P>
const tvec2<T, P> tvec2<T, P>::XY(static_cast<T>(1), static_cast<T>(1));
# endif
// -- Implicit basic constructors --
# if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT)

View File

@ -58,6 +58,17 @@ namespace glm
static GLM_RELAXED_CONSTEXPR precision prec = P;
# endif//GLM_META_PROG_HELPERS
# ifdef GLM_STATIC_CONST_MEMBERS
static const type ZERO;
static const type X;
static const type Y;
static const type Z;
static const type XY;
static const type XZ;
static const type YZ;
static const type XYZ;
# endif
// -- Data --
# if GLM_HAS_ANONYMOUS_UNION

View File

@ -32,6 +32,32 @@
namespace glm
{
# ifdef GLM_STATIC_CONST_MEMBERS
template <typename T, precision P>
const tvec3<T, P> tvec3<T, P>::ZERO(static_cast<T>(0), static_cast<T>(0), static_cast<T>(0));
template <typename T, precision P>
const tvec3<T, P> tvec3<T, P>::X(static_cast<T>(1), static_cast<T>(0), static_cast<T>(0));
template <typename T, precision P>
const tvec3<T, P> tvec3<T, P>::Y(static_cast<T>(0), static_cast<T>(1), static_cast<T>(0));
template <typename T, precision P>
const tvec3<T, P> tvec3<T, P>::Z(static_cast<T>(0), static_cast<T>(0), static_cast<T>(1));
template <typename T, precision P>
const tvec3<T, P> tvec3<T, P>::XY(static_cast<T>(1), static_cast<T>(1), static_cast<T>(0));
template <typename T, precision P>
const tvec3<T, P> tvec3<T, P>::XZ(static_cast<T>(1), static_cast<T>(0), static_cast<T>(1));
template <typename T, precision P>
const tvec3<T, P> tvec3<T, P>::YZ(static_cast<T>(0), static_cast<T>(1), static_cast<T>(1));
template <typename T, precision P>
const tvec3<T, P> tvec3<T, P>::XYZ(static_cast<T>(1), static_cast<T>(1), static_cast<T>(1));
# endif
// -- Implicit basic constructors --
# if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT)

View File

@ -112,6 +112,25 @@ namespace detail
static GLM_RELAXED_CONSTEXPR precision prec = P;
# endif//GLM_META_PROG_HELPERS
# ifdef GLM_STATIC_CONST_MEMBERS
static const type ZERO;
static const type X;
static const type Y;
static const type Z;
static const type W;
static const type XY;
static const type XZ;
static const type XW;
static const type YZ;
static const type YW;
static const type ZW;
static const type XYZ;
static const type XYW;
static const type XZW;
static const type YZW;
static const type XYZW;
# endif
// -- Data --
# if GLM_HAS_ANONYMOUS_UNION && GLM_NOT_BUGGY_VC32BITS

View File

@ -32,6 +32,72 @@
namespace glm
{
# ifdef GLM_STATIC_CONST_MEMBERS
template <typename T, precision P>
const tvec4<T, P> tvec4<T, P>::ZERO
(static_cast<T>(0), static_cast<T>(0), static_cast<T>(0), static_cast<T>(0));
template <typename T, precision P>
const tvec4<T, P> tvec4<T, P>::X
(static_cast<T>(1), static_cast<T>(0), static_cast<T>(0), static_cast<T>(0));
template <typename T, precision P>
const tvec4<T, P> tvec4<T, P>::Y
(static_cast<T>(0), static_cast<T>(1), static_cast<T>(0), static_cast<T>(0));
template <typename T, precision P>
const tvec4<T, P> tvec4<T, P>::Z
(static_cast<T>(0), static_cast<T>(0), static_cast<T>(1), static_cast<T>(0));
template <typename T, precision P>
const tvec4<T, P> tvec4<T, P>::W
(static_cast<T>(0), static_cast<T>(0), static_cast<T>(0), static_cast<T>(1));
template <typename T, precision P>
const tvec4<T, P> tvec4<T, P>::XY
(static_cast<T>(1), static_cast<T>(1), static_cast<T>(0), static_cast<T>(0));
template <typename T, precision P>
const tvec4<T, P> tvec4<T, P>::XZ
(static_cast<T>(1), static_cast<T>(0), static_cast<T>(1), static_cast<T>(0));
template <typename T, precision P>
const tvec4<T, P> tvec4<T, P>::XW
(static_cast<T>(1), static_cast<T>(0), static_cast<T>(0), static_cast<T>(1));
template <typename T, precision P>
const tvec4<T, P> tvec4<T, P>::YZ
(static_cast<T>(0), static_cast<T>(1), static_cast<T>(1), static_cast<T>(0));
template <typename T, precision P>
const tvec4<T, P> tvec4<T, P>::YW
(static_cast<T>(0), static_cast<T>(1), static_cast<T>(0), static_cast<T>(1));
template <typename T, precision P>
const tvec4<T, P> tvec4<T, P>::ZW
(static_cast<T>(0), static_cast<T>(0), static_cast<T>(1), static_cast<T>(1));
template <typename T, precision P>
const tvec4<T, P> tvec4<T, P>::XYZ
(static_cast<T>(1), static_cast<T>(1), static_cast<T>(1), static_cast<T>(0));
template <typename T, precision P>
const tvec4<T, P> tvec4<T, P>::XYW
(static_cast<T>(1), static_cast<T>(1), static_cast<T>(0), static_cast<T>(1));
template <typename T, precision P>
const tvec4<T, P> tvec4<T, P>::XZW
(static_cast<T>(1), static_cast<T>(0), static_cast<T>(1), static_cast<T>(1));
template <typename T, precision P>
const tvec4<T, P> tvec4<T, P>::YZW
(static_cast<T>(0), static_cast<T>(1), static_cast<T>(1), static_cast<T>(1));
template <typename T, precision P>
const tvec4<T, P> tvec4<T, P>::XYZW
(static_cast<T>(1), static_cast<T>(1), static_cast<T>(1), static_cast<T>(1));
# endif
// -- Implicit basic constructors --
# if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT)

View File

@ -76,6 +76,26 @@ namespace glm
T x, y, z, w;
# ifdef GLM_STATIC_CONST_MEMBERS
static const type ZERO;
static const type IDENTITY;
static const type X;
static const type Y;
static const type Z;
static const type W;
static const type XY;
static const type XZ;
static const type XW;
static const type YZ;
static const type YW;
static const type ZW;
static const type XYZ;
static const type XYW;
static const type XZW;
static const type YZW;
static const type XYZW;
# endif
// -- Component accesses --
# ifdef GLM_FORCE_SIZE_FUNC

View File

@ -49,6 +49,73 @@ namespace detail
};
}//namespace detail
# ifdef GLM_STATIC_CONST_MEMBERS
template <typename T, precision P>
const tquat<T, P> tquat<T, P>::ZERO
(static_cast<T>(0), static_cast<T>(0), static_cast<T>(0), static_cast<T>(0));
template <typename T, precision P> const tquat<T, P> tquat<T, P>::IDENTITY;
template <typename T, precision P>
const tquat<T, P> tquat<T, P>::X
(static_cast<T>(0), static_cast<T>(1), static_cast<T>(0), static_cast<T>(0));
template <typename T, precision P>
const tquat<T, P> tquat<T, P>::Y
(static_cast<T>(0), static_cast<T>(0), static_cast<T>(1), static_cast<T>(0));
template <typename T, precision P>
const tquat<T, P> tquat<T, P>::Z
(static_cast<T>(0), static_cast<T>(0), static_cast<T>(0), static_cast<T>(1));
template <typename T, precision P>
const tquat<T, P> tquat<T, P>::W
(static_cast<T>(1), static_cast<T>(0), static_cast<T>(0), static_cast<T>(0));
template <typename T, precision P>
const tquat<T, P> tquat<T, P>::XY
(static_cast<T>(0), static_cast<T>(1), static_cast<T>(1), static_cast<T>(0));
template <typename T, precision P>
const tquat<T, P> tquat<T, P>::XZ
(static_cast<T>(0), static_cast<T>(0), static_cast<T>(1), static_cast<T>(1));
template <typename T, precision P>
const tquat<T, P> tquat<T, P>::XW
(static_cast<T>(1), static_cast<T>(1), static_cast<T>(0), static_cast<T>(0));
template <typename T, precision P>
const tquat<T, P> tquat<T, P>::YZ
(static_cast<T>(0), static_cast<T>(0), static_cast<T>(1), static_cast<T>(1));
template <typename T, precision P>
const tquat<T, P> tquat<T, P>::YW
(static_cast<T>(1), static_cast<T>(0), static_cast<T>(1), static_cast<T>(0));
template <typename T, precision P>
const tquat<T, P> tquat<T, P>::ZW
(static_cast<T>(1), static_cast<T>(0), static_cast<T>(0), static_cast<T>(1));
template <typename T, precision P>
const tquat<T, P> tquat<T, P>::XYZ
(static_cast<T>(0), static_cast<T>(1), static_cast<T>(1), static_cast<T>(1));
template <typename T, precision P>
const tquat<T, P> tquat<T, P>::XYW
(static_cast<T>(1), static_cast<T>(1), static_cast<T>(1), static_cast<T>(0));
template <typename T, precision P>
const tquat<T, P> tquat<T, P>::XZW
(static_cast<T>(1), static_cast<T>(1), static_cast<T>(0), static_cast<T>(1));
template <typename T, precision P>
const tquat<T, P> tquat<T, P>::YZW
(static_cast<T>(1), static_cast<T>(0), static_cast<T>(1), static_cast<T>(1));
template <typename T, precision P>
const tquat<T, P> tquat<T, P>::XYZW
(static_cast<T>(1), static_cast<T>(1), static_cast<T>(1), static_cast<T>(1));
# endif
// -- Component accesses --
# ifdef GLM_FORCE_SIZE_FUNC

View File

@ -83,6 +83,11 @@ namespace detail
static GLM_RELAXED_CONSTEXPR precision prec = defaultp;
# endif//GLM_META_PROG_HELPERS
# ifdef GLM_STATIC_CONST_MEMBERS
static const type ZERO;
static const type IDENTITY;
# endif
GLM_FUNC_DECL length_t length() const;
fvec4SIMD Data[4];

View File

@ -61,6 +61,11 @@ GLM_FUNC_QUALIFIER fvec4SIMD const & fmat4x4SIMD::operator[]
return this->Data[i];
}
#ifdef GLM_STATIC_CONST_MEMBERS
const fmat4x4SIMD fmat4x4SIMD::ZERO(static_cast<float>(0));
const fmat4x4SIMD fmat4x4SIMD::IDENTITY(static_cast<float>(1));
#endif
//////////////////////////////////////////////////////////////
// Constructors

View File

@ -91,6 +91,26 @@ namespace detail
__m128 Data;
#endif
# ifdef GLM_STATIC_CONST_MEMBERS
static const type ZERO;
static const type IDENTITY;
static const type X;
static const type Y;
static const type Z;
static const type W;
static const type XY;
static const type XZ;
static const type XW;
static const type YZ;
static const type YW;
static const type ZW;
static const type XYZ;
static const type XYW;
static const type XZW;
static const type YZW;
static const type XYZW;
# endif
//////////////////////////////////////
// Implicit basic constructors

View File

@ -51,6 +51,25 @@ void print(const fvec4SIMD &v)
}
#endif
# ifdef GLM_STATIC_CONST_MEMBERS
const fquatSIMD fquatSIMD::ZERO(0, 0, 0, 0);
const fquatSIMD fquatSIMD::IDENTITY(1, 0, 0, 0);
const fquatSIMD fquatSIMD::X(0, 1, 0, 0);
const fquatSIMD fquatSIMD::Y(0, 0, 1, 0);
const fquatSIMD fquatSIMD::Z(0, 0, 0, 1);
const fquatSIMD fquatSIMD::W(1, 0, 0, 0);
const fquatSIMD fquatSIMD::XY(0, 1, 1, 0);
const fquatSIMD fquatSIMD::XZ(0, 1, 0, 1);
const fquatSIMD fquatSIMD::XW(1, 1, 0, 0);
const fquatSIMD fquatSIMD::YZ(0, 0, 1, 1);
const fquatSIMD fquatSIMD::YW(1, 0, 1, 0);
const fquatSIMD fquatSIMD::ZW(1, 0, 0, 1);
const fquatSIMD fquatSIMD::XYZ(0, 1, 1, 1);
const fquatSIMD fquatSIMD::XYW(1, 1, 1, 0);
const fquatSIMD fquatSIMD::XZW(1, 1, 0, 1);
const fquatSIMD fquatSIMD::YZW(1, 0, 1, 1);
const fquatSIMD fquatSIMD::XYZW(1, 1, 1, 1);
# endif
//////////////////////////////////////
// Implicit basic constructors

View File

@ -114,6 +114,25 @@ namespace detail
__m128 Data;
#endif
# ifdef GLM_STATIC_CONST_MEMBERS
static const type ZERO;
static const type X;
static const type Y;
static const type Z;
static const type W;
static const type XY;
static const type XZ;
static const type XW;
static const type YZ;
static const type YW;
static const type ZW;
static const type XYZ;
static const type XYW;
static const type XZW;
static const type YZW;
static const type XYZW;
# endif
//////////////////////////////////////
// Implicit basic constructors
@ -167,15 +186,15 @@ namespace detail
//////////////////////////////////////
// Swizzle operators
template <comp X, comp Y, comp Z, comp W>
template <comp X_, comp Y_, comp Z_, comp W_>
fvec4SIMD& swizzle();
template <comp X, comp Y, comp Z, comp W>
template <comp X_, comp Y_, comp Z_, comp W_>
fvec4SIMD swizzle() const;
template <comp X, comp Y, comp Z>
template <comp X_, comp Y_, comp Z_>
fvec4SIMD swizzle() const;
template <comp X, comp Y>
template <comp X_, comp Y_>
fvec4SIMD swizzle() const;
template <comp X>
template <comp X_>
fvec4SIMD swizzle() const;
};
}//namespace detail

View File

@ -16,6 +16,25 @@ struct shuffle_mask
enum{value = Value};
};
# ifdef GLM_STATIC_CONST_MEMBERS
const fvec4SIMD fvec4SIMD::ZERO(0, 0, 0, 0);
const fvec4SIMD fvec4SIMD::X(1, 0, 0, 0);
const fvec4SIMD fvec4SIMD::Y(0, 1, 0, 0);
const fvec4SIMD fvec4SIMD::Z(0, 0, 1, 0);
const fvec4SIMD fvec4SIMD::W(0, 0, 0, 1);
const fvec4SIMD fvec4SIMD::XY(1, 1, 0, 0);
const fvec4SIMD fvec4SIMD::XZ(1, 0, 1, 0);
const fvec4SIMD fvec4SIMD::XW(1, 0, 0, 1);
const fvec4SIMD fvec4SIMD::YZ(0, 1, 1, 0);
const fvec4SIMD fvec4SIMD::YW(0, 1, 0, 1);
const fvec4SIMD fvec4SIMD::ZW(0, 0, 1, 1);
const fvec4SIMD fvec4SIMD::XYZ(1, 1, 1, 0);
const fvec4SIMD fvec4SIMD::XYW(1, 1, 0, 1);
const fvec4SIMD fvec4SIMD::XZW(1, 0, 1, 1);
const fvec4SIMD fvec4SIMD::YZW(0, 1, 1, 1);
const fvec4SIMD fvec4SIMD::XYZW(1, 1, 1, 1);
# endif
//////////////////////////////////////
// Implicit basic constructors
@ -167,21 +186,21 @@ GLM_FUNC_QUALIFIER fvec4SIMD& fvec4SIMD::operator--()
//////////////////////////////////////
// Swizzle operators
template <comp X, comp Y, comp Z, comp W>
template <comp X_, comp Y_, comp Z_, comp W_>
GLM_FUNC_QUALIFIER fvec4SIMD fvec4SIMD::swizzle() const
{
__m128 Data = _mm_shuffle_ps(
this->Data, this->Data,
shuffle_mask<(W << 6) | (Z << 4) | (Y << 2) | (X << 0)>::value);
shuffle_mask<(W_ << 6) | (Z_ << 4) | (Y_ << 2) | (X_ << 0)>::value);
return fvec4SIMD(Data);
}
template <comp X, comp Y, comp Z, comp W>
template <comp X_, comp Y_, comp Z_, comp W_>
GLM_FUNC_QUALIFIER fvec4SIMD& fvec4SIMD::swizzle()
{
this->Data = _mm_shuffle_ps(
this->Data, this->Data,
shuffle_mask<(W << 6) | (Z << 4) | (Y << 2) | (X << 0)>::value);
shuffle_mask<(W_ << 6) | (Z_ << 4) | (Y_ << 2) | (X_ << 0)>::value);
return *this;
}

View File

@ -29,6 +29,7 @@
/// @author Christophe Riccio
///////////////////////////////////////////////////////////////////////////////////
#define GLM_STATIC_CONST_MEMBERS
#include <glm/gtc/epsilon.hpp>
#include <glm/matrix.hpp>
#include <glm/vector_relational.hpp>
@ -86,6 +87,15 @@ int test_inverse()
return Error;
}
int test_static_const() {
int Error(0);
Error += glm::mat2x2(1) == glm::mat2x2::IDENTITY ? 0 : 1;
Error += glm::mat2x2(0) == glm::mat2x2::ZERO ? 0 : 1;
return Error;
}
int test_ctr()
{
int Error(0);
@ -173,6 +183,7 @@ int main()
#endif
Error += cast::test();
Error += test_static_const();
Error += test_ctr();
Error += test_operators();
Error += test_inverse();

View File

@ -29,6 +29,7 @@
/// @author Christophe Riccio
///////////////////////////////////////////////////////////////////////////////////
#define GLM_STATIC_CONST_MEMBERS
#include <glm/vector_relational.hpp>
#include <glm/mat2x2.hpp>
#include <glm/mat2x3.hpp>
@ -102,6 +103,16 @@ int test_ctr()
return Error;
}
int test_static_const() {
int Error(0);
Error += glm::mat2x3(1) == glm::mat2x3::IDENTITY ? 0 : 1;
Error += glm::mat2x3(0) == glm::mat2x3::ZERO ? 0 : 1;
return Error;
}
namespace cast
{
template <typename genType>
@ -147,6 +158,7 @@ int main()
#endif
Error += cast::test();
Error += test_static_const();
Error += test_ctr();
Error += test_operators();

View File

@ -29,6 +29,7 @@
/// @author Christophe Riccio
///////////////////////////////////////////////////////////////////////////////////
#define GLM_STATIC_CONST_MEMBERS
#include <glm/vector_relational.hpp>
#include <glm/mat2x2.hpp>
#include <glm/mat2x3.hpp>
@ -98,6 +99,15 @@ int test_ctr()
};
#endif//GLM_HAS_INITIALIZER_LISTS
return Error;
}
int test_static_const() {
int Error(0);
Error += glm::mat2x4(1) == glm::mat2x4::IDENTITY ? 0 : 1;
Error += glm::mat2x4(0) == glm::mat2x4::ZERO ? 0 : 1;
return Error;
}
@ -147,6 +157,7 @@ int main()
#endif
Error += cast::test();
Error += test_static_const();
Error += test_ctr();
Error += test_operators();

View File

@ -29,6 +29,7 @@
/// @author Christophe Riccio
///////////////////////////////////////////////////////////////////////////////////
#define GLM_STATIC_CONST_MEMBERS
#include <glm/vector_relational.hpp>
#include <glm/mat2x2.hpp>
#include <glm/mat2x3.hpp>
@ -106,6 +107,16 @@ int test_ctr()
return Error;
}
int test_static_const() {
int Error(0);
Error += glm::mat3x2(1) == glm::mat3x2::IDENTITY ? 0 : 1;
Error += glm::mat3x2(0) == glm::mat3x2::ZERO ? 0 : 1;
return Error;
}
namespace cast
{
template <typename genType>
@ -152,6 +163,7 @@ int main()
Error += cast::test();
Error += test_ctr();
Error += test_static_const();
Error += test_operators();
return Error;

View File

@ -29,6 +29,7 @@
/// @author Christophe Riccio
///////////////////////////////////////////////////////////////////////////////////
#define GLM_STATIC_CONST_MEMBERS
#include <glm/gtc/epsilon.hpp>
#include <glm/matrix.hpp>
#include <glm/vector_relational.hpp>
@ -165,6 +166,15 @@ int test_ctr()
return Error;
}
int test_static_const() {
int Error(0);
Error += glm::mat3x3(1) == glm::mat3x3::IDENTITY ? 0 : 1;
Error += glm::mat3x3(0) == glm::mat3x3::ZERO ? 0 : 1;
return Error;
}
namespace cast
{
template <typename genType>
@ -210,6 +220,7 @@ int main()
#endif
Error += cast::test();
Error += test_static_const();
Error += test_ctr();
Error += test_mat3x3();
Error += test_operators();

View File

@ -29,6 +29,7 @@
/// @author Christophe Riccio
///////////////////////////////////////////////////////////////////////////////////
#define GLM_STATIC_CONST_MEMBERS
#include <glm/vector_relational.hpp>
#include <glm/mat2x2.hpp>
#include <glm/mat2x3.hpp>
@ -106,6 +107,15 @@ int test_ctr()
return Error;
}
int test_static_const() {
int Error(0);
Error += glm::mat3x4(1) == glm::mat3x4::IDENTITY ? 0 : 1;
Error += glm::mat3x4(0) == glm::mat3x4::ZERO ? 0 : 1;
return Error;
}
namespace cast
{
template <typename genType>
@ -151,6 +161,7 @@ int main()
#endif
Error += cast::test();
Error += test_static_const();
Error += test_ctr();
Error += test_operators();

View File

@ -29,6 +29,7 @@
/// @author Christophe Riccio
///////////////////////////////////////////////////////////////////////////////////
#define GLM_STATIC_CONST_MEMBERS
#include <glm/vector_relational.hpp>
#include <glm/mat2x2.hpp>
#include <glm/mat2x3.hpp>
@ -110,6 +111,15 @@ int test_ctr()
return Error;
}
int test_static_const() {
int Error(0);
Error += glm::mat4x2(1) == glm::mat4x2::IDENTITY ? 0 : 1;
Error += glm::mat4x2(0) == glm::mat4x2::ZERO ? 0 : 1;
return Error;
}
namespace cast
{
template <typename genType>
@ -155,6 +165,7 @@ int main()
#endif
Error += cast::test();
Error += test_static_const();
Error += test_ctr();
Error += test_operators();

View File

@ -29,6 +29,7 @@
/// @author Christophe Riccio
///////////////////////////////////////////////////////////////////////////////////
#define GLM_STATIC_CONST_MEMBERS
#include <glm/vector_relational.hpp>
#include <glm/mat2x2.hpp>
#include <glm/mat2x3.hpp>
@ -110,6 +111,15 @@ int test_ctr()
return Error;
}
int test_static_const() {
int Error(0);
Error += glm::mat4x3(1) == glm::mat4x3::IDENTITY ? 0 : 1;
Error += glm::mat4x3(0) == glm::mat4x3::ZERO ? 0 : 1;
return Error;
}
namespace cast
{
template <typename genType>
@ -155,6 +165,7 @@ int main()
#endif
Error += cast::test();
Error += test_static_const();
Error += test_ctr();
Error += test_operators();

View File

@ -29,6 +29,7 @@
/// @author Christophe Riccio
///////////////////////////////////////////////////////////////////////////////////
#define GLM_STATIC_CONST_MEMBERS
#define GLM_SIMD
#include <glm/gtc/epsilon.hpp>
#include <glm/matrix.hpp>
@ -283,6 +284,15 @@ int perf_mul()
return Error;
}
int test_static_const() {
int Error(0);
Error += glm::mat4x4(1) == glm::mat4x4::IDENTITY ? 0 : 1;
Error += glm::mat4x4(0) == glm::mat4x4::ZERO ? 0 : 1;
return Error;
}
namespace cast
{
template <typename genType>
@ -339,6 +349,7 @@ int main()
Error += cast::test();
Error += test_ctr();
Error += test_static_const();
Error += test_inverse_dmat4x4();
Error += test_inverse_mat4x4();
Error += test_operators();

View File

@ -32,6 +32,7 @@
#if !(GLM_COMPILER & GLM_COMPILER_GCC)
# define GLM_META_PROG_HELPERS
#endif
#define GLM_STATIC_CONST_MEMBERS
#define GLM_SWIZZLE
#include <glm/vector_relational.hpp>
#include <glm/gtc/vec1.hpp>
@ -166,6 +167,18 @@ int test_vec1_operator_increment()
return Error;
}
int test_vec1_static_const() {
int Error = 0;
Error += (glm::vec1(1.0f) == glm::vec1::X) ? 0 : 1;
Error += (glm::ivec1(1) == glm::ivec1::X) ? 0 : 1;
Error += (glm::dvec1(1.0) == glm::dvec1::X) ? 0 : 1;
Error += (glm::bvec1(false) == glm::bvec1::ZERO) ? 0 : 1;
Error += (glm::uvec1(0) == glm::uvec1::ZERO) ? 0 : 1;
return Error;
}
int main()
{
int Error = 0;
@ -178,6 +191,7 @@ int main()
assert(glm::vec1::components == 1);
# endif
Error += test_vec1_static_const();
Error += test_vec1_size();
Error += test_vec1_ctor();
Error += test_vec1_operators();

View File

@ -29,6 +29,7 @@
/// @author Christophe Riccio
///////////////////////////////////////////////////////////////////////////////////
#define GLM_STATIC_CONST_MEMBERS
#if !(GLM_COMPILER & GLM_COMPILER_GCC)
# define GLM_META_PROG_HELPERS
#endif
@ -40,6 +41,7 @@
# include <type_traits>
#endif
int test_vec2_operators()
{
int Error = 0;
@ -331,6 +333,17 @@ int test_operator_increment()
return Error;
}
int test_vec2_static_const() {
int Error(0);
Error += (glm::ivec2(0, 0) == glm::ivec2::ZERO) ? 0 : 1;
Error += (glm::vec2(1, 0) == glm::vec2::X) ? 0 : 1;
Error += (glm::bvec2(false, true) == glm::bvec2::Y) ? 0 : 1;
Error += (glm::dvec2(1, 1) == glm::dvec2::XY) ? 0 : 1;
return Error;
}
int main()
{
int Error = 0;
@ -343,6 +356,7 @@ int main()
assert(glm::vec2::components == 2);
# endif
Error += test_vec2_static_const();
Error += test_vec2_size();
Error += test_vec2_ctor();
Error += test_vec2_operators();

View File

@ -33,6 +33,7 @@
# define GLM_META_PROG_HELPERS
#endif
#define GLM_SWIZZLE
#define GLM_STATIC_CONST_MEMBERS
#include <glm/vector_relational.hpp>
#include <glm/geometric.hpp>
#include <glm/vec2.hpp>
@ -493,6 +494,21 @@ int test_operator_increment()
return Error;
}
int test_vec3_static_const() {
int Error(0);
Error += (glm::ivec3(0, 0, 0) == glm::ivec3::ZERO) ? 0 : 1;
Error += (glm::vec3(1, 0, 0) == glm::vec3::X) ? 0 : 1;
Error += (glm::bvec3(false, true, false) == glm::bvec3::Y) ? 0 : 1;
Error += (glm::bvec3(false, false, true) == glm::bvec3::Z) ? 0 : 1;
Error += (glm::dvec3(1, 1, 0) == glm::dvec3::XY) ? 0 : 1;
Error += (glm::vec3(1, 0, 1) == glm::vec3::XZ) ? 0 : 1;
Error += (glm::uvec3(0u, 1u, 1u) == glm::uvec3::YZ) ? 0 : 1;
Error += (glm::dvec3(1, 1, 1) == glm::dvec3::XYZ) ? 0 : 1;
return Error;
}
int main()
{
int Error = 0;
@ -505,6 +521,7 @@ int main()
assert(glm::vec3::components == 3);
# endif
Error += test_vec3_static_const();
Error += test_vec3_ctor();
Error += test_vec3_operators();
Error += test_vec3_size();

View File

@ -33,6 +33,7 @@
# define GLM_META_PROG_HELPERS
#endif
#define GLM_SWIZZLE
#define GLM_STATIC_CONST_MEMBERS
#include <glm/vector_relational.hpp>
#include <glm/vec2.hpp>
#include <glm/vec3.hpp>
@ -376,6 +377,28 @@ int test_operator_increment()
return Error;
}
int test_vec4_static_const() {
int Error(0);
Error += (glm::ivec4(0, 0, 0, 0) == glm::ivec4::ZERO) ? 0 : 1;
Error += (glm::vec4(1, 0, 0, 0) == glm::vec4::X) ? 0 : 1;
Error += (glm::bvec4(false, true, false, false) == glm::bvec4::Y) ? 0 : 1;
Error += (glm::bvec4(false, false, true, false) == glm::bvec4::Z) ? 0 : 1;
Error += (glm::uvec4(0u, 0u, 0u, 1u) == glm::uvec4::W) ? 0 : 1;
Error += (glm::dvec4(1, 1, 0, 0) == glm::dvec4::XY) ? 0 : 1;
Error += (glm::vec4(1, 0, 1, 0) == glm::vec4::XZ) ? 0 : 1;
Error += (glm::vec4(1, 0, 0, 1) == glm::vec4::XW) ? 0 : 1;
Error += (glm::uvec4(0u, 1u, 1u, 0u) == glm::uvec4::YZ) ? 0 : 1;
Error += (glm::vec4(0, 1, 0, 1) == glm::vec4::YW) ? 0 : 1;
Error += (glm::dvec4(1, 1, 1, 0) == glm::dvec4::XYZ) ? 0 : 1;
Error += (glm::vec4(1, 1, 0, 1) == glm::vec4::XYW) ? 0 : 1;
Error += (glm::vec4(1, 0, 1, 1) == glm::vec4::XZW) ? 0 : 1;
Error += (glm::vec4(0, 1, 1, 1) == glm::vec4::YZW) ? 0 : 1;
Error += (glm::vec4(1, 1, 1, 1) == glm::vec4::XYZW) ? 0 : 1;
return Error;
}
struct AoS
{
glm::vec4 A;
@ -486,6 +509,7 @@ int main()
Error += test_vec4_perf_SoA(Size);
# endif//NDEBUG
Error += test_vec4_static_const();
Error += test_vec4_ctor();
Error += test_vec4_size();
Error += test_vec4_operators();

View File

@ -29,6 +29,7 @@
/// @author Christophe Riccio
///////////////////////////////////////////////////////////////////////////////////
#define GLM_STATIC_CONST_MEMBERS
#include <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp>
#include <glm/gtc/quaternion.hpp>
@ -252,6 +253,15 @@ int test_compute_gtx()
return 0;
}
int test_static_const() {
int Error(0);
Error += glm::mat4_cast(glm::simdMat4(static_cast<float>(1))) == glm::mat4_cast(glm::simdMat4::IDENTITY) ? 0 : 1;
Error += glm::mat4_cast(glm::simdMat4(static_cast<float>(0))) == glm::mat4_cast(glm::simdMat4::ZERO) ? 0 : 1;
return Error;
}
int main()
{
int Error = 0;
@ -313,7 +323,7 @@ int main()
Error += test_compute_glm();
Error += test_compute_gtx();
Error += test_static_const();
float Det = glm::determinant(glm::simdMat4(1.0));
Error += Det == 1.0f ? 0 : 1;

View File

@ -29,6 +29,8 @@
/// @author Christophe Riccio
///////////////////////////////////////////////////////////////////////////////////
#define GLM_STATIC_CONST_MEMBERS
#include <glm/glm.hpp>
#include <glm/gtx/simd_vec4.hpp>
#include <cstdio>