Merge pull request #720 from yuri-kilochek/master

(UPDATE for #717) Remove redundant specializations of `glm::type` for `glm::mat`s and some accompanying cleanup.  #720
This commit is contained in:
Christophe 2018-01-09 19:34:56 +01:00 committed by GitHub
commit 18e413940a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 71 additions and 144 deletions

View File

@ -17,18 +17,7 @@
#endif
// Dependency:
#include "../detail/type_vec2.hpp"
#include "../detail/type_vec3.hpp"
#include "../detail/type_vec4.hpp"
#include "../detail/type_mat2x2.hpp"
#include "../detail/type_mat2x3.hpp"
#include "../detail/type_mat2x4.hpp"
#include "../detail/type_mat3x2.hpp"
#include "../detail/type_mat3x3.hpp"
#include "../detail/type_mat3x4.hpp"
#include "../detail/type_mat4x2.hpp"
#include "../detail/type_mat4x3.hpp"
#include "../detail/type_mat4x4.hpp"
#include "../detail/qualifier.hpp"
#include "../gtc/quaternion.hpp"
#include "../gtx/dual_quaternion.hpp"
@ -58,136 +47,18 @@ namespace glm
static bool const is_vec = true;
static bool const is_mat = false;
static bool const is_quat = false;
enum
{
components = L
};
static length_t const components = L;
};
template<typename T, qualifier Q>
struct type<mat<2, 2, T, Q> >
template<length_t C, length_t R, typename T, qualifier Q>
struct type<mat<C, R, T, Q> >
{
static bool const is_vec = false;
static bool const is_mat = true;
static bool const is_quat = false;
enum
{
components = 2,
cols = 2,
rows = 2
};
};
template<typename T, qualifier Q>
struct type<mat<2, 3, T, Q> >
{
static bool const is_vec = false;
static bool const is_mat = true;
static bool const is_quat = false;
enum
{
components = 2,
cols = 2,
rows = 3
};
};
template<typename T, qualifier Q>
struct type<mat<2, 4, T, Q> >
{
static bool const is_vec = false;
static bool const is_mat = true;
static bool const is_quat = false;
enum
{
components = 2,
cols = 2,
rows = 4
};
};
template<typename T, qualifier Q>
struct type<mat<3, 2, T, Q> >
{
static bool const is_vec = false;
static bool const is_mat = true;
static bool const is_quat = false;
enum
{
components = 3,
cols = 3,
rows = 2
};
};
template<typename T, qualifier Q>
struct type<mat<3, 3, T, Q> >
{
static bool const is_vec = false;
static bool const is_mat = true;
static bool const is_quat = false;
enum
{
components = 3,
cols = 3,
rows = 3
};
};
template<typename T, qualifier Q>
struct type<mat<3, 4, T, Q> >
{
static bool const is_vec = false;
static bool const is_mat = true;
static bool const is_quat = false;
enum
{
components = 3,
cols = 3,
rows = 4
};
};
template<typename T, qualifier Q>
struct type<mat<4, 2, T, Q> >
{
static bool const is_vec = false;
static bool const is_mat = true;
static bool const is_quat = false;
enum
{
components = 4,
cols = 4,
rows = 2
};
};
template<typename T, qualifier Q>
struct type<mat<4, 3, T, Q> >
{
static bool const is_vec = false;
static bool const is_mat = true;
static bool const is_quat = false;
enum
{
components = 4,
cols = 4,
rows = 3
};
};
template<typename T, qualifier Q>
struct type<mat<4, 4, T, Q> >
{
static bool const is_vec = false;
static bool const is_mat = true;
static bool const is_quat = false;
enum
{
components = 4,
cols = 4,
rows = 4
};
static length_t const components = C;
static length_t const cols = C;
static length_t const rows = R;
};
template<typename T, qualifier Q>
@ -196,10 +67,7 @@ namespace glm
static bool const is_vec = false;
static bool const is_mat = false;
static bool const is_quat = true;
enum
{
components = 4
};
static length_t const components = 4;
};
template<typename T, qualifier Q>
@ -208,10 +76,7 @@ namespace glm
static bool const is_vec = false;
static bool const is_mat = false;
static bool const is_quat = true;
enum
{
components = 8
};
static length_t const components = 8;
};
/// @}

View File

@ -0,0 +1,62 @@
/// @ref gtx_type_trait
/// @file glm/gtx/type_trait.inl
namespace glm
{
template<typename T>
bool const type<T>::is_vec;
template<typename T>
bool const type<T>::is_mat;
template<typename T>
bool const type<T>::is_quat;
template<typename T>
length_t const type<T>::components;
template<typename T>
length_t const type<T>::cols;
template<typename T>
length_t const type<T>::rows;
// vec
template<length_t L, typename T, qualifier Q>
bool const type<vec<L, T, Q> >::is_vec;
template<length_t L, typename T, qualifier Q>
bool const type<vec<L, T, Q> >::is_mat;
template<length_t L, typename T, qualifier Q>
bool const type<vec<L, T, Q> >::is_quat;
template<length_t L, typename T, qualifier Q>
length_t const type<vec<L, T, Q> >::components;
// mat
template<length_t C, length_t R, typename T, qualifier Q>
bool const type<mat<C, R, T, Q> >::is_vec;
template<length_t C, length_t R, typename T, qualifier Q>
bool const type<mat<C, R, T, Q> >::is_mat;
template<length_t C, length_t R, typename T, qualifier Q>
bool const type<mat<C, R, T, Q> >::is_quat;
template<length_t C, length_t R, typename T, qualifier Q>
length_t const type<mat<C, R, T, Q> >::components;
template<length_t C, length_t R, typename T, qualifier Q>
length_t const type<mat<C, R, T, Q> >::cols;
template<length_t C, length_t R, typename T, qualifier Q>
length_t const type<mat<C, R, T, Q> >::rows;
// tquat
template<typename T, qualifier Q>
bool const type<tquat<T, Q> >::is_vec;
template<typename T, qualifier Q>
bool const type<tquat<T, Q> >::is_mat;
template<typename T, qualifier Q>
bool const type<tquat<T, Q> >::is_quat;
template<typename T, qualifier Q>
length_t const type<tquat<T, Q> >::components;
// tdualquat
template<typename T, qualifier Q>
bool const type<tdualquat<T, Q> >::is_vec;
template<typename T, qualifier Q>
bool const type<tdualquat<T, Q> >::is_mat;
template<typename T, qualifier Q>
bool const type<tdualquat<T, Q> >::is_quat;
template<typename T, qualifier Q>
length_t const type<tdualquat<T, Q> >::components;
}//namespace glm