From 47a6947736069c1d31715e424687342d1ef30bd9 Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Mon, 20 Oct 2014 02:22:53 +0200 Subject: [PATCH] Make detail::functor1 capable to return a different argument value_type than the argument value_type --- glm/detail/_vectorize.hpp | 34 +++++++++++++++---------------- glm/detail/func_common.inl | 16 +++++++-------- glm/detail/func_exponential.inl | 10 ++++----- glm/detail/func_trigonometric.inl | 28 ++++++++++++------------- 4 files changed, 44 insertions(+), 44 deletions(-) diff --git a/glm/detail/_vectorize.hpp b/glm/detail/_vectorize.hpp index 7982e4eb..b5fde689 100644 --- a/glm/detail/_vectorize.hpp +++ b/glm/detail/_vectorize.hpp @@ -36,42 +36,42 @@ namespace glm{ namespace detail { - template class vecType> + template class vecType> struct functor1{}; - template - struct functor1 + template + struct functor1 { - GLM_FUNC_QUALIFIER static tvec1 call(T (*Func) (T x), tvec1 const & v) + GLM_FUNC_QUALIFIER static tvec1 call(T (*Func) (T x), tvec1 const & v) { - return tvec1(Func(v.x)); + return tvec1(Func(v.x)); } }; - template - struct functor1 + template + struct functor1 { - GLM_FUNC_QUALIFIER static tvec2 call(T (*Func) (T x), tvec2 const & v) + GLM_FUNC_QUALIFIER static tvec2 call(T (*Func) (T x), tvec2 const & v) { - return tvec2(Func(v.x), Func(v.y)); + return tvec2(Func(v.x), Func(v.y)); } }; - template - struct functor1 + template + struct functor1 { - GLM_FUNC_QUALIFIER static tvec3 call(T (*Func) (T x), tvec3 const & v) + GLM_FUNC_QUALIFIER static tvec3 call(T (*Func) (T x), tvec3 const & v) { - return tvec3(Func(v.x), Func(v.y), Func(v.z)); + return tvec3(Func(v.x), Func(v.y), Func(v.z)); } }; - template - struct functor1 + template + struct functor1 { - GLM_FUNC_QUALIFIER static tvec4 call(T (*Func) (T x), tvec4 const & v) + GLM_FUNC_QUALIFIER static tvec4 call(T (*Func) (T x), tvec4 const & v) { - return tvec4(Func(v.x), Func(v.y), Func(v.z), Func(v.w)); + return tvec4(Func(v.x), Func(v.y), Func(v.z), Func(v.w)); } }; diff --git a/glm/detail/func_common.inl b/glm/detail/func_common.inl index 74117ff3..2fe3aaa7 100644 --- a/glm/detail/func_common.inl +++ b/glm/detail/func_common.inl @@ -139,7 +139,7 @@ namespace detail template class vecType> GLM_FUNC_QUALIFIER vecType abs(vecType const & x) { - return detail::functor1::call(abs, x); + return detail::functor1::call(abs, x); } // sign @@ -164,7 +164,7 @@ namespace detail template class vecType> GLM_FUNC_QUALIFIER vecType sign(vecType const & x) { - return detail::functor1::call(sign, x); + return detail::functor1::call(sign, x); } // floor @@ -173,7 +173,7 @@ namespace detail template class vecType> GLM_FUNC_QUALIFIER vecType floor(vecType const & x) { - return detail::functor1::call(::std::floor, x); + return detail::functor1::call(::std::floor, x); } // trunc @@ -192,7 +192,7 @@ namespace detail template class vecType> GLM_FUNC_QUALIFIER vecType trunc(vecType const & x) { - return detail::functor1::call(::std::trunc, x); + return detail::functor1::call(::std::trunc, x); } // round @@ -211,7 +211,7 @@ namespace detail template class vecType> GLM_FUNC_QUALIFIER vecType round(vecType const & x) { - return detail::functor1::call(round, x); + return detail::functor1::call(round, x); } /* @@ -260,7 +260,7 @@ namespace detail template class vecType> GLM_FUNC_QUALIFIER vecType roundEven(vecType const & x) { - return detail::functor1::call(roundEven, x); + return detail::functor1::call(roundEven, x); } // ceil @@ -269,7 +269,7 @@ namespace detail template class vecType> GLM_FUNC_QUALIFIER vecType ceil(vecType const & x) { - return detail::functor1::call(::std::ceil, x); + return detail::functor1::call(::std::ceil, x); } // fract @@ -284,7 +284,7 @@ namespace detail template class vecType> GLM_FUNC_QUALIFIER vecType fract(vecType const & x) { - return detail::functor1::call(fract, x); + return detail::functor1::call(fract, x); } // mod diff --git a/glm/detail/func_exponential.inl b/glm/detail/func_exponential.inl index 146ef5c9..26fa514f 100644 --- a/glm/detail/func_exponential.inl +++ b/glm/detail/func_exponential.inl @@ -91,7 +91,7 @@ namespace detail template class vecType> GLM_FUNC_QUALIFIER vecType exp(vecType const & x) { - return detail::functor1::call(::std::exp, x); + return detail::functor1::call(::std::exp, x); } // log @@ -99,7 +99,7 @@ namespace detail template class vecType> GLM_FUNC_QUALIFIER vecType log(vecType const & x) { - return detail::functor1::call(::std::log, x); + return detail::functor1::call(::std::log, x); } //exp2, ln2 = 0.69314718055994530941723212145818f @@ -114,7 +114,7 @@ namespace detail template class vecType> GLM_FUNC_QUALIFIER vecType exp2(vecType const & x) { - return detail::functor1::call(exp2, x); + return detail::functor1::call(exp2, x); } // log2, ln2 = 0.69314718055994530941723212145818f @@ -131,7 +131,7 @@ namespace detail template class vecType> GLM_FUNC_QUALIFIER vecType log2(vecType const & x) { - return detail::functor1::call(log2, x); + return detail::functor1::call(log2, x); } // sqrt @@ -140,7 +140,7 @@ namespace detail GLM_FUNC_QUALIFIER vecType sqrt(vecType const & x) { GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'sqrt' only accept floating-point inputs"); - return detail::functor1::call(sqrt, x); + return detail::functor1::call(sqrt, x); } // inversesqrt diff --git a/glm/detail/func_trigonometric.inl b/glm/detail/func_trigonometric.inl index 99e04dda..1d50181c 100644 --- a/glm/detail/func_trigonometric.inl +++ b/glm/detail/func_trigonometric.inl @@ -44,7 +44,7 @@ namespace glm template class vecType> GLM_FUNC_QUALIFIER vecType radians(vecType const & v) { - return detail::functor1::call(radians, v); + return detail::functor1::call(radians, v); } // degrees @@ -59,7 +59,7 @@ namespace glm template class vecType> GLM_FUNC_QUALIFIER vecType degrees(vecType const & v) { - return detail::functor1::call(degrees, v); + return detail::functor1::call(degrees, v); } // sin @@ -68,7 +68,7 @@ namespace glm template class vecType> GLM_FUNC_QUALIFIER vecType sin(vecType const & v) { - return detail::functor1::call(sin, v); + return detail::functor1::call(sin, v); } // cos @@ -77,7 +77,7 @@ namespace glm template class vecType> GLM_FUNC_QUALIFIER vecType cos(vecType const & v) { - return detail::functor1::call(cos, v); + return detail::functor1::call(cos, v); } // tan @@ -86,7 +86,7 @@ namespace glm template class vecType> GLM_FUNC_QUALIFIER vecType tan(vecType const & v) { - return detail::functor1::call(tan, v); + return detail::functor1::call(tan, v); } // asin @@ -95,7 +95,7 @@ namespace glm template class vecType> GLM_FUNC_QUALIFIER vecType asin(vecType const & v) { - return detail::functor1::call(asin, v); + return detail::functor1::call(asin, v); } // acos @@ -104,7 +104,7 @@ namespace glm template class vecType> GLM_FUNC_QUALIFIER vecType acos(vecType const & v) { - return detail::functor1::call(acos, v); + return detail::functor1::call(acos, v); } // atan @@ -127,7 +127,7 @@ namespace glm template class vecType> GLM_FUNC_QUALIFIER vecType atan(vecType const & v) { - return detail::functor1::call(atan, v); + return detail::functor1::call(atan, v); } // sinh @@ -136,7 +136,7 @@ namespace glm template class vecType> GLM_FUNC_QUALIFIER vecType sinh(vecType const & v) { - return detail::functor1::call(sinh, v); + return detail::functor1::call(sinh, v); } // cosh @@ -145,7 +145,7 @@ namespace glm template class vecType> GLM_FUNC_QUALIFIER vecType cosh(vecType const & v) { - return detail::functor1::call(cosh, v); + return detail::functor1::call(cosh, v); } // tanh @@ -154,7 +154,7 @@ namespace glm template class vecType> GLM_FUNC_QUALIFIER vecType tanh(vecType const & v) { - return detail::functor1::call(tanh, v); + return detail::functor1::call(tanh, v); } // asinh @@ -173,7 +173,7 @@ namespace glm template class vecType> GLM_FUNC_QUALIFIER vecType asinh(vecType const & v) { - return detail::functor1::call(asinh, v); + return detail::functor1::call(asinh, v); } // acosh @@ -194,7 +194,7 @@ namespace glm template class vecType> GLM_FUNC_QUALIFIER vecType acosh(vecType const & v) { - return detail::functor1::call(acosh, v); + return detail::functor1::call(acosh, v); } // atanh @@ -215,6 +215,6 @@ namespace glm template class vecType> GLM_FUNC_QUALIFIER vecType atanh(vecType const & v) { - return detail::functor1::call(atanh, v); + return detail::functor1::call(atanh, v); } }//namespace glm