From ac3abfdac7e8e27ea28a595c86ed6a151a49ab15 Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Tue, 15 Aug 2017 19:07:25 +0200 Subject: [PATCH] Replaced vecType template argument by vec template --- glm/detail/func_common.hpp | 53 ++++++++++++++++--------------- glm/detail/func_common.inl | 2 +- glm/detail/func_trigonometric.hpp | 4 ++- glm/detail/precision.hpp | 1 + test/core/core_func_integer.cpp | 16 +++++----- 5 files changed, 40 insertions(+), 36 deletions(-) diff --git a/glm/detail/func_common.hpp b/glm/detail/func_common.hpp index 4cf8f581..b5cb10ae 100644 --- a/glm/detail/func_common.hpp +++ b/glm/detail/func_common.hpp @@ -26,6 +26,7 @@ namespace glm /// /// @see GLSL abs man page /// @see GLSL 4.20.8 specification, section 8.3 Common Functions + /// @see precision template GLM_FUNC_DECL genType abs(genType x); @@ -33,7 +34,7 @@ namespace glm /// /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector /// @tparam T Floating-point or signed integer scalar types - /// @tparam P Enumeration value precision + /// @tparam P Value from precision enum /// /// @see GLSL abs man page /// @see GLSL 4.20.8 specification, section 8.3 Common Functions @@ -44,7 +45,7 @@ namespace glm /// /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector /// @tparam T Floating-point scalar types - /// @tparam P Enumeration value precision + /// @tparam P Value from precision enum /// /// @see GLSL sign man page /// @see GLSL 4.20.8 specification, section 8.3 Common Functions @@ -55,7 +56,7 @@ namespace glm /// /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector /// @tparam T Floating-point scalar types - /// @tparam P Enumeration value precision + /// @tparam P Value from precision enum /// /// @see GLSL floor man page /// @see GLSL 4.20.8 specification, section 8.3 Common Functions @@ -67,7 +68,7 @@ namespace glm /// /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector /// @tparam T Floating-point scalar types - /// @tparam P Enumeration value precision + /// @tparam P Value from precision enum /// /// @see GLSL trunc man page /// @see GLSL 4.20.8 specification, section 8.3 Common Functions @@ -82,7 +83,7 @@ namespace glm /// /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector /// @tparam T Floating-point scalar types - /// @tparam P Enumeration value precision + /// @tparam P Value from precision enum /// /// @see GLSL round man page /// @see GLSL 4.20.8 specification, section 8.3 Common Functions @@ -95,7 +96,7 @@ namespace glm /// /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector /// @tparam T Floating-point scalar types - /// @tparam P Enumeration value precision + /// @tparam P Value from precision enum /// /// @see GLSL roundEven man page /// @see GLSL 4.20.8 specification, section 8.3 Common Functions @@ -108,7 +109,7 @@ namespace glm /// /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector /// @tparam T Floating-point scalar types - /// @tparam P Enumeration value precision + /// @tparam P Value from precision enum /// /// @see GLSL ceil man page /// @see GLSL 4.20.8 specification, section 8.3 Common Functions @@ -128,7 +129,7 @@ namespace glm /// /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector /// @tparam T Floating-point scalar types - /// @tparam P Enumeration value precision + /// @tparam P Value from precision enum /// /// @see GLSL fract man page /// @see GLSL 4.20.8 specification, section 8.3 Common Functions @@ -150,7 +151,7 @@ namespace glm /// /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector /// @tparam T Floating-point scalar types - /// @tparam P Enumeration value precision + /// @tparam P Value from precision enum /// /// @see GLSL mod man page /// @see GLSL 4.20.8 specification, section 8.3 Common Functions @@ -162,7 +163,7 @@ namespace glm /// /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector /// @tparam T Floating-point scalar types - /// @tparam P Enumeration value precision + /// @tparam P Value from precision enum /// /// @see GLSL mod man page /// @see GLSL 4.20.8 specification, section 8.3 Common Functions @@ -194,7 +195,7 @@ namespace glm /// /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector /// @tparam T Floating-point or integer scalar types - /// @tparam P Enumeration value precision + /// @tparam P Value from precision enum /// /// @see GLSL min man page /// @see GLSL 4.20.8 specification, section 8.3 Common Functions @@ -205,7 +206,7 @@ namespace glm /// /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector /// @tparam T Floating-point or integer scalar types - /// @tparam P Enumeration value precision + /// @tparam P Value from precision enum /// /// @see GLSL min man page /// @see GLSL 4.20.8 specification, section 8.3 Common Functions @@ -225,7 +226,7 @@ namespace glm /// /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector /// @tparam T Floating-point or integer scalar types - /// @tparam P Enumeration value precision + /// @tparam P Value from precision enum /// /// @see GLSL max man page /// @see GLSL 4.20.8 specification, section 8.3 Common Functions @@ -236,7 +237,7 @@ namespace glm /// /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector /// @tparam T Floating-point or integer scalar types - /// @tparam P Enumeration value precision + /// @tparam P Value from precision enum /// /// @see GLSL max man page /// @see GLSL 4.20.8 specification, section 8.3 Common Functions @@ -258,7 +259,7 @@ namespace glm /// /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector /// @tparam T Floating-point or integer scalar types - /// @tparam P Enumeration value precision + /// @tparam P Value from precision enum /// /// @see GLSL clamp man page /// @see GLSL 4.20.8 specification, section 8.3 Common Functions @@ -270,7 +271,7 @@ namespace glm /// /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector /// @tparam T Floating-point or integer scalar types - /// @tparam P Enumeration value precision + /// @tparam P Value from precision enum /// /// @see GLSL clamp man page /// @see GLSL 4.20.8 specification, section 8.3 Common Functions @@ -339,7 +340,7 @@ namespace glm /// /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector /// @tparam T Floating-point scalar types - /// @tparam P Enumeration value precision + /// @tparam P Value from precision enum /// /// @see GLSL step man page /// @see GLSL 4.20.8 specification, section 8.3 Common Functions @@ -350,7 +351,7 @@ namespace glm /// /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector /// @tparam T Floating-point scalar types - /// @tparam P Enumeration value precision + /// @tparam P Value from precision enum /// /// @see GLSL step man page /// @see GLSL 4.20.8 specification, section 8.3 Common Functions @@ -390,7 +391,7 @@ namespace glm /// /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector /// @tparam T Floating-point scalar types - /// @tparam P Enumeration value precision + /// @tparam P Value from precision enum /// /// @see GLSL isnan man page /// @see GLSL 4.20.8 specification, section 8.3 Common Functions @@ -405,7 +406,7 @@ namespace glm /// /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector /// @tparam T Floating-point scalar types - /// @tparam P Enumeration value precision + /// @tparam P Value from precision enum /// /// @see GLSL isinf man page /// @see GLSL 4.20.8 specification, section 8.3 Common Functions @@ -425,7 +426,7 @@ namespace glm /// value's bit-level representation is preserved. /// /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector - /// @tparam P Enumeration value precision + /// @tparam P Value from precision enum /// /// @see GLSL floatBitsToInt man page /// @see GLSL 4.20.8 specification, section 8.3 Common Functions @@ -445,7 +446,7 @@ namespace glm /// value's bit-level representation is preserved. /// /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector - /// @tparam P Enumeration value precision + /// @tparam P Value from precision enum /// /// @see GLSL floatBitsToUint man page /// @see GLSL 4.20.8 specification, section 8.3 Common Functions @@ -469,12 +470,12 @@ namespace glm /// the bit-level representation is preserved. /// /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector - /// @tparam P Enumeration value precision + /// @tparam P Value from precision enum /// /// @see GLSL intBitsToFloat man page /// @see GLSL 4.20.8 specification, section 8.3 Common Functions template - GLM_FUNC_DECL vec intBitsToFloat(vec const & v); + GLM_FUNC_DECL vec intBitsToFloat(vec const& v); /// Returns a floating-point value corresponding to a /// unsigned integer encoding of a floating-point value. @@ -493,12 +494,12 @@ namespace glm /// the bit-level representation is preserved. /// /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector - /// @tparam P Enumeration value precision + /// @tparam P Value from precision enum /// /// @see GLSL uintBitsToFloat man page /// @see GLSL 4.20.8 specification, section 8.3 Common Functions template - GLM_FUNC_DECL vec uintBitsToFloat(vec const & v); + GLM_FUNC_DECL vec uintBitsToFloat(vec const& v); /// Computes and returns a * b + c. /// diff --git a/glm/detail/func_common.inl b/glm/detail/func_common.inl index 928d03b3..24a486bb 100644 --- a/glm/detail/func_common.inl +++ b/glm/detail/func_common.inl @@ -777,7 +777,7 @@ namespace detail } template - GLM_FUNC_QUALIFIER genType frexp(genType x, int & exp) + GLM_FUNC_QUALIFIER genType frexp(genType x, int& exp) { GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || GLM_UNRESTRICTED_GENTYPE, "'frexp' only accept floating-point inputs"); diff --git a/glm/detail/func_trigonometric.hpp b/glm/detail/func_trigonometric.hpp index 99b626b7..1eb4d786 100644 --- a/glm/detail/func_trigonometric.hpp +++ b/glm/detail/func_trigonometric.hpp @@ -83,7 +83,9 @@ namespace glm /// The range of values returned by this function is [-PI/2, PI/2]. /// Results are undefined if |x| > 1. /// - /// @tparam vecType Floating-point scalar or vector types. + /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector + /// @tparam T Floating-point scalar types + /// @tparam P Enumeration value precision /// /// @see GLSL asin man page /// @see GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions diff --git a/glm/detail/precision.hpp b/glm/detail/precision.hpp index 86774b26..d6a3f082 100644 --- a/glm/detail/precision.hpp +++ b/glm/detail/precision.hpp @@ -7,6 +7,7 @@ namespace glm { + /// enum precision enum precision { packed_highp, diff --git a/test/core/core_func_integer.cpp b/test/core/core_func_integer.cpp index 021da834..0ce3bba3 100644 --- a/test/core/core_func_integer.cpp +++ b/test/core/core_func_integer.cpp @@ -1397,8 +1397,8 @@ namespace bitCount template struct compute_bitfieldBitCountStep { - template class vecType> - GLM_FUNC_QUALIFIER static vecType call(vecType const & v, T, T) + template + GLM_FUNC_QUALIFIER static glm::vec call(glm::vec const& v, T, T) { return v; } @@ -1407,24 +1407,24 @@ namespace bitCount template<> struct compute_bitfieldBitCountStep { - template class vecType> - GLM_FUNC_QUALIFIER static vecType call(vecType const & v, T Mask, T Shift) + template + GLM_FUNC_QUALIFIER static glm::vec call(glm::vec const& v, T Mask, T Shift) { return (v & Mask) + ((v >> Shift) & Mask); } }; - template class vecType> - static vecType bitCount_bitfield(vecType const & v) + template + static glm::vec bitCount_bitfield(glm::vec const & v) { - vecType::type, P> x(*reinterpret_cast::type, P> const *>(&v)); + glm::vec::type, P> x(*reinterpret_cast::type, P> const *>(&v)); x = compute_bitfieldBitCountStep= 2>::call(x, typename glm::detail::make_unsigned::type(0x5555555555555555ull), typename glm::detail::make_unsigned::type( 1)); x = compute_bitfieldBitCountStep= 4>::call(x, typename glm::detail::make_unsigned::type(0x3333333333333333ull), typename glm::detail::make_unsigned::type( 2)); x = compute_bitfieldBitCountStep= 8>::call(x, typename glm::detail::make_unsigned::type(0x0F0F0F0F0F0F0F0Full), typename glm::detail::make_unsigned::type( 4)); x = compute_bitfieldBitCountStep= 16>::call(x, typename glm::detail::make_unsigned::type(0x00FF00FF00FF00FFull), typename glm::detail::make_unsigned::type( 8)); x = compute_bitfieldBitCountStep= 32>::call(x, typename glm::detail::make_unsigned::type(0x0000FFFF0000FFFFull), typename glm::detail::make_unsigned::type(16)); x = compute_bitfieldBitCountStep= 64>::call(x, typename glm::detail::make_unsigned::type(0x00000000FFFFFFFFull), typename glm::detail::make_unsigned::type(32)); - return vecType(x); + return glm::vec(x); } template