From d23d909e6d6b109827e7d91d5d53b77128a5043f Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Thu, 1 Oct 2015 23:09:06 +0200 Subject: [PATCH] Added type to identify matrix, vector and quaternion at compile time --- glm/detail/precision.hpp | 8 ++++++++ glm/detail/type_mat2x2.hpp | 10 ++++++++++ glm/detail/type_mat2x3.hpp | 10 ++++++++++ glm/detail/type_mat2x4.hpp | 10 ++++++++++ glm/detail/type_mat3x2.hpp | 10 ++++++++++ glm/detail/type_mat3x3.hpp | 10 ++++++++++ glm/detail/type_mat3x4.hpp | 10 ++++++++++ glm/detail/type_mat4x2.hpp | 10 ++++++++++ glm/detail/type_mat4x3.hpp | 10 ++++++++++ glm/detail/type_mat4x4.hpp | 10 ++++++++++ glm/detail/type_vec1.hpp | 10 ++++++++++ glm/detail/type_vec2.hpp | 10 ++++++++++ glm/detail/type_vec3.hpp | 10 ++++++++++ glm/detail/type_vec4.hpp | 10 ++++++++++ glm/gtc/quaternion.hpp | 10 ++++++++++ glm/gtx/dual_quaternion.hpp | 10 ++++++++++ 16 files changed, 158 insertions(+) diff --git a/glm/detail/precision.hpp b/glm/detail/precision.hpp index c657d031..32785b94 100644 --- a/glm/detail/precision.hpp +++ b/glm/detail/precision.hpp @@ -42,4 +42,12 @@ namespace glm simd, defaultp = highp }; + + template class genType> + struct type + { + static bool const is_vec = false; + static bool const is_mat = false; + static bool const is_quat = false; + }; }//namespace glm diff --git a/glm/detail/type_mat2x2.hpp b/glm/detail/type_mat2x2.hpp index aa0c81d7..13840689 100644 --- a/glm/detail/type_mat2x2.hpp +++ b/glm/detail/type_mat2x2.hpp @@ -222,6 +222,16 @@ namespace glm template GLM_FUNC_DECL bool operator!=(tmat2x2 const & m1, tmat2x2 const & m2); + + // -- Is type -- + + template + struct type + { + static bool const is_vec = false; + static bool const is_mat = true; + static bool const is_quat = false; + }; } //namespace glm #ifndef GLM_EXTERNAL_TEMPLATE diff --git a/glm/detail/type_mat2x3.hpp b/glm/detail/type_mat2x3.hpp index 4cacc46c..755c7cb9 100644 --- a/glm/detail/type_mat2x3.hpp +++ b/glm/detail/type_mat2x3.hpp @@ -199,6 +199,16 @@ namespace glm template GLM_FUNC_DECL bool operator!=(tmat2x3 const & m1, tmat2x3 const & m2); + + // -- Is type -- + + template + struct type + { + static bool const is_vec = false; + static bool const is_mat = true; + static bool const is_quat = false; + }; }//namespace glm #ifndef GLM_EXTERNAL_TEMPLATE diff --git a/glm/detail/type_mat2x4.hpp b/glm/detail/type_mat2x4.hpp index d87ce074..4cba2cb8 100644 --- a/glm/detail/type_mat2x4.hpp +++ b/glm/detail/type_mat2x4.hpp @@ -201,6 +201,16 @@ namespace glm template GLM_FUNC_DECL bool operator!=(tmat2x4 const & m1, tmat2x4 const & m2); + + // -- Is type -- + + template + struct type + { + static bool const is_vec = false; + static bool const is_mat = true; + static bool const is_quat = false; + }; }//namespace glm #ifndef GLM_EXTERNAL_TEMPLATE diff --git a/glm/detail/type_mat3x2.hpp b/glm/detail/type_mat3x2.hpp index ac2ea0d4..52890f19 100644 --- a/glm/detail/type_mat3x2.hpp +++ b/glm/detail/type_mat3x2.hpp @@ -206,6 +206,16 @@ namespace glm template GLM_FUNC_DECL bool operator!=(tmat3x2 const & m1, tmat3x2 const & m2); + + // -- Is type -- + + template + struct type + { + static bool const is_vec = false; + static bool const is_mat = true; + static bool const is_quat = false; + }; }//namespace glm #ifndef GLM_EXTERNAL_TEMPLATE diff --git a/glm/detail/type_mat3x3.hpp b/glm/detail/type_mat3x3.hpp index 7b0945ac..58b2e7fe 100644 --- a/glm/detail/type_mat3x3.hpp +++ b/glm/detail/type_mat3x3.hpp @@ -229,6 +229,16 @@ namespace glm template GLM_FUNC_DECL bool operator!=(tmat3x3 const & m1, tmat3x3 const & m2); + + // -- Is type -- + + template + struct type + { + static bool const is_vec = false; + static bool const is_mat = true; + static bool const is_quat = false; + }; }//namespace glm #ifndef GLM_EXTERNAL_TEMPLATE diff --git a/glm/detail/type_mat3x4.hpp b/glm/detail/type_mat3x4.hpp index 8f59f2ad..4bf6ab18 100644 --- a/glm/detail/type_mat3x4.hpp +++ b/glm/detail/type_mat3x4.hpp @@ -206,6 +206,16 @@ namespace glm template GLM_FUNC_DECL bool operator!=(tmat3x4 const & m1, tmat3x4 const & m2); + + // -- Is type -- + + template + struct type + { + static bool const is_vec = false; + static bool const is_mat = true; + static bool const is_quat = false; + }; }//namespace glm #ifndef GLM_EXTERNAL_TEMPLATE diff --git a/glm/detail/type_mat4x2.hpp b/glm/detail/type_mat4x2.hpp index 65666d5c..5c050e26 100644 --- a/glm/detail/type_mat4x2.hpp +++ b/glm/detail/type_mat4x2.hpp @@ -211,6 +211,16 @@ namespace glm template GLM_FUNC_DECL bool operator!=(tmat4x2 const & m1, tmat4x2 const & m2); + + // -- Is type -- + + template + struct type + { + static bool const is_vec = false; + static bool const is_mat = true; + static bool const is_quat = false; + }; }//namespace glm #ifndef GLM_EXTERNAL_TEMPLATE diff --git a/glm/detail/type_mat4x3.hpp b/glm/detail/type_mat4x3.hpp index 55c0b516..74b8364b 100644 --- a/glm/detail/type_mat4x3.hpp +++ b/glm/detail/type_mat4x3.hpp @@ -211,6 +211,16 @@ namespace glm template GLM_FUNC_DECL bool operator!=(tmat4x3 const & m1, tmat4x3 const & m2); + + // -- Is type -- + + template + struct type + { + static bool const is_vec = false; + static bool const is_mat = true; + static bool const is_quat = false; + }; }//namespace glm #ifndef GLM_EXTERNAL_TEMPLATE diff --git a/glm/detail/type_mat4x4.hpp b/glm/detail/type_mat4x4.hpp index 5d36b490..e00b3ac3 100644 --- a/glm/detail/type_mat4x4.hpp +++ b/glm/detail/type_mat4x4.hpp @@ -234,6 +234,16 @@ namespace glm template GLM_FUNC_DECL bool operator!=(tmat4x4 const & m1, tmat4x4 const & m2); + + // -- Is type -- + + template + struct type + { + static bool const is_vec = false; + static bool const is_mat = true; + static bool const is_quat = false; + }; }//namespace glm #ifndef GLM_EXTERNAL_TEMPLATE diff --git a/glm/detail/type_vec1.hpp b/glm/detail/type_vec1.hpp index e18c8a3a..943290bb 100644 --- a/glm/detail/type_vec1.hpp +++ b/glm/detail/type_vec1.hpp @@ -309,6 +309,16 @@ namespace glm template GLM_FUNC_DECL bool operator!=(tvec1 const & v1, tvec1 const & v2); + + // -- Is type -- + + template + struct type + { + static bool const is_vec = true; + static bool const is_mat = false; + static bool const is_quat = false; + }; }//namespace glm #ifndef GLM_EXTERNAL_TEMPLATE diff --git a/glm/detail/type_vec2.hpp b/glm/detail/type_vec2.hpp index 2f78c67e..521e8ccc 100644 --- a/glm/detail/type_vec2.hpp +++ b/glm/detail/type_vec2.hpp @@ -398,6 +398,16 @@ namespace glm template GLM_FUNC_DECL bool operator!=(tvec2 const & v1, tvec2 const & v2); + + // -- Is type -- + + template + struct type + { + static bool const is_vec = true; + static bool const is_mat = false; + static bool const is_quat = false; + }; }//namespace glm #ifndef GLM_EXTERNAL_TEMPLATE diff --git a/glm/detail/type_vec3.hpp b/glm/detail/type_vec3.hpp index 4b7fa1a6..98dd74f8 100644 --- a/glm/detail/type_vec3.hpp +++ b/glm/detail/type_vec3.hpp @@ -417,6 +417,16 @@ namespace glm template GLM_FUNC_DECL bool operator!=(tvec3 const & v1, tvec3 const & v2); + + // -- Is type -- + + template + struct type + { + static bool const is_vec = true; + static bool const is_mat = false; + static bool const is_quat = false; + }; }//namespace glm #ifndef GLM_EXTERNAL_TEMPLATE diff --git a/glm/detail/type_vec4.hpp b/glm/detail/type_vec4.hpp index ffe8066f..2d110c31 100644 --- a/glm/detail/type_vec4.hpp +++ b/glm/detail/type_vec4.hpp @@ -522,6 +522,16 @@ namespace detail template GLM_FUNC_DECL bool operator!=(tvec4 const & v1, tvec4 const & v2); + + // -- Is type -- + + template + struct type + { + static bool const is_vec = true; + static bool const is_mat = false; + static bool const is_quat = false; + }; }//namespace glm #ifndef GLM_EXTERNAL_TEMPLATE diff --git a/glm/gtc/quaternion.hpp b/glm/gtc/quaternion.hpp index 71817dfa..25df0f22 100644 --- a/glm/gtc/quaternion.hpp +++ b/glm/gtc/quaternion.hpp @@ -374,6 +374,16 @@ namespace glm template GLM_FUNC_DECL tvec4 notEqual(tquat const & x, tquat const & y); /// @} + + // -- Is type -- + + template + struct type + { + static bool const is_vec = false; + static bool const is_mat = false; + static bool const is_quat = true; + }; } //namespace glm #include "quaternion.inl" diff --git a/glm/gtx/dual_quaternion.hpp b/glm/gtx/dual_quaternion.hpp index 1c26b34d..6c7bee9e 100644 --- a/glm/gtx/dual_quaternion.hpp +++ b/glm/gtx/dual_quaternion.hpp @@ -292,6 +292,16 @@ namespace glm #endif /// @} + + // -- Is type -- + + template class genType> + struct type + { + static bool is_vec = false; + static bool is_mat = false; + static bool is_quat = true; + }; } //namespace glm #include "dual_quaternion.inl"