Browse Source

Merge branch '0.9.2' into cuda

Christophe Riccio 14 years ago
parent
commit
9e79018737
5 changed files with 159 additions and 9 deletions
  1. 1 2
      CMakeLists.txt
  2. 8 2
      glm/core/func_common.hpp
  3. 2 2
      glm/core/setup.hpp
  4. 145 0
      glm/gtc/type_ptr.hpp
  5. 3 3
      glm/gtx/compatibility.inl

+ 1 - 2
CMakeLists.txt

@@ -2,8 +2,7 @@ cmake_minimum_required(VERSION 2.6 FATAL_ERROR)
 cmake_policy(VERSION 2.6)
 
 project(glm)
-#Delayed for GLM 0.9.2
-#enable_testing()
+enable_testing()
 
 add_definitions(-D_CRT_SECURE_NO_WARNINGS)
 #add_definitions(-pedantic)

+ 8 - 2
glm/core/func_common.hpp

@@ -249,21 +249,27 @@ namespace glm
 	//! Splits x into a floating-point significand in the range
 	//! [0.5, 1.0) and an integral exponent of two, such that:
 	//! x = significand * exp(2, exponent)
+	//! 
 	//! The significand is returned by the function and the
 	//! exponent is returned in the parameter exp. For a
 	//! floating-point value of zero, the significant and exponent
 	//! are both zero. For a floating-point value that is an
 	//! infinity or is not a number, the results are undefined.
-	//! (From GLSL 4.00.08 specification, section 8.3)
+	//! 
+	//! \li <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/frexp.xml">GLSL frexp man page</a>
+	//! \li GLSL 4.00.08 specification, section 8.3
 	template <typename genType, typename genIType>
 	genType frexp(genType const & x, genIType & exp);
 
 	//! Builds a floating-point number from x and the
 	//! corresponding integral exponent of two in exp, returning:
 	//! significand * exp(2, exponent)
+	//! 
 	//! If this product is too large to be represented in the
 	//! floating-point type, the result is undefined.
-	//! (From GLSL 4.00.08 specification, section 8.3)
+	//! 
+	//! \li <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/ldexp.xml">GLSL ldexp man page</a>; 
+	//! \li GLSL 4.00.08 specification, section 8.3
 	template <typename genType, typename genIType>
 	genType ldexp(genType const & x, genIType const & exp);
 

+ 2 - 2
glm/core/setup.hpp

@@ -13,10 +13,10 @@
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 // Version
 
-#define GLM_VERSION					91
+#define GLM_VERSION					92
 #define GLM_VERSION_MAJOR			0
 #define GLM_VERSION_MINOR			9
-#define GLM_VERSION_PATCH			1
+#define GLM_VERSION_PATCH			2
 #define GLM_VERSION_REVISION		0
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////

+ 145 - 0
glm/gtc/type_ptr.hpp

@@ -294,6 +294,151 @@ namespace glm
 			return &(mat[0].x);
 		}
 
+		//! Build a vector from a pointer.
+		//! From GLM_GTC_type_ptr extension.
+		template<typename T>
+		inline detail::tvec2<T> make_vec2(T const * const ptr)
+		{
+			detail::tvec2<T> Result;
+			memcpy(value_ptr(Result), ptr, sizeof(detail::tvec2<T>));
+			return Result;
+		}
+
+		//! Build a vector from a pointer.
+		//! From GLM_GTC_type_ptr extension.
+		template<typename T>
+		inline detail::tvec3<T> make_vec3(T const * const ptr)
+		{
+			detail::tvec3<T> Result;
+			memcpy(value_ptr(Result), ptr, sizeof(detail::tvec3<T>));
+			return Result;
+		}
+
+		//! Build a vector from a pointer.
+		//! From GLM_GTC_type_ptr extension.
+		template<typename T>
+		inline detail::tvec4<T> make_vec4(T const * const ptr)
+		{
+			detail::tvec4<T> Result;
+			memcpy(value_ptr(Result), ptr, sizeof(detail::tvec4<T>));
+			return Result;
+		}
+
+		//! Build a matrix from a pointer.
+		//! From GLM_GTC_type_ptr extension.
+		template<typename T>
+		inline detail::tmat2x2<T> make_mat2x2(T const * const ptr)
+		{
+			detail::tmat2x2<T> Result;
+			memcpy(value_ptr(Result), ptr, sizeof(detail::tmat2x2<T>));
+			return Result;
+		}
+        
+		//! Build a matrix from a pointer.
+		//! From GLM_GTC_type_ptr extension.
+		template<typename T>
+		inline detail::tmat2x3<T> make_mat2x3(T const * const ptr)
+		{
+			detail::tmat2x3<T> Result;
+			memcpy(value_ptr(Result), ptr, sizeof(detail::tmat2x3<T>));
+			return Result;
+		}
+        
+		//! Build a matrix from a pointer.
+		//! From GLM_GTC_type_ptr extension.
+		template<typename T>
+		inline detail::tmat2x4<T> make_mat2x4(T const * const ptr)
+		{
+			detail::tmat2x4<T> Result;
+			memcpy(value_ptr(Result), ptr, sizeof(detail::tmat2x4<T>));
+			return Result;
+		}
+        
+		//! Build a matrix from a pointer.
+		//! From GLM_GTC_type_ptr extension.
+		template<typename T>
+		inline detail::tmat3x2<T> make_mat3x2(T const * const ptr)
+		{
+			detail::tmat3x2<T> Result;
+			memcpy(value_ptr(Result), ptr, sizeof(detail::tmat3x2<T>));
+			return Result;
+		}
+        
+		//! Build a matrix from a pointer.
+		//! From GLM_GTC_type_ptr extension.
+		template<typename T>
+		inline detail::tmat3x3<T> make_mat3x3(T const * const ptr)
+		{
+			detail::tmat3x3<T> Result;
+			memcpy(value_ptr(Result), ptr, sizeof(detail::tmat3x3<T>));
+			return Result;
+		}
+
+		//! Build a matrix from a pointer.
+		//! From GLM_GTC_type_ptr extension.
+		template<typename T>
+		inline detail::tmat3x4<T> make_mat3x4(T const * const ptr)
+		{
+			detail::tmat3x4<T> Result;
+			memcpy(value_ptr(Result), ptr, sizeof(detail::tmat3x4<T>));
+			return Result;
+		}
+
+        
+		//! Build a matrix from a pointer.
+		//! From GLM_GTC_type_ptr extension.
+		template<typename T>
+		inline detail::tmat4x2<T> make_mat4x2(T const * const ptr)
+		{
+			detail::tmat4x2<T> Result;
+			memcpy(value_ptr(Result), ptr, sizeof(detail::tmat4x2<T>));
+			return Result;
+		}
+        
+		//! Build a matrix from a pointer.
+		//! From GLM_GTC_type_ptr extension.
+		template<typename T>
+		inline detail::tmat4x3<T> make_mat4x3(T const * const ptr)
+		{
+			detail::tmat4x3<T> Result;
+			memcpy(value_ptr(Result), ptr, sizeof(detail::tmat4x3<T>));
+			return Result;
+		}
+        
+		//! Build a matrix from a pointer.
+		//! From GLM_GTC_type_ptr extension.
+		template<typename T>
+		inline detail::tmat4x4<T> make_mat4x4(T const * const ptr)
+		{
+			detail::tmat4x4<T> Result;
+			memcpy(value_ptr(Result), ptr, sizeof(detail::tmat4x4<T>));
+			return Result;
+		}
+        
+		//! Build a matrix from a pointer.
+		//! From GLM_GTC_type_ptr extension.
+		template<typename T>
+		inline detail::tmat2x2<T> make_mat2(T const * const ptr)
+		{
+			return make_mat2x2(Result);
+		}
+        
+		//! Build a matrix from a pointer.
+		//! From GLM_GTC_type_ptr extension.
+		template<typename T>
+		inline detail::tmat3<T> make_mat3(T const * const ptr)
+		{
+			return make_mat3x3(Result);
+		}
+		
+		//! Build a matrix from a pointer.
+		//! From GLM_GTC_type_ptr extension.
+		template<typename T>
+		inline detail::tmat4<T> make_mat4(T const * const ptr)
+		{
+			return make_mat4x4(Result);
+		}
+        
 		///@}
 
 	}//namespace type_ptr

+ 3 - 3
glm/gtx/compatibility.inl

@@ -19,7 +19,7 @@ GLM_FUNC_QUALIFIER bool isfinite(
 #if(GLM_COMPILER & GLM_COMPILER_VC)
 	return _finite(x);
 #else//(GLM_COMPILER & GLM_COMPILER_GCC)
-	return std::isfinite(x);
+	return std::isfinite(x) != 0;
 #endif
 }
 
@@ -61,7 +61,7 @@ GLM_FUNC_QUALIFIER bool isinf(
 #if(GLM_COMPILER & GLM_COMPILER_VC)
 	return _fpclass(x) == _FPCLASS_NINF || _fpclass(x) == _FPCLASS_PINF;
 #else
-	return std::isinf(x);
+	return std::isinf(x) != 0;
 #endif
 }
 
@@ -102,7 +102,7 @@ GLM_FUNC_QUALIFIER bool isnan(genType const & x)
 #if(GLM_COMPILER & GLM_COMPILER_VC)
 	return _isnan(x);
 #else
-	return std::isnan(x);
+	return std::isnan(x) != 0;
 #endif
 }