From ea5e268d944cfacdf4c65aa458907fcea3aefd2b Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Wed, 23 Feb 2011 14:45:54 +0000 Subject: [PATCH 1/6] Enable CTest --- CMakeLists.txt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4f606c0f..9f1b82a8 100644 --- a/CMakeLists.txt +++ b/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) From 06c18d08d77c71831d456b92012b48a6a66f8f46 Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Wed, 2 Mar 2011 15:55:45 +0000 Subject: [PATCH 2/6] Added GLSL man page link --- glm/core/func_common.hpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/glm/core/func_common.hpp b/glm/core/func_common.hpp index c9cdc8ba..00f9333c 100644 --- a/glm/core/func_common.hpp +++ b/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 GLSL frexp man page + //! \li GLSL 4.00.08 specification, section 8.3 template 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 GLSL ldexp man page; + //! \li GLSL 4.00.08 specification, section 8.3 template genType ldexp(genType const & x, genIType const & exp); From 24e2477fdf3e7193137f25f97cbc4829602d6ad1 Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Fri, 8 Apr 2011 22:09:15 +0100 Subject: [PATCH 3/6] Create a vector from a pointer --- glm/gtc/type_ptr.hpp | 60 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/glm/gtc/type_ptr.hpp b/glm/gtc/type_ptr.hpp index 5aeea5af..1a0d2620 100644 --- a/glm/gtc/type_ptr.hpp +++ b/glm/gtc/type_ptr.hpp @@ -294,6 +294,66 @@ namespace glm return &(mat[0].x); } + //! Build a vector from a pointer. + //! From GLM_GTC_type_ptr extension. + template + inline detail::tvec2 make_vec2(T const * const ptr) + { + detail::tvec2 Result; + memcpy(&Result[0], ptr, sizeof(detail::tvec2)); + return Result; + } + + //! Build a vector from a pointer. + //! From GLM_GTC_type_ptr extension. + template + inline detail::tvec3 make_vec3(T const * const ptr) + { + detail::tvec3 Result; + memcpy(&Result[0], ptr, sizeof(detail::tvec3)); + return Result; + } + + //! Build a vector from a pointer. + //! From GLM_GTC_type_ptr extension. + template + inline detail::tvec4 make_vec4(T const * const ptr) + { + detail::tvec4 Result; + memcpy(&Result[0], ptr, sizeof(detail::tvec4)); + return Result; + } + + //! Build a matrix from a pointer. + //! From GLM_GTC_type_ptr extension. + template + inline detail::tmat2 make_mat2(T const * const ptr) + { + detail::tmat2 Result; + memcpy(&Result[0], ptr, sizeof(detail::tmat2)); + return Result; + } + + //! Build a matrix from a pointer. + //! From GLM_GTC_type_ptr extension. + template + inline detail::tmat3 make_mat3(T const * const ptr) + { + detail::tmat3 Result; + memcpy(&Result[0], ptr, sizeof(detail::tmat3)); + return Result; + } + + //! Build a matrix from a pointer. + //! From GLM_GTC_type_ptr extension. + template + inline detail::tmat4 make_mat4(T const * const ptr) + { + detail::tmat4 Result; + memcpy(&Result[0], ptr, sizeof(detail::tmat4)); + return Result; + } + ///@} }//namespace type_ptr From b4848bb3e170a5d7644193741894f15ebc965904 Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Sat, 9 Apr 2011 09:52:33 +0100 Subject: [PATCH 4/6] Fixed warnings, ticket #79 --- glm/gtx/compatibility.inl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/glm/gtx/compatibility.inl b/glm/gtx/compatibility.inl index ef7d57c9..035e50d6 100644 --- a/glm/gtx/compatibility.inl +++ b/glm/gtx/compatibility.inl @@ -19,7 +19,7 @@ inline 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 @@ inline 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 @@ inline 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 } From bb99fbb2897535f583fdf660500c9cbb67f9abea Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Sat, 9 Apr 2011 10:10:20 +0100 Subject: [PATCH 5/6] Completed implementation of building a GLM type from a pointer --- glm/gtc/type_ptr.hpp | 111 ++++++++++++++++++++++++++++++++++++++----- 1 file changed, 98 insertions(+), 13 deletions(-) diff --git a/glm/gtc/type_ptr.hpp b/glm/gtc/type_ptr.hpp index 1a0d2620..cd137098 100644 --- a/glm/gtc/type_ptr.hpp +++ b/glm/gtc/type_ptr.hpp @@ -300,7 +300,7 @@ namespace glm inline detail::tvec2 make_vec2(T const * const ptr) { detail::tvec2 Result; - memcpy(&Result[0], ptr, sizeof(detail::tvec2)); + memcpy(value_ptr(Result), ptr, sizeof(detail::tvec2)); return Result; } @@ -310,7 +310,7 @@ namespace glm inline detail::tvec3 make_vec3(T const * const ptr) { detail::tvec3 Result; - memcpy(&Result[0], ptr, sizeof(detail::tvec3)); + memcpy(value_ptr(Result), ptr, sizeof(detail::tvec3)); return Result; } @@ -320,40 +320,125 @@ namespace glm inline detail::tvec4 make_vec4(T const * const ptr) { detail::tvec4 Result; - memcpy(&Result[0], ptr, sizeof(detail::tvec4)); + memcpy(value_ptr(Result), ptr, sizeof(detail::tvec4)); return Result; } //! Build a matrix from a pointer. //! From GLM_GTC_type_ptr extension. template - inline detail::tmat2 make_mat2(T const * const ptr) + inline detail::tmat2x2 make_mat2x2(T const * const ptr) { - detail::tmat2 Result; - memcpy(&Result[0], ptr, sizeof(detail::tmat2)); + detail::tmat2x2 Result; + memcpy(value_ptr(Result), ptr, sizeof(detail::tmat2x2)); + return Result; + } + + //! Build a matrix from a pointer. + //! From GLM_GTC_type_ptr extension. + template + inline detail::tmat2x3 make_mat2x3(T const * const ptr) + { + detail::tmat2x3 Result; + memcpy(value_ptr(Result), ptr, sizeof(detail::tmat2x3)); + return Result; + } + + //! Build a matrix from a pointer. + //! From GLM_GTC_type_ptr extension. + template + inline detail::tmat2x4 make_mat2x4(T const * const ptr) + { + detail::tmat2x4 Result; + memcpy(value_ptr(Result), ptr, sizeof(detail::tmat2x4)); + return Result; + } + + //! Build a matrix from a pointer. + //! From GLM_GTC_type_ptr extension. + template + inline detail::tmat3x2 make_mat3x2(T const * const ptr) + { + detail::tmat3x2 Result; + memcpy(value_ptr(Result), ptr, sizeof(detail::tmat3x2)); + return Result; + } + + //! Build a matrix from a pointer. + //! From GLM_GTC_type_ptr extension. + template + inline detail::tmat3x3 make_mat3x3(T const * const ptr) + { + detail::tmat3x3 Result; + memcpy(value_ptr(Result), ptr, sizeof(detail::tmat3x3)); return Result; } //! Build a matrix from a pointer. //! From GLM_GTC_type_ptr extension. template - inline detail::tmat3 make_mat3(T const * const ptr) + inline detail::tmat3x4 make_mat3x4(T const * const ptr) { - detail::tmat3 Result; - memcpy(&Result[0], ptr, sizeof(detail::tmat3)); + detail::tmat3x4 Result; + memcpy(value_ptr(Result), ptr, sizeof(detail::tmat3x4)); return Result; } + + + //! Build a matrix from a pointer. + //! From GLM_GTC_type_ptr extension. + template + inline detail::tmat4x2 make_mat4x2(T const * const ptr) + { + detail::tmat4x2 Result; + memcpy(value_ptr(Result), ptr, sizeof(detail::tmat4x2)); + return Result; + } + + //! Build a matrix from a pointer. + //! From GLM_GTC_type_ptr extension. + template + inline detail::tmat4x3 make_mat4x3(T const * const ptr) + { + detail::tmat4x3 Result; + memcpy(value_ptr(Result), ptr, sizeof(detail::tmat4x3)); + return Result; + } + + //! Build a matrix from a pointer. + //! From GLM_GTC_type_ptr extension. + template + inline detail::tmat4x4 make_mat4x4(T const * const ptr) + { + detail::tmat4x4 Result; + memcpy(value_ptr(Result), ptr, sizeof(detail::tmat4x4)); + return Result; + } + + //! Build a matrix from a pointer. + //! From GLM_GTC_type_ptr extension. + template + inline detail::tmat2x2 make_mat2(T const * const ptr) + { + return make_mat2x2(Result); + } + + //! Build a matrix from a pointer. + //! From GLM_GTC_type_ptr extension. + template + inline detail::tmat3 make_mat3(T const * const ptr) + { + return make_mat3x3(Result); + } //! Build a matrix from a pointer. //! From GLM_GTC_type_ptr extension. template inline detail::tmat4 make_mat4(T const * const ptr) { - detail::tmat4 Result; - memcpy(&Result[0], ptr, sizeof(detail::tmat4)); - return Result; + return make_mat4x4(Result); } - + ///@} }//namespace type_ptr From 376d40ce00275d178bacd6243146789601fb74a1 Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Sat, 9 Apr 2011 10:11:35 +0100 Subject: [PATCH 6/6] updated version numbers --- glm/core/setup.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/glm/core/setup.hpp b/glm/core/setup.hpp index 07f32498..f1c9a253 100644 --- a/glm/core/setup.hpp +++ b/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 ///////////////////////////////////////////////////////////////////////////////////////////////////