Added type to identify matrix, vector and quaternion at compile time

This commit is contained in:
Christophe Riccio 2015-10-01 23:09:06 +02:00
parent fa18ca7c2e
commit d23d909e6d
16 changed files with 158 additions and 0 deletions

View File

@ -42,4 +42,12 @@ namespace glm
simd,
defaultp = highp
};
template <typename T, precision P, template <typename, precision> class genType>
struct type
{
static bool const is_vec = false;
static bool const is_mat = false;
static bool const is_quat = false;
};
}//namespace glm

View File

@ -222,6 +222,16 @@ namespace glm
template <typename T, precision P>
GLM_FUNC_DECL bool operator!=(tmat2x2<T, P> const & m1, tmat2x2<T, P> const & m2);
// -- Is type --
template <typename T, precision P>
struct type<T, P, tmat2x2>
{
static bool const is_vec = false;
static bool const is_mat = true;
static bool const is_quat = false;
};
} //namespace glm
#ifndef GLM_EXTERNAL_TEMPLATE

View File

@ -199,6 +199,16 @@ namespace glm
template <typename T, precision P>
GLM_FUNC_DECL bool operator!=(tmat2x3<T, P> const & m1, tmat2x3<T, P> const & m2);
// -- Is type --
template <typename T, precision P>
struct type<T, P, tmat2x3>
{
static bool const is_vec = false;
static bool const is_mat = true;
static bool const is_quat = false;
};
}//namespace glm
#ifndef GLM_EXTERNAL_TEMPLATE

View File

@ -201,6 +201,16 @@ namespace glm
template <typename T, precision P>
GLM_FUNC_DECL bool operator!=(tmat2x4<T, P> const & m1, tmat2x4<T, P> const & m2);
// -- Is type --
template <typename T, precision P>
struct type<T, P, tmat2x4>
{
static bool const is_vec = false;
static bool const is_mat = true;
static bool const is_quat = false;
};
}//namespace glm
#ifndef GLM_EXTERNAL_TEMPLATE

View File

@ -206,6 +206,16 @@ namespace glm
template <typename T, precision P>
GLM_FUNC_DECL bool operator!=(tmat3x2<T, P> const & m1, tmat3x2<T, P> const & m2);
// -- Is type --
template <typename T, precision P>
struct type<T, P, tmat3x2>
{
static bool const is_vec = false;
static bool const is_mat = true;
static bool const is_quat = false;
};
}//namespace glm
#ifndef GLM_EXTERNAL_TEMPLATE

View File

@ -229,6 +229,16 @@ namespace glm
template <typename T, precision P>
GLM_FUNC_DECL bool operator!=(tmat3x3<T, P> const & m1, tmat3x3<T, P> const & m2);
// -- Is type --
template <typename T, precision P>
struct type<T, P, tmat3x3>
{
static bool const is_vec = false;
static bool const is_mat = true;
static bool const is_quat = false;
};
}//namespace glm
#ifndef GLM_EXTERNAL_TEMPLATE

View File

@ -206,6 +206,16 @@ namespace glm
template <typename T, precision P>
GLM_FUNC_DECL bool operator!=(tmat3x4<T, P> const & m1, tmat3x4<T, P> const & m2);
// -- Is type --
template <typename T, precision P>
struct type<T, P, tmat3x4>
{
static bool const is_vec = false;
static bool const is_mat = true;
static bool const is_quat = false;
};
}//namespace glm
#ifndef GLM_EXTERNAL_TEMPLATE

View File

@ -211,6 +211,16 @@ namespace glm
template <typename T, precision P>
GLM_FUNC_DECL bool operator!=(tmat4x2<T, P> const & m1, tmat4x2<T, P> const & m2);
// -- Is type --
template <typename T, precision P>
struct type<T, P, tmat4x2>
{
static bool const is_vec = false;
static bool const is_mat = true;
static bool const is_quat = false;
};
}//namespace glm
#ifndef GLM_EXTERNAL_TEMPLATE

View File

@ -211,6 +211,16 @@ namespace glm
template <typename T, precision P>
GLM_FUNC_DECL bool operator!=(tmat4x3<T, P> const & m1, tmat4x3<T, P> const & m2);
// -- Is type --
template <typename T, precision P>
struct type<T, P, tmat4x3>
{
static bool const is_vec = false;
static bool const is_mat = true;
static bool const is_quat = false;
};
}//namespace glm
#ifndef GLM_EXTERNAL_TEMPLATE

View File

@ -234,6 +234,16 @@ namespace glm
template <typename T, precision P>
GLM_FUNC_DECL bool operator!=(tmat4x4<T, P> const & m1, tmat4x4<T, P> const & m2);
// -- Is type --
template <typename T, precision P>
struct type<T, P, tmat4x4>
{
static bool const is_vec = false;
static bool const is_mat = true;
static bool const is_quat = false;
};
}//namespace glm
#ifndef GLM_EXTERNAL_TEMPLATE

View File

@ -309,6 +309,16 @@ namespace glm
template <typename T, precision P>
GLM_FUNC_DECL bool operator!=(tvec1<T, P> const & v1, tvec1<T, P> const & v2);
// -- Is type --
template <typename T, precision P>
struct type<T, P, tvec1>
{
static bool const is_vec = true;
static bool const is_mat = false;
static bool const is_quat = false;
};
}//namespace glm
#ifndef GLM_EXTERNAL_TEMPLATE

View File

@ -398,6 +398,16 @@ namespace glm
template <typename T, precision P>
GLM_FUNC_DECL bool operator!=(tvec2<T, P> const & v1, tvec2<T, P> const & v2);
// -- Is type --
template <typename T, precision P>
struct type<T, P, tvec2>
{
static bool const is_vec = true;
static bool const is_mat = false;
static bool const is_quat = false;
};
}//namespace glm
#ifndef GLM_EXTERNAL_TEMPLATE

View File

@ -417,6 +417,16 @@ namespace glm
template <typename T, precision P>
GLM_FUNC_DECL bool operator!=(tvec3<T, P> const & v1, tvec3<T, P> const & v2);
// -- Is type --
template <typename T, precision P>
struct type<T, P, tvec3>
{
static bool const is_vec = true;
static bool const is_mat = false;
static bool const is_quat = false;
};
}//namespace glm
#ifndef GLM_EXTERNAL_TEMPLATE

View File

@ -522,6 +522,16 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_DECL bool operator!=(tvec4<T, P> const & v1, tvec4<T, P> const & v2);
// -- Is type --
template <typename T, precision P>
struct type<T, P, tvec4>
{
static bool const is_vec = true;
static bool const is_mat = false;
static bool const is_quat = false;
};
}//namespace glm
#ifndef GLM_EXTERNAL_TEMPLATE

View File

@ -374,6 +374,16 @@ namespace glm
template <typename T, precision P>
GLM_FUNC_DECL tvec4<bool, P> notEqual(tquat<T, P> const & x, tquat<T, P> const & y);
/// @}
// -- Is type --
template <typename T, precision P>
struct type<T, P, tquat>
{
static bool const is_vec = false;
static bool const is_mat = false;
static bool const is_quat = true;
};
} //namespace glm
#include "quaternion.inl"

View File

@ -292,6 +292,16 @@ namespace glm
#endif
/// @}
// -- Is type --
template <typename T, precision P, template <typename, precision> class genType>
struct type<T, P, tdualquat>
{
static bool is_vec = false;
static bool is_mat = false;
static bool is_quat = true;
};
} //namespace glm
#include "dual_quaternion.inl"