Reducing header dependences

This commit is contained in:
Christophe Riccio 2014-11-29 22:57:33 +01:00
parent 67964bfd0a
commit ff3872c859
10 changed files with 46 additions and 103 deletions

View File

@ -42,6 +42,10 @@
// Dependencies // Dependencies
#include "../detail/setup.hpp" #include "../detail/setup.hpp"
#include "../matrix.hpp"
#include "../mat2x2.hpp"
#include "../mat3x3.hpp"
#include "../mat4x4.hpp"
#if(defined(GLM_MESSAGES) && !defined(GLM_EXT_INCLUDED)) #if(defined(GLM_MESSAGES) && !defined(GLM_EXT_INCLUDED))
# pragma message("GLM: GLM_GTC_matrix_inverse extension included") # pragma message("GLM: GLM_GTC_matrix_inverse extension included")

View File

@ -30,10 +30,6 @@
/// @author Christophe Riccio /// @author Christophe Riccio
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#include "../mat2x2.hpp"
#include "../mat3x3.hpp"
#include "../mat4x4.hpp"
namespace glm namespace glm
{ {
template <typename T, precision P> template <typename T, precision P>

View File

@ -47,6 +47,13 @@
// Dependencies // Dependencies
#include "../detail/setup.hpp" #include "../detail/setup.hpp"
#include "../detail/precision.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)) #if(defined(GLM_MESSAGES) && !defined(GLM_EXT_INCLUDED))
# pragma message("GLM: GLM_GTC_noise extension included") # pragma message("GLM: GLM_GTC_noise extension included")

View File

@ -35,11 +35,6 @@
// http://www.itn.liu.se/~stegu/simplexnoise/simplexnoise.pdf // 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 glm{
namespace gtc namespace gtc
{ {

View File

@ -54,39 +54,23 @@ namespace gtx
/// @addtogroup gtx_optimum_pow /// @addtogroup gtx_optimum_pow
/// @{ /// @{
//! Returns x raised to the power of 2. /// Returns x raised to the power of 2.
//! From GLM_GTX_optimum_pow extension. ///
/// @see gtx_optimum_pow
template <typename genType> template <typename genType>
GLM_FUNC_DECL genType pow2(const genType& x); GLM_FUNC_DECL genType pow2(genType const & x);
//! Returns x raised to the power of 3. /// Returns x raised to the power of 3.
//! From GLM_GTX_optimum_pow extension. ///
/// @see gtx_optimum_pow
template <typename genType> template <typename genType>
GLM_FUNC_DECL genType pow3(const genType& x); GLM_FUNC_DECL genType pow3(genType const & x);
//! Returns x raised to the power of 4. /// Returns x raised to the power of 4.
//! From GLM_GTX_optimum_pow extension. ///
/// @see gtx_optimum_pow
template <typename genType> template <typename genType>
GLM_FUNC_DECL genType pow4(const genType& x); GLM_FUNC_DECL genType pow4(genType const & 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 <precision P>
GLM_FUNC_DECL tvec2<bool, P> powOfTwo(tvec2<int, P> const & x);
//! Checks to determine if the parameter component are power of 2 numbers.
//! From GLM_GTX_optimum_pow extension.
template <precision P>
GLM_FUNC_DECL tvec3<bool, P> powOfTwo(tvec3<int, P> const & x);
//! Checks to determine if the parameter component are power of 2 numbers.
//! From GLM_GTX_optimum_pow extension.
template <precision P>
GLM_FUNC_DECL tvec4<bool, P> powOfTwo(tvec4<int, P> const & x);
/// @} /// @}
}//namespace gtx }//namespace gtx

View File

@ -49,36 +49,4 @@ namespace glm
{ {
return (x * x) * (x * x); return (x * x) * (x * x);
} }
GLM_FUNC_QUALIFIER bool powOfTwo(int x)
{
return !(x & (x - 1));
}
template <precision P>
GLM_FUNC_QUALIFIER tvec2<bool, P> powOfTwo(tvec2<int, P> const & x)
{
return tvec2<bool, P>(
powOfTwo(x.x),
powOfTwo(x.y));
}
template <precision P>
GLM_FUNC_QUALIFIER tvec3<bool, P> powOfTwo(tvec3<int, P> const & x)
{
return tvec3<bool, P>(
powOfTwo(x.x),
powOfTwo(x.y),
powOfTwo(x.z));
}
template <precision P>
GLM_FUNC_QUALIFIER tvec4<bool, P> powOfTwo(tvec4<int, P> const & x)
{
return tvec4<bool, P>(
powOfTwo(x.x),
powOfTwo(x.y),
powOfTwo(x.z),
powOfTwo(x.w));
}
}//namespace glm }//namespace glm

View File

@ -43,7 +43,9 @@
#pragma once #pragma once
// Dependency: // Dependency:
#include "../glm.hpp" #include "../vec3.hpp"
#include "../mat3x3.hpp"
#include "../geometric.hpp"
#if(defined(GLM_MESSAGES) && !defined(GLM_EXT_INCLUDED)) #if(defined(GLM_MESSAGES) && !defined(GLM_EXT_INCLUDED))
# pragma message("GLM: GLM_GTX_orthonormalize extension included") # pragma message("GLM: GLM_GTX_orthonormalize extension included")
@ -54,18 +56,17 @@ namespace glm
/// @addtogroup gtx_orthonormalize /// @addtogroup gtx_orthonormalize
/// @{ /// @{
//! Returns the orthonormalized matrix of m. /// Returns the orthonormalized matrix of m.
//! From GLM_GTX_orthonormalize extension. ///
/// @see gtx_orthonormalize
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_DECL tmat3x3<T, P> orthonormalize( GLM_FUNC_DECL tmat3x3<T, P> orthonormalize(tmat3x3<T, P> const & m);
const tmat3x3<T, P>& m);
//! Orthonormalizes x according y. /// Orthonormalizes x according y.
//! From GLM_GTX_orthonormalize extension. ///
/// @see gtx_orthonormalize
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_DECL tvec3<T, P> orthonormalize( GLM_FUNC_DECL tvec3<T, P> orthonormalize(tvec3<T, P> const & x, tvec3<T, P> const & y);
const tvec3<T, P>& x,
const tvec3<T, P>& y);
/// @} /// @}
}//namespace glm }//namespace glm

View File

@ -33,20 +33,17 @@
namespace glm namespace glm
{ {
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat3x3<T, P> orthonormalize GLM_FUNC_QUALIFIER tmat3x3<T, P> orthonormalize(tmat3x3<T, P> const & m)
(
const tmat3x3<T, P>& m
)
{ {
tmat3x3<T, P> r = m; tmat3x3<T, P> r = m;
r[0] = normalize(r[0]); 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] -= r[0] * d0;
r[1] = normalize(r[1]); 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]); d0 = dot(r[0], r[2]);
r[2] -= r[0] * d0 + r[1] * d1; r[2] -= r[0] * d0 + r[1] * d1;
r[2] = normalize(r[2]); r[2] = normalize(r[2]);
@ -55,11 +52,7 @@ namespace glm
} }
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P> orthonormalize GLM_FUNC_QUALIFIER tvec3<T, P> orthonormalize(tvec3<T, P> const & x, tvec3<T, P> const & y)
(
const tvec3<T, P>& x,
const tvec3<T, P>& y
)
{ {
return normalize(x - y * dot(y, x)); return normalize(x - y * dot(y, x));
} }

View File

@ -42,7 +42,7 @@
#pragma once #pragma once
// Dependency: // Dependency:
#include "../glm.hpp" #include "../geometric.hpp"
#if(defined(GLM_MESSAGES) && !defined(GLM_EXT_INCLUDED)) #if(defined(GLM_MESSAGES) && !defined(GLM_EXT_INCLUDED))
# pragma message("GLM: GLM_GTX_projection extension included") # pragma message("GLM: GLM_GTX_projection extension included")
@ -53,12 +53,11 @@ namespace glm
/// @addtogroup gtx_projection /// @addtogroup gtx_projection
/// @{ /// @{
//! Projects x on Normal. /// Projects x on Normal.
//! From GLM_GTX_projection extension. ///
/// @see gtx_projection
template <typename vecType> template <typename vecType>
GLM_FUNC_DECL vecType proj( GLM_FUNC_DECL vecType proj(vecType const & x, vecType const & Normal);
vecType const & x,
vecType const & Normal);
/// @} /// @}
}//namespace glm }//namespace glm

View File

@ -33,11 +33,7 @@
namespace glm namespace glm
{ {
template <typename vecType> template <typename vecType>
GLM_FUNC_QUALIFIER vecType proj GLM_FUNC_QUALIFIER vecType proj(vecType const & x, vecType const & Normal)
(
vecType const & x,
vecType const & Normal
)
{ {
return glm::dot(x, Normal) / glm::dot(Normal, Normal) * Normal; return glm::dot(x, Normal) / glm::dot(Normal, Normal) * Normal;
} }