Browse Source

Fixed build on GCC

Christophe Riccio 12 years ago
parent
commit
3394af0cf2
5 changed files with 24 additions and 18 deletions
  1. 15 13
      glm/detail/func_geometric.inl
  2. 5 2
      glm/detail/type_mat4x4.inl
  3. 1 1
      glm/detail/type_vec1.hpp
  4. 2 1
      readme.txt
  5. 1 1
      test/core/core_type_cast.cpp

+ 15 - 13
glm/detail/func_geometric.inl

@@ -38,6 +38,15 @@ namespace detail
 	template <template <class, precision> class vecType, typename T, precision P>
 	struct compute_dot{};
 
+	template <typename T, precision P>
+	struct compute_dot<detail::tvec1, T, P>
+	{
+		static T call(detail::tvec1<T, P> const & x, detail::tvec1<T, P> const & y)
+		{
+			return detail::tvec1<T, P>(x * y).x;
+		}
+	};
+
 	template <typename T, precision P>
 	struct compute_dot<detail::tvec2, T, P>
 	{
@@ -159,22 +168,15 @@ namespace detail
 	}
 
 	// dot
-	GLM_FUNC_QUALIFIER float dot
-	(
-		float const & x,
-		float const & y
-	)
-	{
-		return x * y;
-	}
-
-	GLM_FUNC_QUALIFIER double dot
+	template <typename T>
+	GLM_FUNC_QUALIFIER T dot
 	(
-		double const & x,
-		double const & y
+		T const & x,
+		T const & y
 	)
 	{
-		return x * y;
+		GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'dot' only accept floating-point inputs");
+		return detail::compute_dot<detail::tvec1, T, highp>::call(x, y);
 	}
 
 	template <typename T, precision P, template <typename, precision> class vecType>

+ 5 - 2
glm/detail/type_mat4x4.inl

@@ -503,7 +503,7 @@ namespace detail
 	template <typename T, precision P>
 	struct compute_inverse<detail::tmat4x4, T, P>
 	{
-		static detail::tmat4x4<T, lowp> call(detail::tmat4x4<T, P> const & m)
+		static detail::tmat4x4<T, P> call(detail::tmat4x4<T, P> const & m)
 		{
 			T Coef00 = m[2][2] * m[3][3] - m[3][2] * m[2][3];
 			T Coef02 = m[1][2] * m[3][3] - m[3][2] * m[1][3];
@@ -552,7 +552,10 @@ namespace detail
 
 			detail::tvec4<T, P> Row0(Inverse[0][0], Inverse[1][0], Inverse[2][0], Inverse[3][0]);
 
-			T OneOverDeterminant = static_cast<T>(1) / dot(m[0], Row0);
+			detail::tvec4<T, P> Dot0(m[0] * Row0);
+			T Dot1 = (Dot0.x + Dot0.y) + (Dot0.z + Dot0.w);
+
+			T OneOverDeterminant = static_cast<T>(1) / Dot1;
 
 			return Inverse * OneOverDeterminant;
 		}

+ 1 - 1
glm/detail/type_vec1.hpp

@@ -92,7 +92,7 @@ namespace detail
 
 		GLM_FUNC_DECL explicit tvec1(
 			ctor);
-		GLM_FUNC_DECL explicit tvec1(
+		GLM_FUNC_DECL tvec1(
 			T const & s);
 
 		//////////////////////////////////////

+ 2 - 1
readme.txt

@@ -37,7 +37,7 @@ More informations in GLM manual:
 http://glm.g-truc.net/glm.pdf
 
 ================================================================================
-GLM 0.9.5.1: 2014-XX-XX
+GLM 0.9.5.1: 2014-01-11
 --------------------------------------------------------------------------------
 - Fixed angle and orientedAngle that sometimes return NaN values (#145)
 - Deprecated degrees for function parameters and display a message
@@ -46,6 +46,7 @@ GLM 0.9.5.1: 2014-XX-XX
 - Fixed mismatch between some declarations and definitions
 - Fixed inverse link error when using namespace glm; (#147)
 - Optimized matrix inverse and division code (#149)
+- Added intersectRayPlane function (#153)
 
 ================================================================================
 GLM 0.9.5.0: 2013-12-25

+ 1 - 1
test/core/core_type_cast.cpp

@@ -29,7 +29,7 @@ int test_vec2_cast()
 	
 	my_vec2 I;
 	glm::vec2 J = static_cast<glm::vec2>(I);
-	glm::vec2 K(7.8);
+	glm::vec2 K(7.8f);
 
 	int Error(0);