From ff3872c8597eb718ce01a3e7686aae57ca1f4fdb Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Sat, 29 Nov 2014 22:57:33 +0100 Subject: [PATCH] Reducing header dependences --- glm/gtc/matrix_inverse.hpp | 4 ++++ glm/gtc/matrix_inverse.inl | 4 ---- glm/gtc/noise.hpp | 7 +++++++ glm/gtc/noise.inl | 5 ----- glm/gtx/optimum_pow.hpp | 40 ++++++++++++-------------------------- glm/gtx/optimum_pow.inl | 32 ------------------------------ glm/gtx/orthonormalize.hpp | 21 ++++++++++---------- glm/gtx/orthonormalize.inl | 15 ++++---------- glm/gtx/projection.hpp | 13 ++++++------- glm/gtx/projection.inl | 8 ++------ 10 files changed, 46 insertions(+), 103 deletions(-) diff --git a/glm/gtc/matrix_inverse.hpp b/glm/gtc/matrix_inverse.hpp index 08c7d787..76ab2b8a 100644 --- a/glm/gtc/matrix_inverse.hpp +++ b/glm/gtc/matrix_inverse.hpp @@ -42,6 +42,10 @@ // Dependencies #include "../detail/setup.hpp" +#include "../matrix.hpp" +#include "../mat2x2.hpp" +#include "../mat3x3.hpp" +#include "../mat4x4.hpp" #if(defined(GLM_MESSAGES) && !defined(GLM_EXT_INCLUDED)) # pragma message("GLM: GLM_GTC_matrix_inverse extension included") diff --git a/glm/gtc/matrix_inverse.inl b/glm/gtc/matrix_inverse.inl index 94e0196d..c3409318 100644 --- a/glm/gtc/matrix_inverse.inl +++ b/glm/gtc/matrix_inverse.inl @@ -30,10 +30,6 @@ /// @author Christophe Riccio /////////////////////////////////////////////////////////////////////////////////// -#include "../mat2x2.hpp" -#include "../mat3x3.hpp" -#include "../mat4x4.hpp" - namespace glm { template diff --git a/glm/gtc/noise.hpp b/glm/gtc/noise.hpp index e648c65b..d4ae69ef 100644 --- a/glm/gtc/noise.hpp +++ b/glm/gtc/noise.hpp @@ -47,6 +47,13 @@ // Dependencies #include "../detail/setup.hpp" #include "../detail/precision.hpp" +#include "../detail/_noise.hpp" +#include "../geometric.hpp" +#include "../common.hpp" +#include "../vector_relational.hpp" +#include "../vec2.hpp" +#include "../vec3.hpp" +#include "../vec4.hpp" #if(defined(GLM_MESSAGES) && !defined(GLM_EXT_INCLUDED)) # pragma message("GLM: GLM_GTC_noise extension included") diff --git a/glm/gtc/noise.inl b/glm/gtc/noise.inl index 90b2c1bb..20884bb7 100644 --- a/glm/gtc/noise.inl +++ b/glm/gtc/noise.inl @@ -35,11 +35,6 @@ // 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{ namespace gtc { diff --git a/glm/gtx/optimum_pow.hpp b/glm/gtx/optimum_pow.hpp index 38920bbf..7b6fa283 100644 --- a/glm/gtx/optimum_pow.hpp +++ b/glm/gtx/optimum_pow.hpp @@ -54,39 +54,23 @@ namespace gtx /// @addtogroup gtx_optimum_pow /// @{ - //! Returns x raised to the power of 2. - //! From GLM_GTX_optimum_pow extension. + /// Returns x raised to the power of 2. + /// + /// @see gtx_optimum_pow template - GLM_FUNC_DECL genType pow2(const genType& x); + GLM_FUNC_DECL genType pow2(genType const & x); - //! Returns x raised to the power of 3. - //! From GLM_GTX_optimum_pow extension. + /// Returns x raised to the power of 3. + /// + /// @see gtx_optimum_pow template - GLM_FUNC_DECL genType pow3(const genType& x); + GLM_FUNC_DECL genType pow3(genType const & x); - //! Returns x raised to the power of 4. - //! From GLM_GTX_optimum_pow extension. + /// Returns x raised to the power of 4. + /// + /// @see gtx_optimum_pow template - GLM_FUNC_DECL genType pow4(const genType& x); - - //! Checks if the parameter is a power of 2 number. - //! From GLM_GTX_optimum_pow extension. - GLM_FUNC_DECL bool powOfTwo(int num); - - //! Checks to determine if the parameter component are power of 2 numbers. - //! From GLM_GTX_optimum_pow extension. - template - GLM_FUNC_DECL tvec2 powOfTwo(tvec2 const & x); - - //! Checks to determine if the parameter component are power of 2 numbers. - //! From GLM_GTX_optimum_pow extension. - template - GLM_FUNC_DECL tvec3 powOfTwo(tvec3 const & x); - - //! Checks to determine if the parameter component are power of 2 numbers. - //! From GLM_GTX_optimum_pow extension. - template - GLM_FUNC_DECL tvec4 powOfTwo(tvec4 const & x); + GLM_FUNC_DECL genType pow4(genType const & x); /// @} }//namespace gtx diff --git a/glm/gtx/optimum_pow.inl b/glm/gtx/optimum_pow.inl index 644af031..85f4a732 100644 --- a/glm/gtx/optimum_pow.inl +++ b/glm/gtx/optimum_pow.inl @@ -49,36 +49,4 @@ namespace glm { return (x * x) * (x * x); } - - GLM_FUNC_QUALIFIER bool powOfTwo(int x) - { - return !(x & (x - 1)); - } - - template - GLM_FUNC_QUALIFIER tvec2 powOfTwo(tvec2 const & x) - { - return tvec2( - powOfTwo(x.x), - powOfTwo(x.y)); - } - - template - GLM_FUNC_QUALIFIER tvec3 powOfTwo(tvec3 const & x) - { - return tvec3( - powOfTwo(x.x), - powOfTwo(x.y), - powOfTwo(x.z)); - } - - template - GLM_FUNC_QUALIFIER tvec4 powOfTwo(tvec4 const & x) - { - return tvec4( - powOfTwo(x.x), - powOfTwo(x.y), - powOfTwo(x.z), - powOfTwo(x.w)); - } }//namespace glm diff --git a/glm/gtx/orthonormalize.hpp b/glm/gtx/orthonormalize.hpp index c406abd4..cc83a093 100644 --- a/glm/gtx/orthonormalize.hpp +++ b/glm/gtx/orthonormalize.hpp @@ -43,7 +43,9 @@ #pragma once // Dependency: -#include "../glm.hpp" +#include "../vec3.hpp" +#include "../mat3x3.hpp" +#include "../geometric.hpp" #if(defined(GLM_MESSAGES) && !defined(GLM_EXT_INCLUDED)) # pragma message("GLM: GLM_GTX_orthonormalize extension included") @@ -54,18 +56,17 @@ namespace glm /// @addtogroup gtx_orthonormalize /// @{ - //! Returns the orthonormalized matrix of m. - //! From GLM_GTX_orthonormalize extension. + /// Returns the orthonormalized matrix of m. + /// + /// @see gtx_orthonormalize template - GLM_FUNC_DECL tmat3x3 orthonormalize( - const tmat3x3& m); + GLM_FUNC_DECL tmat3x3 orthonormalize(tmat3x3 const & m); - //! Orthonormalizes x according y. - //! From GLM_GTX_orthonormalize extension. + /// Orthonormalizes x according y. + /// + /// @see gtx_orthonormalize template - GLM_FUNC_DECL tvec3 orthonormalize( - const tvec3& x, - const tvec3& y); + GLM_FUNC_DECL tvec3 orthonormalize(tvec3 const & x, tvec3 const & y); /// @} }//namespace glm diff --git a/glm/gtx/orthonormalize.inl b/glm/gtx/orthonormalize.inl index c147f0c4..28af77e8 100644 --- a/glm/gtx/orthonormalize.inl +++ b/glm/gtx/orthonormalize.inl @@ -33,20 +33,17 @@ namespace glm { template - GLM_FUNC_QUALIFIER tmat3x3 orthonormalize - ( - const tmat3x3& m - ) + GLM_FUNC_QUALIFIER tmat3x3 orthonormalize(tmat3x3 const & m) { tmat3x3 r = m; r[0] = normalize(r[0]); - float d0 = dot(r[0], r[1]); + T d0 = dot(r[0], r[1]); r[1] -= r[0] * d0; r[1] = normalize(r[1]); - float d1 = dot(r[1], r[2]); + T d1 = dot(r[1], r[2]); d0 = dot(r[0], r[2]); r[2] -= r[0] * d0 + r[1] * d1; r[2] = normalize(r[2]); @@ -55,11 +52,7 @@ namespace glm } template - GLM_FUNC_QUALIFIER tvec3 orthonormalize - ( - const tvec3& x, - const tvec3& y - ) + GLM_FUNC_QUALIFIER tvec3 orthonormalize(tvec3 const & x, tvec3 const & y) { return normalize(x - y * dot(y, x)); } diff --git a/glm/gtx/projection.hpp b/glm/gtx/projection.hpp index f5e41738..acb6d045 100644 --- a/glm/gtx/projection.hpp +++ b/glm/gtx/projection.hpp @@ -42,7 +42,7 @@ #pragma once // Dependency: -#include "../glm.hpp" +#include "../geometric.hpp" #if(defined(GLM_MESSAGES) && !defined(GLM_EXT_INCLUDED)) # pragma message("GLM: GLM_GTX_projection extension included") @@ -53,12 +53,11 @@ namespace glm /// @addtogroup gtx_projection /// @{ - //! Projects x on Normal. - //! From GLM_GTX_projection extension. - template - GLM_FUNC_DECL vecType proj( - vecType const & x, - vecType const & Normal); + /// Projects x on Normal. + /// + /// @see gtx_projection + template + GLM_FUNC_DECL vecType proj(vecType const & x, vecType const & Normal); /// @} }//namespace glm diff --git a/glm/gtx/projection.inl b/glm/gtx/projection.inl index b07ee85a..15ee0707 100644 --- a/glm/gtx/projection.inl +++ b/glm/gtx/projection.inl @@ -32,12 +32,8 @@ namespace glm { - template - GLM_FUNC_QUALIFIER vecType proj - ( - vecType const & x, - vecType const & Normal - ) + template + GLM_FUNC_QUALIFIER vecType proj(vecType const & x, vecType const & Normal) { return glm::dot(x, Normal) / glm::dot(Normal, Normal) * Normal; }