From 9f8112f93a0d5447589355595e3e617b7cbff609 Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Wed, 25 Dec 2013 04:16:08 +0100 Subject: [PATCH] Reduced dependencies of GTX extensions. Removed some deprecated code. --- glm/detail/_noise.hpp | 9 - glm/detail/_vectorize.hpp | 4 + glm/detail/func_common.hpp | 14 +- glm/detail/func_geometric.hpp | 15 +- glm/detail/func_geometric.inl | 79 +++++---- glm/detail/func_noise.inl | 14 +- glm/gtc/epsilon.hpp | 17 +- glm/gtc/epsilon.inl | 185 ++++----------------- glm/gtc/noise.inl | 60 ++++--- glm/gtc/quaternion.hpp | 42 +++-- glm/gtc/quaternion.inl | 109 +++++++------ glm/gtx/bit.hpp | 79 ++++----- glm/gtx/bit.inl | 271 +------------------------------ glm/gtx/dual_quaternion.inl | 4 +- glm/gtx/raw_data.hpp | 13 +- glm/gtx/simd_mat4.hpp | 4 +- glm/gtx/simd_mat4.inl | 40 ++--- glm/gtx/simd_vec4.hpp | 6 +- test/core/core_func_packing.cpp | 1 + test/core/core_setup_message.cpp | 22 ++- test/gtc/gtc_epsilon.cpp | 2 +- test/gtc/gtc_quaternion.cpp | 2 +- test/gtx/gtx_bit.cpp | 96 +---------- test/gtx/gtx_dual_quaternion.cpp | 2 +- 24 files changed, 340 insertions(+), 750 deletions(-) diff --git a/glm/detail/_noise.hpp b/glm/detail/_noise.hpp index 9976feb4..f678a3db 100644 --- a/glm/detail/_noise.hpp +++ b/glm/detail/_noise.hpp @@ -123,15 +123,6 @@ namespace detail return (t * t * t) * (t * (t * T(6) - T(15)) + T(10)); } */ - template - GLM_FUNC_QUALIFIER detail::tvec4 grad4(T const & j, detail::tvec4 const & ip) - { - detail::tvec3 pXYZ = floor(fract(detail::tvec3(j) * detail::tvec3(ip)) * T(7)) * ip[2] - T(1); - T pW = static_cast(1.5) - dot(abs(pXYZ), detail::tvec3(1)); - detail::tvec4 s = detail::tvec4(lessThan(detail::tvec4(pXYZ, pW), detail::tvec4(0.0))); - pXYZ = pXYZ + (detail::tvec3(s) * T(2) - T(1)) * s.w; - return detail::tvec4(pXYZ, pW); - } }//namespace detail }//namespace glm diff --git a/glm/detail/_vectorize.hpp b/glm/detail/_vectorize.hpp index fc28be05..3b9bdb9e 100644 --- a/glm/detail/_vectorize.hpp +++ b/glm/detail/_vectorize.hpp @@ -29,6 +29,10 @@ #ifndef GLM_CORE_DETAIL_INCLUDED #define GLM_CORE_DETAIL_INCLUDED +#include "type_vec2.hpp" +#include "type_vec3.hpp" +#include "type_vec4.hpp" + #define VECTORIZE2_VEC(func) \ template \ GLM_FUNC_QUALIFIER detail::tvec2 func( \ diff --git a/glm/detail/func_common.hpp b/glm/detail/func_common.hpp index 6938626a..9ba6e74a 100644 --- a/glm/detail/func_common.hpp +++ b/glm/detail/func_common.hpp @@ -147,7 +147,7 @@ namespace glm template GLM_FUNC_DECL genType mod( genType const & x, - typename genType::T const & y); + typename genType::value_type const & y); /// Returns the fractional part of x and sets i to the integer /// part (as a whole number floating point value). Both the @@ -177,7 +177,7 @@ namespace glm template GLM_FUNC_DECL genType min( genType const & x, - typename genType::T const & y); + typename genType::value_type const & y); /// Returns y if x < y; otherwise, it returns x. /// @@ -193,7 +193,7 @@ namespace glm template GLM_FUNC_DECL genType max( genType const & x, - typename genType::T const & y); + typename genType::value_type const & y); /// Returns min(max(x, minVal), maxVal) for each component in x /// using the floating-point values minVal and maxVal. @@ -211,8 +211,8 @@ namespace glm template GLM_FUNC_DECL genType clamp( genType const & x, - typename genType::T const & minVal, - typename genType::T const & maxVal); + typename genType::value_type const & minVal, + typename genType::value_type const & maxVal); /// If genTypeU is a floating scalar or vector: /// Returns x * (1.0 - a) + y * a, i.e., the linear blend of @@ -302,8 +302,8 @@ namespace glm template GLM_FUNC_DECL genType smoothstep( - typename genType::T const & edge0, - typename genType::T const & edge1, + typename genType::value_type const & edge0, + typename genType::value_type const & edge1, genType const & x); /// Returns true if x holds a NaN (not a number) diff --git a/glm/detail/func_geometric.hpp b/glm/detail/func_geometric.hpp index 8789a789..285735dd 100644 --- a/glm/detail/func_geometric.hpp +++ b/glm/detail/func_geometric.hpp @@ -64,6 +64,17 @@ namespace glm genType const & p0, genType const & p1); + /// Returns the dot product of x and y, i.e., result = x * y. + /// + /// @tparam genType Floating-point vector types. + /// + /// @see GLSL dot man page + /// @see GLSL 4.20.8 specification, section 8.5 Geometric Functions + template class vecType> + GLM_FUNC_DECL T dot( + vecType const & x, + vecType const & y); +/* /// Returns the dot product of x and y, i.e., result = x * y. /// /// @tparam genType Floating-point vector types. @@ -71,10 +82,10 @@ namespace glm /// @see GLSL dot man page /// @see GLSL 4.20.8 specification, section 8.5 Geometric Functions template - GLM_FUNC_DECL typename genType::value_type dot( + GLM_FUNC_DECL genType dot( genType const & x, genType const & y); - +*/ /// Returns the cross product of x and y. /// /// @tparam valType Floating-point scalar types. diff --git a/glm/detail/func_geometric.inl b/glm/detail/func_geometric.inl index 093d92a8..c49148d6 100644 --- a/glm/detail/func_geometric.inl +++ b/glm/detail/func_geometric.inl @@ -31,8 +31,43 @@ #include "type_vec4.hpp" #include "type_float.hpp" -namespace glm +namespace glm{ +namespace detail { + template