diff --git a/glm/detail/func_common.inl b/glm/detail/func_common.inl index 83252de4..c3982e82 100644 --- a/glm/detail/func_common.inl +++ b/glm/detail/func_common.inl @@ -662,7 +662,7 @@ namespace detail { GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'frexp' only accept floating-point inputs"); - return std::frexp(x, exp); + return std::frexp(x, &exp); } template @@ -670,7 +670,7 @@ namespace detail { GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'frexp' only accept floating-point inputs"); - return tvec1(std::frexp(x.x, exp.x)); + return tvec1(std::frexp(x.x, &exp.x)); } template diff --git a/glm/detail/func_trigonometric.inl b/glm/detail/func_trigonometric.inl index f723de47..62861a68 100644 --- a/glm/detail/func_trigonometric.inl +++ b/glm/detail/func_trigonometric.inl @@ -123,7 +123,7 @@ namespace glm template class vecType> GLM_FUNC_QUALIFIER vecType atan(vecType const & a, vecType const & b) { - return detail::functor2::call(atan2, a, b); + return detail::functor2::call(::std::atan2, a, b); } using std::atan; diff --git a/glm/detail/setup.hpp b/glm/detail/setup.hpp index 526abddd..2478c3ef 100644 --- a/glm/detail/setup.hpp +++ b/glm/detail/setup.hpp @@ -65,6 +65,8 @@ #ifdef GLM_FORCE_PLATFORM_UNKNOWN # define GLM_PLATFORM GLM_PLATFORM_UNKNOWN +#elif defined(__CYGWIN__) +# define GLM_PLATFORM GLM_PLATFORM_CYGWIN #elif defined(__QNXNTO__) # define GLM_PLATFORM GLM_PLATFORM_QNXNTO #elif defined(__APPLE__) @@ -577,25 +579,20 @@ # endif # elif GLM_COMPILER & GLM_COMPILER_INTEL # ifdef _MSC_EXTENSIONS +# define GLM_MSC_EXT GLM_LANG_CXXMS_FLAG +# else +# define GLM_MSC_EXT +# endif +# if __INTEL_CXX11_MODE__ # if __cplusplus >= 201402L # define GLM_LANG (GLM_LANG_CXX14 | GLM_LANG_CXXMS_FLAG) # elif __cplusplus >= 201103L # define GLM_LANG (GLM_LANG_CXX11 | GLM_LANG_CXXMS_FLAG) -# elif GLM_COMPILER >= GLM_COMPILER_INTEL13 -# define GLM_LANG (GLM_LANG_CXX0X | GLM_LANG_CXXMS_FLAG) -# elif __cplusplus >= 199711L -# define GLM_LANG (GLM_LANG_CXX98 | GLM_LANG_CXXMS_FLAG) # else -# define GLM_LANG (GLM_LANG_CXX | GLM_LANG_CXXMS_FLAG) +# define GLM_LANG (GLM_LANG_CXX0X | GLM_LANG_CXXMS_FLAG) # endif # else -# if __cplusplus >= 201402L -# define GLM_LANG (GLM_LANG_CXX14 | GLM_LANG_CXXMS_FLAG) -# elif __cplusplus >= 201103L -# define GLM_LANG (GLM_LANG_CXX11 | GLM_LANG_CXXMS_FLAG) -# elif GLM_COMPILER >= GLM_COMPILER_INTEL13 -# define GLM_LANG (GLM_LANG_CXX0X | GLM_LANG_CXXMS_FLAG) -# elif __cplusplus >= 199711L +# if __cplusplus >= 199711L # define GLM_LANG (GLM_LANG_CXX98 | GLM_LANG_CXXMS_FLAG) # else # define GLM_LANG (GLM_LANG_CXX | GLM_LANG_CXXMS_FLAG) @@ -650,7 +647,7 @@ // http://gcc.gnu.org/projects/cxx0x.html // http://msdn.microsoft.com/en-us/library/vstudio/hh567368(v=vs.120).aspx -#if GLM_PLATFORM == GLM_PLATFORM_ANDROID +#if GLM_PLATFORM == GLM_PLATFORM_ANDROID || GLM_PLATFORM == GLM_PLATFORM_CYGWIN # define GLM_HAS_CXX11_STL 0 #elif GLM_COMPILER & (GLM_COMPILER_LLVM | GLM_COMPILER_APPLE_CLANG) # if __has_include(<__config>) // libc++ @@ -667,7 +664,7 @@ # define GLM_HAS_CXX11_STL ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && \ ((GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC48)) || \ ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2013)) || \ - ((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_COMPILER >= GLM_COMPILER_INTEL15))) + ((GLM_PLATFORM != GLM_PLATFORM_WINDOWS) && (GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_COMPILER >= GLM_COMPILER_INTEL15))) #endif // N1720 diff --git a/glm/gtc/matrix_transform.hpp b/glm/gtc/matrix_transform.hpp index b9f8098c..ebaf5e1f 100644 --- a/glm/gtc/matrix_transform.hpp +++ b/glm/gtc/matrix_transform.hpp @@ -116,14 +116,14 @@ namespace glm tmat4x4 const & m, tvec3 const & v); - /// Creates a matrix for an orthographic parallel viewing volume. - /// - /// @param left - /// @param right - /// @param bottom - /// @param top - /// @param zNear - /// @param zFar + /// Creates a matrix for an orthographic parallel viewing volume, using the default handedness. + /// + /// @param left + /// @param right + /// @param bottom + /// @param top + /// @param zNear + /// @param zFar /// @tparam T Value type used to build the matrix. Currently supported: half (not recommanded), float or double. /// @see gtc_matrix_transform /// @see - glm::ortho(T const & left, T const & right, T const & bottom, T const & top) @@ -136,12 +136,52 @@ namespace glm T zNear, T zFar); + /// Creates a matrix for an orthographic parallel viewing volume, using left-handedness. + /// + /// @param left + /// @param right + /// @param bottom + /// @param top + /// @param zNear + /// @param zFar + /// @tparam T Value type used to build the matrix. Currently supported: half (not recommanded), float or double. + /// @see gtc_matrix_transform + /// @see - glm::ortho(T const & left, T const & right, T const & bottom, T const & top) + template + GLM_FUNC_DECL tmat4x4 orthoLH( + T left, + T right, + T bottom, + T top, + T zNear, + T zFar); + + /// Creates a matrix for an orthographic parallel viewing volume, using right-handedness. + /// + /// @param left + /// @param right + /// @param bottom + /// @param top + /// @param zNear + /// @param zFar + /// @tparam T Value type used to build the matrix. Currently supported: half (not recommanded), float or double. + /// @see gtc_matrix_transform + /// @see - glm::ortho(T const & left, T const & right, T const & bottom, T const & top) + template + GLM_FUNC_DECL tmat4x4 orthoRH( + T left, + T right, + T bottom, + T top, + T zNear, + T zFar); + /// Creates a matrix for projecting two-dimensional coordinates onto the screen. - /// - /// @param left - /// @param right - /// @param bottom - /// @param top + /// + /// @param left + /// @param right + /// @param bottom + /// @param top /// @tparam T Value type used to build the matrix. Currently supported: half (not recommanded), float or double. /// @see gtc_matrix_transform /// @see - glm::ortho(T const & left, T const & right, T const & bottom, T const & top, T const & zNear, T const & zFar) @@ -152,14 +192,14 @@ namespace glm T bottom, T top); - /// Creates a frustum matrix. - /// - /// @param left - /// @param right - /// @param bottom - /// @param top - /// @param near - /// @param far + /// Creates a frustum matrix with default handedness. + /// + /// @param left + /// @param right + /// @param bottom + /// @param top + /// @param near + /// @param far /// @tparam T Value type used to build the matrix. Currently supported: half (not recommanded), float or double. /// @see gtc_matrix_transform template @@ -171,6 +211,44 @@ namespace glm T near, T far); + /// Creates a left handed frustum matrix. + /// + /// @param left + /// @param right + /// @param bottom + /// @param top + /// @param near + /// @param far + /// @tparam T Value type used to build the matrix. Currently supported: half (not recommanded), float or double. + /// @see gtc_matrix_transform + template + GLM_FUNC_DECL tmat4x4 frustumLH( + T left, + T right, + T bottom, + T top, + T near, + T far); + + /// Creates a right handed frustum matrix. + /// + /// @param left + /// @param right + /// @param bottom + /// @param top + /// @param near + /// @param far + /// @tparam T Value type used to build the matrix. Currently supported: half (not recommanded), float or double. + /// @see gtc_matrix_transform + template + GLM_FUNC_DECL tmat4x4 frustumRH( + T left, + T right, + T bottom, + T top, + T near, + T far); + /// Creates a matrix for a symetric perspective-view frustum based on the default handedness. /// /// @param fovy Specifies the field of view angle in the y direction. Expressed in radians. @@ -267,8 +345,8 @@ namespace glm T near, T far); - /// Creates a matrix for a symmetric perspective-view frustum with far plane at infinite. - /// + /// Creates a matrix for a symmetric perspective-view frustum with far plane at infinite with default handedness. + /// /// @param fovy Specifies the field of view angle, in degrees, in the y direction. Expressed in radians. /// @param aspect Specifies the aspect ratio that determines the field of view in the x direction. The aspect ratio is the ratio of x (width) to y (height). /// @param near Specifies the distance from the viewer to the near clipping plane (always positive). @@ -278,6 +356,28 @@ namespace glm GLM_FUNC_DECL tmat4x4 infinitePerspective( T fovy, T aspect, T near); + /// Creates a matrix for a left handed, symmetric perspective-view frustum with far plane at infinite. + /// + /// @param fovy Specifies the field of view angle, in degrees, in the y direction. Expressed in radians. + /// @param aspect Specifies the aspect ratio that determines the field of view in the x direction. The aspect ratio is the ratio of x (width) to y (height). + /// @param near Specifies the distance from the viewer to the near clipping plane (always positive). + /// @tparam T Value type used to build the matrix. Currently supported: half (not recommanded), float or double. + /// @see gtc_matrix_transform + template + GLM_FUNC_DECL tmat4x4 infinitePerspectiveLH( + T fovy, T aspect, T near); + + /// Creates a matrix for a right handed, symmetric perspective-view frustum with far plane at infinite. + /// + /// @param fovy Specifies the field of view angle, in degrees, in the y direction. Expressed in radians. + /// @param aspect Specifies the aspect ratio that determines the field of view in the x direction. The aspect ratio is the ratio of x (width) to y (height). + /// @param near Specifies the distance from the viewer to the near clipping plane (always positive). + /// @tparam T Value type used to build the matrix. Currently supported: half (not recommanded), float or double. + /// @see gtc_matrix_transform + template + GLM_FUNC_DECL tmat4x4 infinitePerspectiveRH( + T fovy, T aspect, T near); + /// Creates a matrix for a symmetric perspective-view frustum with far plane at infinite for graphics hardware that doesn't support depth clamping. /// /// @param fovy Specifies the field of view angle, in degrees, in the y direction. Expressed in radians. diff --git a/glm/gtc/matrix_transform.inl b/glm/gtc/matrix_transform.inl index d60494e3..2cd2645c 100644 --- a/glm/gtc/matrix_transform.inl +++ b/glm/gtc/matrix_transform.inl @@ -157,35 +157,86 @@ namespace glm T zNear, T zFar ) + { + #ifdef GLM_LEFT_HANDED + return orthoLH(left, right, bottom, top, zNear, zFar); + #else + return orthoRH(left, right, bottom, top, zNear, zFar); + #endif + } + + template + GLM_FUNC_QUALIFIER tmat4x4 orthoLH + ( + T left, + T right, + T bottom, + T top, + T zNear, + T zFar + ) { tmat4x4 Result(1); Result[0][0] = static_cast(2) / (right - left); Result[1][1] = static_cast(2) / (top - bottom); - Result[2][2] = - static_cast(2) / (zFar - zNear); Result[3][0] = - (right + left) / (right - left); Result[3][1] = - (top + bottom) / (top - bottom); + +#ifdef GLM_DEPTH_ZERO_TO_ONE + Result[2][2] = static_cast(1) / (zFar - zNear); + Result[3][2] = - zNear / (zFar - zNear); +#else + Result[2][2] = static_cast(2) / (zFar - zNear); Result[3][2] = - (zFar + zNear) / (zFar - zNear); +#endif return Result; } template - GLM_FUNC_QUALIFIER tmat4x4 ortho + GLM_FUNC_QUALIFIER tmat4x4 orthoRH ( T left, T right, T bottom, - T top + T top, + T zNear, + T zFar ) { tmat4x4 Result(1); Result[0][0] = static_cast(2) / (right - left); Result[1][1] = static_cast(2) / (top - bottom); - Result[2][2] = - static_cast(1); Result[3][0] = - (right + left) / (right - left); Result[3][1] = - (top + bottom) / (top - bottom); + +#ifdef GLM_DEPTH_ZERO_TO_ONE + Result[2][2] = - static_cast(1) / (zFar - zNear); + Result[3][2] = - zNear / (zFar - zNear); +#else + Result[2][2] = - static_cast(2) / (zFar - zNear); + Result[3][2] = - (zFar + zNear) / (zFar - zNear); +#endif return Result; } + template + GLM_FUNC_QUALIFIER tmat4x4 ortho + ( + T left, + T right, + T bottom, + T top + ) + { + tmat4x4 Result(1); + Result[0][0] = static_cast(2) / (right - left); + Result[1][1] = static_cast(2) / (top - bottom); + Result[2][2] = - static_cast(1); + Result[3][0] = - (right + left) / (right - left); + Result[3][1] = - (top + bottom) / (top - bottom); + return Result; + } + template GLM_FUNC_QUALIFIER tmat4x4 frustum ( @@ -196,15 +247,67 @@ namespace glm T nearVal, T farVal ) + { +#ifdef GLM_LEFT_HANDED + return frustumLH(left, right, bottom, top, nearVal, farVal); +#else + return frustumRH(left, right, bottom, top, nearVal, farVal); +#endif + } + + template + GLM_FUNC_QUALIFIER tmat4x4 frustumLH + ( + T left, + T right, + T bottom, + T top, + T nearVal, + T farVal + ) + { + tmat4x4 Result(0); + Result[0][0] = (static_cast(2) * nearVal) / (right - left); + Result[1][1] = (static_cast(2) * nearVal) / (top - bottom); + Result[2][0] = (right + left) / (right - left); + Result[2][1] = (top + bottom) / (top - bottom); + Result[2][3] = static_cast(1); + +#ifdef GLM_DEPTH_ZERO_TO_ONE + Result[2][2] = farVal / (farVal - nearVal); + Result[3][2] = -(farVal * nearVal) / (farVal - nearVal); +#else + Result[2][2] = (farVal + nearVal) / (farVal - nearVal); + Result[3][2] = - (static_cast(2) * farVal * nearVal) / (farVal - nearVal); +#endif + return Result; + } + + template + GLM_FUNC_QUALIFIER tmat4x4 frustumRH + ( + T left, + T right, + T bottom, + T top, + T nearVal, + T farVal + ) { tmat4x4 Result(0); Result[0][0] = (static_cast(2) * nearVal) / (right - left); Result[1][1] = (static_cast(2) * nearVal) / (top - bottom); Result[2][0] = (right + left) / (right - left); Result[2][1] = (top + bottom) / (top - bottom); - Result[2][2] = -(farVal + nearVal) / (farVal - nearVal); Result[2][3] = static_cast(-1); - Result[3][2] = -(static_cast(2) * farVal * nearVal) / (farVal - nearVal); + +#ifdef GLM_DEPTH_ZERO_TO_ONE + Result[2][2] = farVal / (nearVal - farVal); + Result[3][2] = -(farVal * nearVal) / (farVal - nearVal); +#else + Result[2][2] = - (farVal + nearVal) / (farVal - nearVal); + Result[3][2] = - (static_cast(2) * farVal * nearVal) / (farVal - nearVal); +#endif return Result; } @@ -240,9 +343,15 @@ namespace glm tmat4x4 Result(static_cast(0)); Result[0][0] = static_cast(1) / (aspect * tanHalfFovy); Result[1][1] = static_cast(1) / (tanHalfFovy); - Result[2][2] = - (zFar + zNear) / (zFar - zNear); Result[2][3] = - static_cast(1); + +#ifdef GLM_DEPTH_ZERO_TO_ONE + Result[2][2] = zFar / (zNear - zFar); + Result[3][2] = -(zFar * zNear) / (zFar - zNear); +#else + Result[2][2] = - (zFar + zNear) / (zFar - zNear); Result[3][2] = - (static_cast(2) * zFar * zNear) / (zFar - zNear); +#endif return Result; } @@ -262,9 +371,15 @@ namespace glm tmat4x4 Result(static_cast(0)); Result[0][0] = static_cast(1) / (aspect * tanHalfFovy); Result[1][1] = static_cast(1) / (tanHalfFovy); - Result[2][2] = (zFar + zNear) / (zFar - zNear); Result[2][3] = static_cast(1); - Result[3][2] = -(static_cast(2) * zFar * zNear) / (zFar - zNear); + +#ifdef GLM_DEPTH_ZERO_TO_ONE + Result[2][2] = zFar / (zFar - zNear); + Result[3][2] = -(zFar * zNear) / (zFar - zNear); +#else + Result[2][2] = (zFar + zNear) / (zFar - zNear); + Result[3][2] = - (static_cast(2) * zFar * zNear) / (zFar - zNear); +#endif return Result; } @@ -306,9 +421,15 @@ namespace glm tmat4x4 Result(static_cast(0)); Result[0][0] = w; Result[1][1] = h; - Result[2][2] = - (zFar + zNear) / (zFar - zNear); Result[2][3] = - static_cast(1); + +#ifdef GLM_DEPTH_ZERO_TO_ONE + Result[2][2] = zFar / (zNear - zFar); + Result[3][2] = -(zFar * zNear) / (zFar - zNear); +#else + Result[2][2] = - (zFar + zNear) / (zFar - zNear); Result[3][2] = - (static_cast(2) * zFar * zNear) / (zFar - zNear); +#endif return Result; } @@ -333,9 +454,16 @@ namespace glm tmat4x4 Result(static_cast(0)); Result[0][0] = w; Result[1][1] = h; - Result[2][2] = (zFar + zNear) / (zFar - zNear); Result[2][3] = static_cast(1); + +#ifdef GLM_DEPTH_ZERO_TO_ONE + Result[2][2] = zFar / (zFar - zNear); + Result[3][2] = -(zFar * zNear) / (zFar - zNear); +#else + Result[2][2] = (zFar + zNear) / (zFar - zNear); Result[3][2] = - (static_cast(2) * zFar * zNear) / (zFar - zNear); +#endif + return Result; } @@ -346,6 +474,21 @@ namespace glm T aspect, T zNear ) + { +#ifdef GLM_LEFT_HANDED + return infinitePerspectiveLH(fovy, aspect, zNear); +#else + return infinitePerspectiveRH(fovy, aspect, zNear); +#endif + } + + template + GLM_FUNC_QUALIFIER tmat4x4 infinitePerspectiveRH + ( + T fovy, + T aspect, + T zNear + ) { T const range = tan(fovy / T(2)) * zNear; T const left = -range * aspect; @@ -362,6 +505,29 @@ namespace glm return Result; } + template + GLM_FUNC_QUALIFIER tmat4x4 infinitePerspectiveLH + ( + T fovy, + T aspect, + T zNear + ) + { + T const range = tan(fovy / T(2)) * zNear; + T const left = -range * aspect; + T const right = range * aspect; + T const bottom = -range; + T const top = range; + + tmat4x4 Result(T(0)); + Result[0][0] = (T(2) * zNear) / (right - left); + Result[1][1] = (T(2) * zNear) / (top - bottom); + Result[2][2] = T(1); + Result[2][3] = T(1); + Result[3][2] = - T(2) * zNear; + return Result; + } + // Infinite projection matrix: http://www.terathon.com/gdc07_lengyel.pdf template GLM_FUNC_QUALIFIER tmat4x4 tweakedInfinitePerspective diff --git a/glm/gtx/euler_angles.hpp b/glm/gtx/euler_angles.hpp index e772bbf0..c1d5683d 100644 --- a/glm/gtx/euler_angles.hpp +++ b/glm/gtx/euler_angles.hpp @@ -161,7 +161,7 @@ namespace glm /// Extracts the (X * Y * Z) Euler angles from the rotation matrix M /// @see gtx_euler_angles template - GLM_FUNC_DECL void extractEulerAngleXYZ(tmat4x4 & M, + GLM_FUNC_DECL void extractEulerAngleXYZ(tmat4x4 const & M, T & t1, T & t2, T & t3); diff --git a/glm/gtx/euler_angles.inl b/glm/gtx/euler_angles.inl index 80b30dbe..0b417000 100644 --- a/glm/gtx/euler_angles.inl +++ b/glm/gtx/euler_angles.inl @@ -323,7 +323,7 @@ namespace glm } template - GLM_FUNC_DECL void extractEulerAngleXYZ(tmat4x4 & M, + GLM_FUNC_DECL void extractEulerAngleXYZ(tmat4x4 const & M, T & t1, T & t2, T & t3) diff --git a/glm/gtx/intersect.inl b/glm/gtx/intersect.inl index 0c1cc935..6b94d5bc 100644 --- a/glm/gtx/intersect.inl +++ b/glm/gtx/intersect.inl @@ -49,7 +49,7 @@ namespace glm typename genType::value_type a = glm::dot(e1, p); typename genType::value_type Epsilon = std::numeric_limits::epsilon(); - if(a < Epsilon) + if(a < Epsilon && a > -Epsilon) return false; typename genType::value_type f = typename genType::value_type(1.0f) / a; @@ -73,43 +73,6 @@ namespace glm return baryPosition.z >= typename genType::value_type(0.0f); } - //template - //GLM_FUNC_QUALIFIER bool intersectRayTriangle - //( - // genType const & orig, genType const & dir, - // genType const & vert0, genType const & vert1, genType const & vert2, - // genType & position - //) - //{ - // typename genType::value_type Epsilon = std::numeric_limits::epsilon(); - // - // genType edge1 = vert1 - vert0; - // genType edge2 = vert2 - vert0; - // - // genType pvec = cross(dir, edge2); - // - // float det = dot(edge1, pvec); - // if(det < Epsilon) - // return false; - // - // genType tvec = orig - vert0; - // - // position.y = dot(tvec, pvec); - // if (position.y < typename genType::value_type(0) || position.y > det) - // return typename genType::value_type(0); - // - // genType qvec = cross(tvec, edge1); - // - // position.z = dot(dir, qvec); - // if (position.z < typename genType::value_type(0) || position.y + position.z > det) - // return typename genType::value_type(0); - // - // position.x = dot(edge2, qvec); - // position *= typename genType::value_type(1) / det; - // - // return typename genType::value_type(1); - //} - template GLM_FUNC_QUALIFIER bool intersectLineTriangle ( diff --git a/glm/gtx/vector_angle.hpp b/glm/gtx/vector_angle.hpp index 80288701..a05b988f 100644 --- a/glm/gtx/vector_angle.hpp +++ b/glm/gtx/vector_angle.hpp @@ -58,15 +58,15 @@ namespace glm /// @addtogroup gtx_vector_angle /// @{ - //! Returns the absolute angle between two vectors + //! Returns the absolute angle between two vectors. //! Parameters need to be normalized. - /// @see gtx_vector_angle extension + /// @see gtx_vector_angle extension. template GLM_FUNC_DECL typename vecType::value_type angle( vecType const & x, vecType const & y); - //! Returns the oriented angle between two 2d vectors + //! Returns the oriented angle between two 2d vectors. //! Parameters need to be normalized. /// @see gtx_vector_angle extension. template diff --git a/readme.md b/readme.md index f4d601fb..2b4c91d1 100644 --- a/readme.md +++ b/readme.md @@ -68,12 +68,15 @@ glm::mat4 camera(float Translate, glm::vec2 const & Rotate) ##### Fixes: - Fixed GTX_extended_min_max filename typo #386 +- Fixed intersectRayTriangle to not do any unintentional backface culling +- Fixed frexp compilation error #### [GLM 0.9.7.2](https://github.com/g-truc/glm/tree/0.9.7) - 2015-XX-XX ##### Fixes: - Fixed GTC_round floorMultiple/ceilMultiple #412 - Fixed GTC_packing unpackUnorm3x10_1x2 #414 - Fixed GTC_matrix_inverse affineInverse #192 +- Fixed Cygwin build errors when using C++11 #405 #### [GLM 0.9.7.1](https://github.com/g-truc/glm/releases/tag/0.9.7.1) - 2015-09-07 ##### Improvements: diff --git a/test/core/core_func_common.cpp b/test/core/core_func_common.cpp index 43dade52..6b9940b8 100644 --- a/test/core/core_func_common.cpp +++ b/test/core/core_func_common.cpp @@ -1153,6 +1153,48 @@ namespace sign } }//namespace sign +namespace frexp_ +{ + int test() + { + int Error(0); + + { + glm::vec1 x(1024); + glm::ivec1 exp; + glm::vec1 A = glm::frexp(x, exp); + Error += glm::all(glm::epsilonEqual(A, glm::vec1(0.5), 0.00001f)) ? 0 : 1; + Error += glm::all(glm::equal(exp, glm::ivec1(11))) ? 0 : 1; + } + + { + glm::vec2 x(1024, 0.24); + glm::ivec2 exp; + glm::vec2 A = glm::frexp(x, exp); + Error += glm::all(glm::epsilonEqual(A, glm::vec2(0.5, 0.96), 0.00001f)) ? 0 : 1; + Error += glm::all(glm::equal(exp, glm::ivec2(11, -2))) ? 0 : 1; + } + + { + glm::vec3 x(1024, 0.24, 0); + glm::ivec3 exp; + glm::vec3 A = glm::frexp(x, exp); + Error += glm::all(glm::epsilonEqual(A, glm::vec3(0.5, 0.96, 0.0), 0.00001f)) ? 0 : 1; + Error += glm::all(glm::equal(exp, glm::ivec3(11, -2, 0))) ? 0 : 1; + } + + { + glm::vec4 x(1024, 0.24, 0, -1.33); + glm::ivec4 exp; + glm::vec4 A = glm::frexp(x, exp); + Error += glm::all(glm::epsilonEqual(A, glm::vec4(0.5, 0.96, 0.0, -0.665), 0.00001f)) ? 0 : 1; + Error += glm::all(glm::equal(exp, glm::ivec4(11, -2, 0, 1))) ? 0 : 1; + } + + return Error; + } +}//namespace frexp_ + int main() { int Error(0); @@ -1171,6 +1213,7 @@ int main() Error += roundEven::test(); Error += isnan_::test(); Error += isinf_::test(); + Error += frexp_::test(); # ifdef NDEBUG std::size_t Samples = 1000; diff --git a/test/gtx/gtx_integer.cpp b/test/gtx/gtx_integer.cpp index 01738163..dcbbb692 100644 --- a/test/gtx/gtx_integer.cpp +++ b/test/gtx/gtx_integer.cpp @@ -63,10 +63,10 @@ int test_log2() Error += glm::abs(double(A) - B) <= 24 ? 0 : 1; assert(!Error); - printf("Log2(%d) Error: %d, %d\n", 1 << i, A, B); + printf("Log2(%d) error A=%d, B=%d\n", 1 << i, A, B); } - printf("log2 error: %d\n", Error); + printf("log2 error=%d\n", Error); return Error; }