Browse Source

Reducing header dependences

Christophe Riccio 11 years ago
parent
commit
ff3872c859

+ 4 - 0
glm/gtc/matrix_inverse.hpp

@@ -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")

+ 0 - 4
glm/gtc/matrix_inverse.inl

@@ -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>

+ 7 - 0
glm/gtc/noise.hpp

@@ -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")

+ 0 - 5
glm/gtc/noise.inl

@@ -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
 {
 {

+ 12 - 28
glm/gtx/optimum_pow.hpp

@@ -54,39 +54,23 @@ namespace gtx
 	/// @addtogroup gtx_optimum_pow
 	/// @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 <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.
-	//! From GLM_GTX_optimum_pow extension.
+	/// Returns x raised to the power of 3.
+	///
+	/// @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.
-	//! From GLM_GTX_optimum_pow extension.
+	/// Returns x raised to the power of 4.
+	///
+	/// @see gtx_optimum_pow
 	template <typename genType>
 	template <typename genType>
-	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 <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);
+	GLM_FUNC_DECL genType pow4(genType const & x);
 
 
 	/// @}
 	/// @}
 }//namespace gtx
 }//namespace gtx

+ 0 - 32
glm/gtx/optimum_pow.inl

@@ -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

+ 11 - 10
glm/gtx/orthonormalize.hpp

@@ -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.
-	//! From GLM_GTX_orthonormalize extension.
+	/// Returns the orthonormalized matrix of m.
+	///
+	/// @see gtx_orthonormalize
 	template <typename T, precision P> 
 	template <typename T, precision P> 
-	GLM_FUNC_DECL tmat3x3<T, P> orthonormalize(
-		const tmat3x3<T, P>& m);
+	GLM_FUNC_DECL tmat3x3<T, P> orthonormalize(tmat3x3<T, P> const & m);
 		
 		
-	//! Orthonormalizes x according y.
-	//! From GLM_GTX_orthonormalize extension.
+	/// Orthonormalizes x according y.
+	///
+	/// @see gtx_orthonormalize
 	template <typename T, precision P> 
 	template <typename T, precision P> 
-	GLM_FUNC_DECL tvec3<T, P> orthonormalize(
-		const tvec3<T, P>& x, 
-		const tvec3<T, P>& y);
+	GLM_FUNC_DECL tvec3<T, P> orthonormalize(tvec3<T, P> const & x, tvec3<T, P> const & y);
 
 
 	/// @}
 	/// @}
 }//namespace glm
 }//namespace glm

+ 4 - 11
glm/gtx/orthonormalize.inl

@@ -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
-	(
-		const tmat3x3<T, P>& m
-	)
+	GLM_FUNC_QUALIFIER tmat3x3<T, P> orthonormalize(tmat3x3<T, P> const & 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
-	(
-		const tvec3<T, P>& x, 
-		const tvec3<T, P>& y
-	)
+	GLM_FUNC_QUALIFIER tvec3<T, P> orthonormalize(tvec3<T, P> const & x, tvec3<T, P> const & y)
 	{
 	{
 		return normalize(x - y * dot(y, x));
 		return normalize(x - y * dot(y, x));
 	}
 	}

+ 6 - 7
glm/gtx/projection.hpp

@@ -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.
-	//! From GLM_GTX_projection extension.
-	template <typename vecType> 
-	GLM_FUNC_DECL vecType proj(
-		vecType const & x, 
-		vecType const & Normal);
+	/// Projects x on Normal.
+	///
+	/// @see gtx_projection
+	template <typename vecType>
+	GLM_FUNC_DECL vecType proj(vecType const & x, vecType const & Normal);
 
 
 	/// @}
 	/// @}
 }//namespace glm
 }//namespace glm

+ 2 - 6
glm/gtx/projection.inl

@@ -32,12 +32,8 @@
 
 
 namespace glm
 namespace glm
 {
 {
-	template <typename vecType> 
-	GLM_FUNC_QUALIFIER vecType proj
-	(
-		vecType const & x, 
-		vecType const & Normal
-	)
+	template <typename vecType>
+	GLM_FUNC_QUALIFIER vecType proj(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;
 	}
 	}