diff --git a/glm/detail/_noise.hpp b/glm/detail/_noise.hpp new file mode 100644 index 00000000..9976feb4 --- /dev/null +++ b/glm/detail/_noise.hpp @@ -0,0 +1,139 @@ +/////////////////////////////////////////////////////////////////////////////////// +/// OpenGL Mathematics (glm.g-truc.net) +/// +/// Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) +/// Permission is hereby granted, free of charge, to any person obtaining a copy +/// of this software and associated documentation files (the "Software"), to deal +/// in the Software without restriction, including without limitation the rights +/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +/// copies of the Software, and to permit persons to whom the Software is +/// furnished to do so, subject to the following conditions: +/// +/// The above copyright notice and this permission notice shall be included in +/// all copies or substantial portions of the Software. +/// +/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +/// THE SOFTWARE. +/// +/// @ref core +/// @file glm/detail/_noise.hpp +/// @date 2013-12-24 / 2013-12-24 +/// @author Christophe Riccio +/////////////////////////////////////////////////////////////////////////////////// + +#ifndef GLM_DETAIL_NOISE_INCLUDED +#define GLM_DETAIL_NOISE_INCLUDED + +namespace glm{ +namespace detail +{ + template + GLM_FUNC_QUALIFIER T mod289(T const & x) + { + return x - floor(x * T(1.0 / 289.0)) * T(289.0); + } + + template + GLM_FUNC_QUALIFIER T permute(T const & x) + { + return mod289(((x * T(34)) + T(1)) * x); + } + + template + GLM_FUNC_QUALIFIER tvec2 permute(tvec2 const & x) + { + return mod289(((x * T(34)) + T(1)) * x); + } + + template + GLM_FUNC_QUALIFIER tvec3 permute(tvec3 const & x) + { + return mod289(((x * T(34)) + T(1)) * x); + } + + template + GLM_FUNC_QUALIFIER tvec4 permute(tvec4 const & x) + { + return mod289(((x * T(34)) + T(1)) * x); + } +/* + template class vecType> + GLM_FUNC_QUALIFIER vecType permute(vecType const & x) + { + return mod289(((x * T(34)) + T(1)) * x); + } +*/ + template + GLM_FUNC_QUALIFIER T taylorInvSqrt(T const & r) + { + return T(1.79284291400159) - T(0.85373472095314) * r; + } + + template + GLM_FUNC_QUALIFIER detail::tvec2 taylorInvSqrt(detail::tvec2 const & r) + { + return T(1.79284291400159) - T(0.85373472095314) * r; + } + + template + GLM_FUNC_QUALIFIER detail::tvec3 taylorInvSqrt(detail::tvec3 const & r) + { + return T(1.79284291400159) - T(0.85373472095314) * r; + } + + template + GLM_FUNC_QUALIFIER detail::tvec4 taylorInvSqrt(detail::tvec4 const & r) + { + return T(1.79284291400159) - T(0.85373472095314) * r; + } +/* + template class vecType> + GLM_FUNC_QUALIFIER vecType taylorInvSqrt(vecType const & r) + { + return T(1.79284291400159) - T(0.85373472095314) * r; + } +*/ + + template + GLM_FUNC_QUALIFIER detail::tvec2 fade(detail::tvec2 const & t) + { + return (t * t * t) * (t * (t * T(6) - T(15)) + T(10)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec3 fade(detail::tvec3 const & t) + { + return (t * t * t) * (t * (t * T(6) - T(15)) + T(10)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec4 fade(detail::tvec4 const & t) + { + return (t * t * t) * (t * (t * T(6) - T(15)) + T(10)); + } +/* + template class vecType> + GLM_FUNC_QUALIFIER vecType fade(vecType const & t) + { + 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 + +#endif//GLM_DETAIL_NOISE_INCLUDED + diff --git a/glm/detail/func_common.hpp b/glm/detail/func_common.hpp index 1457930d..6938626a 100644 --- a/glm/detail/func_common.hpp +++ b/glm/detail/func_common.hpp @@ -33,8 +33,8 @@ /// These all operate component-wise. The description is per component. /////////////////////////////////////////////////////////////////////////////////// -#ifndef GLM_CORE_func_common -#define GLM_CORE_func_common GLM_VERSION +#ifndef GLM_FUNC_COMMON_INCLUDED +#define GLM_FUNC_COMMON_INCLUDED #include "setup.hpp" #include "_fixes.hpp" @@ -455,4 +455,4 @@ namespace glm #include "func_common.inl" -#endif//GLM_CORE_func_common +#endif//GLM_FUNC_COMMON_INCLUDED diff --git a/glm/detail/func_exponential.hpp b/glm/detail/func_exponential.hpp index b466f682..376e7971 100644 --- a/glm/detail/func_exponential.hpp +++ b/glm/detail/func_exponential.hpp @@ -34,12 +34,13 @@ /////////////////////////////////////////////////////////////////////////////////// #ifndef glm_core_func_exponential -#define glm_core_func_exponential GLM_VERSION +#define glm_core_func_exponential #include "type_vec1.hpp" #include "type_vec2.hpp" #include "type_vec3.hpp" #include "type_vec4.hpp" +#include namespace glm { diff --git a/glm/detail/func_exponential.inl b/glm/detail/func_exponential.inl index 45367456..9c03129e 100644 --- a/glm/detail/func_exponential.inl +++ b/glm/detail/func_exponential.inl @@ -30,7 +30,6 @@ #include "_vectorize.hpp" #include #include -#include namespace glm { diff --git a/glm/detail/func_geometric.hpp b/glm/detail/func_geometric.hpp index 079a91b2..8789a789 100644 --- a/glm/detail/func_geometric.hpp +++ b/glm/detail/func_geometric.hpp @@ -34,7 +34,7 @@ /////////////////////////////////////////////////////////////////////////////////// #ifndef glm_core_func_geometric -#define glm_core_func_geometric GLM_VERSION +#define glm_core_func_geometric #include "type_vec3.hpp" diff --git a/glm/detail/func_integer.hpp b/glm/detail/func_integer.hpp index 87daa476..b534d0be 100644 --- a/glm/detail/func_integer.hpp +++ b/glm/detail/func_integer.hpp @@ -36,7 +36,7 @@ /////////////////////////////////////////////////////////////////////////////////// #ifndef glm_core_func_integer -#define glm_core_func_integer GLM_VERSION +#define glm_core_func_integer #include "setup.hpp" diff --git a/glm/detail/func_matrix.hpp b/glm/detail/func_matrix.hpp index d3939c5e..238b3ad9 100644 --- a/glm/detail/func_matrix.hpp +++ b/glm/detail/func_matrix.hpp @@ -38,7 +38,7 @@ /////////////////////////////////////////////////////////////////////////////////// #ifndef GLM_CORE_func_matrix -#define GLM_CORE_func_matrix GLM_VERSION +#define GLM_CORE_func_matrix #include "type_mat2x2.hpp" #include "type_mat2x3.hpp" diff --git a/glm/detail/func_matrix.inl b/glm/detail/func_matrix.inl index c4d12d1d..d1509e60 100644 --- a/glm/detail/func_matrix.inl +++ b/glm/detail/func_matrix.inl @@ -26,7 +26,11 @@ /// @author Christophe Riccio /////////////////////////////////////////////////////////////////////////////////// -#include "func_geometric.hpp" +#include "../geometric.hpp" +#include "../vec2.hpp" +#include "../vec3.hpp" +#include "../vec4.hpp" +#include namespace glm { diff --git a/glm/detail/func_noise.hpp b/glm/detail/func_noise.hpp index 8e9f8ebe..69034604 100644 --- a/glm/detail/func_noise.hpp +++ b/glm/detail/func_noise.hpp @@ -36,7 +36,7 @@ /////////////////////////////////////////////////////////////////////////////////// #ifndef glm_core_func_noise -#define glm_core_func_noise GLM_VERSION +#define glm_core_func_noise #include "type_vec1.hpp" #include "type_vec2.hpp" diff --git a/glm/detail/func_noise.inl b/glm/detail/func_noise.inl index a05d431c..983fa7da 100644 --- a/glm/detail/func_noise.inl +++ b/glm/detail/func_noise.inl @@ -26,6 +26,9 @@ /// @author Christophe Riccio /////////////////////////////////////////////////////////////////////////////////// +#include "../detail/_noise.hpp" +#include "./func_common.hpp" + namespace glm { template @@ -87,8 +90,8 @@ namespace glm // Permutations i = mod(i, T(289)); // Avoid truncation effects in permutation - detail::tvec3 p = permute( - permute(i.y + detail::tvec3(T(0), i1.y, T(1))) + i.x + detail::tvec3(T(0), i1.x, T(1))); + detail::tvec3 p = detail::permute( + detail::permute(i.y + detail::tvec3(T(0), i1.y, T(1))) + i.x + detail::tvec3(T(0), i1.x, T(1))); detail::tvec3 m = max(T(0.5) - detail::tvec3( dot(x0, x0), @@ -145,7 +148,7 @@ namespace glm // Permutations i = mod289(i); - detail::tvec4 p(permute(permute(permute( + detail::tvec4 p(detail::permute(detail::permute(detail::permute( i.z + detail::tvec4(T(0), i1.z, i2.z, T(1))) + i.y + detail::tvec4(T(0), i1.y, i2.y, T(1))) + i.x + detail::tvec4(T(0), i1.x, i2.x, T(1)))); @@ -248,8 +251,8 @@ namespace glm // Permutations i = mod(i, T(289)); - T j0 = permute(permute(permute(permute(i.w) + i.z) + i.y) + i.x); - detail::tvec4 j1 = permute(permute(permute(permute( + T j0 = detail::permute(detail::permute(detail::permute(detail::permute(i.w) + i.z) + i.y) + i.x); + detail::tvec4 j1 = detail::permute(detail::permute(detail::permute(detail::permute( i.w + detail::tvec4(i1.w, i2.w, i3.w, T(1))) + i.z + detail::tvec4(i1.z, i2.z, i3.z, T(1))) + i.y + detail::tvec4(i1.y, i2.y, i3.y, T(1))) + @@ -259,14 +262,14 @@ namespace glm // 7*7*6 = 294, which is close to the ring size 17*17 = 289. detail::tvec4 ip = detail::tvec4(T(1) / T(294), T(1) / T(49), T(1) / T(7), T(0)); - detail::tvec4 p0 = grad4(j0, ip); - detail::tvec4 p1 = grad4(j1.x, ip); - detail::tvec4 p2 = grad4(j1.y, ip); - detail::tvec4 p3 = grad4(j1.z, ip); - detail::tvec4 p4 = grad4(j1.w, ip); + detail::tvec4 p0 = detail::grad4(j0, ip); + detail::tvec4 p1 = detail::grad4(j1.x, ip); + detail::tvec4 p2 = detail::grad4(j1.y, ip); + detail::tvec4 p3 = detail::grad4(j1.z, ip); + detail::tvec4 p4 = detail::grad4(j1.w, ip); // Normalise gradients - detail::tvec4 norm = taylorInvSqrt(detail::tvec4(dot(p0, p0), dot(p1, p1), dot(p2, p2), dot(p3, p3))); + detail::tvec4 norm = detail::taylorInvSqrt(detail::tvec4(dot(p0, p0), dot(p1, p1), dot(p2, p2), dot(p3, p3))); p0 *= norm.x; p1 *= norm.y; p2 *= norm.z; diff --git a/glm/detail/func_packing.hpp b/glm/detail/func_packing.hpp index 466ca7e3..2008e3d2 100644 --- a/glm/detail/func_packing.hpp +++ b/glm/detail/func_packing.hpp @@ -34,7 +34,7 @@ /////////////////////////////////////////////////////////////////////////////////// #ifndef GLM_CORE_func_packing -#define GLM_CORE_func_packing GLM_VERSION +#define GLM_CORE_func_packing #include "type_vec2.hpp" #include "type_vec4.hpp" diff --git a/glm/detail/func_trigonometric.hpp b/glm/detail/func_trigonometric.hpp index 9954d9ce..f40124cc 100644 --- a/glm/detail/func_trigonometric.hpp +++ b/glm/detail/func_trigonometric.hpp @@ -38,7 +38,7 @@ /////////////////////////////////////////////////////////////////////////////////// #ifndef GLM_CORE_func_trigonometric -#define GLM_CORE_func_trigonometric GLM_VERSION +#define GLM_CORE_func_trigonometric namespace glm { diff --git a/glm/detail/func_trigonometric.inl b/glm/detail/func_trigonometric.inl index 45553a63..d90645b2 100644 --- a/glm/detail/func_trigonometric.inl +++ b/glm/detail/func_trigonometric.inl @@ -27,6 +27,8 @@ /////////////////////////////////////////////////////////////////////////////////// #include "_vectorize.hpp" +#include +#include namespace glm { diff --git a/glm/detail/func_vector_relational.hpp b/glm/detail/func_vector_relational.hpp index c2f17806..b28099c4 100644 --- a/glm/detail/func_vector_relational.hpp +++ b/glm/detail/func_vector_relational.hpp @@ -39,7 +39,7 @@ /////////////////////////////////////////////////////////////////////////////////// #ifndef GLM_CORE_func_vector_relational -#define GLM_CORE_func_vector_relational GLM_VERSION +#define GLM_CORE_func_vector_relational #include "precision.hpp" #include "setup.hpp" diff --git a/glm/gtc/constants.hpp b/glm/gtc/constants.hpp index cf0235b6..4a5c72b2 100644 --- a/glm/gtc/constants.hpp +++ b/glm/gtc/constants.hpp @@ -39,8 +39,8 @@ #ifndef GLM_GTC_constants #define GLM_GTC_constants -// Dependency: -#include "../glm.hpp" +// Dependencies +#include "../detail/setup.hpp" #if(defined(GLM_MESSAGES) && !defined(GLM_EXT_INCLUDED)) # pragma message("GLM: GLM_GTC_constants extension included") diff --git a/glm/gtc/constants.inl b/glm/gtc/constants.inl index a1665c09..cdf738b5 100644 --- a/glm/gtc/constants.inl +++ b/glm/gtc/constants.inl @@ -26,6 +26,8 @@ /// @author Christophe Riccio /////////////////////////////////////////////////////////////////////////////////// +#include + namespace glm { template diff --git a/glm/gtc/epsilon.hpp b/glm/gtc/epsilon.hpp index 92b65939..1830496e 100644 --- a/glm/gtc/epsilon.hpp +++ b/glm/gtc/epsilon.hpp @@ -40,9 +40,8 @@ #ifndef GLM_GTC_epsilon #define GLM_GTC_epsilon -// Dependency: -#include "../glm.hpp" -#include "../gtc/quaternion.hpp" +// Dependencies +#include "../detail/setup.hpp" #if(defined(GLM_MESSAGES) && !defined(GLM_EXT_INCLUDED)) # pragma message("GLM: GLM_GTC_epsilon extension included") @@ -58,19 +57,19 @@ namespace glm /// /// @see gtc_epsilon template - typename genType::boolType epsilonEqual( + typename genType::bool_type epsilonEqual( genType const & x, genType const & y, - typename genType::T const & epsilon); + typename genType::value_type const & epsilon); /// Returns the component-wise comparison of |x - y| < epsilon. /// True if this expression is satisfied. /// /// @see gtc_epsilon - template - typename genType::boolType epsilonEqual( - genType const & x, - genType const & y, + template + typename genType::bool_type epsilonEqual( + genType const & x, + genType const & y, genType const & epsilon); /// Returns the component-wise comparison of |x - y| < epsilon. @@ -81,7 +80,7 @@ namespace glm typename genType::boolType epsilonNotEqual( genType const & x, genType const & y, - typename genType::T const & epsilon); + typename genType::value_type const & epsilon); /// Returns the component-wise comparison of |x - y| >= epsilon. /// True if this expression is not satisfied. @@ -89,8 +88,8 @@ namespace glm /// @see gtc_epsilon template typename genType::boolType epsilonNotEqual( - genType const & x, - genType const & y, + genType const & x, + genType const & y, genType const & epsilon); /// @} diff --git a/glm/gtc/epsilon.inl b/glm/gtc/epsilon.inl index 4190cef8..d8f54857 100644 --- a/glm/gtc/epsilon.inl +++ b/glm/gtc/epsilon.inl @@ -26,6 +26,13 @@ /// @author Christophe Riccio /////////////////////////////////////////////////////////////////////////////////// +// Dependency: +#include "quaternion.hpp" +#include "../common.hpp" +#include "../vec2.hpp" +#include "../vec3.hpp" +#include "../vec4.hpp" + namespace glm { GLM_FUNC_QUALIFIER bool epsilonEqual diff --git a/glm/gtc/matrix_access.hpp b/glm/gtc/matrix_access.hpp index 04a99f81..19664b2d 100644 --- a/glm/gtc/matrix_access.hpp +++ b/glm/gtc/matrix_access.hpp @@ -38,7 +38,7 @@ #define GLM_GTC_matrix_access // Dependency: -#include "../glm.hpp" +#include "../detail/setup.hpp" #if(defined(GLM_MESSAGES) && !defined(GLM_EXT_INCLUDED)) # pragma message("GLM: GLM_GTC_matrix_access extension included") @@ -51,32 +51,32 @@ namespace glm /// Get a specific row of a matrix. /// @see gtc_matrix_access - template + template typename genType::row_type row( genType const & m, - typename genType::size_type const & index); + length_t const & index); /// Set a specific row to a matrix. /// @see gtc_matrix_access - template + template genType row( - genType const & m, - typename genType::size_type const & index, + genType const & m, + length_t const & index, typename genType::row_type const & x); /// Get a specific column of a matrix. /// @see gtc_matrix_access - template + template typename genType::col_type column( - genType const & m, - typename genType::size_type const & index); + genType const & m, + length_t const & index); /// Set a specific column to a matrix. /// @see gtc_matrix_access - template + template genType column( - genType const & m, - typename genType::size_type const & index, + genType const & m, + length_t const & index, typename genType::col_type const & x); /// @} diff --git a/glm/gtc/matrix_integer.hpp b/glm/gtc/matrix_integer.hpp index dc7f2df6..837bb58a 100644 --- a/glm/gtc/matrix_integer.hpp +++ b/glm/gtc/matrix_integer.hpp @@ -38,7 +38,15 @@ #define GLM_GTC_matrix_integer // Dependency: -#include "../glm.hpp" +#include "../mat2x2.hpp" +#include "../mat2x3.hpp" +#include "../mat2x4.hpp" +#include "../mat3x2.hpp" +#include "../mat3x3.hpp" +#include "../mat3x4.hpp" +#include "../mat4x2.hpp" +#include "../mat4x3.hpp" +#include "../mat4x4.hpp" #if(defined(GLM_MESSAGES) && !defined(GLM_EXT_INCLUDED)) # pragma message("GLM: GLM_GTC_matrix_integer extension included") diff --git a/glm/gtc/matrix_inverse.hpp b/glm/gtc/matrix_inverse.hpp index 5785b699..ec954d00 100644 --- a/glm/gtc/matrix_inverse.hpp +++ b/glm/gtc/matrix_inverse.hpp @@ -37,8 +37,8 @@ #ifndef GLM_GTC_matrix_inverse #define GLM_GTC_matrix_inverse -// Dependency: -#include "../glm.hpp" +// Dependencies +#include "../detail/setup.hpp" #if(defined(GLM_MESSAGES) && !defined(GLM_EXT_INCLUDED)) # pragma message("GLM: GLM_GTC_matrix_inverse extension included") @@ -55,7 +55,7 @@ namespace glm /// @tparam genType Squared floating-point matrix: half, float or double. Inverse of matrix based of half-precision floating point value is highly innacurate. /// @see gtc_matrix_inverse template - genType affineInverse(genType const & m); + GLM_FUNC_QUALIFIER genType affineInverse(genType const & m); /// Compute the inverse transpose of a matrix. /// diff --git a/glm/gtc/matrix_inverse.inl b/glm/gtc/matrix_inverse.inl index 2d3e00bd..39252307 100644 --- a/glm/gtc/matrix_inverse.inl +++ b/glm/gtc/matrix_inverse.inl @@ -26,6 +26,10 @@ /// @author Christophe Riccio /////////////////////////////////////////////////////////////////////////////////// +#include "../mat2x2.hpp" +#include "../mat3x3.hpp" +#include "../mat4x4.hpp" + namespace glm { template diff --git a/glm/gtc/matrix_transform.hpp b/glm/gtc/matrix_transform.hpp index 2d7d878e..62e20c78 100644 --- a/glm/gtc/matrix_transform.hpp +++ b/glm/gtc/matrix_transform.hpp @@ -47,7 +47,10 @@ #define GLM_GTC_matrix_transform // Dependency: -#include "../glm.hpp" +#include "../mat4x4.hpp" +#include "../vec2.hpp" +#include "../vec3.hpp" +#include "../vec4.hpp" #if(defined(GLM_MESSAGES) && !defined(GLM_EXT_INCLUDED)) # pragma message("GLM: GLM_GTC_matrix_transform extension included") diff --git a/glm/gtc/matrix_transform.inl b/glm/gtc/matrix_transform.inl index 57bf9b84..965fffd7 100644 --- a/glm/gtc/matrix_transform.inl +++ b/glm/gtc/matrix_transform.inl @@ -26,6 +26,9 @@ /// @author Christophe Riccio /////////////////////////////////////////////////////////////////////////////////// +#include "../geometric.hpp" +#include "../trigonometric.hpp" + namespace glm { template diff --git a/glm/gtc/noise.hpp b/glm/gtc/noise.hpp index 9fd157db..58a110ba 100644 --- a/glm/gtc/noise.hpp +++ b/glm/gtc/noise.hpp @@ -41,8 +41,8 @@ #ifndef GLM_GTC_noise #define GLM_GTC_noise -// Dependency: -#include "../glm.hpp" +// Dependencies +#include "../detail/setup.hpp" #if(defined(GLM_MESSAGES) && !defined(GLM_EXT_INCLUDED)) # pragma message("GLM: GLM_GTC_noise extension included") @@ -55,22 +55,22 @@ namespace glm /// Classic perlin noise. /// @see gtc_noise - template class vecType> + template class vecType> T perlin( - vecType const & p); + vecType const & p); /// Periodic perlin noise. /// @see gtc_noise - template class vecType> + template class vecType> T perlin( - vecType const & p, - vecType const & rep); + vecType const & p, + vecType const & rep); /// Simplex noise. /// @see gtc_noise - template class vecType> + template class vecType> T simplex( - vecType const & p); + vecType const & p); /// @} }//namespace glm diff --git a/glm/gtc/noise.inl b/glm/gtc/noise.inl index c1a0a8f8..89f55107 100644 --- a/glm/gtc/noise.inl +++ b/glm/gtc/noise.inl @@ -31,109 +31,13 @@ // http://www.itn.liu.se/~stegu/simplexnoise/simplexnoise.pdf /////////////////////////////////////////////////////////////////////////////////// +#include "../geometric.hpp" +#include "../common.hpp" +#include "../vector_relational.hpp" +#include "../detail/_noise.hpp" + namespace glm { - template - GLM_FUNC_QUALIFIER T mod289(T const & x) - { - return x - floor(x * T(1.0 / 289.0)) * T(289.0); - } - - template - GLM_FUNC_QUALIFIER T permute(T const & x) - { - return mod289(((x * T(34)) + T(1)) * x); - } - - template - GLM_FUNC_QUALIFIER detail::tvec2 permute(detail::tvec2 const & x) - { - return mod289(((x * T(34)) + T(1)) * x); - } - - template - GLM_FUNC_QUALIFIER detail::tvec3 permute(detail::tvec3 const & x) - { - return mod289(((x * T(34)) + T(1)) * x); - } - - template - GLM_FUNC_QUALIFIER detail::tvec4 permute(detail::tvec4 const & x) - { - return mod289(((x * T(34)) + T(1)) * x); - } -/* - template class vecType> - GLM_FUNC_QUALIFIER vecType permute(vecType const & x) - { - return mod289(((x * T(34)) + T(1)) * x); - } -*/ - template - GLM_FUNC_QUALIFIER T taylorInvSqrt(T const & r) - { - return T(1.79284291400159) - T(0.85373472095314) * r; - } - - template - GLM_FUNC_QUALIFIER detail::tvec2 taylorInvSqrt(detail::tvec2 const & r) - { - return T(1.79284291400159) - T(0.85373472095314) * r; - } - - template - GLM_FUNC_QUALIFIER detail::tvec3 taylorInvSqrt(detail::tvec3 const & r) - { - return T(1.79284291400159) - T(0.85373472095314) * r; - } - - template - GLM_FUNC_QUALIFIER detail::tvec4 taylorInvSqrt(detail::tvec4 const & r) - { - return T(1.79284291400159) - T(0.85373472095314) * r; - } -/* - template class vecType> - GLM_FUNC_QUALIFIER vecType taylorInvSqrt(vecType const & r) - { - return T(1.79284291400159) - T(0.85373472095314) * r; - } -*/ - - template - GLM_FUNC_QUALIFIER detail::tvec2 fade(detail::tvec2 const & t) - { - return (t * t * t) * (t * (t * T(6) - T(15)) + T(10)); - } - - template - GLM_FUNC_QUALIFIER detail::tvec3 fade(detail::tvec3 const & t) - { - return (t * t * t) * (t * (t * T(6) - T(15)) + T(10)); - } - - template - GLM_FUNC_QUALIFIER detail::tvec4 fade(detail::tvec4 const & t) - { - return (t * t * t) * (t * (t * T(6) - T(15)) + T(10)); - } -/* - template class vecType> - GLM_FUNC_QUALIFIER vecType fade(vecType const & t) - { - 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); - } - // Classic Perlin noise template GLM_FUNC_QUALIFIER T perlin(detail::tvec2 const & Position) @@ -146,7 +50,7 @@ namespace glm detail::tvec4 fx(Pf.x, Pf.z, Pf.x, Pf.z); detail::tvec4 fy(Pf.y, Pf.y, Pf.w, Pf.w); - detail::tvec4 i = glm::permute(glm::permute(ix) + iy); + detail::tvec4 i = detail::permute(detail::permute(ix) + iy); detail::tvec4 gx = static_cast(2) * glm::fract(i / T(41)) - T(1); detail::tvec4 gy = glm::abs(gx) - T(0.5); @@ -190,9 +94,9 @@ namespace glm detail::tvec4 iz0(Pi0.z); detail::tvec4 iz1(Pi1.z); - detail::tvec4 ixy = permute(permute(ix) + iy); - detail::tvec4 ixy0 = permute(ixy + iz0); - detail::tvec4 ixy1 = permute(ixy + iz1); + detail::tvec4 ixy = detail::permute(detail::permute(ix) + iy); + detail::tvec4 ixy0 = detail::permute(ixy + iz0); + detail::tvec4 ixy1 = detail::permute(ixy + iz1); detail::tvec4 gx0 = ixy0 * T(1.0 / 7.0); detail::tvec4 gy0 = fract(floor(gx0) * T(1.0 / 7.0)) - T(0.5); @@ -219,12 +123,12 @@ namespace glm detail::tvec3 g011(gx1.z, gy1.z, gz1.z); detail::tvec3 g111(gx1.w, gy1.w, gz1.w); - detail::tvec4 norm0 = taylorInvSqrt(detail::tvec4(dot(g000, g000), dot(g010, g010), dot(g100, g100), dot(g110, g110))); + detail::tvec4 norm0 = detail::taylorInvSqrt(detail::tvec4(dot(g000, g000), dot(g010, g010), dot(g100, g100), dot(g110, g110))); g000 *= norm0.x; g010 *= norm0.y; g100 *= norm0.z; g110 *= norm0.w; - detail::tvec4 norm1 = taylorInvSqrt(detail::tvec4(dot(g001, g001), dot(g011, g011), dot(g101, g101), dot(g111, g111))); + detail::tvec4 norm1 = detail::taylorInvSqrt(detail::tvec4(dot(g001, g001), dot(g011, g011), dot(g101, g101), dot(g111, g111))); g001 *= norm1.x; g011 *= norm1.y; g101 *= norm1.z; @@ -336,13 +240,13 @@ namespace glm detail::tvec4 iw0(Pi0.w); detail::tvec4 iw1(Pi1.w); - detail::tvec4 ixy = permute(permute(ix) + iy); - detail::tvec4 ixy0 = permute(ixy + iz0); - detail::tvec4 ixy1 = permute(ixy + iz1); - detail::tvec4 ixy00 = permute(ixy0 + iw0); - detail::tvec4 ixy01 = permute(ixy0 + iw1); - detail::tvec4 ixy10 = permute(ixy1 + iw0); - detail::tvec4 ixy11 = permute(ixy1 + iw1); + detail::tvec4 ixy = detail::permute(detail::permute(ix) + iy); + detail::tvec4 ixy0 = detail::permute(ixy + iz0); + detail::tvec4 ixy1 = detail::permute(ixy + iz1); + detail::tvec4 ixy00 = detail::permute(ixy0 + iw0); + detail::tvec4 ixy01 = detail::permute(ixy0 + iw1); + detail::tvec4 ixy10 = detail::permute(ixy1 + iw0); + detail::tvec4 ixy11 = detail::permute(ixy1 + iw1); detail::tvec4 gx00 = ixy00 / T(7); detail::tvec4 gy00 = floor(gx00) / T(7); @@ -405,25 +309,25 @@ namespace glm detail::tvec4 g0111(gx11.z, gy11.z, gz11.z, gw11.z); detail::tvec4 g1111(gx11.w, gy11.w, gz11.w, gw11.w); - detail::tvec4 norm00 = taylorInvSqrt(detail::tvec4(dot(g0000, g0000), dot(g0100, g0100), dot(g1000, g1000), dot(g1100, g1100))); + detail::tvec4 norm00 = detail::taylorInvSqrt(detail::tvec4(dot(g0000, g0000), dot(g0100, g0100), dot(g1000, g1000), dot(g1100, g1100))); g0000 *= norm00.x; g0100 *= norm00.y; g1000 *= norm00.z; g1100 *= norm00.w; - detail::tvec4 norm01 = taylorInvSqrt(detail::tvec4(dot(g0001, g0001), dot(g0101, g0101), dot(g1001, g1001), dot(g1101, g1101))); + detail::tvec4 norm01 = detail::taylorInvSqrt(detail::tvec4(dot(g0001, g0001), dot(g0101, g0101), dot(g1001, g1001), dot(g1101, g1101))); g0001 *= norm01.x; g0101 *= norm01.y; g1001 *= norm01.z; g1101 *= norm01.w; - detail::tvec4 norm10 = taylorInvSqrt(detail::tvec4(dot(g0010, g0010), dot(g0110, g0110), dot(g1010, g1010), dot(g1110, g1110))); + detail::tvec4 norm10 = detail::taylorInvSqrt(detail::tvec4(dot(g0010, g0010), dot(g0110, g0110), dot(g1010, g1010), dot(g1110, g1110))); g0010 *= norm10.x; g0110 *= norm10.y; g1010 *= norm10.z; g1110 *= norm10.w; - detail::tvec4 norm11 = taylorInvSqrt(detail::tvec4(dot(g0011, g0011), dot(g0111, g0111), dot(g1011, g1011), dot(g1111, g1111))); + detail::tvec4 norm11 = detail::taylorInvSqrt(detail::tvec4(dot(g0011, g0011), dot(g0111, g0111), dot(g1011, g1011), dot(g1111, g1111))); g0011 *= norm11.x; g0111 *= norm11.y; g1011 *= norm11.z; @@ -468,7 +372,7 @@ namespace glm detail::tvec4 fx(Pf.x, Pf.z, Pf.x, Pf.z); detail::tvec4 fy(Pf.y, Pf.y, Pf.w, Pf.w); - detail::tvec4 i = permute(permute(ix) + iy); + detail::tvec4 i = detail::permute(detail::permute(ix) + iy); detail::tvec4 gx = static_cast(2) * fract(i / T(41)) - T(1); detail::tvec4 gy = abs(gx) - T(0.5); @@ -480,7 +384,7 @@ namespace glm detail::tvec2 g01(gx.z, gy.z); detail::tvec2 g11(gx.w, gy.w); - detail::tvec4 norm = taylorInvSqrt(detail::tvec4(dot(g00, g00), dot(g01, g01), dot(g10, g10), dot(g11, g11))); + detail::tvec4 norm = detail::taylorInvSqrt(detail::tvec4(dot(g00, g00), dot(g01, g01), dot(g10, g10), dot(g11, g11))); g00 *= norm.x; g01 *= norm.y; g10 *= norm.z; @@ -512,9 +416,9 @@ namespace glm detail::tvec4 iz0(Pi0.z); detail::tvec4 iz1(Pi1.z); - detail::tvec4 ixy = permute(permute(ix) + iy); - detail::tvec4 ixy0 = permute(ixy + iz0); - detail::tvec4 ixy1 = permute(ixy + iz1); + detail::tvec4 ixy = detail::permute(detail::permute(ix) + iy); + detail::tvec4 ixy0 = detail::permute(ixy + iz0); + detail::tvec4 ixy1 = detail::permute(ixy + iz1); detail::tvec4 gx0 = ixy0 / T(7); detail::tvec4 gy0 = fract(floor(gx0) / T(7)) - T(0.5); @@ -541,12 +445,12 @@ namespace glm detail::tvec3 g011 = detail::tvec3(gx1.z, gy1.z, gz1.z); detail::tvec3 g111 = detail::tvec3(gx1.w, gy1.w, gz1.w); - detail::tvec4 norm0 = taylorInvSqrt(detail::tvec4(dot(g000, g000), dot(g010, g010), dot(g100, g100), dot(g110, g110))); + detail::tvec4 norm0 = detail::taylorInvSqrt(detail::tvec4(dot(g000, g000), dot(g010, g010), dot(g100, g100), dot(g110, g110))); g000 *= norm0.x; g010 *= norm0.y; g100 *= norm0.z; g110 *= norm0.w; - detail::tvec4 norm1 = taylorInvSqrt(detail::tvec4(dot(g001, g001), dot(g011, g011), dot(g101, g101), dot(g111, g111))); + detail::tvec4 norm1 = detail::taylorInvSqrt(detail::tvec4(dot(g001, g001), dot(g011, g011), dot(g101, g101), dot(g111, g111))); g001 *= norm1.x; g011 *= norm1.y; g101 *= norm1.z; @@ -564,7 +468,7 @@ namespace glm detail::tvec3 fade_xyz = fade(Pf0); detail::tvec4 n_z = mix(detail::tvec4(n000, n100, n010, n110), detail::tvec4(n001, n101, n011, n111), fade_xyz.z); detail::tvec2 n_yz = mix(detail::tvec2(n_z.x, n_z.y), detail::tvec2(n_z.z, n_z.w), fade_xyz.y); - T n_xyz = mix(n_yz.x, n_yz.y, fade_xyz.x); + T n_xyz = mix(n_yz.x, n_yz.y, fade_xyz.x); return T(2.2) * n_xyz; } @@ -583,13 +487,13 @@ namespace glm detail::tvec4 iw0(Pi0.w); detail::tvec4 iw1(Pi1.w); - detail::tvec4 ixy = permute(permute(ix) + iy); - detail::tvec4 ixy0 = permute(ixy + iz0); - detail::tvec4 ixy1 = permute(ixy + iz1); - detail::tvec4 ixy00 = permute(ixy0 + iw0); - detail::tvec4 ixy01 = permute(ixy0 + iw1); - detail::tvec4 ixy10 = permute(ixy1 + iw0); - detail::tvec4 ixy11 = permute(ixy1 + iw1); + detail::tvec4 ixy = detail::permute(detail::permute(ix) + iy); + detail::tvec4 ixy0 = detail::permute(ixy + iz0); + detail::tvec4 ixy1 = detail::permute(ixy + iz1); + detail::tvec4 ixy00 = detail::permute(ixy0 + iw0); + detail::tvec4 ixy01 = detail::permute(ixy0 + iw1); + detail::tvec4 ixy10 = detail::permute(ixy1 + iw0); + detail::tvec4 ixy11 = detail::permute(ixy1 + iw1); detail::tvec4 gx00 = ixy00 / T(7); detail::tvec4 gy00 = floor(gx00) / T(7); @@ -652,13 +556,13 @@ namespace glm detail::tvec4 g0111(gx11.z, gy11.z, gz11.z, gw11.z); detail::tvec4 g1111(gx11.w, gy11.w, gz11.w, gw11.w); - detail::tvec4 norm00 = taylorInvSqrt(detail::tvec4(dot(g0000, g0000), dot(g0100, g0100), dot(g1000, g1000), dot(g1100, g1100))); + detail::tvec4 norm00 = detail::taylorInvSqrt(detail::tvec4(dot(g0000, g0000), dot(g0100, g0100), dot(g1000, g1000), dot(g1100, g1100))); g0000 *= norm00.x; g0100 *= norm00.y; g1000 *= norm00.z; g1100 *= norm00.w; - detail::tvec4 norm01 = taylorInvSqrt(detail::tvec4(dot(g0001, g0001), dot(g0101, g0101), dot(g1001, g1001), dot(g1101, g1101))); + detail::tvec4 norm01 = detail::taylorInvSqrt(detail::tvec4(dot(g0001, g0001), dot(g0101, g0101), dot(g1001, g1001), dot(g1101, g1101))); g0001 *= norm01.x; g0101 *= norm01.y; g1001 *= norm01.z; @@ -727,8 +631,8 @@ namespace glm // Permutations i = mod(i, T(289)); // Avoid truncation effects in permutation - detail::tvec3 p = permute( - permute(i.y + detail::tvec3(T(0), i1.y, T(1))) + detail::tvec3 p = detail::permute( + detail::permute(i.y + detail::tvec3(T(0), i1.y, T(1))) + i.x + detail::tvec3(T(0), i1.x, T(1))); detail::tvec3 m = max(T(0.5) - detail::tvec3( @@ -785,9 +689,9 @@ namespace glm // Permutations i = mod289(i); - detail::tvec4 p(permute(permute(permute( - i.z + detail::tvec4(T(0), i1.z, i2.z, T(1))) + - i.y + detail::tvec4(T(0), i1.y, i2.y, T(1))) + + detail::tvec4 p(detail::permute(detail::permute(detail::permute( + i.z + detail::tvec4(T(0), i1.z, i2.z, T(1))) + + i.y + detail::tvec4(T(0), i1.y, i2.y, T(1))) + i.x + detail::tvec4(T(0), i1.x, i2.x, T(1)))); // Gradients: 7x7 points over a square, mapped onto an octahedron. @@ -822,7 +726,7 @@ namespace glm detail::tvec3 p3(a1.z, a1.w, h.w); // Normalise gradients - detail::tvec4 norm = taylorInvSqrt(detail::tvec4(dot(p0, p0), dot(p1, p1), dot(p2, p2), dot(p3, p3))); + detail::tvec4 norm = detail::taylorInvSqrt(detail::tvec4(dot(p0, p0), dot(p1, p1), dot(p2, p2), dot(p3, p3))); p0 *= norm.x; p1 *= norm.y; p2 *= norm.z; @@ -885,8 +789,8 @@ namespace glm // Permutations i = mod(i, T(289)); - T j0 = permute(permute(permute(permute(i.w) + i.z) + i.y) + i.x); - detail::tvec4 j1 = permute(permute(permute(permute( + T j0 = detail::permute(detail::permute(detail::permute(detail::permute(i.w) + i.z) + i.y) + i.x); + detail::tvec4 j1 = detail::permute(detail::permute(detail::permute(detail::permute( i.w + detail::tvec4(i1.w, i2.w, i3.w, T(1))) + i.z + detail::tvec4(i1.z, i2.z, i3.z, T(1))) + i.y + detail::tvec4(i1.y, i2.y, i3.y, T(1))) @@ -896,19 +800,19 @@ namespace glm // 7*7*6 = 294, which is close to the ring size 17*17 = 289. detail::tvec4 ip = detail::tvec4(T(1) / T(294), T(1) / T(49), T(1) / T(7), T(0)); - detail::tvec4 p0 = grad4(j0, ip); - detail::tvec4 p1 = grad4(j1.x, ip); - detail::tvec4 p2 = grad4(j1.y, ip); - detail::tvec4 p3 = grad4(j1.z, ip); - detail::tvec4 p4 = grad4(j1.w, ip); + detail::tvec4 p0 = detail::grad4(j0, ip); + detail::tvec4 p1 = detail::grad4(j1.x, ip); + detail::tvec4 p2 = detail::grad4(j1.y, ip); + detail::tvec4 p3 = detail::grad4(j1.z, ip); + detail::tvec4 p4 = detail::grad4(j1.w, ip); // Normalise gradients - detail::tvec4 norm = taylorInvSqrt(detail::tvec4(dot(p0, p0), dot(p1, p1), dot(p2, p2), dot(p3, p3))); + detail::tvec4 norm = detail::taylorInvSqrt(detail::tvec4(dot(p0, p0), dot(p1, p1), dot(p2, p2), dot(p3, p3))); p0 *= norm.x; p1 *= norm.y; p2 *= norm.z; p3 *= norm.w; - p4 *= taylorInvSqrt(dot(p4, p4)); + p4 *= detail::taylorInvSqrt(dot(p4, p4)); // Mix contributions from the five corners detail::tvec3 m0 = max(T(0.6) - detail::tvec3(dot(x0, x0), dot(x1, x1), dot(x2, x2)), T(0)); diff --git a/glm/gtc/packing.hpp b/glm/gtc/packing.hpp index 2db41e6b..01e4e3e5 100644 --- a/glm/gtc/packing.hpp +++ b/glm/gtc/packing.hpp @@ -40,7 +40,7 @@ #define GLM_GTC_packing // Dependency: -#include "../glm.hpp" +#include "type_precision.hpp" #if(defined(GLM_MESSAGES) && !defined(GLM_EXT_INCLUDED)) # pragma message("GLM: GLM_GTC_packing extension included") diff --git a/glm/gtc/packing.inl b/glm/gtc/packing.inl index 0aaac0f6..9c98d3d0 100644 --- a/glm/gtc/packing.inl +++ b/glm/gtc/packing.inl @@ -26,6 +26,12 @@ /// @author Christophe Riccio /////////////////////////////////////////////////////////////////////////////////// +#include "../common.hpp" +#include "../vec2.hpp" +#include "../vec3.hpp" +#include "../vec4.hpp" +#include "../detail/type_half.hpp" + namespace glm{ namespace detail { @@ -42,9 +48,9 @@ namespace detail // 0x7f800000 => 01111111 10000000 00000000 00000000 // 0x00008000 => 00000000 00000000 10000000 00000000 return - ((f >> 16) & 0x8000) | // sign - ((((f & 0x7f800000) - 0x38000000) >> 13) & 0x7c00) | // exponential - ((f >> 13) & 0x03ff); // Mantissa + ((f >> 16) & 0x8000) | // sign + ((((f & 0x7f800000) - 0x38000000) >> 13) & 0x7c00) | // exponential + ((f >> 13) & 0x03ff); // Mantissa } GLM_FUNC_QUALIFIER glm::uint32 float2packed11(glm::uint32 const & f) diff --git a/glm/gtc/quaternion.hpp b/glm/gtc/quaternion.hpp index 7bcd5a40..1082231b 100644 --- a/glm/gtc/quaternion.hpp +++ b/glm/gtc/quaternion.hpp @@ -41,7 +41,10 @@ #define GLM_GTC_quaternion // Dependency: -#include "../glm.hpp" +#include "../mat3x3.hpp" +#include "../mat4x4.hpp" +#include "../vec3.hpp" +#include "../vec4.hpp" #include "../gtc/constants.hpp" #if(defined(GLM_MESSAGES) && !defined(GLM_EXT_INCLUDED)) @@ -61,7 +64,7 @@ namespace detail public: T x, y, z, w; - GLM_FUNC_DECL GLM_CONSTEXPR int length() const; + GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const; // Constructors GLM_FUNC_DECL tquat(); @@ -102,12 +105,12 @@ namespace detail tmat4x4 const & m); // Accesses - GLM_FUNC_DECL T & operator[](int i); - GLM_FUNC_DECL T const & operator[](int i) const; + GLM_FUNC_DECL T & operator[](length_t i); + GLM_FUNC_DECL T const & operator[](length_t i) const; // Operators - GLM_FUNC_DECL tquat & operator+=(tquat const & q); - GLM_FUNC_DECL tquat & operator*=(tquat const & q); + GLM_FUNC_DECL tquat & operator+=(tquat const & q); + GLM_FUNC_DECL tquat & operator*=(tquat const & q); GLM_FUNC_DECL tquat & operator*=(T const & s); GLM_FUNC_DECL tquat & operator/=(T const & s); }; diff --git a/glm/gtc/quaternion.inl b/glm/gtc/quaternion.inl index e8aa037b..930a02ef 100644 --- a/glm/gtc/quaternion.inl +++ b/glm/gtc/quaternion.inl @@ -26,13 +26,16 @@ /// @author Christophe Riccio /////////////////////////////////////////////////////////////////////////////////// +#include "../trigonometric.hpp" +#include "../geometric.hpp" +#include "../exponential.hpp" #include namespace glm{ namespace detail { template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR int tquat::length() const + GLM_FUNC_QUALIFIER GLM_CONSTEXPR length_t tquat::length() const { return 4; } @@ -166,14 +169,14 @@ namespace detail // tquat accesses template - GLM_FUNC_QUALIFIER T & tquat::operator[] (int i) + GLM_FUNC_QUALIFIER T & tquat::operator[] (length_t i) { assert(i >= 0 && i < this->length()); return (&x)[i]; } - template - GLM_FUNC_QUALIFIER T const & tquat::operator[] (int i) const + template + GLM_FUNC_QUALIFIER T const & tquat::operator[] (length_t i) const { assert(i >= 0 && i < this->length()); return (&x)[i]; @@ -182,34 +185,34 @@ namespace detail ////////////////////////////////////////////////////////////// // tquat operators - template - GLM_FUNC_QUALIFIER tquat & tquat::operator += - ( - tquat const & q - ) - { - this->w += q.w; + template + GLM_FUNC_QUALIFIER tquat & tquat::operator += + ( + tquat const & q + ) + { + this->w += q.w; this->x += q.x; this->y += q.y; this->z += q.z; return *this; - } + } - template - GLM_FUNC_QUALIFIER tquat & tquat::operator *= - ( - tquat const & q - ) - { - tquat const p(*this); - - this->w = p.w * q.w - p.x * q.x - p.y * q.y - p.z * q.z; + template + GLM_FUNC_QUALIFIER tquat & tquat::operator *= + ( + tquat const & q + ) + { + tquat const p(*this); + + this->w = p.w * q.w - p.x * q.x - p.y * q.y - p.z * q.z; this->x = p.w * q.x + p.x * q.w + p.y * q.z - p.z * q.y; this->y = p.w * q.y + p.y * q.w + p.z * q.x - p.x * q.z; this->z = p.w * q.z + p.z * q.w + p.x * q.y - p.y * q.x; return *this; - } - + } + template GLM_FUNC_QUALIFIER tquat & tquat::operator *= ( @@ -222,7 +225,7 @@ namespace detail this->z *= s; return *this; } - + template GLM_FUNC_QUALIFIER tquat & tquat::operator /= ( diff --git a/glm/gtc/random.hpp b/glm/gtc/random.hpp index 2e5dbc11..8ed26554 100644 --- a/glm/gtc/random.hpp +++ b/glm/gtc/random.hpp @@ -41,7 +41,8 @@ #define GLM_GTC_random // Dependency: -#include "../glm.hpp" +#include "../vec2.hpp" +#include "../vec3.hpp" #if(defined(GLM_MESSAGES) && !defined(GLM_EXT_INCLUDED)) # pragma message("GLM: GLM_GTC_random extension included") diff --git a/glm/gtc/random.inl b/glm/gtc/random.inl index 02e4de78..4b256575 100644 --- a/glm/gtc/random.inl +++ b/glm/gtc/random.inl @@ -26,6 +26,8 @@ /// @author Christophe Riccio /////////////////////////////////////////////////////////////////////////////////// +#include "../geometric.hpp" +#include "../exponential.hpp" #include #include #include @@ -67,7 +69,7 @@ namespace detail template GLM_FUNC_QUALIFIER genType linearRand ( - genType const & Min, + genType const & Min, genType const & Max ) { diff --git a/glm/gtc/reciprocal.hpp b/glm/gtc/reciprocal.hpp index 8a4d00db..33dbb9a7 100644 --- a/glm/gtc/reciprocal.hpp +++ b/glm/gtc/reciprocal.hpp @@ -38,8 +38,8 @@ #ifndef GLM_GTC_reciprocal #define GLM_GTC_reciprocal -// Dependency: -#include "../glm.hpp" +// Dependencies +#include "../detail/setup.hpp" #if(defined(GLM_MESSAGES) && !defined(GLM_EXT_INCLUDED)) # pragma message("GLM: GLM_GTC_reciprocal extension included") diff --git a/glm/gtc/reciprocal.inl b/glm/gtc/reciprocal.inl index ec8f6335..904e8d9f 100644 --- a/glm/gtc/reciprocal.inl +++ b/glm/gtc/reciprocal.inl @@ -26,6 +26,9 @@ /// @author Christophe Riccio /////////////////////////////////////////////////////////////////////////////////// +#include "../trigonometric.hpp" +#include + namespace glm { // sec diff --git a/glm/gtc/type_precision.hpp b/glm/gtc/type_precision.hpp index 368ecbc3..08a50bd1 100644 --- a/glm/gtc/type_precision.hpp +++ b/glm/gtc/type_precision.hpp @@ -44,8 +44,19 @@ #define GLM_GTC_type_precision // Dependency: -#include "../glm.hpp" #include "../gtc/quaternion.hpp" +#include "../vec2.hpp" +#include "../vec3.hpp" +#include "../vec4.hpp" +#include "../mat2x2.hpp" +#include "../mat2x3.hpp" +#include "../mat2x4.hpp" +#include "../mat3x2.hpp" +#include "../mat3x3.hpp" +#include "../mat3x4.hpp" +#include "../mat4x2.hpp" +#include "../mat4x3.hpp" +#include "../mat4x4.hpp" #if(defined(GLM_MESSAGES) && !defined(GLM_EXT_INCLUDED)) # pragma message("GLM: GLM_GTC_type_precision extension included") diff --git a/glm/gtc/type_ptr.hpp b/glm/gtc/type_ptr.hpp index adae75d1..aa36d08e 100644 --- a/glm/gtc/type_ptr.hpp +++ b/glm/gtc/type_ptr.hpp @@ -60,8 +60,19 @@ #define GLM_GTC_type_ptr // Dependency: -#include "../glm.hpp" #include "../gtc/quaternion.hpp" +#include "../vec2.hpp" +#include "../vec3.hpp" +#include "../vec4.hpp" +#include "../mat2x2.hpp" +#include "../mat2x3.hpp" +#include "../mat2x4.hpp" +#include "../mat3x2.hpp" +#include "../mat3x3.hpp" +#include "../mat3x4.hpp" +#include "../mat4x2.hpp" +#include "../mat4x3.hpp" +#include "../mat4x4.hpp" #include #if(defined(GLM_MESSAGES) && !defined(GLM_EXT_INCLUDED)) diff --git a/glm/gtc/ulp.hpp b/glm/gtc/ulp.hpp index eadd5156..4ba4a1e5 100644 --- a/glm/gtc/ulp.hpp +++ b/glm/gtc/ulp.hpp @@ -39,8 +39,8 @@ #ifndef GLM_GTC_ulp #define GLM_GTC_ulp -// Dependency: -#include "../glm.hpp" +// Dependencies +#include "../detail/setup.hpp" #if(defined(GLM_MESSAGES) && !defined(GLM_EXT_INCLUDED)) # pragma message("GLM: GLM_GTC_ulp extension included") diff --git a/glm/gtc/ulp.inl b/glm/gtc/ulp.inl index 80e070e7..d0d8aa81 100644 --- a/glm/gtc/ulp.inl +++ b/glm/gtc/ulp.inl @@ -33,6 +33,7 @@ /// is preserved. /////////////////////////////////////////////////////////////////////////////////// +#include "../detail/type_int.hpp" #include #include @@ -212,11 +213,11 @@ namespace glm return GLM_NEXT_AFTER_DBL(x, std::numeric_limits::max()); } - template class vecType> - GLM_FUNC_QUALIFIER vecType next_float(vecType const & x) + template class vecType> + GLM_FUNC_QUALIFIER vecType next_float(vecType const & x) { - vecType Result; - for(std::size_t i = 0; i < Result.length(); ++i) + vecType Result; + for(length_t i = 0; i < Result.length(); ++i) Result[i] = next_float(x[i]); return Result; } @@ -231,11 +232,11 @@ namespace glm return GLM_NEXT_AFTER_DBL(x, std::numeric_limits::min()); } - template class vecType> - GLM_FUNC_QUALIFIER vecType prev_float(vecType const & x) + template class vecType> + GLM_FUNC_QUALIFIER vecType prev_float(vecType const & x) { - vecType Result; - for(std::size_t i = 0; i < Result.length(); ++i) + vecType Result; + for(length_t i = 0; i < Result.length(); ++i) Result[i] = prev_float(x[i]); return Result; } @@ -244,16 +245,16 @@ namespace glm GLM_FUNC_QUALIFIER T next_float(T const & x, uint const & ulps) { T temp = x; - for(std::size_t i = 0; i < ulps; ++i) + for(length_t i = 0; i < ulps; ++i) temp = next_float(temp); return temp; } - template class vecType> - GLM_FUNC_QUALIFIER vecType next_float(vecType const & x, vecType const & ulps) + template class vecType> + GLM_FUNC_QUALIFIER vecType next_float(vecType const & x, vecType const & ulps) { - vecType Result; - for(std::size_t i = 0; i < Result.length(); ++i) + vecType Result; + for(length_t i = 0; i < Result.length(); ++i) Result[i] = next_float(x[i], ulps[i]); return Result; } @@ -262,16 +263,16 @@ namespace glm GLM_FUNC_QUALIFIER T prev_float(T const & x, uint const & ulps) { T temp = x; - for(std::size_t i = 0; i < ulps; ++i) + for(length_t i = 0; i < ulps; ++i) temp = prev_float(temp); return temp; } - template class vecType> - GLM_FUNC_QUALIFIER vecType prev_float(vecType const & x, vecType const & ulps) + template class vecType> + GLM_FUNC_QUALIFIER vecType prev_float(vecType const & x, vecType const & ulps) { - vecType Result; - for(std::size_t i = 0; i < Result.length(); ++i) + vecType Result; + for(length_t i = 0; i < Result.length(); ++i) Result[i] = prev_float(x[i], ulps[i]); return Result; } @@ -307,11 +308,11 @@ namespace glm return ulp; } - template class vecType> - GLM_FUNC_QUALIFIER vecType float_distance(vecType const & x, vecType const & y) + template class vecType> + GLM_FUNC_QUALIFIER vecType float_distance(vecType const & x, vecType const & y) { - vecType Result; - for(std::size_t i = 0; i < Result.length(); ++i) + vecType Result; + for(length_t i = 0; i < Result.length(); ++i) Result[i] = float_distance(x[i], y[i]); return Result; } diff --git a/glm/gtx/dual_quaternion.inl b/glm/gtx/dual_quaternion.inl index fee1d119..b1589fc1 100644 --- a/glm/gtx/dual_quaternion.inl +++ b/glm/gtx/dual_quaternion.inl @@ -26,6 +26,7 @@ /// @author Maksim Vorobiev (msomeone@gmail.com) /////////////////////////////////////////////////////////////////////////////////// +#include "../geometric.hpp" #include namespace glm{ diff --git a/glm/gtx/intersect.inl b/glm/gtx/intersect.inl index 3fd8cea3..9b7a7772 100644 --- a/glm/gtx/intersect.inl +++ b/glm/gtx/intersect.inl @@ -7,6 +7,7 @@ // File : glm/gtx/intersect.inl /////////////////////////////////////////////////////////////////////////////////////////////////// +#include "../geometric.hpp" #include #include diff --git a/glm/gtx/mixed_product.inl b/glm/gtx/mixed_product.inl index 8fa03591..8b449eb9 100644 --- a/glm/gtx/mixed_product.inl +++ b/glm/gtx/mixed_product.inl @@ -9,11 +9,11 @@ namespace glm { - template + template GLM_FUNC_QUALIFIER T mixedProduct ( - detail::tvec3 const & v1, - detail::tvec3 const & v2, + detail::tvec3 const & v1, + detail::tvec3 const & v2, detail::tvec3 const & v3 ) { diff --git a/test/core/core_type_mat2x2.cpp b/test/core/core_type_mat2x2.cpp index fc93c3dc..b2d72bf0 100644 --- a/test/core/core_type_mat2x2.cpp +++ b/test/core/core_type_mat2x2.cpp @@ -8,6 +8,7 @@ /////////////////////////////////////////////////////////////////////////////////////////////////// #include +#include #include #include #include diff --git a/test/core/core_type_mat3x3.cpp b/test/core/core_type_mat3x3.cpp index e9b5804c..03cd3701 100644 --- a/test/core/core_type_mat3x3.cpp +++ b/test/core/core_type_mat3x3.cpp @@ -7,8 +7,10 @@ // File : test/core/type_mat3x3.cpp /////////////////////////////////////////////////////////////////////////////////////////////////// -#include #include +#include +#include +#include #include #include diff --git a/test/core/core_type_mat4x4.cpp b/test/core/core_type_mat4x4.cpp index 999a3c50..e9f6b31e 100644 --- a/test/core/core_type_mat4x4.cpp +++ b/test/core/core_type_mat4x4.cpp @@ -7,8 +7,9 @@ // File : test/core/type_mat4x4.cpp /////////////////////////////////////////////////////////////////////////////////////////////////// -#include #include +#include +#include #include #include