From 2877f4eda3d1b0c7431039e3142ecf1a282a34b1 Mon Sep 17 00:00:00 2001 From: LaG1924 <12997935+LaG1924@users.noreply.github.com> Date: Tue, 21 Aug 2018 20:40:38 +0500 Subject: Update glm to 0.9.9.0 --- external/include/glm/gtx/associated_min_max.hpp | 171 +- external/include/glm/gtx/associated_min_max.inl | 194 +- external/include/glm/gtx/bit.hpp | 39 +- external/include/glm/gtx/bit.inl | 40 +- external/include/glm/gtx/closest_point.hpp | 34 +- external/include/glm/gtx/closest_point.inl | 38 +- external/include/glm/gtx/color_encoding.hpp | 50 + external/include/glm/gtx/color_encoding.inl | 46 + external/include/glm/gtx/color_space.hpp | 46 +- external/include/glm/gtx/color_space.inl | 61 +- external/include/glm/gtx/color_space_YCoCg.hpp | 32 +- external/include/glm/gtx/color_space_YCoCg.inl | 70 +- external/include/glm/gtx/common.hpp | 41 +- external/include/glm/gtx/common.inl | 80 +- external/include/glm/gtx/compatibility.hpp | 161 +- external/include/glm/gtx/compatibility.inl | 36 +- external/include/glm/gtx/component_wise.hpp | 44 +- external/include/glm/gtx/component_wise.inl | 78 +- external/include/glm/gtx/dual_quaternion.hpp | 162 +- external/include/glm/gtx/dual_quaternion.inl | 240 +- external/include/glm/gtx/easing.hpp | 221 ++ external/include/glm/gtx/easing.inl | 437 +++ external/include/glm/gtx/euler_angles.hpp | 320 ++- external/include/glm/gtx/euler_angles.inl | 738 +++++- external/include/glm/gtx/extend.hpp | 14 +- external/include/glm/gtx/extend.inl | 38 +- external/include/glm/gtx/extended_min_max.hpp | 227 +- external/include/glm/gtx/extended_min_max.inl | 187 +- external/include/glm/gtx/exterior_product.hpp | 41 + external/include/glm/gtx/exterior_product.inl | 27 + external/include/glm/gtx/fast_exponential.hpp | 44 +- external/include/glm/gtx/fast_exponential.inl | 46 +- external/include/glm/gtx/fast_square_root.hpp | 40 +- external/include/glm/gtx/fast_square_root.inl | 38 +- external/include/glm/gtx/fast_trigonometry.hpp | 38 +- external/include/glm/gtx/fast_trigonometry.inl | 84 +- external/include/glm/gtx/float_notmalize.inl | 6 +- external/include/glm/gtx/functions.hpp | 52 + external/include/glm/gtx/functions.inl | 31 + external/include/glm/gtx/gradient_paint.hpp | 27 +- external/include/glm/gtx/gradient_paint.inl | 24 +- .../include/glm/gtx/handed_coordinate_space.hpp | 24 +- .../include/glm/gtx/handed_coordinate_space.inl | 16 +- external/include/glm/gtx/hash.hpp | 104 +- external/include/glm/gtx/hash.inl | 82 +- external/include/glm/gtx/integer.hpp | 20 +- external/include/glm/gtx/integer.inl | 42 +- external/include/glm/gtx/intersect.hpp | 51 +- external/include/glm/gtx/intersect.inl | 103 +- external/include/glm/gtx/io.hpp | 98 +- external/include/glm/gtx/io.inl | 124 +- external/include/glm/gtx/log_base.hpp | 22 +- external/include/glm/gtx/log_base.inl | 10 +- external/include/glm/gtx/matrix_cross_product.hpp | 22 +- external/include/glm/gtx/matrix_cross_product.inl | 16 +- external/include/glm/gtx/matrix_decompose.hpp | 16 +- external/include/glm/gtx/matrix_decompose.inl | 115 +- external/include/glm/gtx/matrix_factorisation.hpp | 69 + external/include/glm/gtx/matrix_factorisation.inl | 85 + external/include/glm/gtx/matrix_interpolation.hpp | 34 +- external/include/glm/gtx/matrix_interpolation.inl | 140 +- external/include/glm/gtx/matrix_major_storage.hpp | 114 +- external/include/glm/gtx/matrix_major_storage.inl | 120 +- external/include/glm/gtx/matrix_operation.hpp | 62 +- external/include/glm/gtx/matrix_operation.inl | 78 +- external/include/glm/gtx/matrix_query.hpp | 46 +- external/include/glm/gtx/matrix_query.inl | 42 +- external/include/glm/gtx/matrix_transform_2d.hpp | 55 +- external/include/glm/gtx/matrix_transform_2d.inl | 46 +- external/include/glm/gtx/mixed_product.hpp | 16 +- external/include/glm/gtx/mixed_product.inl | 8 +- external/include/glm/gtx/norm.hpp | 66 +- external/include/glm/gtx/norm.inl | 66 +- external/include/glm/gtx/normal.hpp | 20 +- external/include/glm/gtx/normal.inl | 10 +- external/include/glm/gtx/normalize_dot.hpp | 16 +- external/include/glm/gtx/normalize_dot.inl | 8 +- external/include/glm/gtx/number_precision.hpp | 26 +- external/include/glm/gtx/optimum_pow.hpp | 20 +- external/include/glm/gtx/optimum_pow.inl | 12 +- external/include/glm/gtx/orthonormalize.hpp | 18 +- external/include/glm/gtx/orthonormalize.inl | 10 +- external/include/glm/gtx/perpendicular.hpp | 14 +- external/include/glm/gtx/perpendicular.inl | 8 +- external/include/glm/gtx/polar_coordinates.hpp | 20 +- external/include/glm/gtx/polar_coordinates.inl | 18 +- external/include/glm/gtx/projection.hpp | 12 +- external/include/glm/gtx/projection.inl | 4 +- external/include/glm/gtx/quaternion.hpp | 187 +- external/include/glm/gtx/quaternion.inl | 158 +- external/include/glm/gtx/range.hpp | 61 +- external/include/glm/gtx/raw_data.hpp | 16 +- .../include/glm/gtx/rotate_normalized_axis.hpp | 50 +- .../include/glm/gtx/rotate_normalized_axis.inl | 34 +- external/include/glm/gtx/rotate_vector.hpp | 128 +- external/include/glm/gtx/rotate_vector.inl | 122 +- external/include/glm/gtx/scalar_multiplication.hpp | 22 +- external/include/glm/gtx/scalar_relational.hpp | 8 +- external/include/glm/gtx/scalar_relational.inl | 46 +- external/include/glm/gtx/simd_mat4.hpp | 182 -- external/include/glm/gtx/simd_mat4.inl | 577 ---- external/include/glm/gtx/simd_quat.hpp | 307 --- external/include/glm/gtx/simd_quat.inl | 620 ----- external/include/glm/gtx/simd_vec4.hpp | 546 ---- external/include/glm/gtx/simd_vec4.inl | 721 ----- external/include/glm/gtx/spline.hpp | 50 +- external/include/glm/gtx/spline.inl | 38 +- external/include/glm/gtx/std_based_type.hpp | 25 +- external/include/glm/gtx/string_cast.hpp | 15 +- external/include/glm/gtx/string_cast.inl | 290 +- external/include/glm/gtx/texture.hpp | 46 + external/include/glm/gtx/texture.inl | 18 + external/include/glm/gtx/transform.hpp | 30 +- external/include/glm/gtx/transform.inl | 18 +- external/include/glm/gtx/transform2.hpp | 78 +- external/include/glm/gtx/transform2.inl | 74 +- external/include/glm/gtx/type_aligned.hpp | 491 ++-- external/include/glm/gtx/type_trait.hpp | 211 +- external/include/glm/gtx/type_trait.inl | 62 + external/include/glm/gtx/vec_swizzle.hpp | 2778 ++++++++++++++++++++ external/include/glm/gtx/vector_angle.hpp | 27 +- external/include/glm/gtx/vector_angle.inl | 31 +- external/include/glm/gtx/vector_query.hpp | 36 +- external/include/glm/gtx/vector_query.inl | 134 +- external/include/glm/gtx/wrap.hpp | 16 +- external/include/glm/gtx/wrap.inl | 52 +- 126 files changed, 8441 insertions(+), 6335 deletions(-) create mode 100644 external/include/glm/gtx/color_encoding.hpp create mode 100644 external/include/glm/gtx/color_encoding.inl create mode 100644 external/include/glm/gtx/easing.hpp create mode 100644 external/include/glm/gtx/easing.inl create mode 100644 external/include/glm/gtx/exterior_product.hpp create mode 100644 external/include/glm/gtx/exterior_product.inl create mode 100644 external/include/glm/gtx/functions.hpp create mode 100644 external/include/glm/gtx/functions.inl create mode 100644 external/include/glm/gtx/matrix_factorisation.hpp create mode 100644 external/include/glm/gtx/matrix_factorisation.inl delete mode 100644 external/include/glm/gtx/simd_mat4.hpp delete mode 100644 external/include/glm/gtx/simd_mat4.inl delete mode 100644 external/include/glm/gtx/simd_quat.hpp delete mode 100644 external/include/glm/gtx/simd_quat.inl delete mode 100644 external/include/glm/gtx/simd_vec4.hpp delete mode 100644 external/include/glm/gtx/simd_vec4.inl create mode 100644 external/include/glm/gtx/texture.hpp create mode 100644 external/include/glm/gtx/texture.inl create mode 100644 external/include/glm/gtx/vec_swizzle.hpp (limited to 'external/include/glm/gtx') diff --git a/external/include/glm/gtx/associated_min_max.hpp b/external/include/glm/gtx/associated_min_max.hpp index eb9d721..42ac2eb 100644 --- a/external/include/glm/gtx/associated_min_max.hpp +++ b/external/include/glm/gtx/associated_min_max.hpp @@ -6,15 +6,20 @@ /// /// @defgroup gtx_associated_min_max GLM_GTX_associated_min_max /// @ingroup gtx -/// +/// +/// Include to use the features of this extension. +/// /// @brief Min and max functions that return associated values not the compared onces. -/// need to be included to use these functionalities. #pragma once // Dependency: #include "../glm.hpp" +#ifndef GLM_ENABLE_EXPERIMENTAL +# error "GLM: GTX_associated_min_max is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." +#endif + #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) # pragma message("GLM: GLM_GTX_associated_min_max extension included") #endif @@ -26,29 +31,29 @@ namespace glm /// Minimum comparison between 2 variables and returns 2 associated variable values /// @see gtx_associated_min_max - template + template GLM_FUNC_DECL U associatedMin(T x, U a, T y, U b); /// Minimum comparison between 2 variables and returns 2 associated variable values /// @see gtx_associated_min_max - template class vecType> - GLM_FUNC_DECL tvec2 associatedMin( - vecType const & x, vecType const & a, - vecType const & y, vecType const & b); + template + GLM_FUNC_DECL vec<2, U, Q> associatedMin( + vec const& x, vec const& a, + vec const& y, vec const& b); /// Minimum comparison between 2 variables and returns 2 associated variable values /// @see gtx_associated_min_max - template class vecType> - GLM_FUNC_DECL vecType associatedMin( - T x, const vecType& a, - T y, const vecType& b); + template + GLM_FUNC_DECL vec associatedMin( + T x, const vec& a, + T y, const vec& b); /// Minimum comparison between 2 variables and returns 2 associated variable values /// @see gtx_associated_min_max - template class vecType> - GLM_FUNC_DECL vecType associatedMin( - vecType const & x, U a, - vecType const & y, U b); + template + GLM_FUNC_DECL vec associatedMin( + vec const& x, U a, + vec const& y, U b); /// Minimum comparison between 3 variables and returns 3 associated variable values /// @see gtx_associated_min_max @@ -60,11 +65,11 @@ namespace glm /// Minimum comparison between 3 variables and returns 3 associated variable values /// @see gtx_associated_min_max - template class vecType> - GLM_FUNC_DECL vecType associatedMin( - vecType const & x, vecType const & a, - vecType const & y, vecType const & b, - vecType const & z, vecType const & c); + template + GLM_FUNC_DECL vec associatedMin( + vec const& x, vec const& a, + vec const& y, vec const& b, + vec const& z, vec const& c); /// Minimum comparison between 4 variables and returns 4 associated variable values /// @see gtx_associated_min_max @@ -77,30 +82,30 @@ namespace glm /// Minimum comparison between 4 variables and returns 4 associated variable values /// @see gtx_associated_min_max - template class vecType> - GLM_FUNC_DECL vecType associatedMin( - vecType const & x, vecType const & a, - vecType const & y, vecType const & b, - vecType const & z, vecType const & c, - vecType const & w, vecType const & d); + template + GLM_FUNC_DECL vec associatedMin( + vec const& x, vec const& a, + vec const& y, vec const& b, + vec const& z, vec const& c, + vec const& w, vec const& d); /// Minimum comparison between 4 variables and returns 4 associated variable values /// @see gtx_associated_min_max - template class vecType> - GLM_FUNC_DECL vecType associatedMin( - T x, vecType const & a, - T y, vecType const & b, - T z, vecType const & c, - T w, vecType const & d); + template + GLM_FUNC_DECL vec associatedMin( + T x, vec const& a, + T y, vec const& b, + T z, vec const& c, + T w, vec const& d); /// Minimum comparison between 4 variables and returns 4 associated variable values /// @see gtx_associated_min_max - template class vecType> - GLM_FUNC_DECL vecType associatedMin( - vecType const & x, U a, - vecType const & y, U b, - vecType const & z, U c, - vecType const & w, U d); + template + GLM_FUNC_DECL vec associatedMin( + vec const& x, U a, + vec const& y, U b, + vec const& z, U c, + vec const& w, U d); /// Maximum comparison between 2 variables and returns 2 associated variable values /// @see gtx_associated_min_max @@ -109,24 +114,24 @@ namespace glm /// Maximum comparison between 2 variables and returns 2 associated variable values /// @see gtx_associated_min_max - template class vecType> - GLM_FUNC_DECL tvec2 associatedMax( - vecType const & x, vecType const & a, - vecType const & y, vecType const & b); + template + GLM_FUNC_DECL vec<2, U, Q> associatedMax( + vec const& x, vec const& a, + vec const& y, vec const& b); /// Maximum comparison between 2 variables and returns 2 associated variable values /// @see gtx_associated_min_max - template class vecType> - GLM_FUNC_DECL vecType associatedMax( - T x, vecType const & a, - T y, vecType const & b); + template + GLM_FUNC_DECL vec associatedMax( + T x, vec const& a, + T y, vec const& b); /// Maximum comparison between 2 variables and returns 2 associated variable values /// @see gtx_associated_min_max - template class vecType> - GLM_FUNC_DECL vecType associatedMax( - vecType const & x, U a, - vecType const & y, U b); + template + GLM_FUNC_DECL vec associatedMax( + vec const& x, U a, + vec const& y, U b); /// Maximum comparison between 3 variables and returns 3 associated variable values /// @see gtx_associated_min_max @@ -138,27 +143,27 @@ namespace glm /// Maximum comparison between 3 variables and returns 3 associated variable values /// @see gtx_associated_min_max - template class vecType> - GLM_FUNC_DECL vecType associatedMax( - vecType const & x, vecType const & a, - vecType const & y, vecType const & b, - vecType const & z, vecType const & c); + template + GLM_FUNC_DECL vec associatedMax( + vec const& x, vec const& a, + vec const& y, vec const& b, + vec const& z, vec const& c); /// Maximum comparison between 3 variables and returns 3 associated variable values /// @see gtx_associated_min_max - template class vecType> - GLM_FUNC_DECL vecType associatedMax( - T x, vecType const & a, - T y, vecType const & b, - T z, vecType const & c); + template + GLM_FUNC_DECL vec associatedMax( + T x, vec const& a, + T y, vec const& b, + T z, vec const& c); /// Maximum comparison between 3 variables and returns 3 associated variable values /// @see gtx_associated_min_max - template class vecType> - GLM_FUNC_DECL vecType associatedMax( - vecType const & x, U a, - vecType const & y, U b, - vecType const & z, U c); + template + GLM_FUNC_DECL vec associatedMax( + vec const& x, U a, + vec const& y, U b, + vec const& z, U c); /// Maximum comparison between 4 variables and returns 4 associated variable values /// @see gtx_associated_min_max @@ -171,30 +176,30 @@ namespace glm /// Maximum comparison between 4 variables and returns 4 associated variable values /// @see gtx_associated_min_max - template class vecType> - GLM_FUNC_DECL vecType associatedMax( - vecType const & x, vecType const & a, - vecType const & y, vecType const & b, - vecType const & z, vecType const & c, - vecType const & w, vecType const & d); + template + GLM_FUNC_DECL vec associatedMax( + vec const& x, vec const& a, + vec const& y, vec const& b, + vec const& z, vec const& c, + vec const& w, vec const& d); /// Maximum comparison between 4 variables and returns 4 associated variable values /// @see gtx_associated_min_max - template class vecType> - GLM_FUNC_DECL vecType associatedMax( - T x, vecType const & a, - T y, vecType const & b, - T z, vecType const & c, - T w, vecType const & d); + template + GLM_FUNC_DECL vec associatedMax( + T x, vec const& a, + T y, vec const& b, + T z, vec const& c, + T w, vec const& d); /// Maximum comparison between 4 variables and returns 4 associated variable values /// @see gtx_associated_min_max - template class vecType> - GLM_FUNC_DECL vecType associatedMax( - vecType const & x, U a, - vecType const & y, U b, - vecType const & z, U c, - vecType const & w, U d); + template + GLM_FUNC_DECL vec associatedMax( + vec const& x, U a, + vec const& y, U b, + vec const& z, U c, + vec const& w, U d); /// @} } //namespace glm diff --git a/external/include/glm/gtx/associated_min_max.inl b/external/include/glm/gtx/associated_min_max.inl index 6a57d48..d0666cc 100644 --- a/external/include/glm/gtx/associated_min_max.inl +++ b/external/include/glm/gtx/associated_min_max.inl @@ -4,46 +4,46 @@ namespace glm{ // Min comparison between 2 variables -template +template GLM_FUNC_QUALIFIER U associatedMin(T x, U a, T y, U b) { return x < y ? a : b; } -template class vecType> -GLM_FUNC_QUALIFIER tvec2 associatedMin +template +GLM_FUNC_QUALIFIER vec<2, U, Q> associatedMin ( - vecType const & x, vecType const & a, - vecType const & y, vecType const & b + vec const& x, vec const& a, + vec const& y, vec const& b ) { - vecType Result(uninitialize); + vec Result; for(length_t i = 0, n = Result.length(); i < n; ++i) Result[i] = x[i] < y[i] ? a[i] : b[i]; return Result; } -template class vecType> -GLM_FUNC_QUALIFIER vecType associatedMin +template +GLM_FUNC_QUALIFIER vec associatedMin ( - T x, const vecType& a, - T y, const vecType& b + T x, const vec& a, + T y, const vec& b ) { - vecType Result(uninitialize); + vec Result; for(length_t i = 0, n = Result.length(); i < n; ++i) Result[i] = x < y ? a[i] : b[i]; return Result; } -template class vecType> -GLM_FUNC_QUALIFIER vecType associatedMin +template +GLM_FUNC_QUALIFIER vec associatedMin ( - vecType const & x, U a, - vecType const & y, U b + vec const& x, U a, + vec const& y, U b ) { - vecType Result(uninitialize); + vec Result; for(length_t i = 0, n = Result.length(); i < n; ++i) Result[i] = x[i] < y[i] ? a : b; return Result; @@ -62,15 +62,15 @@ GLM_FUNC_QUALIFIER U associatedMin return Result; } -template class vecType> -GLM_FUNC_QUALIFIER vecType associatedMin +template +GLM_FUNC_QUALIFIER vec associatedMin ( - vecType const & x, vecType const & a, - vecType const & y, vecType const & b, - vecType const & z, vecType const & c + vec const& x, vec const& a, + vec const& y, vec const& b, + vec const& z, vec const& c ) { - vecType Result(uninitialize); + vec Result; for(length_t i = 0, n = Result.length(); i < n; ++i) Result[i] = x[i] < y[i] ? (x[i] < z[i] ? a[i] : c[i]) : (y[i] < z[i] ? b[i] : c[i]); return Result; @@ -95,16 +95,16 @@ GLM_FUNC_QUALIFIER U associatedMin } // Min comparison between 4 variables -template class vecType> -GLM_FUNC_QUALIFIER vecType associatedMin +template +GLM_FUNC_QUALIFIER vec associatedMin ( - vecType const & x, vecType const & a, - vecType const & y, vecType const & b, - vecType const & z, vecType const & c, - vecType const & w, vecType const & d + vec const& x, vec const& a, + vec const& y, vec const& b, + vec const& z, vec const& c, + vec const& w, vec const& d ) { - vecType Result(uninitialize); + vec Result; for(length_t i = 0, n = Result.length(); i < n; ++i) { T Test1 = min(x[i], y[i]); @@ -117,19 +117,19 @@ GLM_FUNC_QUALIFIER vecType associatedMin } // Min comparison between 4 variables -template class vecType> -GLM_FUNC_QUALIFIER vecType associatedMin +template +GLM_FUNC_QUALIFIER vec associatedMin ( - T x, vecType const & a, - T y, vecType const & b, - T z, vecType const & c, - T w, vecType const & d + T x, vec const& a, + T y, vec const& b, + T z, vec const& c, + T w, vec const& d ) { T Test1 = min(x, y); T Test2 = min(z, w); - vecType Result(uninitialize); + vec Result; for(length_t i = 0, n = Result.length(); i < n; ++i) { U Result1 = x < y ? a[i] : b[i]; @@ -140,16 +140,16 @@ GLM_FUNC_QUALIFIER vecType associatedMin } // Min comparison between 4 variables -template class vecType> -GLM_FUNC_QUALIFIER vecType associatedMin +template +GLM_FUNC_QUALIFIER vec associatedMin ( - vecType const & x, U a, - vecType const & y, U b, - vecType const & z, U c, - vecType const & w, U d + vec const& x, U a, + vec const& y, U b, + vec const& z, U c, + vec const& w, U d ) { - vecType Result(uninitialize); + vec Result; for(length_t i = 0, n = Result.length(); i < n; ++i) { T Test1 = min(x[i], y[i]); @@ -169,42 +169,42 @@ GLM_FUNC_QUALIFIER U associatedMax(T x, U a, T y, U b) } // Max comparison between 2 variables -template class vecType> -GLM_FUNC_QUALIFIER tvec2 associatedMax +template +GLM_FUNC_QUALIFIER vec<2, U, Q> associatedMax ( - vecType const & x, vecType const & a, - vecType const & y, vecType const & b + vec const& x, vec const& a, + vec const& y, vec const& b ) { - vecType Result(uninitialize); + vec Result; for(length_t i = 0, n = Result.length(); i < n; ++i) Result[i] = x[i] > y[i] ? a[i] : b[i]; return Result; } // Max comparison between 2 variables -template class vecType> -GLM_FUNC_QUALIFIER vecType associatedMax +template +GLM_FUNC_QUALIFIER vec associatedMax ( - T x, vecType const & a, - T y, vecType const & b + T x, vec const& a, + T y, vec const& b ) { - vecType Result(uninitialize); + vec Result; for(length_t i = 0, n = Result.length(); i < n; ++i) Result[i] = x > y ? a[i] : b[i]; return Result; } // Max comparison between 2 variables -template class vecType> -GLM_FUNC_QUALIFIER vecType associatedMax +template +GLM_FUNC_QUALIFIER vec associatedMax ( - vecType const & x, U a, - vecType const & y, U b + vec const& x, U a, + vec const& y, U b ) { - vecType Result(uninitialize); + vec Result; for(length_t i = 0, n = Result.length(); i < n; ++i) Result[i] = x[i] > y[i] ? a : b; return Result; @@ -224,45 +224,45 @@ GLM_FUNC_QUALIFIER U associatedMax } // Max comparison between 3 variables -template class vecType> -GLM_FUNC_QUALIFIER vecType associatedMax +template +GLM_FUNC_QUALIFIER vec associatedMax ( - vecType const & x, vecType const & a, - vecType const & y, vecType const & b, - vecType const & z, vecType const & c + vec const& x, vec const& a, + vec const& y, vec const& b, + vec const& z, vec const& c ) { - vecType Result(uninitialize); + vec Result; for(length_t i = 0, n = Result.length(); i < n; ++i) Result[i] = x[i] > y[i] ? (x[i] > z[i] ? a[i] : c[i]) : (y[i] > z[i] ? b[i] : c[i]); return Result; } // Max comparison between 3 variables -template class vecType> -GLM_FUNC_QUALIFIER vecType associatedMax +template +GLM_FUNC_QUALIFIER vec associatedMax ( - T x, vecType const & a, - T y, vecType const & b, - T z, vecType const & c + T x, vec const& a, + T y, vec const& b, + T z, vec const& c ) { - vecType Result(uninitialize); + vec Result; for(length_t i = 0, n = Result.length(); i < n; ++i) Result[i] = x > y ? (x > z ? a[i] : c[i]) : (y > z ? b[i] : c[i]); return Result; } // Max comparison between 3 variables -template class vecType> -GLM_FUNC_QUALIFIER vecType associatedMax +template +GLM_FUNC_QUALIFIER vec associatedMax ( - vecType const & x, U a, - vecType const & y, U b, - vecType const & z, U c + vec const& x, U a, + vec const& y, U b, + vec const& z, U c ) { - vecType Result(uninitialize); + vec Result; for(length_t i = 0, n = Result.length(); i < n; ++i) Result[i] = x[i] > y[i] ? (x[i] > z[i] ? a : c) : (y[i] > z[i] ? b : c); return Result; @@ -287,16 +287,16 @@ GLM_FUNC_QUALIFIER U associatedMax } // Max comparison between 4 variables -template class vecType> -GLM_FUNC_QUALIFIER vecType associatedMax +template +GLM_FUNC_QUALIFIER vec associatedMax ( - vecType const & x, vecType const & a, - vecType const & y, vecType const & b, - vecType const & z, vecType const & c, - vecType const & w, vecType const & d + vec const& x, vec const& a, + vec const& y, vec const& b, + vec const& z, vec const& c, + vec const& w, vec const& d ) { - vecType Result(uninitialize); + vec Result; for(length_t i = 0, n = Result.length(); i < n; ++i) { T Test1 = max(x[i], y[i]); @@ -309,19 +309,19 @@ GLM_FUNC_QUALIFIER vecType associatedMax } // Max comparison between 4 variables -template class vecType> -GLM_FUNC_QUALIFIER vecType associatedMax +template +GLM_FUNC_QUALIFIER vec associatedMax ( - T x, vecType const & a, - T y, vecType const & b, - T z, vecType const & c, - T w, vecType const & d + T x, vec const& a, + T y, vec const& b, + T z, vec const& c, + T w, vec const& d ) { T Test1 = max(x, y); T Test2 = max(z, w); - vecType Result(uninitialize); + vec Result; for(length_t i = 0, n = Result.length(); i < n; ++i) { U Result1 = x > y ? a[i] : b[i]; @@ -332,16 +332,16 @@ GLM_FUNC_QUALIFIER vecType associatedMax } // Max comparison between 4 variables -template class vecType> -GLM_FUNC_QUALIFIER vecType associatedMax +template +GLM_FUNC_QUALIFIER vec associatedMax ( - vecType const & x, U a, - vecType const & y, U b, - vecType const & z, U c, - vecType const & w, U d + vec const& x, U a, + vec const& y, U b, + vec const& z, U c, + vec const& w, U d ) { - vecType Result(uninitialize); + vec Result; for(length_t i = 0, n = Result.length(); i < n; ++i) { T Test1 = max(x[i], y[i]); diff --git a/external/include/glm/gtx/bit.hpp b/external/include/glm/gtx/bit.hpp index 17378f3..2eb4c26 100644 --- a/external/include/glm/gtx/bit.hpp +++ b/external/include/glm/gtx/bit.hpp @@ -2,20 +2,23 @@ /// @file glm/gtx/bit.hpp /// /// @see core (dependence) -/// @see gtc_half_float (dependence) /// /// @defgroup gtx_bit GLM_GTX_bit /// @ingroup gtx -/// -/// @brief Allow to perform bit operations on integer values -/// -/// need to be included to use these functionalities. +/// +/// Include to use the features of this extension. +/// +/// Allow to perform bit operations on integer values #pragma once // Dependencies #include "../gtc/bitfield.hpp" +#ifndef GLM_ENABLE_EXPERIMENTAL +# error "GLM: GLM_GTX_bit is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." +#endif + #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) # pragma message("GLM: GLM_GTX_bit extension is deprecated, include GLM_GTC_bitfield and GLM_GTC_integer instead") #endif @@ -26,25 +29,25 @@ namespace glm /// @{ /// @see gtx_bit - template + template GLM_FUNC_DECL genIUType highestBitValue(genIUType Value); /// @see gtx_bit - template + template GLM_FUNC_DECL genIUType lowestBitValue(genIUType Value); /// Find the highest bit set to 1 in a integer variable and return its value. /// /// @see gtx_bit - template class vecType> - GLM_FUNC_DECL vecType highestBitValue(vecType const & value); + template + GLM_FUNC_DECL vec highestBitValue(vec const& value); /// Return the power of two number which value is just higher the input value. /// Deprecated, use ceilPowerOfTwo from GTC_round instead /// /// @see gtc_round /// @see gtx_bit - template + template GLM_DEPRECATED GLM_FUNC_DECL genIUType powerOfTwoAbove(genIUType Value); /// Return the power of two number which value is just higher the input value. @@ -52,15 +55,15 @@ namespace glm /// /// @see gtc_round /// @see gtx_bit - template class vecType> - GLM_DEPRECATED GLM_FUNC_DECL vecType powerOfTwoAbove(vecType const & value); + template + GLM_DEPRECATED GLM_FUNC_DECL vec powerOfTwoAbove(vec const& value); /// Return the power of two number which value is just lower the input value. /// Deprecated, use floorPowerOfTwo from GTC_round instead /// /// @see gtc_round /// @see gtx_bit - template + template GLM_DEPRECATED GLM_FUNC_DECL genIUType powerOfTwoBelow(genIUType Value); /// Return the power of two number which value is just lower the input value. @@ -68,15 +71,15 @@ namespace glm /// /// @see gtc_round /// @see gtx_bit - template class vecType> - GLM_DEPRECATED GLM_FUNC_DECL vecType powerOfTwoBelow(vecType const & value); + template + GLM_DEPRECATED GLM_FUNC_DECL vec powerOfTwoBelow(vec const& value); /// Return the power of two number which value is the closet to the input value. /// Deprecated, use roundPowerOfTwo from GTC_round instead /// /// @see gtc_round /// @see gtx_bit - template + template GLM_DEPRECATED GLM_FUNC_DECL genIUType powerOfTwoNearest(genIUType Value); /// Return the power of two number which value is the closet to the input value. @@ -84,8 +87,8 @@ namespace glm /// /// @see gtc_round /// @see gtx_bit - template class vecType> - GLM_DEPRECATED GLM_FUNC_DECL vecType powerOfTwoNearest(vecType const & value); + template + GLM_DEPRECATED GLM_FUNC_DECL vec powerOfTwoNearest(vec const& value); /// @} } //namespace glm diff --git a/external/include/glm/gtx/bit.inl b/external/include/glm/gtx/bit.inl index 10d5f7f..277aeaa 100644 --- a/external/include/glm/gtx/bit.inl +++ b/external/include/glm/gtx/bit.inl @@ -6,7 +6,7 @@ namespace glm /////////////////// // highestBitValue - template + template GLM_FUNC_QUALIFIER genIUType highestBitValue(genIUType Value) { genIUType tmp = Value; @@ -19,61 +19,61 @@ namespace glm return result; } - template class vecType> - GLM_FUNC_QUALIFIER vecType highestBitValue(vecType const & v) + template + GLM_FUNC_QUALIFIER vec highestBitValue(vec const& v) { - return detail::functor1::call(highestBitValue, v); + return detail::functor1::call(highestBitValue, v); } /////////////////// // lowestBitValue - template + template GLM_FUNC_QUALIFIER genIUType lowestBitValue(genIUType Value) { return (Value & (~Value + 1)); } - template class vecType> - GLM_FUNC_QUALIFIER vecType lowestBitValue(vecType const & v) + template + GLM_FUNC_QUALIFIER vec lowestBitValue(vec const& v) { - return detail::functor1::call(lowestBitValue, v); + return detail::functor1::call(lowestBitValue, v); } /////////////////// // powerOfTwoAbove - template + template GLM_FUNC_QUALIFIER genType powerOfTwoAbove(genType value) { return isPowerOfTwo(value) ? value : highestBitValue(value) << 1; } - template class vecType> - GLM_FUNC_QUALIFIER vecType powerOfTwoAbove(vecType const & v) + template + GLM_FUNC_QUALIFIER vec powerOfTwoAbove(vec const& v) { - return detail::functor1::call(powerOfTwoAbove, v); + return detail::functor1::call(powerOfTwoAbove, v); } /////////////////// // powerOfTwoBelow - template + template GLM_FUNC_QUALIFIER genType powerOfTwoBelow(genType value) { return isPowerOfTwo(value) ? value : highestBitValue(value); } - template class vecType> - GLM_FUNC_QUALIFIER vecType powerOfTwoBelow(vecType const & v) + template + GLM_FUNC_QUALIFIER vec powerOfTwoBelow(vec const& v) { - return detail::functor1::call(powerOfTwoBelow, v); + return detail::functor1::call(powerOfTwoBelow, v); } ///////////////////// // powerOfTwoNearest - template + template GLM_FUNC_QUALIFIER genType powerOfTwoNearest(genType value) { if(isPowerOfTwo(value)) @@ -84,10 +84,10 @@ namespace glm return (next - value) < (value - prev) ? next : prev; } - template class vecType> - GLM_FUNC_QUALIFIER vecType powerOfTwoNearest(vecType const & v) + template + GLM_FUNC_QUALIFIER vec powerOfTwoNearest(vec const& v) { - return detail::functor1::call(powerOfTwoNearest, v); + return detail::functor1::call(powerOfTwoNearest, v); } }//namespace glm diff --git a/external/include/glm/gtx/closest_point.hpp b/external/include/glm/gtx/closest_point.hpp index 8d435b8..a788299 100644 --- a/external/include/glm/gtx/closest_point.hpp +++ b/external/include/glm/gtx/closest_point.hpp @@ -6,15 +6,19 @@ /// @defgroup gtx_closest_point GLM_GTX_closest_point /// @ingroup gtx /// -/// @brief Find the point on a straight line which is the closet of a point. +/// Include to use the features of this extension. /// -/// need to be included to use these functionalities. +/// Find the point on a straight line which is the closet of a point. #pragma once // Dependency: #include "../glm.hpp" +#ifndef GLM_ENABLE_EXPERIMENTAL +# error "GLM: GLM_GTX_closest_point is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." +#endif + #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) # pragma message("GLM: GLM_GTX_closest_point extension included") #endif @@ -24,20 +28,20 @@ namespace glm /// @addtogroup gtx_closest_point /// @{ - /// Find the point on a straight line which is the closet of a point. + /// Find the point on a straight line which is the closet of a point. /// @see gtx_closest_point - template - GLM_FUNC_DECL tvec3 closestPointOnLine( - tvec3 const & point, - tvec3 const & a, - tvec3 const & b); - - /// 2d lines work as well - template - GLM_FUNC_DECL tvec2 closestPointOnLine( - tvec2 const & point, - tvec2 const & a, - tvec2 const & b); + template + GLM_FUNC_DECL vec<3, T, Q> closestPointOnLine( + vec<3, T, Q> const& point, + vec<3, T, Q> const& a, + vec<3, T, Q> const& b); + + /// 2d lines work as well + template + GLM_FUNC_DECL vec<2, T, Q> closestPointOnLine( + vec<2, T, Q> const& point, + vec<2, T, Q> const& a, + vec<2, T, Q> const& b); /// @} }// namespace glm diff --git a/external/include/glm/gtx/closest_point.inl b/external/include/glm/gtx/closest_point.inl index ccda9ab..26d1e38 100644 --- a/external/include/glm/gtx/closest_point.inl +++ b/external/include/glm/gtx/closest_point.inl @@ -3,44 +3,44 @@ namespace glm { - template - GLM_FUNC_QUALIFIER tvec3 closestPointOnLine + template + GLM_FUNC_QUALIFIER vec<3, T, Q> closestPointOnLine ( - tvec3 const & point, - tvec3 const & a, - tvec3 const & b + vec<3, T, Q> const& point, + vec<3, T, Q> const& a, + vec<3, T, Q> const& b ) { T LineLength = distance(a, b); - tvec3 Vector = point - a; - tvec3 LineDirection = (b - a) / LineLength; + vec<3, T, Q> Vector = point - a; + vec<3, T, Q> LineDirection = (b - a) / LineLength; - // Project Vector3 to LineDirection to get the distance of point from a + // Project Vector to LineDirection to get the distance of point from a T Distance = dot(Vector, LineDirection); if(Distance <= T(0)) return a; if(Distance >= LineLength) return b; return a + LineDirection * Distance; } - - template - GLM_FUNC_QUALIFIER tvec2 closestPointOnLine + + template + GLM_FUNC_QUALIFIER vec<2, T, Q> closestPointOnLine ( - tvec2 const & point, - tvec2 const & a, - tvec2 const & b + vec<2, T, Q> const& point, + vec<2, T, Q> const& a, + vec<2, T, Q> const& b ) { T LineLength = distance(a, b); - tvec2 Vector = point - a; - tvec2 LineDirection = (b - a) / LineLength; + vec<2, T, Q> Vector = point - a; + vec<2, T, Q> LineDirection = (b - a) / LineLength; - // Project Vector3 to LineDirection to get the distance of point from a - T Distance = dot(Vector3, LineDirection); + // Project Vector to LineDirection to get the distance of point from a + T Distance = dot(Vector, LineDirection); if(Distance <= T(0)) return a; if(Distance >= LineLength) return b; return a + LineDirection * Distance; } - + }//namespace glm diff --git a/external/include/glm/gtx/color_encoding.hpp b/external/include/glm/gtx/color_encoding.hpp new file mode 100644 index 0000000..b57b3be --- /dev/null +++ b/external/include/glm/gtx/color_encoding.hpp @@ -0,0 +1,50 @@ +/// @ref gtx_color_encoding +/// @file glm/gtx/color_encoding.hpp +/// +/// @see core (dependence) +/// @see gtx_color_encoding (dependence) +/// +/// @defgroup gtx_color_encoding GLM_GTX_color_encoding +/// @ingroup gtx +/// +/// Include to use the features of this extension. +/// +/// @brief Allow to perform bit operations on integer values + +#pragma once + +// Dependencies +#include "../detail/setup.hpp" +#include "../detail/qualifier.hpp" +#include "../vec3.hpp" +#include + +#if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) +# pragma message("GLM: GLM_GTC_color_encoding extension included") +#endif + +namespace glm +{ + /// @addtogroup gtx_color_encoding + /// @{ + + /// Convert a linear sRGB color to D65 YUV. + template + GLM_FUNC_DECL vec<3, T, Q> convertLinearSRGBToD65XYZ(vec<3, T, Q> const& ColorLinearSRGB); + + /// Convert a linear sRGB color to D50 YUV. + template + GLM_FUNC_DECL vec<3, T, Q> convertLinearSRGBToD50XYZ(vec<3, T, Q> const& ColorLinearSRGB); + + /// Convert a D65 YUV color to linear sRGB. + template + GLM_FUNC_DECL vec<3, T, Q> convertD65XYZToLinearSRGB(vec<3, T, Q> const& ColorD65XYZ); + + /// Convert a D65 YUV color to D50 YUV. + template + GLM_FUNC_DECL vec<3, T, Q> convertD65XYZToD50XYZ(vec<3, T, Q> const& ColorD65XYZ); + + /// @} +} //namespace glm + +#include "color_encoding.inl" diff --git a/external/include/glm/gtx/color_encoding.inl b/external/include/glm/gtx/color_encoding.inl new file mode 100644 index 0000000..8dca67b --- /dev/null +++ b/external/include/glm/gtx/color_encoding.inl @@ -0,0 +1,46 @@ +/// @ref gtx_color_encoding +/// @file glm/gtx/color_encoding.inl + +namespace glm +{ + template + GLM_FUNC_QUALIFIER vec<3, T, Q> convertLinearSRGBToD65XYZ(vec<3, T, Q> const& ColorLinearSRGB) + { + vec<3, T, Q> const M(0.490f, 0.17697f, 0.2f); + vec<3, T, Q> const N(0.31f, 0.8124f, 0.01063f); + vec<3, T, Q> const O(0.490f, 0.01f, 0.99f); + + return (M * ColorLinearSRGB + N * ColorLinearSRGB + O * ColorLinearSRGB) * static_cast(5.650675255693055f); + } + + template + GLM_FUNC_QUALIFIER vec<3, T, Q> convertLinearSRGBToD50XYZ(vec<3, T, Q> const& ColorLinearSRGB) + { + vec<3, T, Q> const M(0.436030342570117f, 0.222438466210245f, 0.013897440074263f); + vec<3, T, Q> const N(0.385101860087134f, 0.716942745571917f, 0.097076381494207f); + vec<3, T, Q> const O(0.143067806654203f, 0.060618777416563f, 0.713926257896652f); + + return M * ColorLinearSRGB + N * ColorLinearSRGB + O * ColorLinearSRGB; + } + + template + GLM_FUNC_QUALIFIER vec<3, T, Q> convertD65XYZToLinearSRGB(vec<3, T, Q> const& ColorD65XYZ) + { + vec<3, T, Q> const M(0.41847f, -0.091169f, 0.0009209f); + vec<3, T, Q> const N(-0.15866f, 0.25243f, 0.015708f); + vec<3, T, Q> const O(0.0009209f, -0.0025498f, 0.1786f); + + return M * ColorD65XYZ + N * ColorD65XYZ + O * ColorD65XYZ; + } + + template + GLM_FUNC_QUALIFIER vec<3, T, Q> convertD65XYZToD50XYZ(vec<3, T, Q> const& ColorD65XYZ) + { + vec<3, T, Q> const M(+1.047844353856414f, +0.029549007606644f, -0.009250984365223f); + vec<3, T, Q> const N(+0.022898981050086f, +0.990508028941971f, +0.015072338237051f); + vec<3, T, Q> const O(-0.050206647741605f, -0.017074711360960f, +0.751717835079977f); + + return M * ColorD65XYZ + N * ColorD65XYZ + O * ColorD65XYZ; + } + +}//namespace glm diff --git a/external/include/glm/gtx/color_space.hpp b/external/include/glm/gtx/color_space.hpp index 9ff08dc..9e95eb3 100644 --- a/external/include/glm/gtx/color_space.hpp +++ b/external/include/glm/gtx/color_space.hpp @@ -6,15 +6,19 @@ /// @defgroup gtx_color_space GLM_GTX_color_space /// @ingroup gtx /// -/// @brief Related to RGB to HSV conversions and operations. +/// Include to use the features of this extension. /// -/// need to be included to use these functionalities. +/// Related to RGB to HSV conversions and operations. #pragma once // Dependency: #include "../glm.hpp" +#ifndef GLM_ENABLE_EXPERIMENTAL +# error "GLM: GLM_GTX_color_space is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." +#endif + #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) # pragma message("GLM: GLM_GTX_color_space extension included") #endif @@ -26,41 +30,41 @@ namespace glm /// Converts a color from HSV color space to its color in RGB color space. /// @see gtx_color_space - template - GLM_FUNC_DECL tvec3 rgbColor( - tvec3 const & hsvValue); + template + GLM_FUNC_DECL vec<3, T, Q> rgbColor( + vec<3, T, Q> const& hsvValue); /// Converts a color from RGB color space to its color in HSV color space. /// @see gtx_color_space - template - GLM_FUNC_DECL tvec3 hsvColor( - tvec3 const & rgbValue); - + template + GLM_FUNC_DECL vec<3, T, Q> hsvColor( + vec<3, T, Q> const& rgbValue); + /// Build a saturation matrix. /// @see gtx_color_space - template - GLM_FUNC_DECL tmat4x4 saturation( + template + GLM_FUNC_DECL mat<4, 4, T, defaultp> saturation( T const s); /// Modify the saturation of a color. /// @see gtx_color_space - template - GLM_FUNC_DECL tvec3 saturation( + template + GLM_FUNC_DECL vec<3, T, Q> saturation( T const s, - tvec3 const & color); - + vec<3, T, Q> const& color); + /// Modify the saturation of a color. /// @see gtx_color_space - template - GLM_FUNC_DECL tvec4 saturation( + template + GLM_FUNC_DECL vec<4, T, Q> saturation( T const s, - tvec4 const & color); - + vec<4, T, Q> const& color); + /// Compute color luminosity associating ratios (0.33, 0.59, 0.11) to RGB canals. /// @see gtx_color_space - template + template GLM_FUNC_DECL T luminosity( - tvec3 const & color); + vec<3, T, Q> const& color); /// @} }//namespace glm diff --git a/external/include/glm/gtx/color_space.inl b/external/include/glm/gtx/color_space.inl index e7cd58d..ff82395 100644 --- a/external/include/glm/gtx/color_space.inl +++ b/external/include/glm/gtx/color_space.inl @@ -3,19 +3,19 @@ namespace glm { - template - GLM_FUNC_QUALIFIER tvec3 rgbColor(const tvec3& hsvColor) + template + GLM_FUNC_QUALIFIER vec<3, T, Q> rgbColor(const vec<3, T, Q>& hsvColor) { - tvec3 hsv = hsvColor; - tvec3 rgbColor; + vec<3, T, Q> hsv = hsvColor; + vec<3, T, Q> rgbColor; if(hsv.y == static_cast(0)) // achromatic (grey) - rgbColor = tvec3(hsv.z); + rgbColor = vec<3, T, Q>(hsv.z); else { - T sector = floor(hsv.x / T(60)); - T frac = (hsv.x / T(60)) - sector; + T sector = floor(hsv.x * (T(1) / T(60))); + T frac = (hsv.x * (T(1) / T(60))) - sector; // factorial part of h T o = hsv.z * (T(1) - hsv.y); T p = hsv.z * (T(1) - hsv.y * frac); @@ -45,13 +45,13 @@ namespace glm rgbColor.b = hsv.z; break; case 4: - rgbColor.r = q; - rgbColor.g = o; + rgbColor.r = q; + rgbColor.g = o; rgbColor.b = hsv.z; break; case 5: - rgbColor.r = hsv.z; - rgbColor.g = o; + rgbColor.r = hsv.z; + rgbColor.g = o; rgbColor.b = p; break; } @@ -60,19 +60,19 @@ namespace glm return rgbColor; } - template - GLM_FUNC_QUALIFIER tvec3 hsvColor(const tvec3& rgbColor) + template + GLM_FUNC_QUALIFIER vec<3, T, Q> hsvColor(const vec<3, T, Q>& rgbColor) { - tvec3 hsv = rgbColor; + vec<3, T, Q> hsv = rgbColor; float Min = min(min(rgbColor.r, rgbColor.g), rgbColor.b); float Max = max(max(rgbColor.r, rgbColor.g), rgbColor.b); float Delta = Max - Min; - hsv.z = Max; + hsv.z = Max; if(Max != static_cast(0)) { - hsv.y = Delta / hsv.z; + hsv.y = Delta / hsv.z; T h = static_cast(0); if(rgbColor.r == Max) @@ -85,7 +85,7 @@ namespace glm // between magenta & cyan h = static_cast(240) + T(60) * (rgbColor.r - rgbColor.g) / Delta; - if(h < T(0)) + if(h < T(0)) hsv.x = h + T(360); else hsv.x = h; @@ -100,14 +100,14 @@ namespace glm return hsv; } - template - GLM_FUNC_QUALIFIER tmat4x4 saturation(T const s) + template + GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> saturation(T const s) { - tvec3 rgbw = tvec3(T(0.2126), T(0.7152), T(0.0722)); + vec<3, T, defaultp> rgbw = vec<3, T, defaultp>(T(0.2126), T(0.7152), T(0.0722)); - tvec3 const col((T(1) - s) * rgbw); + vec<3, T, defaultp> const col((T(1) - s) * rgbw); - tmat4x4 result(T(1)); + mat<4, 4, T, defaultp> result(T(1)); result[0][0] = col.x + s; result[0][1] = col.x; result[0][2] = col.x; @@ -117,25 +117,26 @@ namespace glm result[2][0] = col.z; result[2][1] = col.z; result[2][2] = col.z + s; + return result; } - template - GLM_FUNC_QUALIFIER tvec3 saturation(const T s, const tvec3& color) + template + GLM_FUNC_QUALIFIER vec<3, T, Q> saturation(const T s, const vec<3, T, Q>& color) { - return tvec3(saturation(s) * tvec4(color, T(0))); + return vec<3, T, Q>(saturation(s) * vec<4, T, Q>(color, T(0))); } - template - GLM_FUNC_QUALIFIER tvec4 saturation(const T s, const tvec4& color) + template + GLM_FUNC_QUALIFIER vec<4, T, Q> saturation(const T s, const vec<4, T, Q>& color) { return saturation(s) * color; } - template - GLM_FUNC_QUALIFIER T luminosity(const tvec3& color) + template + GLM_FUNC_QUALIFIER T luminosity(const vec<3, T, Q>& color) { - const tvec3 tmp = tvec3(0.33, 0.59, 0.11); + const vec<3, T, Q> tmp = vec<3, T, Q>(0.33, 0.59, 0.11); return dot(color, tmp); } }//namespace glm diff --git a/external/include/glm/gtx/color_space_YCoCg.hpp b/external/include/glm/gtx/color_space_YCoCg.hpp index 428ca6d..e82cbd8 100644 --- a/external/include/glm/gtx/color_space_YCoCg.hpp +++ b/external/include/glm/gtx/color_space_YCoCg.hpp @@ -6,15 +6,19 @@ /// @defgroup gtx_color_space_YCoCg GLM_GTX_color_space_YCoCg /// @ingroup gtx /// -/// @brief RGB to YCoCg conversions and operations +/// Include to use the features of this extension. /// -/// need to be included to use these functionalities. +/// RGB to YCoCg conversions and operations #pragma once // Dependency: #include "../glm.hpp" +#ifndef GLM_ENABLE_EXPERIMENTAL +# error "GLM: GLM_GTX_color_space_YCoCg is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." +#endif + #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) # pragma message("GLM: GLM_GTX_color_space_YCoCg extension included") #endif @@ -26,29 +30,29 @@ namespace glm /// Convert a color from RGB color space to YCoCg color space. /// @see gtx_color_space_YCoCg - template - GLM_FUNC_DECL tvec3 rgb2YCoCg( - tvec3 const & rgbColor); + template + GLM_FUNC_DECL vec<3, T, Q> rgb2YCoCg( + vec<3, T, Q> const& rgbColor); /// Convert a color from YCoCg color space to RGB color space. /// @see gtx_color_space_YCoCg - template - GLM_FUNC_DECL tvec3 YCoCg2rgb( - tvec3 const & YCoCgColor); + template + GLM_FUNC_DECL vec<3, T, Q> YCoCg2rgb( + vec<3, T, Q> const& YCoCgColor); /// Convert a color from RGB color space to YCoCgR color space. /// @see "YCoCg-R: A Color Space with RGB Reversibility and Low Dynamic Range" /// @see gtx_color_space_YCoCg - template - GLM_FUNC_DECL tvec3 rgb2YCoCgR( - tvec3 const & rgbColor); + template + GLM_FUNC_DECL vec<3, T, Q> rgb2YCoCgR( + vec<3, T, Q> const& rgbColor); /// Convert a color from YCoCgR color space to RGB color space. /// @see "YCoCg-R: A Color Space with RGB Reversibility and Low Dynamic Range" /// @see gtx_color_space_YCoCg - template - GLM_FUNC_DECL tvec3 YCoCgR2rgb( - tvec3 const & YCoCgColor); + template + GLM_FUNC_DECL vec<3, T, Q> YCoCgR2rgb( + vec<3, T, Q> const& YCoCgColor); /// @} }//namespace glm diff --git a/external/include/glm/gtx/color_space_YCoCg.inl b/external/include/glm/gtx/color_space_YCoCg.inl index 1ca2e5b..105a576 100644 --- a/external/include/glm/gtx/color_space_YCoCg.inl +++ b/external/include/glm/gtx/color_space_YCoCg.inl @@ -3,70 +3,70 @@ namespace glm { - template - GLM_FUNC_QUALIFIER tvec3 rgb2YCoCg + template + GLM_FUNC_QUALIFIER vec<3, T, Q> rgb2YCoCg ( - tvec3 const & rgbColor + vec<3, T, Q> const& rgbColor ) { - tvec3 result; + vec<3, T, Q> result; result.x/*Y */ = rgbColor.r / T(4) + rgbColor.g / T(2) + rgbColor.b / T(4); result.y/*Co*/ = rgbColor.r / T(2) + rgbColor.g * T(0) - rgbColor.b / T(2); result.z/*Cg*/ = - rgbColor.r / T(4) + rgbColor.g / T(2) - rgbColor.b / T(4); return result; } - template - GLM_FUNC_QUALIFIER tvec3 YCoCg2rgb + template + GLM_FUNC_QUALIFIER vec<3, T, Q> YCoCg2rgb ( - tvec3 const & YCoCgColor + vec<3, T, Q> const& YCoCgColor ) { - tvec3 result; + vec<3, T, Q> result; result.r = YCoCgColor.x + YCoCgColor.y - YCoCgColor.z; result.g = YCoCgColor.x + YCoCgColor.z; result.b = YCoCgColor.x - YCoCgColor.y - YCoCgColor.z; return result; } - template + template class compute_YCoCgR { public: - static GLM_FUNC_QUALIFIER tvec3 rgb2YCoCgR + static GLM_FUNC_QUALIFIER vec<3, T, Q> rgb2YCoCgR ( - tvec3 const & rgbColor + vec<3, T, Q> const& rgbColor ) { - tvec3 result; - result.x/*Y */ = rgbColor.g / T(2) + (rgbColor.r + rgbColor.b) / T(4); + vec<3, T, Q> result; + result.x/*Y */ = rgbColor.g * static_cast(0.5) + (rgbColor.r + rgbColor.b) * static_cast(0.25); result.y/*Co*/ = rgbColor.r - rgbColor.b; - result.z/*Cg*/ = rgbColor.g - (rgbColor.r + rgbColor.b) / T(2); + result.z/*Cg*/ = rgbColor.g - (rgbColor.r + rgbColor.b) * static_cast(0.5); return result; } - static GLM_FUNC_QUALIFIER tvec3 YCoCgR2rgb + static GLM_FUNC_QUALIFIER vec<3, T, Q> YCoCgR2rgb ( - tvec3 const & YCoCgRColor + vec<3, T, Q> const& YCoCgRColor ) { - tvec3 result; - T tmp = YCoCgRColor.x - (YCoCgRColor.z / T(2)); + vec<3, T, Q> result; + T tmp = YCoCgRColor.x - (YCoCgRColor.z * static_cast(0.5)); result.g = YCoCgRColor.z + tmp; - result.b = tmp - (YCoCgRColor.y / T(2)); + result.b = tmp - (YCoCgRColor.y * static_cast(0.5)); result.r = result.b + YCoCgRColor.y; return result; } }; - template - class compute_YCoCgR { + template + class compute_YCoCgR { public: - static GLM_FUNC_QUALIFIER tvec3 rgb2YCoCgR + static GLM_FUNC_QUALIFIER vec<3, T, Q> rgb2YCoCgR ( - tvec3 const & rgbColor + vec<3, T, Q> const& rgbColor ) { - tvec3 result; + vec<3, T, Q> result; result.y/*Co*/ = rgbColor.r - rgbColor.b; T tmp = rgbColor.b + (result.y >> 1); result.z/*Cg*/ = rgbColor.g - tmp; @@ -74,12 +74,12 @@ namespace glm return result; } - static GLM_FUNC_QUALIFIER tvec3 YCoCgR2rgb + static GLM_FUNC_QUALIFIER vec<3, T, Q> YCoCgR2rgb ( - tvec3 const & YCoCgRColor + vec<3, T, Q> const& YCoCgRColor ) { - tvec3 result; + vec<3, T, Q> result; T tmp = YCoCgRColor.x - (YCoCgRColor.z >> 1); result.g = YCoCgRColor.z + tmp; result.b = tmp - (YCoCgRColor.y >> 1); @@ -88,21 +88,21 @@ namespace glm } }; - template - GLM_FUNC_QUALIFIER tvec3 rgb2YCoCgR + template + GLM_FUNC_QUALIFIER vec<3, T, Q> rgb2YCoCgR ( - tvec3 const & rgbColor + vec<3, T, Q> const& rgbColor ) { - return compute_YCoCgR::is_integer>::rgb2YCoCgR(rgbColor); + return compute_YCoCgR::is_integer>::rgb2YCoCgR(rgbColor); } - template - GLM_FUNC_QUALIFIER tvec3 YCoCgR2rgb + template + GLM_FUNC_QUALIFIER vec<3, T, Q> YCoCgR2rgb ( - tvec3 const & YCoCgRColor + vec<3, T, Q> const& YCoCgRColor ) { - return compute_YCoCgR::is_integer>::YCoCgR2rgb(YCoCgRColor); + return compute_YCoCgR::is_integer>::YCoCgR2rgb(YCoCgRColor); } }//namespace glm diff --git a/external/include/glm/gtx/common.hpp b/external/include/glm/gtx/common.hpp index 6533a54..6eadf48 100644 --- a/external/include/glm/gtx/common.hpp +++ b/external/include/glm/gtx/common.hpp @@ -2,14 +2,13 @@ /// @file glm/gtx/common.hpp /// /// @see core (dependence) -/// @see gtc_half_float (dependence) /// /// @defgroup gtx_common GLM_GTX_common /// @ingroup gtx /// -/// @brief Provide functions to increase the compatibility with Cg and HLSL languages +/// Include to use the features of this extension. /// -/// need to be included to use these functionalities. +/// @brief Provide functions to increase the compatibility with Cg and HLSL languages #pragma once @@ -19,6 +18,10 @@ #include "../vec4.hpp" #include "../gtc/vec1.hpp" +#ifndef GLM_ENABLE_EXPERIMENTAL +# error "GLM: GLM_GTX_common is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." +#endif + #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) # pragma message("GLM: GLM_GTX_common extension included") #endif @@ -31,21 +34,41 @@ namespace glm /// Returns true if x is a denormalized number /// Numbers whose absolute value is too small to be represented in the normal format are represented in an alternate, denormalized format. /// This format is less precise but can represent values closer to zero. - /// + /// /// @tparam genType Floating-point scalar or vector types. /// /// @see GLSL isnan man page /// @see GLSL 4.20.8 specification, section 8.3 Common Functions - template - GLM_FUNC_DECL typename genType::bool_type isdenormal(genType const & x); + template + GLM_FUNC_DECL typename genType::bool_type isdenormal(genType const& x); /// Similar to 'mod' but with a different rounding and integer support. /// Returns 'x - y * trunc(x/y)' instead of 'x - y * floor(x/y)' - /// + /// /// @see GLSL mod vs HLSL fmod /// @see GLSL mod man page - template class vecType> - GLM_FUNC_DECL vecType fmod(vecType const & v); + template + GLM_FUNC_DECL vec fmod(vec const& v); + + /// Returns whether vector components values are within an interval. A open interval excludes its endpoints, and is denoted with square brackets. + /// + /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector + /// @tparam T Floating-point or integer scalar types + /// @tparam Q Value from qualifier enum + /// + /// @see ext_vector_relational + template + GLM_FUNC_DECL vec openBounded(vec const& Value, vec const& Min, vec const& Max); + + /// Returns whether vector components values are within an interval. A closed interval includes its endpoints, and is denoted with square brackets. + /// + /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector + /// @tparam T Floating-point or integer scalar types + /// @tparam Q Value from qualifier enum + /// + /// @see ext_vector_relational + template + GLM_FUNC_DECL vec closeBounded(vec const& Value, vec const& Min, vec const& Max); /// @} }//namespace glm diff --git a/external/include/glm/gtx/common.inl b/external/include/glm/gtx/common.inl index 6c9cb65..158eabe 100644 --- a/external/include/glm/gtx/common.inl +++ b/external/include/glm/gtx/common.inl @@ -2,89 +2,91 @@ /// @file glm/gtx/common.inl #include +#include "../gtc/epsilon.hpp" +#include "../gtc/constants.hpp" namespace glm{ namespace detail { - template class vecType, bool isFloat = true> + template struct compute_fmod { - GLM_FUNC_QUALIFIER static vecType call(vecType const & a, vecType const & b) + GLM_FUNC_QUALIFIER static vec call(vec const& a, vec const& b) { - return detail::functor2::call(std::fmod, a, b); + return detail::functor2::call(std::fmod, a, b); } }; - template class vecType> - struct compute_fmod + template + struct compute_fmod { - GLM_FUNC_QUALIFIER static vecType call(vecType const & a, vecType const & b) + GLM_FUNC_QUALIFIER static vec call(vec const& a, vec const& b) { return a % b; } }; }//namespace detail - template - GLM_FUNC_QUALIFIER bool isdenormal(T const & x) + template + GLM_FUNC_QUALIFIER bool isdenormal(T const& x) { GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'isdenormal' only accept floating-point inputs"); # if GLM_HAS_CXX11_STL return std::fpclassify(x) == FP_SUBNORMAL; # else - return x != static_cast(0) && std::fabs(x) < std::numeric_limits::min(); + return epsilonNotEqual(x, static_cast(0), epsilon()) && std::fabs(x) < std::numeric_limits::min(); # endif } - template - GLM_FUNC_QUALIFIER typename tvec1::bool_type isdenormal + template + GLM_FUNC_QUALIFIER typename vec<1, T, Q>::bool_type isdenormal ( - tvec1 const & x + vec<1, T, Q> const& x ) { GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'isdenormal' only accept floating-point inputs"); - return typename tvec1::bool_type( + return typename vec<1, T, Q>::bool_type( isdenormal(x.x)); } - template - GLM_FUNC_QUALIFIER typename tvec2::bool_type isdenormal + template + GLM_FUNC_QUALIFIER typename vec<2, T, Q>::bool_type isdenormal ( - tvec2 const & x + vec<2, T, Q> const& x ) { GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'isdenormal' only accept floating-point inputs"); - return typename tvec2::bool_type( + return typename vec<2, T, Q>::bool_type( isdenormal(x.x), isdenormal(x.y)); } - template - GLM_FUNC_QUALIFIER typename tvec3::bool_type isdenormal + template + GLM_FUNC_QUALIFIER typename vec<3, T, Q>::bool_type isdenormal ( - tvec3 const & x + vec<3, T, Q> const& x ) { GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'isdenormal' only accept floating-point inputs"); - return typename tvec3::bool_type( + return typename vec<3, T, Q>::bool_type( isdenormal(x.x), isdenormal(x.y), isdenormal(x.z)); } - template - GLM_FUNC_QUALIFIER typename tvec4::bool_type isdenormal + template + GLM_FUNC_QUALIFIER typename vec<4, T, Q>::bool_type isdenormal ( - tvec4 const & x + vec<4, T, Q> const& x ) { GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'isdenormal' only accept floating-point inputs"); - return typename tvec4::bool_type( + return typename vec<4, T, Q>::bool_type( isdenormal(x.x), isdenormal(x.y), isdenormal(x.z), @@ -92,21 +94,33 @@ namespace detail } // fmod - template + template GLM_FUNC_QUALIFIER genType fmod(genType x, genType y) { - return fmod(tvec1(x), y).x; + return fmod(vec<1, genType>(x), y).x; } - template class vecType> - GLM_FUNC_QUALIFIER vecType fmod(vecType const & x, T y) + template + GLM_FUNC_QUALIFIER vec fmod(vec const& x, T y) { - return detail::compute_fmod::is_iec559>::call(x, vecType(y)); + return detail::compute_fmod::is_iec559>::call(x, vec(y)); } - template class vecType> - GLM_FUNC_QUALIFIER vecType fmod(vecType const & x, vecType const & y) + template + GLM_FUNC_QUALIFIER vec fmod(vec const& x, vec const& y) { - return detail::compute_fmod::is_iec559>::call(x, y); + return detail::compute_fmod::is_iec559>::call(x, y); + } + + template + GLM_FUNC_QUALIFIER vec openBounded(vec const& Value, vec const& Min, vec const& Max) + { + return greaterThan(Value, Min) && lessThan(Value, Max); + } + + template + GLM_FUNC_QUALIFIER vec closeBounded(vec const& Value, vec const& Min, vec const& Max) + { + return greaterThanEqual(Value, Min) && lessThanEqual(Value, Max); } }//namespace glm diff --git a/external/include/glm/gtx/compatibility.hpp b/external/include/glm/gtx/compatibility.hpp index 9f4819a..e5b6039 100644 --- a/external/include/glm/gtx/compatibility.hpp +++ b/external/include/glm/gtx/compatibility.hpp @@ -2,14 +2,13 @@ /// @file glm/gtx/compatibility.hpp /// /// @see core (dependence) -/// @see gtc_half_float (dependence) /// /// @defgroup gtx_compatibility GLM_GTX_compatibility /// @ingroup gtx /// -/// @brief Provide functions to increase the compatibility with Cg and HLSL languages +/// Include to use the features of this extension. /// -/// need to be included to use these functionalities. +/// Provide functions to increase the compatibility with Cg and HLSL languages #pragma once @@ -17,6 +16,10 @@ #include "../glm.hpp" #include "../gtc/quaternion.hpp" +#ifndef GLM_ENABLE_EXPERIMENTAL +# error "GLM: GLM_GTX_compatibility is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." +#endif + #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) # pragma message("GLM: GLM_GTX_compatibility extension included") #endif @@ -35,94 +38,94 @@ namespace glm /// @addtogroup gtx_compatibility /// @{ - template GLM_FUNC_QUALIFIER T lerp(T x, T y, T a){return mix(x, y, a);} //!< \brief Returns x * (1.0 - a) + y * a, i.e., the linear blend of x and y using the floating-point value a. The value for a is not restricted to the range [0, 1]. (From GLM_GTX_compatibility) - template GLM_FUNC_QUALIFIER tvec2 lerp(const tvec2& x, const tvec2& y, T a){return mix(x, y, a);} //!< \brief Returns x * (1.0 - a) + y * a, i.e., the linear blend of x and y using the floating-point value a. The value for a is not restricted to the range [0, 1]. (From GLM_GTX_compatibility) + template GLM_FUNC_QUALIFIER T lerp(T x, T y, T a){return mix(x, y, a);} //!< \brief Returns x * (1.0 - a) + y * a, i.e., the linear blend of x and y using the floating-point value a. The value for a is not restricted to the range [0, 1]. (From GLM_GTX_compatibility) + template GLM_FUNC_QUALIFIER vec<2, T, Q> lerp(const vec<2, T, Q>& x, const vec<2, T, Q>& y, T a){return mix(x, y, a);} //!< \brief Returns x * (1.0 - a) + y * a, i.e., the linear blend of x and y using the floating-point value a. The value for a is not restricted to the range [0, 1]. (From GLM_GTX_compatibility) - template GLM_FUNC_QUALIFIER tvec3 lerp(const tvec3& x, const tvec3& y, T a){return mix(x, y, a);} //!< \brief Returns x * (1.0 - a) + y * a, i.e., the linear blend of x and y using the floating-point value a. The value for a is not restricted to the range [0, 1]. (From GLM_GTX_compatibility) - template GLM_FUNC_QUALIFIER tvec4 lerp(const tvec4& x, const tvec4& y, T a){return mix(x, y, a);} //!< \brief Returns x * (1.0 - a) + y * a, i.e., the linear blend of x and y using the floating-point value a. The value for a is not restricted to the range [0, 1]. (From GLM_GTX_compatibility) - template GLM_FUNC_QUALIFIER tvec2 lerp(const tvec2& x, const tvec2& y, const tvec2& a){return mix(x, y, a);} //!< \brief Returns the component-wise result of x * (1.0 - a) + y * a, i.e., the linear blend of x and y using vector a. The value for a is not restricted to the range [0, 1]. (From GLM_GTX_compatibility) - template GLM_FUNC_QUALIFIER tvec3 lerp(const tvec3& x, const tvec3& y, const tvec3& a){return mix(x, y, a);} //!< \brief Returns the component-wise result of x * (1.0 - a) + y * a, i.e., the linear blend of x and y using vector a. The value for a is not restricted to the range [0, 1]. (From GLM_GTX_compatibility) - template GLM_FUNC_QUALIFIER tvec4 lerp(const tvec4& x, const tvec4& y, const tvec4& a){return mix(x, y, a);} //!< \brief Returns the component-wise result of x * (1.0 - a) + y * a, i.e., the linear blend of x and y using vector a. The value for a is not restricted to the range [0, 1]. (From GLM_GTX_compatibility) + template GLM_FUNC_QUALIFIER vec<3, T, Q> lerp(const vec<3, T, Q>& x, const vec<3, T, Q>& y, T a){return mix(x, y, a);} //!< \brief Returns x * (1.0 - a) + y * a, i.e., the linear blend of x and y using the floating-point value a. The value for a is not restricted to the range [0, 1]. (From GLM_GTX_compatibility) + template GLM_FUNC_QUALIFIER vec<4, T, Q> lerp(const vec<4, T, Q>& x, const vec<4, T, Q>& y, T a){return mix(x, y, a);} //!< \brief Returns x * (1.0 - a) + y * a, i.e., the linear blend of x and y using the floating-point value a. The value for a is not restricted to the range [0, 1]. (From GLM_GTX_compatibility) + template GLM_FUNC_QUALIFIER vec<2, T, Q> lerp(const vec<2, T, Q>& x, const vec<2, T, Q>& y, const vec<2, T, Q>& a){return mix(x, y, a);} //!< \brief Returns the component-wise result of x * (1.0 - a) + y * a, i.e., the linear blend of x and y using vector a. The value for a is not restricted to the range [0, 1]. (From GLM_GTX_compatibility) + template GLM_FUNC_QUALIFIER vec<3, T, Q> lerp(const vec<3, T, Q>& x, const vec<3, T, Q>& y, const vec<3, T, Q>& a){return mix(x, y, a);} //!< \brief Returns the component-wise result of x * (1.0 - a) + y * a, i.e., the linear blend of x and y using vector a. The value for a is not restricted to the range [0, 1]. (From GLM_GTX_compatibility) + template GLM_FUNC_QUALIFIER vec<4, T, Q> lerp(const vec<4, T, Q>& x, const vec<4, T, Q>& y, const vec<4, T, Q>& a){return mix(x, y, a);} //!< \brief Returns the component-wise result of x * (1.0 - a) + y * a, i.e., the linear blend of x and y using vector a. The value for a is not restricted to the range [0, 1]. (From GLM_GTX_compatibility) - template GLM_FUNC_QUALIFIER T saturate(T x){return clamp(x, T(0), T(1));} //!< \brief Returns clamp(x, 0, 1) for each component in x. (From GLM_GTX_compatibility) - template GLM_FUNC_QUALIFIER tvec2 saturate(const tvec2& x){return clamp(x, T(0), T(1));} //!< \brief Returns clamp(x, 0, 1) for each component in x. (From GLM_GTX_compatibility) - template GLM_FUNC_QUALIFIER tvec3 saturate(const tvec3& x){return clamp(x, T(0), T(1));} //!< \brief Returns clamp(x, 0, 1) for each component in x. (From GLM_GTX_compatibility) - template GLM_FUNC_QUALIFIER tvec4 saturate(const tvec4& x){return clamp(x, T(0), T(1));} //!< \brief Returns clamp(x, 0, 1) for each component in x. (From GLM_GTX_compatibility) + template GLM_FUNC_QUALIFIER T saturate(T x){return clamp(x, T(0), T(1));} //!< \brief Returns clamp(x, 0, 1) for each component in x. (From GLM_GTX_compatibility) + template GLM_FUNC_QUALIFIER vec<2, T, Q> saturate(const vec<2, T, Q>& x){return clamp(x, T(0), T(1));} //!< \brief Returns clamp(x, 0, 1) for each component in x. (From GLM_GTX_compatibility) + template GLM_FUNC_QUALIFIER vec<3, T, Q> saturate(const vec<3, T, Q>& x){return clamp(x, T(0), T(1));} //!< \brief Returns clamp(x, 0, 1) for each component in x. (From GLM_GTX_compatibility) + template GLM_FUNC_QUALIFIER vec<4, T, Q> saturate(const vec<4, T, Q>& x){return clamp(x, T(0), T(1));} //!< \brief Returns clamp(x, 0, 1) for each component in x. (From GLM_GTX_compatibility) - template GLM_FUNC_QUALIFIER T atan2(T x, T y){return atan(x, y);} //!< \brief Arc tangent. Returns an angle whose tangent is y/x. The signs of x and y are used to determine what quadrant the angle is in. The range of values returned by this function is [-PI, PI]. Results are undefined if x and y are both 0. (From GLM_GTX_compatibility) - template GLM_FUNC_QUALIFIER tvec2 atan2(const tvec2& x, const tvec2& y){return atan(x, y);} //!< \brief Arc tangent. Returns an angle whose tangent is y/x. The signs of x and y are used to determine what quadrant the angle is in. The range of values returned by this function is [-PI, PI]. Results are undefined if x and y are both 0. (From GLM_GTX_compatibility) - template GLM_FUNC_QUALIFIER tvec3 atan2(const tvec3& x, const tvec3& y){return atan(x, y);} //!< \brief Arc tangent. Returns an angle whose tangent is y/x. The signs of x and y are used to determine what quadrant the angle is in. The range of values returned by this function is [-PI, PI]. Results are undefined if x and y are both 0. (From GLM_GTX_compatibility) - template GLM_FUNC_QUALIFIER tvec4 atan2(const tvec4& x, const tvec4& y){return atan(x, y);} //!< \brief Arc tangent. Returns an angle whose tangent is y/x. The signs of x and y are used to determine what quadrant the angle is in. The range of values returned by this function is [-PI, PI]. Results are undefined if x and y are both 0. (From GLM_GTX_compatibility) + template GLM_FUNC_QUALIFIER T atan2(T x, T y){return atan(x, y);} //!< \brief Arc tangent. Returns an angle whose tangent is y/x. The signs of x and y are used to determine what quadrant the angle is in. The range of values returned by this function is [-PI, PI]. Results are undefined if x and y are both 0. (From GLM_GTX_compatibility) + template GLM_FUNC_QUALIFIER vec<2, T, Q> atan2(const vec<2, T, Q>& x, const vec<2, T, Q>& y){return atan(x, y);} //!< \brief Arc tangent. Returns an angle whose tangent is y/x. The signs of x and y are used to determine what quadrant the angle is in. The range of values returned by this function is [-PI, PI]. Results are undefined if x and y are both 0. (From GLM_GTX_compatibility) + template GLM_FUNC_QUALIFIER vec<3, T, Q> atan2(const vec<3, T, Q>& x, const vec<3, T, Q>& y){return atan(x, y);} //!< \brief Arc tangent. Returns an angle whose tangent is y/x. The signs of x and y are used to determine what quadrant the angle is in. The range of values returned by this function is [-PI, PI]. Results are undefined if x and y are both 0. (From GLM_GTX_compatibility) + template GLM_FUNC_QUALIFIER vec<4, T, Q> atan2(const vec<4, T, Q>& x, const vec<4, T, Q>& y){return atan(x, y);} //!< \brief Arc tangent. Returns an angle whose tangent is y/x. The signs of x and y are used to determine what quadrant the angle is in. The range of values returned by this function is [-PI, PI]. Results are undefined if x and y are both 0. (From GLM_GTX_compatibility) - template GLM_FUNC_DECL bool isfinite(genType const & x); //!< \brief Test whether or not a scalar or each vector component is a finite value. (From GLM_GTX_compatibility) - template GLM_FUNC_DECL tvec1 isfinite(const tvec1& x); //!< \brief Test whether or not a scalar or each vector component is a finite value. (From GLM_GTX_compatibility) - template GLM_FUNC_DECL tvec2 isfinite(const tvec2& x); //!< \brief Test whether or not a scalar or each vector component is a finite value. (From GLM_GTX_compatibility) - template GLM_FUNC_DECL tvec3 isfinite(const tvec3& x); //!< \brief Test whether or not a scalar or each vector component is a finite value. (From GLM_GTX_compatibility) - template GLM_FUNC_DECL tvec4 isfinite(const tvec4& x); //!< \brief Test whether or not a scalar or each vector component is a finite value. (From GLM_GTX_compatibility) + template GLM_FUNC_DECL bool isfinite(genType const& x); //!< \brief Test whether or not a scalar or each vector component is a finite value. (From GLM_GTX_compatibility) + template GLM_FUNC_DECL vec<1, bool, Q> isfinite(const vec<1, T, Q>& x); //!< \brief Test whether or not a scalar or each vector component is a finite value. (From GLM_GTX_compatibility) + template GLM_FUNC_DECL vec<2, bool, Q> isfinite(const vec<2, T, Q>& x); //!< \brief Test whether or not a scalar or each vector component is a finite value. (From GLM_GTX_compatibility) + template GLM_FUNC_DECL vec<3, bool, Q> isfinite(const vec<3, T, Q>& x); //!< \brief Test whether or not a scalar or each vector component is a finite value. (From GLM_GTX_compatibility) + template GLM_FUNC_DECL vec<4, bool, Q> isfinite(const vec<4, T, Q>& x); //!< \brief Test whether or not a scalar or each vector component is a finite value. (From GLM_GTX_compatibility) typedef bool bool1; //!< \brief boolean type with 1 component. (From GLM_GTX_compatibility extension) - typedef tvec2 bool2; //!< \brief boolean type with 2 components. (From GLM_GTX_compatibility extension) - typedef tvec3 bool3; //!< \brief boolean type with 3 components. (From GLM_GTX_compatibility extension) - typedef tvec4 bool4; //!< \brief boolean type with 4 components. (From GLM_GTX_compatibility extension) + typedef vec<2, bool, highp> bool2; //!< \brief boolean type with 2 components. (From GLM_GTX_compatibility extension) + typedef vec<3, bool, highp> bool3; //!< \brief boolean type with 3 components. (From GLM_GTX_compatibility extension) + typedef vec<4, bool, highp> bool4; //!< \brief boolean type with 4 components. (From GLM_GTX_compatibility extension) typedef bool bool1x1; //!< \brief boolean matrix with 1 x 1 component. (From GLM_GTX_compatibility extension) - typedef tmat2x2 bool2x2; //!< \brief boolean matrix with 2 x 2 components. (From GLM_GTX_compatibility extension) - typedef tmat2x3 bool2x3; //!< \brief boolean matrix with 2 x 3 components. (From GLM_GTX_compatibility extension) - typedef tmat2x4 bool2x4; //!< \brief boolean matrix with 2 x 4 components. (From GLM_GTX_compatibility extension) - typedef tmat3x2 bool3x2; //!< \brief boolean matrix with 3 x 2 components. (From GLM_GTX_compatibility extension) - typedef tmat3x3 bool3x3; //!< \brief boolean matrix with 3 x 3 components. (From GLM_GTX_compatibility extension) - typedef tmat3x4 bool3x4; //!< \brief boolean matrix with 3 x 4 components. (From GLM_GTX_compatibility extension) - typedef tmat4x2 bool4x2; //!< \brief boolean matrix with 4 x 2 components. (From GLM_GTX_compatibility extension) - typedef tmat4x3 bool4x3; //!< \brief boolean matrix with 4 x 3 components. (From GLM_GTX_compatibility extension) - typedef tmat4x4 bool4x4; //!< \brief boolean matrix with 4 x 4 components. (From GLM_GTX_compatibility extension) + typedef mat<2, 2, bool, highp> bool2x2; //!< \brief boolean matrix with 2 x 2 components. (From GLM_GTX_compatibility extension) + typedef mat<2, 3, bool, highp> bool2x3; //!< \brief boolean matrix with 2 x 3 components. (From GLM_GTX_compatibility extension) + typedef mat<2, 4, bool, highp> bool2x4; //!< \brief boolean matrix with 2 x 4 components. (From GLM_GTX_compatibility extension) + typedef mat<3, 2, bool, highp> bool3x2; //!< \brief boolean matrix with 3 x 2 components. (From GLM_GTX_compatibility extension) + typedef mat<3, 3, bool, highp> bool3x3; //!< \brief boolean matrix with 3 x 3 components. (From GLM_GTX_compatibility extension) + typedef mat<3, 4, bool, highp> bool3x4; //!< \brief boolean matrix with 3 x 4 components. (From GLM_GTX_compatibility extension) + typedef mat<4, 2, bool, highp> bool4x2; //!< \brief boolean matrix with 4 x 2 components. (From GLM_GTX_compatibility extension) + typedef mat<4, 3, bool, highp> bool4x3; //!< \brief boolean matrix with 4 x 3 components. (From GLM_GTX_compatibility extension) + typedef mat<4, 4, bool, highp> bool4x4; //!< \brief boolean matrix with 4 x 4 components. (From GLM_GTX_compatibility extension) typedef int int1; //!< \brief integer vector with 1 component. (From GLM_GTX_compatibility extension) - typedef tvec2 int2; //!< \brief integer vector with 2 components. (From GLM_GTX_compatibility extension) - typedef tvec3 int3; //!< \brief integer vector with 3 components. (From GLM_GTX_compatibility extension) - typedef tvec4 int4; //!< \brief integer vector with 4 components. (From GLM_GTX_compatibility extension) + typedef vec<2, int, highp> int2; //!< \brief integer vector with 2 components. (From GLM_GTX_compatibility extension) + typedef vec<3, int, highp> int3; //!< \brief integer vector with 3 components. (From GLM_GTX_compatibility extension) + typedef vec<4, int, highp> int4; //!< \brief integer vector with 4 components. (From GLM_GTX_compatibility extension) typedef int int1x1; //!< \brief integer matrix with 1 component. (From GLM_GTX_compatibility extension) - typedef tmat2x2 int2x2; //!< \brief integer matrix with 2 x 2 components. (From GLM_GTX_compatibility extension) - typedef tmat2x3 int2x3; //!< \brief integer matrix with 2 x 3 components. (From GLM_GTX_compatibility extension) - typedef tmat2x4 int2x4; //!< \brief integer matrix with 2 x 4 components. (From GLM_GTX_compatibility extension) - typedef tmat3x2 int3x2; //!< \brief integer matrix with 3 x 2 components. (From GLM_GTX_compatibility extension) - typedef tmat3x3 int3x3; //!< \brief integer matrix with 3 x 3 components. (From GLM_GTX_compatibility extension) - typedef tmat3x4 int3x4; //!< \brief integer matrix with 3 x 4 components. (From GLM_GTX_compatibility extension) - typedef tmat4x2 int4x2; //!< \brief integer matrix with 4 x 2 components. (From GLM_GTX_compatibility extension) - typedef tmat4x3 int4x3; //!< \brief integer matrix with 4 x 3 components. (From GLM_GTX_compatibility extension) - typedef tmat4x4 int4x4; //!< \brief integer matrix with 4 x 4 components. (From GLM_GTX_compatibility extension) - - typedef float float1; //!< \brief single-precision floating-point vector with 1 component. (From GLM_GTX_compatibility extension) - typedef tvec2 float2; //!< \brief single-precision floating-point vector with 2 components. (From GLM_GTX_compatibility extension) - typedef tvec3 float3; //!< \brief single-precision floating-point vector with 3 components. (From GLM_GTX_compatibility extension) - typedef tvec4 float4; //!< \brief single-precision floating-point vector with 4 components. (From GLM_GTX_compatibility extension) - - typedef float float1x1; //!< \brief single-precision floating-point matrix with 1 component. (From GLM_GTX_compatibility extension) - typedef tmat2x2 float2x2; //!< \brief single-precision floating-point matrix with 2 x 2 components. (From GLM_GTX_compatibility extension) - typedef tmat2x3 float2x3; //!< \brief single-precision floating-point matrix with 2 x 3 components. (From GLM_GTX_compatibility extension) - typedef tmat2x4 float2x4; //!< \brief single-precision floating-point matrix with 2 x 4 components. (From GLM_GTX_compatibility extension) - typedef tmat3x2 float3x2; //!< \brief single-precision floating-point matrix with 3 x 2 components. (From GLM_GTX_compatibility extension) - typedef tmat3x3 float3x3; //!< \brief single-precision floating-point matrix with 3 x 3 components. (From GLM_GTX_compatibility extension) - typedef tmat3x4 float3x4; //!< \brief single-precision floating-point matrix with 3 x 4 components. (From GLM_GTX_compatibility extension) - typedef tmat4x2 float4x2; //!< \brief single-precision floating-point matrix with 4 x 2 components. (From GLM_GTX_compatibility extension) - typedef tmat4x3 float4x3; //!< \brief single-precision floating-point matrix with 4 x 3 components. (From GLM_GTX_compatibility extension) - typedef tmat4x4 float4x4; //!< \brief single-precision floating-point matrix with 4 x 4 components. (From GLM_GTX_compatibility extension) - - typedef double double1; //!< \brief double-precision floating-point vector with 1 component. (From GLM_GTX_compatibility extension) - typedef tvec2 double2; //!< \brief double-precision floating-point vector with 2 components. (From GLM_GTX_compatibility extension) - typedef tvec3 double3; //!< \brief double-precision floating-point vector with 3 components. (From GLM_GTX_compatibility extension) - typedef tvec4 double4; //!< \brief double-precision floating-point vector with 4 components. (From GLM_GTX_compatibility extension) - - typedef double double1x1; //!< \brief double-precision floating-point matrix with 1 component. (From GLM_GTX_compatibility extension) - typedef tmat2x2 double2x2; //!< \brief double-precision floating-point matrix with 2 x 2 components. (From GLM_GTX_compatibility extension) - typedef tmat2x3 double2x3; //!< \brief double-precision floating-point matrix with 2 x 3 components. (From GLM_GTX_compatibility extension) - typedef tmat2x4 double2x4; //!< \brief double-precision floating-point matrix with 2 x 4 components. (From GLM_GTX_compatibility extension) - typedef tmat3x2 double3x2; //!< \brief double-precision floating-point matrix with 3 x 2 components. (From GLM_GTX_compatibility extension) - typedef tmat3x3 double3x3; //!< \brief double-precision floating-point matrix with 3 x 3 components. (From GLM_GTX_compatibility extension) - typedef tmat3x4 double3x4; //!< \brief double-precision floating-point matrix with 3 x 4 components. (From GLM_GTX_compatibility extension) - typedef tmat4x2 double4x2; //!< \brief double-precision floating-point matrix with 4 x 2 components. (From GLM_GTX_compatibility extension) - typedef tmat4x3 double4x3; //!< \brief double-precision floating-point matrix with 4 x 3 components. (From GLM_GTX_compatibility extension) - typedef tmat4x4 double4x4; //!< \brief double-precision floating-point matrix with 4 x 4 components. (From GLM_GTX_compatibility extension) + typedef mat<2, 2, int, highp> int2x2; //!< \brief integer matrix with 2 x 2 components. (From GLM_GTX_compatibility extension) + typedef mat<2, 3, int, highp> int2x3; //!< \brief integer matrix with 2 x 3 components. (From GLM_GTX_compatibility extension) + typedef mat<2, 4, int, highp> int2x4; //!< \brief integer matrix with 2 x 4 components. (From GLM_GTX_compatibility extension) + typedef mat<3, 2, int, highp> int3x2; //!< \brief integer matrix with 3 x 2 components. (From GLM_GTX_compatibility extension) + typedef mat<3, 3, int, highp> int3x3; //!< \brief integer matrix with 3 x 3 components. (From GLM_GTX_compatibility extension) + typedef mat<3, 4, int, highp> int3x4; //!< \brief integer matrix with 3 x 4 components. (From GLM_GTX_compatibility extension) + typedef mat<4, 2, int, highp> int4x2; //!< \brief integer matrix with 4 x 2 components. (From GLM_GTX_compatibility extension) + typedef mat<4, 3, int, highp> int4x3; //!< \brief integer matrix with 4 x 3 components. (From GLM_GTX_compatibility extension) + typedef mat<4, 4, int, highp> int4x4; //!< \brief integer matrix with 4 x 4 components. (From GLM_GTX_compatibility extension) + + typedef float float1; //!< \brief single-qualifier floating-point vector with 1 component. (From GLM_GTX_compatibility extension) + typedef vec<2, float, highp> float2; //!< \brief single-qualifier floating-point vector with 2 components. (From GLM_GTX_compatibility extension) + typedef vec<3, float, highp> float3; //!< \brief single-qualifier floating-point vector with 3 components. (From GLM_GTX_compatibility extension) + typedef vec<4, float, highp> float4; //!< \brief single-qualifier floating-point vector with 4 components. (From GLM_GTX_compatibility extension) + + typedef float float1x1; //!< \brief single-qualifier floating-point matrix with 1 component. (From GLM_GTX_compatibility extension) + typedef mat<2, 2, float, highp> float2x2; //!< \brief single-qualifier floating-point matrix with 2 x 2 components. (From GLM_GTX_compatibility extension) + typedef mat<2, 3, float, highp> float2x3; //!< \brief single-qualifier floating-point matrix with 2 x 3 components. (From GLM_GTX_compatibility extension) + typedef mat<2, 4, float, highp> float2x4; //!< \brief single-qualifier floating-point matrix with 2 x 4 components. (From GLM_GTX_compatibility extension) + typedef mat<3, 2, float, highp> float3x2; //!< \brief single-qualifier floating-point matrix with 3 x 2 components. (From GLM_GTX_compatibility extension) + typedef mat<3, 3, float, highp> float3x3; //!< \brief single-qualifier floating-point matrix with 3 x 3 components. (From GLM_GTX_compatibility extension) + typedef mat<3, 4, float, highp> float3x4; //!< \brief single-qualifier floating-point matrix with 3 x 4 components. (From GLM_GTX_compatibility extension) + typedef mat<4, 2, float, highp> float4x2; //!< \brief single-qualifier floating-point matrix with 4 x 2 components. (From GLM_GTX_compatibility extension) + typedef mat<4, 3, float, highp> float4x3; //!< \brief single-qualifier floating-point matrix with 4 x 3 components. (From GLM_GTX_compatibility extension) + typedef mat<4, 4, float, highp> float4x4; //!< \brief single-qualifier floating-point matrix with 4 x 4 components. (From GLM_GTX_compatibility extension) + + typedef double double1; //!< \brief double-qualifier floating-point vector with 1 component. (From GLM_GTX_compatibility extension) + typedef vec<2, double, highp> double2; //!< \brief double-qualifier floating-point vector with 2 components. (From GLM_GTX_compatibility extension) + typedef vec<3, double, highp> double3; //!< \brief double-qualifier floating-point vector with 3 components. (From GLM_GTX_compatibility extension) + typedef vec<4, double, highp> double4; //!< \brief double-qualifier floating-point vector with 4 components. (From GLM_GTX_compatibility extension) + + typedef double double1x1; //!< \brief double-qualifier floating-point matrix with 1 component. (From GLM_GTX_compatibility extension) + typedef mat<2, 2, double, highp> double2x2; //!< \brief double-qualifier floating-point matrix with 2 x 2 components. (From GLM_GTX_compatibility extension) + typedef mat<2, 3, double, highp> double2x3; //!< \brief double-qualifier floating-point matrix with 2 x 3 components. (From GLM_GTX_compatibility extension) + typedef mat<2, 4, double, highp> double2x4; //!< \brief double-qualifier floating-point matrix with 2 x 4 components. (From GLM_GTX_compatibility extension) + typedef mat<3, 2, double, highp> double3x2; //!< \brief double-qualifier floating-point matrix with 3 x 2 components. (From GLM_GTX_compatibility extension) + typedef mat<3, 3, double, highp> double3x3; //!< \brief double-qualifier floating-point matrix with 3 x 3 components. (From GLM_GTX_compatibility extension) + typedef mat<3, 4, double, highp> double3x4; //!< \brief double-qualifier floating-point matrix with 3 x 4 components. (From GLM_GTX_compatibility extension) + typedef mat<4, 2, double, highp> double4x2; //!< \brief double-qualifier floating-point matrix with 4 x 2 components. (From GLM_GTX_compatibility extension) + typedef mat<4, 3, double, highp> double4x3; //!< \brief double-qualifier floating-point matrix with 4 x 3 components. (From GLM_GTX_compatibility extension) + typedef mat<4, 4, double, highp> double4x4; //!< \brief double-qualifier floating-point matrix with 4 x 4 components. (From GLM_GTX_compatibility extension) /// @} }//namespace glm diff --git a/external/include/glm/gtx/compatibility.inl b/external/include/glm/gtx/compatibility.inl index 368527a..11affa1 100644 --- a/external/include/glm/gtx/compatibility.inl +++ b/external/include/glm/gtx/compatibility.inl @@ -6,9 +6,9 @@ namespace glm { // isfinite - template + template GLM_FUNC_QUALIFIER bool isfinite( - genType const & x) + genType const& x) { # if GLM_HAS_CXX11_STL return std::isfinite(x) != 0; @@ -24,38 +24,38 @@ namespace glm # endif } - template - GLM_FUNC_QUALIFIER tvec1 isfinite( - tvec1 const & x) + template + GLM_FUNC_QUALIFIER vec<1, bool, Q> isfinite( + vec<1, T, Q> const& x) { - return tvec1( + return vec<1, bool, Q>( isfinite(x.x)); } - template - GLM_FUNC_QUALIFIER tvec2 isfinite( - tvec2 const & x) + template + GLM_FUNC_QUALIFIER vec<2, bool, Q> isfinite( + vec<2, T, Q> const& x) { - return tvec2( + return vec<2, bool, Q>( isfinite(x.x), isfinite(x.y)); } - template - GLM_FUNC_QUALIFIER tvec3 isfinite( - tvec3 const & x) + template + GLM_FUNC_QUALIFIER vec<3, bool, Q> isfinite( + vec<3, T, Q> const& x) { - return tvec3( + return vec<3, bool, Q>( isfinite(x.x), isfinite(x.y), isfinite(x.z)); } - template - GLM_FUNC_QUALIFIER tvec4 isfinite( - tvec4 const & x) + template + GLM_FUNC_QUALIFIER vec<4, bool, Q> isfinite( + vec<4, T, Q> const& x) { - return tvec4( + return vec<4, bool, Q>( isfinite(x.x), isfinite(x.y), isfinite(x.z), diff --git a/external/include/glm/gtx/component_wise.hpp b/external/include/glm/gtx/component_wise.hpp index c316f9e..6ed7d55 100644 --- a/external/include/glm/gtx/component_wise.hpp +++ b/external/include/glm/gtx/component_wise.hpp @@ -2,21 +2,25 @@ /// @file glm/gtx/component_wise.hpp /// @date 2007-05-21 / 2011-06-07 /// @author Christophe Riccio -/// +/// /// @see core (dependence) /// /// @defgroup gtx_component_wise GLM_GTX_component_wise /// @ingroup gtx /// -/// @brief Operations between components of a type +/// Include to use the features of this extension. /// -/// need to be included to use these functionalities. +/// Operations between components of a type #pragma once // Dependencies #include "../detail/setup.hpp" -#include "../detail/precision.hpp" +#include "../detail/qualifier.hpp" + +#ifndef GLM_ENABLE_EXPERIMENTAL +# error "GLM: GLM_GTX_component_wise is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." +#endif #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) # pragma message("GLM: GLM_GTX_component_wise extension included") @@ -28,36 +32,36 @@ namespace glm /// @{ /// Convert an integer vector to a normalized float vector. - /// If the parameter value type is already a floating precision type, the value is passed through. + /// If the parameter value type is already a floating qualifier type, the value is passed through. /// @see gtx_component_wise - template class vecType> - GLM_FUNC_DECL vecType compNormalize(vecType const & v); + template + GLM_FUNC_DECL vec compNormalize(vec const& v); /// Convert a normalized float vector to an integer vector. - /// If the parameter value type is already a floating precision type, the value is passed through. + /// If the parameter value type is already a floating qualifier type, the value is passed through. /// @see gtx_component_wise - template class vecType> - GLM_FUNC_DECL vecType compScale(vecType const & v); + template + GLM_FUNC_DECL vec compScale(vec const& v); - /// Add all vector components together. + /// Add all vector components together. /// @see gtx_component_wise - template - GLM_FUNC_DECL typename genType::value_type compAdd(genType const & v); + template + GLM_FUNC_DECL typename genType::value_type compAdd(genType const& v); - /// Multiply all vector components together. + /// Multiply all vector components together. /// @see gtx_component_wise - template - GLM_FUNC_DECL typename genType::value_type compMul(genType const & v); + template + GLM_FUNC_DECL typename genType::value_type compMul(genType const& v); /// Find the minimum value between single vector components. /// @see gtx_component_wise - template - GLM_FUNC_DECL typename genType::value_type compMin(genType const & v); + template + GLM_FUNC_DECL typename genType::value_type compMin(genType const& v); /// Find the maximum value between single vector components. /// @see gtx_component_wise - template - GLM_FUNC_DECL typename genType::value_type compMax(genType const & v); + template + GLM_FUNC_DECL typename genType::value_type compMax(genType const& v); /// @} }//namespace glm diff --git a/external/include/glm/gtx/component_wise.inl b/external/include/glm/gtx/component_wise.inl index add3969..8ca0ca9 100644 --- a/external/include/glm/gtx/component_wise.inl +++ b/external/include/glm/gtx/component_wise.inl @@ -6,92 +6,92 @@ namespace glm{ namespace detail { - template class vecType, bool isInteger, bool signedType> + template struct compute_compNormalize {}; - template class vecType> - struct compute_compNormalize + template + struct compute_compNormalize { - GLM_FUNC_QUALIFIER static vecType call(vecType const & v) + GLM_FUNC_QUALIFIER static vec call(vec const& v) { floatType const Min = static_cast(std::numeric_limits::min()); floatType const Max = static_cast(std::numeric_limits::max()); - return (vecType(v) - Min) / (Max - Min) * static_cast(2) - static_cast(1); + return (vec(v) - Min) / (Max - Min) * static_cast(2) - static_cast(1); } }; - template class vecType> - struct compute_compNormalize + template + struct compute_compNormalize { - GLM_FUNC_QUALIFIER static vecType call(vecType const & v) + GLM_FUNC_QUALIFIER static vec call(vec const& v) { - return vecType(v) / static_cast(std::numeric_limits::max()); + return vec(v) / static_cast(std::numeric_limits::max()); } }; - template class vecType> - struct compute_compNormalize + template + struct compute_compNormalize { - GLM_FUNC_QUALIFIER static vecType call(vecType const & v) + GLM_FUNC_QUALIFIER static vec call(vec const& v) { return v; } }; - template class vecType, bool isInteger, bool signedType> + template struct compute_compScale {}; - template class vecType> - struct compute_compScale + template + struct compute_compScale { - GLM_FUNC_QUALIFIER static vecType call(vecType const & v) + GLM_FUNC_QUALIFIER static vec call(vec const& v) { floatType const Max = static_cast(std::numeric_limits::max()) + static_cast(0.5); - vecType const Scaled(v * Max); - vecType const Result(Scaled - static_cast(0.5)); + vec const Scaled(v * Max); + vec const Result(Scaled - static_cast(0.5)); return Result; } }; - template class vecType> - struct compute_compScale + template + struct compute_compScale { - GLM_FUNC_QUALIFIER static vecType call(vecType const & v) + GLM_FUNC_QUALIFIER static vec call(vec const& v) { - return vecType(vecType(v) * static_cast(std::numeric_limits::max())); + return vec(vec(v) * static_cast(std::numeric_limits::max())); } }; - template class vecType> - struct compute_compScale + template + struct compute_compScale { - GLM_FUNC_QUALIFIER static vecType call(vecType const & v) + GLM_FUNC_QUALIFIER static vec call(vec const& v) { return v; } }; }//namespace detail - template class vecType> - GLM_FUNC_QUALIFIER vecType compNormalize(vecType const & v) + template + GLM_FUNC_QUALIFIER vec compNormalize(vec const& v) { GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'compNormalize' accepts only floating-point types for 'floatType' template parameter"); - return detail::compute_compNormalize::is_integer, std::numeric_limits::is_signed>::call(v); + return detail::compute_compNormalize::is_integer, std::numeric_limits::is_signed>::call(v); } - template class vecType> - GLM_FUNC_QUALIFIER vecType compScale(vecType const & v) + template + GLM_FUNC_QUALIFIER vec compScale(vec const& v) { GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'compScale' accepts only floating-point types for 'floatType' template parameter"); - return detail::compute_compScale::is_integer, std::numeric_limits::is_signed>::call(v); + return detail::compute_compScale::is_integer, std::numeric_limits::is_signed>::call(v); } - template class vecType> - GLM_FUNC_QUALIFIER T compAdd(vecType const & v) + template + GLM_FUNC_QUALIFIER T compAdd(vec const& v) { T Result(0); for(length_t i = 0, n = v.length(); i < n; ++i) @@ -99,8 +99,8 @@ namespace detail return Result; } - template class vecType> - GLM_FUNC_QUALIFIER T compMul(vecType const & v) + template + GLM_FUNC_QUALIFIER T compMul(vec const& v) { T Result(1); for(length_t i = 0, n = v.length(); i < n; ++i) @@ -108,8 +108,8 @@ namespace detail return Result; } - template class vecType> - GLM_FUNC_QUALIFIER T compMin(vecType const & v) + template + GLM_FUNC_QUALIFIER T compMin(vec const& v) { T Result(v[0]); for(length_t i = 1, n = v.length(); i < n; ++i) @@ -117,8 +117,8 @@ namespace detail return Result; } - template class vecType> - GLM_FUNC_QUALIFIER T compMax(vecType const & v) + template + GLM_FUNC_QUALIFIER T compMax(vec const& v) { T Result(v[0]); for(length_t i = 1, n = v.length(); i < n; ++i) diff --git a/external/include/glm/gtx/dual_quaternion.hpp b/external/include/glm/gtx/dual_quaternion.hpp index 4d7b61e..5544514 100644 --- a/external/include/glm/gtx/dual_quaternion.hpp +++ b/external/include/glm/gtx/dual_quaternion.hpp @@ -3,16 +3,15 @@ /// @author Maksim Vorobiev (msomeone@gmail.com) /// /// @see core (dependence) -/// @see gtc_half_float (dependence) /// @see gtc_constants (dependence) /// @see gtc_quaternion (dependence) /// /// @defgroup gtx_dual_quaternion GLM_GTX_dual_quaternion /// @ingroup gtx /// -/// @brief Defines a templated dual-quaternion type and several dual-quaternion operations. +/// Include to use the features of this extension. /// -/// need to be included to use these functionalities. +/// Defines a templated dual-quaternion type and several dual-quaternion operations. #pragma once @@ -21,6 +20,10 @@ #include "../gtc/constants.hpp" #include "../gtc/quaternion.hpp" +#ifndef GLM_ENABLE_EXPERIMENTAL +# error "GLM: GLM_GTX_dual_quaternion is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." +#endif + #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) # pragma message("GLM: GLM_GTX_dual_quaternion extension included") #endif @@ -30,192 +33,197 @@ namespace glm /// @addtogroup gtx_dual_quaternion /// @{ - template + template struct tdualquat { // -- Implementation detail -- typedef T value_type; - typedef glm::tquat part_type; + typedef glm::tquat part_type; // -- Data -- - glm::tquat real, dual; + glm::tquat real, dual; // -- Component accesses -- typedef length_t length_type; /// Return the count of components of a dual quaternion - GLM_FUNC_DECL static length_type length(){return 2;} + GLM_FUNC_DECL static GLM_CONSTEXPR length_type length(){return 2;} GLM_FUNC_DECL part_type & operator[](length_type i); - GLM_FUNC_DECL part_type const & operator[](length_type i) const; + GLM_FUNC_DECL part_type const& operator[](length_type i) const; // -- Implicit basic constructors -- GLM_FUNC_DECL GLM_CONSTEXPR tdualquat() GLM_DEFAULT_CTOR; - GLM_FUNC_DECL GLM_CONSTEXPR tdualquat(tdualquat const & d) GLM_DEFAULT; - template - GLM_FUNC_DECL GLM_CONSTEXPR tdualquat(tdualquat const & d); + GLM_FUNC_DECL GLM_CONSTEXPR tdualquat(tdualquat const& d) GLM_DEFAULT; + template + GLM_FUNC_DECL GLM_CONSTEXPR tdualquat(tdualquat const& d); // -- Explicit basic constructors -- - GLM_FUNC_DECL GLM_CONSTEXPR_CTOR explicit tdualquat(ctor); - GLM_FUNC_DECL GLM_CONSTEXPR tdualquat(tquat const & real); - GLM_FUNC_DECL GLM_CONSTEXPR tdualquat(tquat const & orientation, tvec3 const & translation); - GLM_FUNC_DECL GLM_CONSTEXPR tdualquat(tquat const & real, tquat const & dual); + GLM_FUNC_DECL GLM_CONSTEXPR tdualquat(tquat const& real); + GLM_FUNC_DECL GLM_CONSTEXPR tdualquat(tquat const& orientation, vec<3, T, Q> const& translation); + GLM_FUNC_DECL GLM_CONSTEXPR tdualquat(tquat const& real, tquat const& dual); // -- Conversion constructors -- - template - GLM_FUNC_DECL GLM_CONSTEXPR GLM_EXPLICIT tdualquat(tdualquat const & q); + template + GLM_FUNC_DECL GLM_CONSTEXPR GLM_EXPLICIT tdualquat(tdualquat const& q); - GLM_FUNC_DECL GLM_EXPLICIT tdualquat(tmat2x4 const & holder_mat); - GLM_FUNC_DECL GLM_EXPLICIT tdualquat(tmat3x4 const & aug_mat); + GLM_FUNC_DECL GLM_EXPLICIT tdualquat(mat<2, 4, T, Q> const& holder_mat); + GLM_FUNC_DECL GLM_EXPLICIT tdualquat(mat<3, 4, T, Q> const& aug_mat); // -- Unary arithmetic operators -- - GLM_FUNC_DECL tdualquat & operator=(tdualquat const & m) GLM_DEFAULT; + GLM_FUNC_DECL tdualquat & operator=(tdualquat const& m) GLM_DEFAULT; - template - GLM_FUNC_DECL tdualquat & operator=(tdualquat const & m); - template - GLM_FUNC_DECL tdualquat & operator*=(U s); - template - GLM_FUNC_DECL tdualquat & operator/=(U s); + template + GLM_FUNC_DECL tdualquat & operator=(tdualquat const& m); + template + GLM_FUNC_DECL tdualquat & operator*=(U s); + template + GLM_FUNC_DECL tdualquat & operator/=(U s); }; // -- Unary bit operators -- - template - GLM_FUNC_DECL tdualquat operator+(tdualquat const & q); + template + GLM_FUNC_DECL tdualquat operator+(tdualquat const& q); - template - GLM_FUNC_DECL tdualquat operator-(tdualquat const & q); + template + GLM_FUNC_DECL tdualquat operator-(tdualquat const& q); // -- Binary operators -- - template - GLM_FUNC_DECL tdualquat operator+(tdualquat const & q, tdualquat const & p); + template + GLM_FUNC_DECL tdualquat operator+(tdualquat const& q, tdualquat const& p); - template - GLM_FUNC_DECL tdualquat operator*(tdualquat const & q, tdualquat const & p); + template + GLM_FUNC_DECL tdualquat operator*(tdualquat const& q, tdualquat const& p); - template - GLM_FUNC_DECL tvec3 operator*(tdualquat const & q, tvec3 const & v); + template + GLM_FUNC_DECL vec<3, T, Q> operator*(tdualquat const& q, vec<3, T, Q> const& v); - template - GLM_FUNC_DECL tvec3 operator*(tvec3 const & v, tdualquat const & q); + template + GLM_FUNC_DECL vec<3, T, Q> operator*(vec<3, T, Q> const& v, tdualquat const& q); - template - GLM_FUNC_DECL tvec4 operator*(tdualquat const & q, tvec4 const & v); + template + GLM_FUNC_DECL vec<4, T, Q> operator*(tdualquat const& q, vec<4, T, Q> const& v); - template - GLM_FUNC_DECL tvec4 operator*(tvec4 const & v, tdualquat const & q); + template + GLM_FUNC_DECL vec<4, T, Q> operator*(vec<4, T, Q> const& v, tdualquat const& q); - template - GLM_FUNC_DECL tdualquat operator*(tdualquat const & q, T const & s); + template + GLM_FUNC_DECL tdualquat operator*(tdualquat const& q, T const& s); - template - GLM_FUNC_DECL tdualquat operator*(T const & s, tdualquat const & q); + template + GLM_FUNC_DECL tdualquat operator*(T const& s, tdualquat const& q); - template - GLM_FUNC_DECL tdualquat operator/(tdualquat const & q, T const & s); + template + GLM_FUNC_DECL tdualquat operator/(tdualquat const& q, T const& s); // -- Boolean operators -- - template - GLM_FUNC_DECL bool operator==(tdualquat const & q1, tdualquat const & q2); + template + GLM_FUNC_DECL bool operator==(tdualquat const& q1, tdualquat const& q2); + + template + GLM_FUNC_DECL bool operator!=(tdualquat const& q1, tdualquat const& q2); - template - GLM_FUNC_DECL bool operator!=(tdualquat const & q1, tdualquat const & q2); + /// Creates an identity dual quaternion. + /// + /// @see gtx_dual_quaternion + template + GLM_FUNC_DECL tdualquat dual_quat_identity(); /// Returns the normalized quaternion. /// /// @see gtx_dual_quaternion - template - GLM_FUNC_DECL tdualquat normalize(tdualquat const & q); + template + GLM_FUNC_DECL tdualquat normalize(tdualquat const& q); /// Returns the linear interpolation of two dual quaternion. /// /// @see gtc_dual_quaternion - template - GLM_FUNC_DECL tdualquat lerp(tdualquat const & x, tdualquat const & y, T const & a); + template + GLM_FUNC_DECL tdualquat lerp(tdualquat const& x, tdualquat const& y, T const& a); /// Returns the q inverse. /// /// @see gtx_dual_quaternion - template - GLM_FUNC_DECL tdualquat inverse(tdualquat const & q); + template + GLM_FUNC_DECL tdualquat inverse(tdualquat const& q); /// Converts a quaternion to a 2 * 4 matrix. /// /// @see gtx_dual_quaternion - template - GLM_FUNC_DECL tmat2x4 mat2x4_cast(tdualquat const & x); + template + GLM_FUNC_DECL mat<2, 4, T, Q> mat2x4_cast(tdualquat const& x); /// Converts a quaternion to a 3 * 4 matrix. /// /// @see gtx_dual_quaternion - template - GLM_FUNC_DECL tmat3x4 mat3x4_cast(tdualquat const & x); + template + GLM_FUNC_DECL mat<3, 4, T, Q> mat3x4_cast(tdualquat const& x); /// Converts a 2 * 4 matrix (matrix which holds real and dual parts) to a quaternion. /// /// @see gtx_dual_quaternion - template - GLM_FUNC_DECL tdualquat dualquat_cast(tmat2x4 const & x); + template + GLM_FUNC_DECL tdualquat dualquat_cast(mat<2, 4, T, Q> const& x); /// Converts a 3 * 4 matrix (augmented matrix rotation + translation) to a quaternion. /// /// @see gtx_dual_quaternion - template - GLM_FUNC_DECL tdualquat dualquat_cast(tmat3x4 const & x); + template + GLM_FUNC_DECL tdualquat dualquat_cast(mat<3, 4, T, Q> const& x); - /// Dual-quaternion of low single-precision floating-point numbers. + /// Dual-quaternion of low single-qualifier floating-point numbers. /// /// @see gtx_dual_quaternion typedef tdualquat lowp_dualquat; - /// Dual-quaternion of medium single-precision floating-point numbers. + /// Dual-quaternion of medium single-qualifier floating-point numbers. /// /// @see gtx_dual_quaternion typedef tdualquat mediump_dualquat; - /// Dual-quaternion of high single-precision floating-point numbers. + /// Dual-quaternion of high single-qualifier floating-point numbers. /// /// @see gtx_dual_quaternion typedef tdualquat highp_dualquat; - /// Dual-quaternion of low single-precision floating-point numbers. + /// Dual-quaternion of low single-qualifier floating-point numbers. /// /// @see gtx_dual_quaternion typedef tdualquat lowp_fdualquat; - /// Dual-quaternion of medium single-precision floating-point numbers. + /// Dual-quaternion of medium single-qualifier floating-point numbers. /// /// @see gtx_dual_quaternion typedef tdualquat mediump_fdualquat; - /// Dual-quaternion of high single-precision floating-point numbers. + /// Dual-quaternion of high single-qualifier floating-point numbers. /// /// @see gtx_dual_quaternion typedef tdualquat highp_fdualquat; - /// Dual-quaternion of low double-precision floating-point numbers. + /// Dual-quaternion of low double-qualifier floating-point numbers. /// /// @see gtx_dual_quaternion typedef tdualquat lowp_ddualquat; - /// Dual-quaternion of medium double-precision floating-point numbers. + /// Dual-quaternion of medium double-qualifier floating-point numbers. /// /// @see gtx_dual_quaternion typedef tdualquat mediump_ddualquat; - /// Dual-quaternion of high double-precision floating-point numbers. + /// Dual-quaternion of high double-qualifier floating-point numbers. /// /// @see gtx_dual_quaternion typedef tdualquat highp_ddualquat; @@ -227,7 +235,7 @@ namespace glm /// @see gtx_dual_quaternion typedef highp_fdualquat dualquat; - /// Dual-quaternion of single-precision floating-point numbers. + /// Dual-quaternion of single-qualifier floating-point numbers. /// /// @see gtx_dual_quaternion typedef highp_fdualquat fdualquat; @@ -246,7 +254,7 @@ namespace glm #if(!defined(GLM_PRECISION_HIGHP_DOUBLE) && !defined(GLM_PRECISION_MEDIUMP_DOUBLE) && !defined(GLM_PRECISION_LOWP_DOUBLE)) - /// Dual-quaternion of default double-precision floating-point numbers. + /// Dual-quaternion of default double-qualifier floating-point numbers. /// /// @see gtx_dual_quaternion typedef highp_ddualquat ddualquat; diff --git a/external/include/glm/gtx/dual_quaternion.inl b/external/include/glm/gtx/dual_quaternion.inl index c3f2bc6..5c82b88 100644 --- a/external/include/glm/gtx/dual_quaternion.inl +++ b/external/include/glm/gtx/dual_quaternion.inl @@ -8,15 +8,15 @@ namespace glm { // -- Component accesses -- - template - GLM_FUNC_QUALIFIER typename tdualquat::part_type & tdualquat::operator[](typename tdualquat::length_type i) + template + GLM_FUNC_QUALIFIER typename tdualquat::part_type & tdualquat::operator[](typename tdualquat::length_type i) { assert(i >= 0 && i < this->length()); return (&real)[i]; } - template - GLM_FUNC_QUALIFIER typename tdualquat::part_type const & tdualquat::operator[](typename tdualquat::length_type i) const + template + GLM_FUNC_QUALIFIER typename tdualquat::part_type const& tdualquat::operator[](typename tdualquat::length_type i) const { assert(i >= 0 && i < this->length()); return (&real)[i]; @@ -24,44 +24,40 @@ namespace glm // -- Implicit basic constructors -- -# if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT) - template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR tdualquat::tdualquat() -# ifndef GLM_FORCE_NO_CTOR_INIT - : real(tquat()) - , dual(tquat(0, 0, 0, 0)) +# if !GLM_HAS_DEFAULTED_FUNCTIONS || defined(GLM_FORCE_CTOR_INIT) + template + GLM_FUNC_QUALIFIER GLM_CONSTEXPR tdualquat::tdualquat() +# ifdef GLM_FORCE_CTOR_INIT + : real(tquat()) + , dual(tquat(0, 0, 0, 0)) # endif {} # endif # if !GLM_HAS_DEFAULTED_FUNCTIONS - template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR tdualquat::tdualquat(tdualquat const & d) + template + GLM_FUNC_QUALIFIER GLM_CONSTEXPR tdualquat::tdualquat(tdualquat const& d) : real(d.real) , dual(d.dual) {} # endif//!GLM_HAS_DEFAULTED_FUNCTIONS - template - template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR tdualquat::tdualquat(tdualquat const & d) + template + template + GLM_FUNC_QUALIFIER GLM_CONSTEXPR tdualquat::tdualquat(tdualquat const& d) : real(d.real) , dual(d.dual) {} // -- Explicit basic constructors -- - template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tdualquat::tdualquat(ctor) + template + GLM_FUNC_QUALIFIER GLM_CONSTEXPR tdualquat::tdualquat(tquat const& r) + : real(r), dual(tquat(0, 0, 0, 0)) {} - template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR tdualquat::tdualquat(tquat const & r) - : real(r), dual(tquat(0, 0, 0, 0)) - {} - - template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR tdualquat::tdualquat(tquat const & q, tvec3 const& p) + template + GLM_FUNC_QUALIFIER GLM_CONSTEXPR tdualquat::tdualquat(tquat const& q, vec<3, T, Q> const& p) : real(q), dual( T(-0.5) * ( p.x*q.x + p.y*q.y + p.z*q.z), T(+0.5) * ( p.x*q.w + p.y*q.z - p.z*q.y), @@ -69,28 +65,28 @@ namespace glm T(+0.5) * ( p.x*q.y - p.y*q.x + p.z*q.w)) {} - template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR tdualquat::tdualquat(tquat const & r, tquat const & d) + template + GLM_FUNC_QUALIFIER GLM_CONSTEXPR tdualquat::tdualquat(tquat const& r, tquat const& d) : real(r), dual(d) {} // -- Conversion constructors -- - template - template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR tdualquat::tdualquat(tdualquat const & q) + template + template + GLM_FUNC_QUALIFIER GLM_CONSTEXPR tdualquat::tdualquat(tdualquat const& q) : real(q.real) , dual(q.dual) {} - template - GLM_FUNC_QUALIFIER tdualquat::tdualquat(tmat2x4 const & m) + template + GLM_FUNC_QUALIFIER tdualquat::tdualquat(mat<2, 4, T, Q> const& m) { *this = dualquat_cast(m); } - template - GLM_FUNC_QUALIFIER tdualquat::tdualquat(tmat3x4 const & m) + template + GLM_FUNC_QUALIFIER tdualquat::tdualquat(mat<3, 4, T, Q> const& m) { *this = dualquat_cast(m); } @@ -98,8 +94,8 @@ namespace glm // -- Unary arithmetic operators -- # if !GLM_HAS_DEFAULTED_FUNCTIONS - template - GLM_FUNC_QUALIFIER tdualquat & tdualquat::operator=(tdualquat const & q) + template + GLM_FUNC_QUALIFIER tdualquat & tdualquat::operator=(tdualquat const& q) { this->real = q.real; this->dual = q.dual; @@ -107,27 +103,27 @@ namespace glm } # endif//!GLM_HAS_DEFAULTED_FUNCTIONS - template - template - GLM_FUNC_QUALIFIER tdualquat & tdualquat::operator=(tdualquat const & q) + template + template + GLM_FUNC_QUALIFIER tdualquat & tdualquat::operator=(tdualquat const& q) { this->real = q.real; this->dual = q.dual; return *this; } - template - template - GLM_FUNC_QUALIFIER tdualquat & tdualquat::operator*=(U s) + template + template + GLM_FUNC_QUALIFIER tdualquat & tdualquat::operator*=(U s) { this->real *= static_cast(s); this->dual *= static_cast(s); return *this; } - template - template - GLM_FUNC_QUALIFIER tdualquat & tdualquat::operator/=(U s) + template + template + GLM_FUNC_QUALIFIER tdualquat & tdualquat::operator/=(U s) { this->real /= static_cast(s); this->dual /= static_cast(s); @@ -136,100 +132,108 @@ namespace glm // -- Unary bit operators -- - template - GLM_FUNC_QUALIFIER tdualquat operator+(tdualquat const & q) + template + GLM_FUNC_QUALIFIER tdualquat operator+(tdualquat const& q) { return q; } - template - GLM_FUNC_QUALIFIER tdualquat operator-(tdualquat const & q) + template + GLM_FUNC_QUALIFIER tdualquat operator-(tdualquat const& q) { - return tdualquat(-q.real, -q.dual); + return tdualquat(-q.real, -q.dual); } // -- Binary operators -- - template - GLM_FUNC_QUALIFIER tdualquat operator+(tdualquat const & q, tdualquat const & p) + template + GLM_FUNC_QUALIFIER tdualquat operator+(tdualquat const& q, tdualquat const& p) { - return tdualquat(q.real + p.real,q.dual + p.dual); + return tdualquat(q.real + p.real,q.dual + p.dual); } - template - GLM_FUNC_QUALIFIER tdualquat operator*(tdualquat const & p, tdualquat const & o) + template + GLM_FUNC_QUALIFIER tdualquat operator*(tdualquat const& p, tdualquat const& o) { - return tdualquat(p.real * o.real,p.real * o.dual + p.dual * o.real); + return tdualquat(p.real * o.real,p.real * o.dual + p.dual * o.real); } - template - GLM_FUNC_QUALIFIER tvec3 operator*(tdualquat const & q, tvec3 const & v) + template + GLM_FUNC_QUALIFIER vec<3, T, Q> operator*(tdualquat const& q, vec<3, T, Q> const& v) { - tvec3 const real_v3(q.real.x,q.real.y,q.real.z); - tvec3 const dual_v3(q.dual.x,q.dual.y,q.dual.z); + vec<3, T, Q> const real_v3(q.real.x,q.real.y,q.real.z); + vec<3, T, Q> const dual_v3(q.dual.x,q.dual.y,q.dual.z); return (cross(real_v3, cross(real_v3,v) + v * q.real.w + dual_v3) + dual_v3 * q.real.w - real_v3 * q.dual.w) * T(2) + v; } - template - GLM_FUNC_QUALIFIER tvec3 operator*(tvec3 const & v, tdualquat const & q) + template + GLM_FUNC_QUALIFIER vec<3, T, Q> operator*(vec<3, T, Q> const& v, tdualquat const& q) { return glm::inverse(q) * v; } - template - GLM_FUNC_QUALIFIER tvec4 operator*(tdualquat const & q, tvec4 const & v) + template + GLM_FUNC_QUALIFIER vec<4, T, Q> operator*(tdualquat const& q, vec<4, T, Q> const& v) { - return tvec4(q * tvec3(v), v.w); + return vec<4, T, Q>(q * vec<3, T, Q>(v), v.w); } - template - GLM_FUNC_QUALIFIER tvec4 operator*(tvec4 const & v, tdualquat const & q) + template + GLM_FUNC_QUALIFIER vec<4, T, Q> operator*(vec<4, T, Q> const& v, tdualquat const& q) { return glm::inverse(q) * v; } - template - GLM_FUNC_QUALIFIER tdualquat operator*(tdualquat const & q, T const & s) + template + GLM_FUNC_QUALIFIER tdualquat operator*(tdualquat const& q, T const& s) { - return tdualquat(q.real * s, q.dual * s); + return tdualquat(q.real * s, q.dual * s); } - template - GLM_FUNC_QUALIFIER tdualquat operator*(T const & s, tdualquat const & q) + template + GLM_FUNC_QUALIFIER tdualquat operator*(T const& s, tdualquat const& q) { return q * s; } - template - GLM_FUNC_QUALIFIER tdualquat operator/(tdualquat const & q, T const & s) + template + GLM_FUNC_QUALIFIER tdualquat operator/(tdualquat const& q, T const& s) { - return tdualquat(q.real / s, q.dual / s); + return tdualquat(q.real / s, q.dual / s); } // -- Boolean operators -- - template - GLM_FUNC_QUALIFIER bool operator==(tdualquat const & q1, tdualquat const & q2) + template + GLM_FUNC_QUALIFIER bool operator==(tdualquat const& q1, tdualquat const& q2) { return (q1.real == q2.real) && (q1.dual == q2.dual); } - template - GLM_FUNC_QUALIFIER bool operator!=(tdualquat const & q1, tdualquat const & q2) + template + GLM_FUNC_QUALIFIER bool operator!=(tdualquat const& q1, tdualquat const& q2) { - return (q1.real != q2.dual) || (q1.real != q2.dual); + return (q1.real != q2.real) || (q1.dual != q2.dual); } // -- Operations -- - template - GLM_FUNC_QUALIFIER tdualquat normalize(tdualquat const & q) + template + GLM_FUNC_QUALIFIER tdualquat dual_quat_identity() + { + return tdualquat( + tquat(static_cast(1), static_cast(0), static_cast(0), static_cast(0)), + tquat(static_cast(0), static_cast(0), static_cast(0), static_cast(0))); + } + + template + GLM_FUNC_QUALIFIER tdualquat normalize(tdualquat const& q) { return q / length(q.real); } - template - GLM_FUNC_QUALIFIER tdualquat lerp(tdualquat const & x, tdualquat const & y, T const & a) + template + GLM_FUNC_QUALIFIER tdualquat lerp(tdualquat const& x, tdualquat const& y, T const& a) { // Dual Quaternion Linear blend aka DLB: // Lerp is only defined in [0, 1] @@ -237,72 +241,72 @@ namespace glm assert(a <= static_cast(1)); T const k = dot(x.real,y.real) < static_cast(0) ? -a : a; T const one(1); - return tdualquat(x * (one - a) + y * k); + return tdualquat(x * (one - a) + y * k); } - template - GLM_FUNC_QUALIFIER tdualquat inverse(tdualquat const & q) + template + GLM_FUNC_QUALIFIER tdualquat inverse(tdualquat const& q) { - const glm::tquat real = conjugate(q.real); - const glm::tquat dual = conjugate(q.dual); - return tdualquat(real, dual + (real * (-2.0f * dot(real,dual)))); + const glm::tquat real = conjugate(q.real); + const glm::tquat dual = conjugate(q.dual); + return tdualquat(real, dual + (real * (-2.0f * dot(real,dual)))); } - template - GLM_FUNC_QUALIFIER tmat2x4 mat2x4_cast(tdualquat const & x) + template + GLM_FUNC_QUALIFIER mat<2, 4, T, Q> mat2x4_cast(tdualquat const& x) { - return tmat2x4( x[0].x, x[0].y, x[0].z, x[0].w, x[1].x, x[1].y, x[1].z, x[1].w ); + return mat<2, 4, T, Q>( x[0].x, x[0].y, x[0].z, x[0].w, x[1].x, x[1].y, x[1].z, x[1].w ); } - template - GLM_FUNC_QUALIFIER tmat3x4 mat3x4_cast(tdualquat const & x) + template + GLM_FUNC_QUALIFIER mat<3, 4, T, Q> mat3x4_cast(tdualquat const& x) { - tquat r = x.real / length2(x.real); - - tquat const rr(r.w * x.real.w, r.x * x.real.x, r.y * x.real.y, r.z * x.real.z); + tquat r = x.real / length2(x.real); + + tquat const rr(r.w * x.real.w, r.x * x.real.x, r.y * x.real.y, r.z * x.real.z); r *= static_cast(2); - + T const xy = r.x * x.real.y; T const xz = r.x * x.real.z; T const yz = r.y * x.real.z; T const wx = r.w * x.real.x; T const wy = r.w * x.real.y; T const wz = r.w * x.real.z; - - tvec4 const a( + + vec<4, T, Q> const a( rr.w + rr.x - rr.y - rr.z, xy - wz, xz + wy, -(x.dual.w * r.x - x.dual.x * r.w + x.dual.y * r.z - x.dual.z * r.y)); - - tvec4 const b( + + vec<4, T, Q> const b( xy + wz, rr.w + rr.y - rr.x - rr.z, yz - wx, -(x.dual.w * r.y - x.dual.x * r.z - x.dual.y * r.w + x.dual.z * r.x)); - - tvec4 const c( + + vec<4, T, Q> const c( xz - wy, yz + wx, rr.w + rr.z - rr.x - rr.y, -(x.dual.w * r.z + x.dual.x * r.y - x.dual.y * r.x - x.dual.z * r.w)); - - return tmat3x4(a, b, c); + + return mat<3, 4, T, Q>(a, b, c); } - template - GLM_FUNC_QUALIFIER tdualquat dualquat_cast(tmat2x4 const & x) + template + GLM_FUNC_QUALIFIER tdualquat dualquat_cast(mat<2, 4, T, Q> const& x) { - return tdualquat( - tquat( x[0].w, x[0].x, x[0].y, x[0].z ), - tquat( x[1].w, x[1].x, x[1].y, x[1].z )); + return tdualquat( + tquat( x[0].w, x[0].x, x[0].y, x[0].z ), + tquat( x[1].w, x[1].x, x[1].y, x[1].z )); } - template - GLM_FUNC_QUALIFIER tdualquat dualquat_cast(tmat3x4 const & x) + template + GLM_FUNC_QUALIFIER tdualquat dualquat_cast(mat<3, 4, T, Q> const& x) { - tquat real(uninitialize); - + tquat real; + T const trace = x[0].x + x[1].y + x[2].z; if(trace > static_cast(0)) { @@ -340,12 +344,12 @@ namespace glm real.z = static_cast(0.5) * r; real.w = (x[1].x - x[0].y) * invr; } - - tquat dual(uninitialize); + + tquat dual; dual.x = static_cast(0.5) * ( x[0].w * real.w + x[1].w * real.z - x[2].w * real.y); dual.y = static_cast(0.5) * (-x[0].w * real.z + x[1].w * real.w + x[2].w * real.x); dual.z = static_cast(0.5) * ( x[0].w * real.y - x[1].w * real.x + x[2].w * real.w); dual.w = -static_cast(0.5) * ( x[0].w * real.x + x[1].w * real.y + x[2].w * real.z); - return tdualquat(real, dual); + return tdualquat(real, dual); } }//namespace glm diff --git a/external/include/glm/gtx/easing.hpp b/external/include/glm/gtx/easing.hpp new file mode 100644 index 0000000..913ca70 --- /dev/null +++ b/external/include/glm/gtx/easing.hpp @@ -0,0 +1,221 @@ +/// @ref gtx_easing +/// @file glm/gtx/easing.hpp +/// @author Robert Chisholm +/// +/// @see core (dependence) +/// +/// @defgroup gtx_easing GLM_GTX_easing +/// @ingroup gtx +/// +/// Include to use the features of this extension. +/// +/// Easing functions for animations and transitons +/// All functions take a parameter x in the range [0.0,1.0] +/// +/// Based on the AHEasing project of Warren Moore (https://github.com/warrenm/AHEasing) + +#pragma once + +// Dependency: +#include "../glm.hpp" +#include "../gtc/constants.hpp" +#include "../detail/setup.hpp" +#include "../detail/qualifier.hpp" +#include "../detail/type_int.hpp" + +#ifndef GLM_ENABLE_EXPERIMENTAL +# error "GLM: GLM_GTX_easing is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." +#endif + +#if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) +# pragma message("GLM: GLM_GTX_easing extension included") +#endif + +namespace glm{ + /// @addtogroup gtx_easing + /// @{ + + /// Modelled after the line y = x + /// @see gtx_easing + template + GLM_FUNC_DECL genType linearInterpolation(genType const & a); + + /// Modelled after the parabola y = x^2 + /// @see gtx_easing + template + GLM_FUNC_DECL genType quadraticEaseIn(genType const & a); + + /// Modelled after the parabola y = -x^2 + 2x + /// @see gtx_easing + template + GLM_FUNC_DECL genType quadraticEaseOut(genType const & a); + + /// Modelled after the piecewise quadratic + /// y = (1/2)((2x)^2) ; [0, 0.5) + /// y = -(1/2)((2x-1)*(2x-3) - 1) ; [0.5, 1] + /// @see gtx_easing + template + GLM_FUNC_DECL genType quadraticEaseInOut(genType const & a); + + /// Modelled after the cubic y = x^3 + template + GLM_FUNC_DECL genType cubicEaseIn(genType const & a); + + /// Modelled after the cubic y = (x - 1)^3 + 1 + /// @see gtx_easing + template + GLM_FUNC_DECL genType cubicEaseOut(genType const & a); + + /// Modelled after the piecewise cubic + /// y = (1/2)((2x)^3) ; [0, 0.5) + /// y = (1/2)((2x-2)^3 + 2) ; [0.5, 1] + /// @see gtx_easing + template + GLM_FUNC_DECL genType cubicEaseInOut(genType const & a); + + /// Modelled after the quartic x^4 + /// @see gtx_easing + template + GLM_FUNC_DECL genType quarticEaseIn(genType const & a); + + /// Modelled after the quartic y = 1 - (x - 1)^4 + /// @see gtx_easing + template + GLM_FUNC_DECL genType quarticEaseOut(genType const & a); + + /// Modelled after the piecewise quartic + /// y = (1/2)((2x)^4) ; [0, 0.5) + /// y = -(1/2)((2x-2)^4 - 2) ; [0.5, 1] + /// @see gtx_easing + template + GLM_FUNC_DECL genType quarticEaseInOut(genType const & a); + + /// Modelled after the quintic y = x^5 + /// @see gtx_easing + template + GLM_FUNC_DECL genType quinticEaseIn(genType const & a); + + /// Modelled after the quintic y = (x - 1)^5 + 1 + /// @see gtx_easing + template + GLM_FUNC_DECL genType quinticEaseOut(genType const & a); + + /// Modelled after the piecewise quintic + /// y = (1/2)((2x)^5) ; [0, 0.5) + /// y = (1/2)((2x-2)^5 + 2) ; [0.5, 1] + /// @see gtx_easing + template + GLM_FUNC_DECL genType quinticEaseInOut(genType const & a); + + /// Modelled after quarter-cycle of sine wave + /// @see gtx_easing + template + GLM_FUNC_DECL genType sineEaseIn(genType const & a); + + /// Modelled after quarter-cycle of sine wave (different phase) + /// @see gtx_easing + template + GLM_FUNC_DECL genType sineEaseOut(genType const & a); + + /// Modelled after half sine wave + /// @see gtx_easing + template + GLM_FUNC_DECL genType sineEaseInOut(genType const & a); + + /// Modelled after shifted quadrant IV of unit circle + /// @see gtx_easing + template + GLM_FUNC_DECL genType circularEaseIn(genType const & a); + + /// Modelled after shifted quadrant II of unit circle + /// @see gtx_easing + template + GLM_FUNC_DECL genType circularEaseOut(genType const & a); + + /// Modelled after the piecewise circular function + /// y = (1/2)(1 - sqrt(1 - 4x^2)) ; [0, 0.5) + /// y = (1/2)(sqrt(-(2x - 3)*(2x - 1)) + 1) ; [0.5, 1] + /// @see gtx_easing + template + GLM_FUNC_DECL genType circularEaseInOut(genType const & a); + + /// Modelled after the exponential function y = 2^(10(x - 1)) + /// @see gtx_easing + template + GLM_FUNC_DECL genType exponentialEaseIn(genType const & a); + + /// Modelled after the exponential function y = -2^(-10x) + 1 + /// @see gtx_easing + template + GLM_FUNC_DECL genType exponentialEaseOut(genType const & a); + + /// Modelled after the piecewise exponential + /// y = (1/2)2^(10(2x - 1)) ; [0,0.5) + /// y = -(1/2)*2^(-10(2x - 1))) + 1 ; [0.5,1] + /// @see gtx_easing + template + GLM_FUNC_DECL genType exponentialEaseInOut(genType const & a); + + /// Modelled after the damped sine wave y = sin(13pi/2*x)*pow(2, 10 * (x - 1)) + /// @see gtx_easing + template + GLM_FUNC_DECL genType elasticEaseIn(genType const & a); + + /// Modelled after the damped sine wave y = sin(-13pi/2*(x + 1))*pow(2, -10x) + 1 + /// @see gtx_easing + template + GLM_FUNC_DECL genType elasticEaseOut(genType const & a); + + /// Modelled after the piecewise exponentially-damped sine wave: + /// y = (1/2)*sin(13pi/2*(2*x))*pow(2, 10 * ((2*x) - 1)) ; [0,0.5) + /// y = (1/2)*(sin(-13pi/2*((2x-1)+1))*pow(2,-10(2*x-1)) + 2) ; [0.5, 1] + /// @see gtx_easing + template + GLM_FUNC_DECL genType elasticEaseInOut(genType const & a); + + /// @see gtx_easing + template + GLM_FUNC_DECL genType backEaseIn(genType const& a); + + /// @see gtx_easing + template + GLM_FUNC_DECL genType backEaseOut(genType const& a); + + /// @see gtx_easing + template + GLM_FUNC_DECL genType backEaseInOut(genType const& a); + + /// @param a parameter + /// @param o Optional overshoot modifier + /// @see gtx_easing + template + GLM_FUNC_DECL genType backEaseIn(genType const& a, genType const& o); + + /// @param a parameter + /// @param o Optional overshoot modifier + /// @see gtx_easing + template + GLM_FUNC_DECL genType backEaseOut(genType const& a, genType const& o); + + /// @param a parameter + /// @param o Optional overshoot modifier + /// @see gtx_easing + template + GLM_FUNC_DECL genType backEaseInOut(genType const& a, genType const& o); + + /// @see gtx_easing + template + GLM_FUNC_DECL genType bounceEaseIn(genType const& a); + + /// @see gtx_easing + template + GLM_FUNC_DECL genType bounceEaseOut(genType const& a); + + /// @see gtx_easing + template + GLM_FUNC_DECL genType bounceEaseInOut(genType const& a); + + /// @} +}//namespace glm + +#include "easing.inl" diff --git a/external/include/glm/gtx/easing.inl b/external/include/glm/gtx/easing.inl new file mode 100644 index 0000000..b6d7886 --- /dev/null +++ b/external/include/glm/gtx/easing.inl @@ -0,0 +1,437 @@ +/// @ref gtx_easing +/// @file glm/gtx/easing.inl + +#include + +namespace glm{ + + template + GLM_FUNC_QUALIFIER genType linearInterpolation(genType const& a) + { + // Only defined in [0, 1] + assert(a >= zero()); + assert(a <= one()); + + return a; + } + + template + GLM_FUNC_QUALIFIER genType quadraticEaseIn(genType const& a) + { + // Only defined in [0, 1] + assert(a >= zero()); + assert(a <= one()); + + return a * a; + } + + template + GLM_FUNC_QUALIFIER genType quadraticEaseOut(genType const& a) + { + // Only defined in [0, 1] + assert(a >= zero()); + assert(a <= one()); + + return -(a * (a - static_cast(2))); + } + + template + GLM_FUNC_QUALIFIER genType quadraticEaseInOut(genType const& a) + { + // Only defined in [0, 1] + assert(a >= zero()); + assert(a <= one()); + + if(a < static_cast(0.5)) + { + return static_cast(2) * a * a; + } + else + { + return (-static_cast(2) * a * a) + (4 * a) - one(); + } + } + + template + GLM_FUNC_QUALIFIER genType cubicEaseIn(genType const& a) + { + // Only defined in [0, 1] + assert(a >= zero()); + assert(a <= one()); + + return a * a * a; + } + + template + GLM_FUNC_QUALIFIER genType cubicEaseOut(genType const& a) + { + // Only defined in [0, 1] + assert(a >= zero()); + assert(a <= one()); + + genType const f = a - one(); + return f * f * f + one(); + } + + template + GLM_FUNC_QUALIFIER genType cubicEaseInOut(genType const& a) + { + // Only defined in [0, 1] + assert(a >= zero()); + assert(a <= one()); + + if (a < static_cast(0.5)) + { + return static_cast(4) * a * a * a; + } + else + { + genType const f = ((static_cast(2) * a) - static_cast(2)); + return static_cast(0.5) * f * f * f + one(); + } + } + + template + GLM_FUNC_QUALIFIER genType quarticEaseIn(genType const& a) + { + // Only defined in [0, 1] + assert(a >= zero()); + assert(a <= one()); + + return a * a * a * a; + } + + template + GLM_FUNC_QUALIFIER genType quarticEaseOut(genType const& a) + { + // Only defined in [0, 1] + assert(a >= zero()); + assert(a <= one()); + + genType const f = (a - one()); + return f * f * f * (one() - a) + one(); + } + + template + GLM_FUNC_QUALIFIER genType quarticEaseInOut(genType const& a) + { + // Only defined in [0, 1] + assert(a >= zero()); + assert(a <= one()); + + if(a < static_cast(0.5)) + { + return static_cast(8) * a * a * a * a; + } + else + { + genType const f = (a - one()); + return -static_cast(8) * f * f * f * f + one(); + } + } + + template + GLM_FUNC_QUALIFIER genType quinticEaseIn(genType const& a) + { + // Only defined in [0, 1] + assert(a >= zero()); + assert(a <= one()); + + return a * a * a * a * a; + } + + template + GLM_FUNC_QUALIFIER genType quinticEaseOut(genType const& a) + { + // Only defined in [0, 1] + assert(a >= zero()); + assert(a <= one()); + + genType const f = (a - one()); + return f * f * f * f * f + one(); + } + + template + GLM_FUNC_QUALIFIER genType quinticEaseInOut(genType const& a) + { + // Only defined in [0, 1] + assert(a >= zero()); + assert(a <= one()); + + if(a < static_cast(0.5)) + { + return static_cast(16) * a * a * a * a * a; + } + else + { + genType const f = ((static_cast(2) * a) - static_cast(2)); + return static_cast(0.5) * f * f * f * f * f + one(); + } + } + + template + GLM_FUNC_QUALIFIER genType sineEaseIn(genType const& a) + { + // Only defined in [0, 1] + assert(a >= zero()); + assert(a <= one()); + + return sin((a - one()) * half_pi()) + one(); + } + + template + GLM_FUNC_QUALIFIER genType sineEaseOut(genType const& a) + { + // Only defined in [0, 1] + assert(a >= zero()); + assert(a <= one()); + + return sin(a * half_pi()); + } + + template + GLM_FUNC_QUALIFIER genType sineEaseInOut(genType const& a) + { + // Only defined in [0, 1] + assert(a >= zero()); + assert(a <= one()); + + return static_cast(0.5) * (one() - cos(a * pi())); + } + + template + GLM_FUNC_QUALIFIER genType circularEaseIn(genType const& a) + { + // Only defined in [0, 1] + assert(a >= zero()); + assert(a <= one()); + + return one() - sqrt(one() - (a * a)); + } + + template + GLM_FUNC_QUALIFIER genType circularEaseOut(genType const& a) + { + // Only defined in [0, 1] + assert(a >= zero()); + assert(a <= one()); + + return sqrt((static_cast(2) - a) * a); + } + + template + GLM_FUNC_QUALIFIER genType circularEaseInOut(genType const& a) + { + // Only defined in [0, 1] + assert(a >= zero()); + assert(a <= one()); + + if(a < static_cast(0.5)) + { + return static_cast(0.5) * (one() - std::sqrt(one() - static_cast(4) * (a * a))); + } + else + { + return static_cast(0.5) * (std::sqrt(-((static_cast(2) * a) - static_cast(3)) * ((static_cast(2) * a) - one())) + one()); + } + } + + template + GLM_FUNC_QUALIFIER genType exponentialEaseIn(genType const& a) + { + // Only defined in [0, 1] + assert(a >= zero()); + assert(a <= one()); + + if(a <= zero()) + return a; + else + { + genType const Complementary = a - one(); + genType const Two = static_cast(2); + + return glm::pow(Two, Complementary * static_cast(10)); + } + } + + template + GLM_FUNC_QUALIFIER genType exponentialEaseOut(genType const& a) + { + // Only defined in [0, 1] + assert(a >= zero()); + assert(a <= one()); + + if(a >= one()) + return a; + else + { + return one() - glm::pow(static_cast(2), -static_cast(10) * a); + } + } + + template + GLM_FUNC_QUALIFIER genType exponentialEaseInOut(genType const& a) + { + // Only defined in [0, 1] + assert(a >= zero()); + assert(a <= one()); + + if(a < static_cast(0.5)) + return static_cast(0.5) * glm::pow(static_cast(2), (static_cast(20) * a) - static_cast(10)); + else + return -static_cast(0.5) * glm::pow(static_cast(2), (-static_cast(20) * a) + static_cast(10)) + one(); + } + + template + GLM_FUNC_QUALIFIER genType elasticEaseIn(genType const& a) + { + // Only defined in [0, 1] + assert(a >= zero()); + assert(a <= one()); + + return std::sin(static_cast(13) * half_pi() * a) * glm::pow(static_cast(2), static_cast(10) * (a - one())); + } + + template + GLM_FUNC_QUALIFIER genType elasticEaseOut(genType const& a) + { + // Only defined in [0, 1] + assert(a >= zero()); + assert(a <= one()); + + return std::sin(-static_cast(13) * half_pi() * (a + one())) * glm::pow(static_cast(2), -static_cast(10) * a) + one(); + } + + template + GLM_FUNC_QUALIFIER genType elasticEaseInOut(genType const& a) + { + // Only defined in [0, 1] + assert(a >= zero()); + assert(a <= one()); + + if(a < static_cast(0.5)) + return static_cast(0.5) * std::sin(static_cast(13) * half_pi() * (static_cast(2) * a)) * glm::pow(static_cast(2), static_cast(10) * ((static_cast(2) * a) - one())); + else + return static_cast(0.5) * (std::sin(-static_cast(13) * half_pi() * ((static_cast(2) * a - one()) + one())) * glm::pow(static_cast(2), -static_cast(10) * (static_cast(2) * a - one())) + static_cast(2)); + } + + template + GLM_FUNC_QUALIFIER genType backEaseIn(genType const& a, genType const& o) + { + // Only defined in [0, 1] + assert(a >= zero()); + assert(a <= one()); + + genType z = ((o + one()) * a) - o; + return (a * a * z); + } + + template + GLM_FUNC_QUALIFIER genType backEaseOut(genType const& a, genType const& o) + { + // Only defined in [0, 1] + assert(a >= zero()); + assert(a <= one()); + + genType n = a - one(); + genType z = ((o + one()) * n) + o; + return (n * n * z) + one(); + } + + template + GLM_FUNC_QUALIFIER genType backEaseInOut(genType const& a, genType const& o) + { + // Only defined in [0, 1] + assert(a >= zero()); + assert(a <= one()); + + genType s = o * static_cast(1.525); + genType x = static_cast(0.5); + genType n = a / static_cast(0.5); + + if (n < static_cast(1)) + { + genType z = ((s + static_cast(1)) * n) - s; + genType m = n * n * z; + return x * m; + } + else + { + n -= static_cast(2); + genType z = ((s + static_cast(1)) * n) + s; + genType m = (n*n*z) + static_cast(2); + return x * m; + } + } + + template + GLM_FUNC_QUALIFIER genType backEaseIn(genType const& a) + { + return backEaseIn(a, static_cast(1.70158)); + } + + template + GLM_FUNC_QUALIFIER genType backEaseOut(genType const& a) + { + return backEaseOut(a, static_cast(1.70158)); + } + + template + GLM_FUNC_QUALIFIER genType backEaseInOut(genType const& a) + { + return backEaseInOut(a, static_cast(1.70158)); + } + + template + GLM_FUNC_QUALIFIER genType bounceEaseOut(genType const& a) + { + // Only defined in [0, 1] + assert(a >= zero()); + assert(a <= one()); + + if(a < static_cast(4.0 / 11.0)) + { + return (static_cast(121) * a * a) / static_cast(16); + } + else if(a < static_cast(8.0 / 11.0)) + { + return (static_cast(363.0 / 40.0) * a * a) - (static_cast(99.0 / 10.0) * a) + static_cast(17.0 / 5.0); + } + else if(a < static_cast(9.0 / 10.0)) + { + return (static_cast(4356.0 / 361.0) * a * a) - (static_cast(35442.0 / 1805.0) * a) + static_cast(16061.0 / 1805.0); + } + else + { + return (static_cast(54.0 / 5.0) * a * a) - (static_cast(513.0 / 25.0) * a) + static_cast(268.0 / 25.0); + } + } + + template + GLM_FUNC_QUALIFIER genType bounceEaseIn(genType const& a) + { + // Only defined in [0, 1] + assert(a >= zero()); + assert(a <= one()); + + return one() - bounceEaseOut(one() - a); + } + + template + GLM_FUNC_QUALIFIER genType bounceEaseInOut(genType const& a) + { + // Only defined in [0, 1] + assert(a >= zero()); + assert(a <= one()); + + if(a < static_cast(0.5)) + { + return static_cast(0.5) * (one() - bounceEaseOut(a * static_cast(2))); + } + else + { + return static_cast(0.5) * bounceEaseOut(a * static_cast(2) - one()) + static_cast(0.5); + } + } + +}//namespace glm diff --git a/external/include/glm/gtx/euler_angles.hpp b/external/include/glm/gtx/euler_angles.hpp index fdc4f26..dccc621 100644 --- a/external/include/glm/gtx/euler_angles.hpp +++ b/external/include/glm/gtx/euler_angles.hpp @@ -2,20 +2,26 @@ /// @file glm/gtx/euler_angles.hpp /// /// @see core (dependence) -/// @see gtc_half_float (dependence) /// /// @defgroup gtx_euler_angles GLM_GTX_euler_angles /// @ingroup gtx /// -/// @brief Build matrices from Euler angles. +/// Include to use the features of this extension. /// -/// need to be included to use these functionalities. +/// Build matrices from Euler angles. +/// +/// Extraction of Euler angles from rotation matrix. +/// Based on the original paper 2014 Mike Day - Extracting Euler Angles from a Rotation Matrix. #pragma once // Dependency: #include "../glm.hpp" +#ifndef GLM_ENABLE_EXPERIMENTAL +# error "GLM: GLM_GTX_euler_angles is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." +#endif + #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) # pragma message("GLM: GLM_GTX_euler_angles extension included") #endif @@ -27,116 +33,302 @@ namespace glm /// Creates a 3D 4 * 4 homogeneous rotation matrix from an euler angle X. /// @see gtx_euler_angles - template - GLM_FUNC_DECL tmat4x4 eulerAngleX( - T const & angleX); + template + GLM_FUNC_DECL mat<4, 4, T, defaultp> eulerAngleX( + T const& angleX); /// Creates a 3D 4 * 4 homogeneous rotation matrix from an euler angle Y. /// @see gtx_euler_angles - template - GLM_FUNC_DECL tmat4x4 eulerAngleY( - T const & angleY); + template + GLM_FUNC_DECL mat<4, 4, T, defaultp> eulerAngleY( + T const& angleY); /// Creates a 3D 4 * 4 homogeneous rotation matrix from an euler angle Z. /// @see gtx_euler_angles + template + GLM_FUNC_DECL mat<4, 4, T, defaultp> eulerAngleZ( + T const& angleZ); + + /// Creates a 3D 4 * 4 homogeneous derived matrix from the rotation matrix about X-axis. + /// @see gtx_euler_angles template - GLM_FUNC_DECL tmat4x4 eulerAngleZ( - T const & angleZ); + GLM_FUNC_DECL mat<4, 4, T, defaultp> derivedEulerAngleX( + T const & angleX, T const & angularVelocityX); - /// Creates a 3D 4 * 4 homogeneous rotation matrix from euler angles (X * Y). + /// Creates a 3D 4 * 4 homogeneous derived matrix from the rotation matrix about Y-axis. /// @see gtx_euler_angles template - GLM_FUNC_DECL tmat4x4 eulerAngleXY( - T const & angleX, - T const & angleY); + GLM_FUNC_DECL mat<4, 4, T, defaultp> derivedEulerAngleY( + T const & angleY, T const & angularVelocityY); - /// Creates a 3D 4 * 4 homogeneous rotation matrix from euler angles (Y * X). + /// Creates a 3D 4 * 4 homogeneous derived matrix from the rotation matrix about Z-axis. /// @see gtx_euler_angles template - GLM_FUNC_DECL tmat4x4 eulerAngleYX( - T const & angleY, - T const & angleX); + GLM_FUNC_DECL mat<4, 4, T, defaultp> derivedEulerAngleZ( + T const & angleZ, T const & angularVelocityZ); + + /// Creates a 3D 4 * 4 homogeneous rotation matrix from euler angles (X * Y). + /// @see gtx_euler_angles + template + GLM_FUNC_DECL mat<4, 4, T, defaultp> eulerAngleXY( + T const& angleX, + T const& angleY); + + /// Creates a 3D 4 * 4 homogeneous rotation matrix from euler angles (Y * X). + /// @see gtx_euler_angles + template + GLM_FUNC_DECL mat<4, 4, T, defaultp> eulerAngleYX( + T const& angleY, + T const& angleX); /// Creates a 3D 4 * 4 homogeneous rotation matrix from euler angles (X * Z). /// @see gtx_euler_angles - template - GLM_FUNC_DECL tmat4x4 eulerAngleXZ( - T const & angleX, - T const & angleZ); + template + GLM_FUNC_DECL mat<4, 4, T, defaultp> eulerAngleXZ( + T const& angleX, + T const& angleZ); /// Creates a 3D 4 * 4 homogeneous rotation matrix from euler angles (Z * X). /// @see gtx_euler_angles - template - GLM_FUNC_DECL tmat4x4 eulerAngleZX( - T const & angle, - T const & angleX); + template + GLM_FUNC_DECL mat<4, 4, T, defaultp> eulerAngleZX( + T const& angle, + T const& angleX); /// Creates a 3D 4 * 4 homogeneous rotation matrix from euler angles (Y * Z). /// @see gtx_euler_angles - template - GLM_FUNC_DECL tmat4x4 eulerAngleYZ( - T const & angleY, - T const & angleZ); + template + GLM_FUNC_DECL mat<4, 4, T, defaultp> eulerAngleYZ( + T const& angleY, + T const& angleZ); /// Creates a 3D 4 * 4 homogeneous rotation matrix from euler angles (Z * Y). /// @see gtx_euler_angles - template - GLM_FUNC_DECL tmat4x4 eulerAngleZY( - T const & angleZ, - T const & angleY); + template + GLM_FUNC_DECL mat<4, 4, T, defaultp> eulerAngleZY( + T const& angleZ, + T const& angleY); /// Creates a 3D 4 * 4 homogeneous rotation matrix from euler angles (X * Y * Z). /// @see gtx_euler_angles - template - GLM_FUNC_DECL tmat4x4 eulerAngleXYZ( - T const & t1, - T const & t2, - T const & t3); - + template + GLM_FUNC_DECL mat<4, 4, T, defaultp> eulerAngleXYZ( + T const& t1, + T const& t2, + T const& t3); + /// Creates a 3D 4 * 4 homogeneous rotation matrix from euler angles (Y * X * Z). /// @see gtx_euler_angles + template + GLM_FUNC_DECL mat<4, 4, T, defaultp> eulerAngleYXZ( + T const& yaw, + T const& pitch, + T const& roll); + + /// Creates a 3D 4 * 4 homogeneous rotation matrix from euler angles (X * Z * X). + /// @see gtx_euler_angles template - GLM_FUNC_DECL tmat4x4 eulerAngleYXZ( - T const & yaw, - T const & pitch, - T const & roll); - - /// Creates a 3D 4 * 4 homogeneous rotation matrix from euler angles (Y * X * Z). + GLM_FUNC_DECL mat<4, 4, T, defaultp> eulerAngleXZX( + T const & t1, + T const & t2, + T const & t3); + + /// Creates a 3D 4 * 4 homogeneous rotation matrix from euler angles (X * Y * X). /// @see gtx_euler_angles template - GLM_FUNC_DECL tmat4x4 yawPitchRoll( - T const & yaw, - T const & pitch, - T const & roll); + GLM_FUNC_DECL mat<4, 4, T, defaultp> eulerAngleXYX( + T const & t1, + T const & t2, + T const & t3); - /// Creates a 2D 2 * 2 rotation matrix from an euler angle. + /// Creates a 3D 4 * 4 homogeneous rotation matrix from euler angles (Y * X * Y). /// @see gtx_euler_angles template - GLM_FUNC_DECL tmat2x2 orientate2(T const & angle); + GLM_FUNC_DECL mat<4, 4, T, defaultp> eulerAngleYXY( + T const & t1, + T const & t2, + T const & t3); - /// Creates a 2D 4 * 4 homogeneous rotation matrix from an euler angle. + /// Creates a 3D 4 * 4 homogeneous rotation matrix from euler angles (Y * Z * Y). + /// @see gtx_euler_angles + template + GLM_FUNC_DECL mat<4, 4, T, defaultp> eulerAngleYZY( + T const & t1, + T const & t2, + T const & t3); + + /// Creates a 3D 4 * 4 homogeneous rotation matrix from euler angles (Z * Y * Z). + /// @see gtx_euler_angles + template + GLM_FUNC_DECL mat<4, 4, T, defaultp> eulerAngleZYZ( + T const & t1, + T const & t2, + T const & t3); + + /// Creates a 3D 4 * 4 homogeneous rotation matrix from euler angles (Z * X * Z). + /// @see gtx_euler_angles + template + GLM_FUNC_DECL mat<4, 4, T, defaultp> eulerAngleZXZ( + T const & t1, + T const & t2, + T const & t3); + + /// Creates a 3D 4 * 4 homogeneous rotation matrix from euler angles (X * Z * Y). + /// @see gtx_euler_angles + template + GLM_FUNC_DECL mat<4, 4, T, defaultp> eulerAngleXZY( + T const & t1, + T const & t2, + T const & t3); + + /// Creates a 3D 4 * 4 homogeneous rotation matrix from euler angles (Y * Z * X). + /// @see gtx_euler_angles + template + GLM_FUNC_DECL mat<4, 4, T, defaultp> eulerAngleYZX( + T const & t1, + T const & t2, + T const & t3); + + /// Creates a 3D 4 * 4 homogeneous rotation matrix from euler angles (Z * Y * X). + /// @see gtx_euler_angles + template + GLM_FUNC_DECL mat<4, 4, T, defaultp> eulerAngleZYX( + T const & t1, + T const & t2, + T const & t3); + + /// Creates a 3D 4 * 4 homogeneous rotation matrix from euler angles (Z * X * Y). /// @see gtx_euler_angles template - GLM_FUNC_DECL tmat3x3 orientate3(T const & angle); + GLM_FUNC_DECL mat<4, 4, T, defaultp> eulerAngleZXY( + T const & t1, + T const & t2, + T const & t3); - /// Creates a 3D 3 * 3 rotation matrix from euler angles (Y * X * Z). + /// Creates a 3D 4 * 4 homogeneous rotation matrix from euler angles (Y * X * Z). + /// @see gtx_euler_angles + template + GLM_FUNC_DECL mat<4, 4, T, defaultp> yawPitchRoll( + T const& yaw, + T const& pitch, + T const& roll); + + /// Creates a 2D 2 * 2 rotation matrix from an euler angle. /// @see gtx_euler_angles - template - GLM_FUNC_DECL tmat3x3 orientate3(tvec3 const & angles); - + template + GLM_FUNC_DECL mat<2, 2, T, defaultp> orientate2(T const& angle); + + /// Creates a 2D 4 * 4 homogeneous rotation matrix from an euler angle. + /// @see gtx_euler_angles + template + GLM_FUNC_DECL mat<3, 3, T, defaultp> orientate3(T const& angle); + + /// Creates a 3D 3 * 3 rotation matrix from euler angles (Y * X * Z). + /// @see gtx_euler_angles + template + GLM_FUNC_DECL mat<3, 3, T, Q> orientate3(vec<3, T, Q> const& angles); + /// Creates a 3D 4 * 4 homogeneous rotation matrix from euler angles (Y * X * Z). /// @see gtx_euler_angles - template - GLM_FUNC_DECL tmat4x4 orientate4(tvec3 const & angles); + template + GLM_FUNC_DECL mat<4, 4, T, Q> orientate4(vec<3, T, Q> const& angles); /// Extracts the (X * Y * Z) Euler angles from the rotation matrix M /// @see gtx_euler_angles - template - GLM_FUNC_DECL void extractEulerAngleXYZ(tmat4x4 const & M, + template + GLM_FUNC_DECL void extractEulerAngleXYZ(mat<4, 4, T, defaultp> const& M, T & t1, T & t2, T & t3); - + + /// Extracts the (Y * X * Z) Euler angles from the rotation matrix M + /// @see gtx_euler_angles + template + GLM_FUNC_DECL void extractEulerAngleYXZ(mat<4, 4, T, defaultp> const & M, + T & t1, + T & t2, + T & t3); + + /// Extracts the (X * Z * X) Euler angles from the rotation matrix M + /// @see gtx_euler_angles + template + GLM_FUNC_DECL void extractEulerAngleXZX(mat<4, 4, T, defaultp> const & M, + T & t1, + T & t2, + T & t3); + + /// Extracts the (X * Y * X) Euler angles from the rotation matrix M + /// @see gtx_euler_angles + template + GLM_FUNC_DECL void extractEulerAngleXYX(mat<4, 4, T, defaultp> const & M, + T & t1, + T & t2, + T & t3); + + /// Extracts the (Y * X * Y) Euler angles from the rotation matrix M + /// @see gtx_euler_angles + template + GLM_FUNC_DECL void extractEulerAngleYXY(mat<4, 4, T, defaultp> const & M, + T & t1, + T & t2, + T & t3); + + /// Extracts the (Y * Z * Y) Euler angles from the rotation matrix M + /// @see gtx_euler_angles + template + GLM_FUNC_DECL void extractEulerAngleYZY(mat<4, 4, T, defaultp> const & M, + T & t1, + T & t2, + T & t3); + + /// Extracts the (Z * Y * Z) Euler angles from the rotation matrix M + /// @see gtx_euler_angles + template + GLM_FUNC_DECL void extractEulerAngleZYZ(mat<4, 4, T, defaultp> const & M, + T & t1, + T & t2, + T & t3); + + /// Extracts the (Z * X * Z) Euler angles from the rotation matrix M + /// @see gtx_euler_angles + template + GLM_FUNC_DECL void extractEulerAngleZXZ(mat<4, 4, T, defaultp> const & M, + T & t1, + T & t2, + T & t3); + + /// Extracts the (X * Z * Y) Euler angles from the rotation matrix M + /// @see gtx_euler_angles + template + GLM_FUNC_DECL void extractEulerAngleXZY(mat<4, 4, T, defaultp> const & M, + T & t1, + T & t2, + T & t3); + + /// Extracts the (Y * Z * X) Euler angles from the rotation matrix M + /// @see gtx_euler_angles + template + GLM_FUNC_DECL void extractEulerAngleYZX(mat<4, 4, T, defaultp> const & M, + T & t1, + T & t2, + T & t3); + + /// Extracts the (Z * Y * X) Euler angles from the rotation matrix M + /// @see gtx_euler_angles + template + GLM_FUNC_DECL void extractEulerAngleZYX(mat<4, 4, T, defaultp> const & M, + T & t1, + T & t2, + T & t3); + + /// Extracts the (Z * X * Y) Euler angles from the rotation matrix M + /// @see gtx_euler_angles + template + GLM_FUNC_DECL void extractEulerAngleZXY(mat<4, 4, T, defaultp> const & M, + T & t1, + T & t2, + T & t3); + /// @} }//namespace glm diff --git a/external/include/glm/gtx/euler_angles.inl b/external/include/glm/gtx/euler_angles.inl index dbe0a48..8a289d8 100644 --- a/external/include/glm/gtx/euler_angles.inl +++ b/external/include/glm/gtx/euler_angles.inl @@ -5,48 +5,48 @@ namespace glm { - template - GLM_FUNC_QUALIFIER tmat4x4 eulerAngleX + template + GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> eulerAngleX ( - T const & angleX + T const& angleX ) { T cosX = glm::cos(angleX); T sinX = glm::sin(angleX); - - return tmat4x4( + + return mat<4, 4, T, defaultp>( T(1), T(0), T(0), T(0), T(0), cosX, sinX, T(0), T(0),-sinX, cosX, T(0), T(0), T(0), T(0), T(1)); } - template - GLM_FUNC_QUALIFIER tmat4x4 eulerAngleY + template + GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> eulerAngleY ( - T const & angleY + T const& angleY ) { T cosY = glm::cos(angleY); T sinY = glm::sin(angleY); - return tmat4x4( + return mat<4, 4, T, defaultp>( cosY, T(0), -sinY, T(0), T(0), T(1), T(0), T(0), sinY, T(0), cosY, T(0), T(0), T(0), T(0), T(1)); } - template - GLM_FUNC_QUALIFIER tmat4x4 eulerAngleZ + template + GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> eulerAngleZ ( - T const & angleZ + T const& angleZ ) { T cosZ = glm::cos(angleZ); T sinZ = glm::sin(angleZ); - return tmat4x4( + return mat<4, 4, T, defaultp>( cosZ, sinZ, T(0), T(0), -sinZ, cosZ, T(0), T(0), T(0), T(0), T(1), T(0), @@ -54,10 +54,61 @@ namespace glm } template - GLM_FUNC_QUALIFIER tmat4x4 eulerAngleXY + GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> derivedEulerAngleX ( T const & angleX, - T const & angleY + T const & angularVelocityX + ) + { + T cosX = glm::cos(angleX) * angularVelocityX; + T sinX = glm::sin(angleX) * angularVelocityX; + + return mat<4, 4, T, defaultp>( + T(0), T(0), T(0), T(0), + T(0),-sinX, cosX, T(0), + T(0),-cosX,-sinX, T(0), + T(0), T(0), T(0), T(0)); + } + + template + GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> derivedEulerAngleY + ( + T const & angleY, + T const & angularVelocityY + ) + { + T cosY = glm::cos(angleY) * angularVelocityY; + T sinY = glm::sin(angleY) * angularVelocityY; + + return mat<4, 4, T, defaultp>( + -sinY, T(0), -cosY, T(0), + T(0), T(0), T(0), T(0), + cosY, T(0), -sinY, T(0), + T(0), T(0), T(0), T(0)); + } + + template + GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> derivedEulerAngleZ + ( + T const & angleZ, + T const & angularVelocityZ + ) + { + T cosZ = glm::cos(angleZ) * angularVelocityZ; + T sinZ = glm::sin(angleZ) * angularVelocityZ; + + return mat<4, 4, T, defaultp>( + -sinZ, cosZ, T(0), T(0), + -cosZ, -sinZ, T(0), T(0), + T(0), T(0), T(0), T(0), + T(0), T(0), T(0), T(0)); + } + + template + GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> eulerAngleXY + ( + T const& angleX, + T const& angleY ) { T cosX = glm::cos(angleX); @@ -65,18 +116,18 @@ namespace glm T cosY = glm::cos(angleY); T sinY = glm::sin(angleY); - return tmat4x4( + return mat<4, 4, T, defaultp>( cosY, -sinX * -sinY, cosX * -sinY, T(0), T(0), cosX, sinX, T(0), sinY, -sinX * cosY, cosX * cosY, T(0), T(0), T(0), T(0), T(1)); } - template - GLM_FUNC_QUALIFIER tmat4x4 eulerAngleYX + template + GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> eulerAngleYX ( - T const & angleY, - T const & angleX + T const& angleY, + T const& angleX ) { T cosX = glm::cos(angleX); @@ -84,59 +135,59 @@ namespace glm T cosY = glm::cos(angleY); T sinY = glm::sin(angleY); - return tmat4x4( + return mat<4, 4, T, defaultp>( cosY, 0, -sinY, T(0), sinY * sinX, cosX, cosY * sinX, T(0), sinY * cosX, -sinX, cosY * cosX, T(0), T(0), T(0), T(0), T(1)); } - template - GLM_FUNC_QUALIFIER tmat4x4 eulerAngleXZ + template + GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> eulerAngleXZ ( - T const & angleX, - T const & angleZ + T const& angleX, + T const& angleZ ) { return eulerAngleX(angleX) * eulerAngleZ(angleZ); } - template - GLM_FUNC_QUALIFIER tmat4x4 eulerAngleZX + template + GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> eulerAngleZX ( - T const & angleZ, - T const & angleX + T const& angleZ, + T const& angleX ) { return eulerAngleZ(angleZ) * eulerAngleX(angleX); } - template - GLM_FUNC_QUALIFIER tmat4x4 eulerAngleYZ + template + GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> eulerAngleYZ ( - T const & angleY, - T const & angleZ + T const& angleY, + T const& angleZ ) { return eulerAngleY(angleY) * eulerAngleZ(angleZ); } - template - GLM_FUNC_QUALIFIER tmat4x4 eulerAngleZY + template + GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> eulerAngleZY ( - T const & angleZ, - T const & angleY + T const& angleZ, + T const& angleY ) { return eulerAngleZ(angleZ) * eulerAngleY(angleY); } - - template - GLM_FUNC_QUALIFIER tmat4x4 eulerAngleXYZ + + template + GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> eulerAngleXYZ ( - T const & t1, - T const & t2, - T const & t3 + T const& t1, + T const& t2, + T const& t3 ) { T c1 = glm::cos(-t1); @@ -145,8 +196,8 @@ namespace glm T s1 = glm::sin(-t1); T s2 = glm::sin(-t2); T s3 = glm::sin(-t3); - - tmat4x4 Result; + + mat<4, 4, T, defaultp> Result; Result[0][0] = c2 * c3; Result[0][1] =-c1 * s3 + s1 * s2 * c3; Result[0][2] = s1 * s3 + c1 * s2 * c3; @@ -165,13 +216,13 @@ namespace glm Result[3][3] = static_cast(1); return Result; } - - template - GLM_FUNC_QUALIFIER tmat4x4 eulerAngleYXZ + + template + GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> eulerAngleYXZ ( - T const & yaw, - T const & pitch, - T const & roll + T const& yaw, + T const& pitch, + T const& roll ) { T tmp_ch = glm::cos(yaw); @@ -181,7 +232,7 @@ namespace glm T tmp_cb = glm::cos(roll); T tmp_sb = glm::sin(roll); - tmat4x4 Result; + mat<4, 4, T, defaultp> Result; Result[0][0] = tmp_ch * tmp_cb + tmp_sh * tmp_sp * tmp_sb; Result[0][1] = tmp_sb * tmp_cp; Result[0][2] = -tmp_sh * tmp_cb + tmp_ch * tmp_sp * tmp_sb; @@ -202,11 +253,361 @@ namespace glm } template - GLM_FUNC_QUALIFIER tmat4x4 yawPitchRoll + GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> eulerAngleXZX + ( + T const & t1, + T const & t2, + T const & t3 + ) + { + T c1 = glm::cos(t1); + T s1 = glm::sin(t1); + T c2 = glm::cos(t2); + T s2 = glm::sin(t2); + T c3 = glm::cos(t3); + T s3 = glm::sin(t3); + + mat<4, 4, T, defaultp> Result; + Result[0][0] = c2; + Result[0][1] = c1 * s2; + Result[0][2] = s1 * s2; + Result[0][3] = static_cast(0); + Result[1][0] =-c3 * s2; + Result[1][1] = c1 * c2 * c3 - s1 * s3; + Result[1][2] = c1 * s3 + c2 * c3 * s1; + Result[1][3] = static_cast(0); + Result[2][0] = s2 * s3; + Result[2][1] =-c3 * s1 - c1 * c2 * s3; + Result[2][2] = c1 * c3 - c2 * s1 * s3; + Result[2][3] = static_cast(0); + Result[3][0] = static_cast(0); + Result[3][1] = static_cast(0); + Result[3][2] = static_cast(0); + Result[3][3] = static_cast(1); + return Result; + } + + template + GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> eulerAngleXYX ( - T const & yaw, - T const & pitch, - T const & roll + T const & t1, + T const & t2, + T const & t3 + ) + { + T c1 = glm::cos(t1); + T s1 = glm::sin(t1); + T c2 = glm::cos(t2); + T s2 = glm::sin(t2); + T c3 = glm::cos(t3); + T s3 = glm::sin(t3); + + mat<4, 4, T, defaultp> Result; + Result[0][0] = c2; + Result[0][1] = s1 * s2; + Result[0][2] =-c1 * s2; + Result[0][3] = static_cast(0); + Result[1][0] = s2 * s3; + Result[1][1] = c1 * c3 - c2 * s1 * s3; + Result[1][2] = c3 * s1 + c1 * c2 * s3; + Result[1][3] = static_cast(0); + Result[2][0] = c3 * s2; + Result[2][1] =-c1 * s3 - c2 * c3 * s1; + Result[2][2] = c1 * c2 * c3 - s1 * s3; + Result[2][3] = static_cast(0); + Result[3][0] = static_cast(0); + Result[3][1] = static_cast(0); + Result[3][2] = static_cast(0); + Result[3][3] = static_cast(1); + return Result; + } + + template + GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> eulerAngleYXY + ( + T const & t1, + T const & t2, + T const & t3 + ) + { + T c1 = glm::cos(t1); + T s1 = glm::sin(t1); + T c2 = glm::cos(t2); + T s2 = glm::sin(t2); + T c3 = glm::cos(t3); + T s3 = glm::sin(t3); + + mat<4, 4, T, defaultp> Result; + Result[0][0] = c1 * c3 - c2 * s1 * s3; + Result[0][1] = s2* s3; + Result[0][2] =-c3 * s1 - c1 * c2 * s3; + Result[0][3] = static_cast(0); + Result[1][0] = s1 * s2; + Result[1][1] = c2; + Result[1][2] = c1 * s2; + Result[1][3] = static_cast(0); + Result[2][0] = c1 * s3 + c2 * c3 * s1; + Result[2][1] =-c3 * s2; + Result[2][2] = c1 * c2 * c3 - s1 * s3; + Result[2][3] = static_cast(0); + Result[3][0] = static_cast(0); + Result[3][1] = static_cast(0); + Result[3][2] = static_cast(0); + Result[3][3] = static_cast(1); + return Result; + } + + template + GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> eulerAngleYZY + ( + T const & t1, + T const & t2, + T const & t3 + ) + { + T c1 = glm::cos(t1); + T s1 = glm::sin(t1); + T c2 = glm::cos(t2); + T s2 = glm::sin(t2); + T c3 = glm::cos(t3); + T s3 = glm::sin(t3); + + mat<4, 4, T, defaultp> Result; + Result[0][0] = c1 * c2 * c3 - s1 * s3; + Result[0][1] = c3 * s2; + Result[0][2] =-c1 * s3 - c2 * c3 * s1; + Result[0][3] = static_cast(0); + Result[1][0] =-c1 * s2; + Result[1][1] = c2; + Result[1][2] = s1 * s2; + Result[1][3] = static_cast(0); + Result[2][0] = c3 * s1 + c1 * c2 * s3; + Result[2][1] = s2 * s3; + Result[2][2] = c1 * c3 - c2 * s1 * s3; + Result[2][3] = static_cast(0); + Result[3][0] = static_cast(0); + Result[3][1] = static_cast(0); + Result[3][2] = static_cast(0); + Result[3][3] = static_cast(1); + return Result; + } + + template + GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> eulerAngleZYZ + ( + T const & t1, + T const & t2, + T const & t3 + ) + { + T c1 = glm::cos(t1); + T s1 = glm::sin(t1); + T c2 = glm::cos(t2); + T s2 = glm::sin(t2); + T c3 = glm::cos(t3); + T s3 = glm::sin(t3); + + mat<4, 4, T, defaultp> Result; + Result[0][0] = c1 * c2 * c3 - s1 * s3; + Result[0][1] = c1 * s3 + c2 * c3 * s1; + Result[0][2] =-c3 * s2; + Result[0][3] = static_cast(0); + Result[1][0] =-c3 * s1 - c1 * c2 * s3; + Result[1][1] = c1 * c3 - c2 * s1 * s3; + Result[1][2] = s2 * s3; + Result[1][3] = static_cast(0); + Result[2][0] = c1 * s2; + Result[2][1] = s1 * s2; + Result[2][2] = c2; + Result[2][3] = static_cast(0); + Result[3][0] = static_cast(0); + Result[3][1] = static_cast(0); + Result[3][2] = static_cast(0); + Result[3][3] = static_cast(1); + return Result; + } + + template + GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> eulerAngleZXZ + ( + T const & t1, + T const & t2, + T const & t3 + ) + { + T c1 = glm::cos(t1); + T s1 = glm::sin(t1); + T c2 = glm::cos(t2); + T s2 = glm::sin(t2); + T c3 = glm::cos(t3); + T s3 = glm::sin(t3); + + mat<4, 4, T, defaultp> Result; + Result[0][0] = c1 * c3 - c2 * s1 * s3; + Result[0][1] = c3 * s1 + c1 * c2 * s3; + Result[0][2] = s2 *s3; + Result[0][3] = static_cast(0); + Result[1][0] =-c1 * s3 - c2 * c3 * s1; + Result[1][1] = c1 * c2 * c3 - s1 * s3; + Result[1][2] = c3 * s2; + Result[1][3] = static_cast(0); + Result[2][0] = s1 * s2; + Result[2][1] =-c1 * s2; + Result[2][2] = c2; + Result[2][3] = static_cast(0); + Result[3][0] = static_cast(0); + Result[3][1] = static_cast(0); + Result[3][2] = static_cast(0); + Result[3][3] = static_cast(1); + return Result; + } + + template + GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> eulerAngleXZY + ( + T const & t1, + T const & t2, + T const & t3 + ) + { + T c1 = glm::cos(t1); + T s1 = glm::sin(t1); + T c2 = glm::cos(t2); + T s2 = glm::sin(t2); + T c3 = glm::cos(t3); + T s3 = glm::sin(t3); + + mat<4, 4, T, defaultp> Result; + Result[0][0] = c2 * c3; + Result[0][1] = s1 * s3 + c1 * c3 * s2; + Result[0][2] = c3 * s1 * s2 - c1 * s3; + Result[0][3] = static_cast(0); + Result[1][0] =-s2; + Result[1][1] = c1 * c2; + Result[1][2] = c2 * s1; + Result[1][3] = static_cast(0); + Result[2][0] = c2 * s3; + Result[2][1] = c1 * s2 * s3 - c3 * s1; + Result[2][2] = c1 * c3 + s1 * s2 *s3; + Result[2][3] = static_cast(0); + Result[3][0] = static_cast(0); + Result[3][1] = static_cast(0); + Result[3][2] = static_cast(0); + Result[3][3] = static_cast(1); + return Result; + } + + template + GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> eulerAngleYZX + ( + T const & t1, + T const & t2, + T const & t3 + ) + { + T c1 = glm::cos(t1); + T s1 = glm::sin(t1); + T c2 = glm::cos(t2); + T s2 = glm::sin(t2); + T c3 = glm::cos(t3); + T s3 = glm::sin(t3); + + mat<4, 4, T, defaultp> Result; + Result[0][0] = c1 * c2; + Result[0][1] = s2; + Result[0][2] =-c2 * s1; + Result[0][3] = static_cast(0); + Result[1][0] = s1 * s3 - c1 * c3 * s2; + Result[1][1] = c2 * c3; + Result[1][2] = c1 * s3 + c3 * s1 * s2; + Result[1][3] = static_cast(0); + Result[2][0] = c3 * s1 + c1 * s2 * s3; + Result[2][1] =-c2 * s3; + Result[2][2] = c1 * c3 - s1 * s2 * s3; + Result[2][3] = static_cast(0); + Result[3][0] = static_cast(0); + Result[3][1] = static_cast(0); + Result[3][2] = static_cast(0); + Result[3][3] = static_cast(1); + return Result; + } + + template + GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> eulerAngleZYX + ( + T const & t1, + T const & t2, + T const & t3 + ) + { + T c1 = glm::cos(t1); + T s1 = glm::sin(t1); + T c2 = glm::cos(t2); + T s2 = glm::sin(t2); + T c3 = glm::cos(t3); + T s3 = glm::sin(t3); + + mat<4, 4, T, defaultp> Result; + Result[0][0] = c1 * c2; + Result[0][1] = c2 * s1; + Result[0][2] =-s2; + Result[0][3] = static_cast(0); + Result[1][0] = c1 * s2 * s3 - c3 * s1; + Result[1][1] = c1 * c3 + s1 * s2 * s3; + Result[1][2] = c2 * s3; + Result[1][3] = static_cast(0); + Result[2][0] = s1 * s3 + c1 * c3 * s2; + Result[2][1] = c3 * s1 * s2 - c1 * s3; + Result[2][2] = c2 * c3; + Result[2][3] = static_cast(0); + Result[3][0] = static_cast(0); + Result[3][1] = static_cast(0); + Result[3][2] = static_cast(0); + Result[3][3] = static_cast(1); + return Result; + } + + template + GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> eulerAngleZXY + ( + T const & t1, + T const & t2, + T const & t3 + ) + { + T c1 = glm::cos(t1); + T s1 = glm::sin(t1); + T c2 = glm::cos(t2); + T s2 = glm::sin(t2); + T c3 = glm::cos(t3); + T s3 = glm::sin(t3); + + mat<4, 4, T, defaultp> Result; + Result[0][0] = c1 * c3 - s1 * s2 * s3; + Result[0][1] = c3 * s1 + c1 * s2 * s3; + Result[0][2] =-c2 * s3; + Result[0][3] = static_cast(0); + Result[1][0] =-c2 * s1; + Result[1][1] = c1 * c2; + Result[1][2] = s2; + Result[1][3] = static_cast(0); + Result[2][0] = c1 * s3 + c3 * s1 * s2; + Result[2][1] = s1 * s3 - c1 * c3 * s2; + Result[2][2] = c2 * c3; + Result[2][3] = static_cast(0); + Result[3][0] = static_cast(0); + Result[3][1] = static_cast(0); + Result[3][2] = static_cast(0); + Result[3][3] = static_cast(1); + return Result; + } + + template + GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> yawPitchRoll + ( + T const& yaw, + T const& pitch, + T const& roll ) { T tmp_ch = glm::cos(yaw); @@ -216,7 +617,7 @@ namespace glm T tmp_cb = glm::cos(roll); T tmp_sb = glm::sin(roll); - tmat4x4 Result; + mat<4, 4, T, defaultp> Result; Result[0][0] = tmp_ch * tmp_cb + tmp_sh * tmp_sp * tmp_sb; Result[0][1] = tmp_sb * tmp_cp; Result[0][2] = -tmp_sh * tmp_cb + tmp_ch * tmp_sp * tmp_sb; @@ -236,16 +637,16 @@ namespace glm return Result; } - template - GLM_FUNC_QUALIFIER tmat2x2 orientate2 + template + GLM_FUNC_QUALIFIER mat<2, 2, T, defaultp> orientate2 ( - T const & angle + T const& angle ) { T c = glm::cos(angle); T s = glm::sin(angle); - tmat2x2 Result; + mat<2, 2, T, defaultp> Result; Result[0][0] = c; Result[0][1] = s; Result[1][0] = -s; @@ -253,16 +654,16 @@ namespace glm return Result; } - template - GLM_FUNC_QUALIFIER tmat3x3 orientate3 + template + GLM_FUNC_QUALIFIER mat<3, 3, T, defaultp> orientate3 ( - T const & angle + T const& angle ) { T c = glm::cos(angle); T s = glm::sin(angle); - tmat3x3 Result; + mat<3, 3, T, defaultp> Result; Result[0][0] = c; Result[0][1] = s; Result[0][2] = 0.0f; @@ -275,26 +676,26 @@ namespace glm return Result; } - template - GLM_FUNC_QUALIFIER tmat3x3 orientate3 + template + GLM_FUNC_QUALIFIER mat<3, 3, T, Q> orientate3 ( - tvec3 const & angles + vec<3, T, Q> const& angles ) { - return tmat3x3(yawPitchRoll(angles.z, angles.x, angles.y)); + return mat<3, 3, T, Q>(yawPitchRoll(angles.z, angles.x, angles.y)); } - template - GLM_FUNC_QUALIFIER tmat4x4 orientate4 + template + GLM_FUNC_QUALIFIER mat<4, 4, T, Q> orientate4 ( - tvec3 const & angles + vec<3, T, Q> const& angles ) { return yawPitchRoll(angles.z, angles.x, angles.y); } - - template - GLM_FUNC_DECL void extractEulerAngleXYZ(tmat4x4 const & M, + + template + GLM_FUNC_DECL void extractEulerAngleXYZ(mat<4, 4, T, defaultp> const& M, T & t1, T & t2, T & t3) @@ -309,4 +710,191 @@ namespace glm t2 = -T2; t3 = -T3; } + + template + GLM_FUNC_QUALIFIER void extractEulerAngleYXZ(mat<4, 4, T, defaultp> const & M, + T & t1, + T & t2, + T & t3) + { + T T1 = glm::atan2(M[2][0], M[2][2]); + T C2 = glm::sqrt(M[0][1]*M[0][1] + M[1][1]*M[1][1]); + T T2 = glm::atan2(-M[2][1], C2); + T S1 = glm::sin(T1); + T C1 = glm::cos(T1); + T T3 = glm::atan2(S1*M[1][2] - C1*M[1][0], C1*M[0][0] - S1*M[0][2]); + t1 = T1; + t2 = T2; + t3 = T3; + } + + template + GLM_FUNC_QUALIFIER void extractEulerAngleXZX(mat<4, 4, T, defaultp> const & M, + T & t1, + T & t2, + T & t3) + { + T T1 = glm::atan2(M[0][2], M[0][1]); + T S2 = glm::sqrt(M[1][0]*M[1][0] + M[2][0]*M[2][0]); + T T2 = glm::atan2(S2, M[0][0]); + T S1 = glm::sin(T1); + T C1 = glm::cos(T1); + T T3 = glm::atan2(C1*M[1][2] - S1*M[1][1], C1*M[2][2] - S1*M[2][1]); + t1 = T1; + t2 = T2; + t3 = T3; + } + + template + GLM_FUNC_QUALIFIER void extractEulerAngleXYX(mat<4, 4, T, defaultp> const & M, + T & t1, + T & t2, + T & t3) + { + T T1 = glm::atan2(M[0][1], -M[0][2]); + T S2 = glm::sqrt(M[1][0]*M[1][0] + M[2][0]*M[2][0]); + T T2 = glm::atan2(S2, M[0][0]); + T S1 = glm::sin(T1); + T C1 = glm::cos(T1); + T T3 = glm::atan2(-C1*M[2][1] - S1*M[2][2], C1*M[1][1] + S1*M[1][2]); + t1 = T1; + t2 = T2; + t3 = T3; + } + + template + GLM_FUNC_QUALIFIER void extractEulerAngleYXY(mat<4, 4, T, defaultp> const & M, + T & t1, + T & t2, + T & t3) + { + T T1 = glm::atan2(M[1][0], M[1][2]); + T S2 = glm::sqrt(M[0][1]*M[0][1] + M[2][1]*M[2][1]); + T T2 = glm::atan2(S2, M[1][1]); + T S1 = glm::sin(T1); + T C1 = glm::cos(T1); + T T3 = glm::atan2(C1*M[2][0] - S1*M[2][2], C1*M[0][0] - S1*M[0][2]); + t1 = T1; + t2 = T2; + t3 = T3; + } + + template + GLM_FUNC_QUALIFIER void extractEulerAngleYZY(mat<4, 4, T, defaultp> const & M, + T & t1, + T & t2, + T & t3) + { + T T1 = glm::atan2(M[1][2], -M[1][0]); + T S2 = glm::sqrt(M[0][1]*M[0][1] + M[2][1]*M[2][1]); + T T2 = glm::atan2(S2, M[1][1]); + T S1 = glm::sin(T1); + T C1 = glm::cos(T1); + T T3 = glm::atan2(-S1*M[0][0] - C1*M[0][2], S1*M[2][0] + C1*M[2][2]); + t1 = T1; + t2 = T2; + t3 = T3; + } + + template + GLM_FUNC_QUALIFIER void extractEulerAngleZYZ(mat<4, 4, T, defaultp> const & M, + T & t1, + T & t2, + T & t3) + { + T T1 = glm::atan2(M[2][1], M[2][0]); + T S2 = glm::sqrt(M[0][2]*M[0][2] + M[1][2]*M[1][2]); + T T2 = glm::atan2(S2, M[2][2]); + T S1 = glm::sin(T1); + T C1 = glm::cos(T1); + T T3 = glm::atan2(C1*M[0][1] - S1*M[0][0], C1*M[1][1] - S1*M[1][0]); + t1 = T1; + t2 = T2; + t3 = T3; + } + + template + GLM_FUNC_QUALIFIER void extractEulerAngleZXZ(mat<4, 4, T, defaultp> const & M, + T & t1, + T & t2, + T & t3) + { + T T1 = glm::atan2(M[2][0], -M[2][1]); + T S2 = glm::sqrt(M[0][2]*M[0][2] + M[1][2]*M[1][2]); + T T2 = glm::atan2(S2, M[2][2]); + T S1 = glm::sin(T1); + T C1 = glm::cos(T1); + T T3 = glm::atan2(-C1*M[1][0] - S1*M[1][1], C1*M[0][0] + S1*M[0][1]); + t1 = T1; + t2 = T2; + t3 = T3; + } + + template + GLM_FUNC_QUALIFIER void extractEulerAngleXZY(mat<4, 4, T, defaultp> const & M, + T & t1, + T & t2, + T & t3) + { + T T1 = glm::atan2(M[1][2], M[1][1]); + T C2 = glm::sqrt(M[0][0]*M[0][0] + M[2][0]*M[2][0]); + T T2 = glm::atan2(-M[1][0], C2); + T S1 = glm::sin(T1); + T C1 = glm::cos(T1); + T T3 = glm::atan2(S1*M[0][1] - C1*M[0][2], C1*M[2][2] - S1*M[2][1]); + t1 = T1; + t2 = T2; + t3 = T3; + } + + template + GLM_FUNC_QUALIFIER void extractEulerAngleYZX(mat<4, 4, T, defaultp> const & M, + T & t1, + T & t2, + T & t3) + { + T T1 = glm::atan2(-M[0][2], M[0][0]); + T C2 = glm::sqrt(M[1][1]*M[1][1] + M[2][1]*M[2][1]); + T T2 = glm::atan2(M[0][1], C2); + T S1 = glm::sin(T1); + T C1 = glm::cos(T1); + T T3 = glm::atan2(S1*M[1][0] + C1*M[1][2], S1*M[2][0] + C1*M[2][2]); + t1 = T1; + t2 = T2; + t3 = T3; + } + + template + GLM_FUNC_QUALIFIER void extractEulerAngleZYX(mat<4, 4, T, defaultp> const & M, + T & t1, + T & t2, + T & t3) + { + T T1 = glm::atan2(M[0][1], M[0][0]); + T C2 = glm::sqrt(M[1][2]*M[1][2] + M[2][2]*M[2][2]); + T T2 = glm::atan2(-M[0][2], C2); + T S1 = glm::sin(T1); + T C1 = glm::cos(T1); + T T3 = glm::atan2(S1*M[2][0] - C1*M[2][1], C1*M[1][1] - S1*M[1][0]); + t1 = T1; + t2 = T2; + t3 = T3; + } + + template + GLM_FUNC_QUALIFIER void extractEulerAngleZXY(mat<4, 4, T, defaultp> const & M, + T & t1, + T & t2, + T & t3) + { + T T1 = glm::atan2(-M[1][0], M[1][1]); + T C2 = glm::sqrt(M[0][2]*M[0][2] + M[2][2]*M[2][2]); + T T2 = glm::atan2(M[1][2], C2); + T S1 = glm::sin(T1); + T C1 = glm::cos(T1); + T T3 = glm::atan2(C1*M[2][0] + S1*M[2][1], C1*M[0][0] + S1*M[0][1]); + t1 = T1; + t2 = T2; + t3 = T3; + } }//namespace glm diff --git a/external/include/glm/gtx/extend.hpp b/external/include/glm/gtx/extend.hpp index 26837a8..c456fae 100644 --- a/external/include/glm/gtx/extend.hpp +++ b/external/include/glm/gtx/extend.hpp @@ -6,15 +6,19 @@ /// @defgroup gtx_extend GLM_GTX_extend /// @ingroup gtx /// -/// @brief Extend a position from a source to a position at a defined length. +/// Include to use the features of this extension. /// -/// need to be included to use these functionalities. +/// Extend a position from a source to a position at a defined length. #pragma once // Dependency: #include "../glm.hpp" +#ifndef GLM_ENABLE_EXPERIMENTAL +# error "GLM: GLM_GTX_extend is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." +#endif + #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) # pragma message("GLM: GLM_GTX_extend extension included") #endif @@ -26,10 +30,10 @@ namespace glm /// Extends of Length the Origin position using the (Source - Origin) direction. /// @see gtx_extend - template + template GLM_FUNC_DECL genType extend( - genType const & Origin, - genType const & Source, + genType const& Origin, + genType const& Source, typename genType::value_type const Length); /// @} diff --git a/external/include/glm/gtx/extend.inl b/external/include/glm/gtx/extend.inl index 3155583..9371ee6 100644 --- a/external/include/glm/gtx/extend.inl +++ b/external/include/glm/gtx/extend.inl @@ -3,45 +3,45 @@ namespace glm { - template + template GLM_FUNC_QUALIFIER genType extend ( - genType const & Origin, - genType const & Source, - genType const & Distance + genType const& Origin, + genType const& Source, + genType const& Distance ) { return Origin + (Source - Origin) * Distance; } - template - GLM_FUNC_QUALIFIER tvec2 extend + template + GLM_FUNC_QUALIFIER vec<2, T, Q> extend ( - tvec2 const & Origin, - tvec2 const & Source, - T const & Distance + vec<2, T, Q> const& Origin, + vec<2, T, Q> const& Source, + T const& Distance ) { return Origin + (Source - Origin) * Distance; } - template - GLM_FUNC_QUALIFIER tvec3 extend + template + GLM_FUNC_QUALIFIER vec<3, T, Q> extend ( - tvec3 const & Origin, - tvec3 const & Source, - T const & Distance + vec<3, T, Q> const& Origin, + vec<3, T, Q> const& Source, + T const& Distance ) { return Origin + (Source - Origin) * Distance; } - template - GLM_FUNC_QUALIFIER tvec4 extend + template + GLM_FUNC_QUALIFIER vec<4, T, Q> extend ( - tvec4 const & Origin, - tvec4 const & Source, - T const & Distance + vec<4, T, Q> const& Origin, + vec<4, T, Q> const& Source, + T const& Distance ) { return Origin + (Source - Origin) * Distance; diff --git a/external/include/glm/gtx/extended_min_max.hpp b/external/include/glm/gtx/extended_min_max.hpp index f4d8859..b061bc8 100644 --- a/external/include/glm/gtx/extended_min_max.hpp +++ b/external/include/glm/gtx/extended_min_max.hpp @@ -2,130 +2,223 @@ /// @file glm/gtx/extended_min_max.hpp /// /// @see core (dependence) -/// @see gtx_half_float (dependence) /// -/// @defgroup gtx_extented_min_max GLM_GTX_extented_min_max +/// @defgroup gtx_extended_min_max GLM_GTX_extented_min_max /// @ingroup gtx /// -/// Min and max functions for 3 to 4 parameters. +/// Include to use the features of this extension. /// -/// need to be included to use these functionalities. +/// Min and max functions for 3 to 4 parameters. #pragma once // Dependency: #include "../glm.hpp" +#ifndef GLM_ENABLE_EXPERIMENTAL +# error "GLM: GLM_GTX_extented_min_max is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." +#endif + #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) # pragma message("GLM: GLM_GTX_extented_min_max extension included") #endif namespace glm { - /// @addtogroup gtx_extented_min_max + /// @addtogroup gtx_extended_min_max /// @{ - /// Return the minimum component-wise values of 3 inputs + /// Return the minimum component-wise values of 3 inputs /// @see gtx_extented_min_max - template + template GLM_FUNC_DECL T min( - T const & x, - T const & y, - T const & z); + T const& x, + T const& y, + T const& z); /// Return the minimum component-wise values of 3 inputs /// @see gtx_extented_min_max - template class C> + template class C> GLM_FUNC_DECL C min( - C const & x, - typename C::T const & y, - typename C::T const & z); + C const& x, + typename C::T const& y, + typename C::T const& z); - /// Return the minimum component-wise values of 3 inputs + /// Return the minimum component-wise values of 3 inputs /// @see gtx_extented_min_max - template class C> + template class C> GLM_FUNC_DECL C min( - C const & x, - C const & y, - C const & z); + C const& x, + C const& y, + C const& z); - /// Return the minimum component-wise values of 4 inputs + /// Return the minimum component-wise values of 4 inputs /// @see gtx_extented_min_max - template + template GLM_FUNC_DECL T min( - T const & x, - T const & y, - T const & z, - T const & w); + T const& x, + T const& y, + T const& z, + T const& w); - /// Return the minimum component-wise values of 4 inputs + /// Return the minimum component-wise values of 4 inputs /// @see gtx_extented_min_max - template class C> + template class C> GLM_FUNC_DECL C min( - C const & x, - typename C::T const & y, - typename C::T const & z, - typename C::T const & w); + C const& x, + typename C::T const& y, + typename C::T const& z, + typename C::T const& w); /// Return the minimum component-wise values of 4 inputs /// @see gtx_extented_min_max - template class C> + template class C> GLM_FUNC_DECL C min( - C const & x, - C const & y, - C const & z, - C const & w); + C const& x, + C const& y, + C const& z, + C const& w); - /// Return the maximum component-wise values of 3 inputs + /// Return the maximum component-wise values of 3 inputs /// @see gtx_extented_min_max - template + template GLM_FUNC_DECL T max( - T const & x, - T const & y, - T const & z); + T const& x, + T const& y, + T const& z); /// Return the maximum component-wise values of 3 inputs /// @see gtx_extented_min_max - template class C> + template class C> GLM_FUNC_DECL C max( - C const & x, - typename C::T const & y, - typename C::T const & z); + C const& x, + typename C::T const& y, + typename C::T const& z); - /// Return the maximum component-wise values of 3 inputs + /// Return the maximum component-wise values of 3 inputs /// @see gtx_extented_min_max - template class C> + template class C> GLM_FUNC_DECL C max( - C const & x, - C const & y, - C const & z); + C const& x, + C const& y, + C const& z); /// Return the maximum component-wise values of 4 inputs /// @see gtx_extented_min_max - template + template GLM_FUNC_DECL T max( - T const & x, - T const & y, - T const & z, - T const & w); + T const& x, + T const& y, + T const& z, + T const& w); - /// Return the maximum component-wise values of 4 inputs + /// Return the maximum component-wise values of 4 inputs /// @see gtx_extented_min_max - template class C> + template class C> GLM_FUNC_DECL C max( - C const & x, - typename C::T const & y, - typename C::T const & z, - typename C::T const & w); + C const& x, + typename C::T const& y, + typename C::T const& z, + typename C::T const& w); - /// Return the maximum component-wise values of 4 inputs + /// Return the maximum component-wise values of 4 inputs /// @see gtx_extented_min_max - template class C> + template class C> GLM_FUNC_DECL C max( - C const & x, - C const & y, - C const & z, - C const & w); + C const& x, + C const& y, + C const& z, + C const& w); + + /// Returns y if y < x; otherwise, it returns x. If one of the two arguments is NaN, the value of the other argument is returned. + /// + /// @tparam genType Floating-point or integer; scalar or vector types. + /// + /// @see gtx_extented_min_max + template + GLM_FUNC_DECL genType fmin(genType x, genType y); + + /// Returns y if y < x; otherwise, it returns x. If one of the two arguments is NaN, the value of the other argument is returned. + /// + /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector + /// @tparam T Floating-point scalar types + /// @tparam Q Value from qualifier enum + /// + /// @see gtx_extented_min_max + /// @see std::fmin documentation + template + GLM_FUNC_DECL vec fmin(vec const& x, T y); + + /// Returns y if y < x; otherwise, it returns x. If one of the two arguments is NaN, the value of the other argument is returned. + /// + /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector + /// @tparam T Floating-point scalar types + /// @tparam Q Value from qualifier enum + /// + /// @see gtx_extented_min_max + /// @see std::fmin documentation + template + GLM_FUNC_DECL vec fmin(vec const& x, vec const& y); + + /// Returns y if x < y; otherwise, it returns x. If one of the two arguments is NaN, the value of the other argument is returned. + /// + /// @tparam genType Floating-point; scalar or vector types. + /// + /// @see gtx_extented_min_max + /// @see std::fmax documentation + template + GLM_FUNC_DECL genType fmax(genType x, genType y); + + /// Returns y if x < y; otherwise, it returns x. If one of the two arguments is NaN, the value of the other argument is returned. + /// + /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector + /// @tparam T Floating-point scalar types + /// @tparam Q Value from qualifier enum + /// + /// @see gtx_extented_min_max + /// @see std::fmax documentation + template + GLM_FUNC_DECL vec fmax(vec const& x, T y); + + /// Returns y if x < y; otherwise, it returns x. If one of the two arguments is NaN, the value of the other argument is returned. + /// + /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector + /// @tparam T Floating-point scalar types + /// @tparam Q Value from qualifier enum + /// + /// @see gtx_extented_min_max + /// @see std::fmax documentation + template + GLM_FUNC_DECL vec fmax(vec const& x, vec const& y); + + /// Returns min(max(x, minVal), maxVal) for each component in x. If one of the two arguments is NaN, the value of the other argument is returned. + /// + /// @tparam genType Floating-point scalar or vector types. + /// + /// @see gtx_extented_min_max + template + GLM_FUNC_DECL genType fclamp(genType x, genType minVal, genType maxVal); + + /// Returns min(max(x, minVal), maxVal) for each component in x. If one of the two arguments is NaN, the value of the other argument is returned. + /// + /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector + /// @tparam T Floating-point scalar types + /// @tparam Q Value from qualifier enum + /// + /// @see gtx_extented_min_max + template + GLM_FUNC_DECL vec fclamp(vec const& x, T minVal, T maxVal); + + /// Returns min(max(x, minVal), maxVal) for each component in x. If one of the two arguments is NaN, the value of the other argument is returned. + /// + /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector + /// @tparam T Floating-point scalar types + /// @tparam Q Value from qualifier enum + /// + /// @see gtx_extented_min_max + template + GLM_FUNC_DECL vec fclamp(vec const& x, vec const& minVal, vec const& maxVal); + /// @} }//namespace glm diff --git a/external/include/glm/gtx/extended_min_max.inl b/external/include/glm/gtx/extended_min_max.inl index 64ea445..ac3dd64 100644 --- a/external/include/glm/gtx/extended_min_max.inl +++ b/external/include/glm/gtx/extended_min_max.inl @@ -3,138 +3,217 @@ namespace glm { - template + template GLM_FUNC_QUALIFIER T min( - T const & x, - T const & y, - T const & z) + T const& x, + T const& y, + T const& z) { return glm::min(glm::min(x, y), z); } - template class C> + template class C> GLM_FUNC_QUALIFIER C min ( - C const & x, - typename C::T const & y, - typename C::T const & z + C const& x, + typename C::T const& y, + typename C::T const& z ) { return glm::min(glm::min(x, y), z); } - template class C> + template class C> GLM_FUNC_QUALIFIER C min ( - C const & x, - C const & y, - C const & z + C const& x, + C const& y, + C const& z ) { return glm::min(glm::min(x, y), z); } - template + template GLM_FUNC_QUALIFIER T min ( - T const & x, - T const & y, - T const & z, - T const & w + T const& x, + T const& y, + T const& z, + T const& w ) { return glm::min(glm::min(x, y), glm::min(z, w)); } - template class C> + template class C> GLM_FUNC_QUALIFIER C min ( - C const & x, - typename C::T const & y, - typename C::T const & z, - typename C::T const & w + C const& x, + typename C::T const& y, + typename C::T const& z, + typename C::T const& w ) { return glm::min(glm::min(x, y), glm::min(z, w)); } - template class C> + template class C> GLM_FUNC_QUALIFIER C min ( - C const & x, - C const & y, - C const & z, - C const & w + C const& x, + C const& y, + C const& z, + C const& w ) { return glm::min(glm::min(x, y), glm::min(z, w)); } - template + template GLM_FUNC_QUALIFIER T max( - T const & x, - T const & y, - T const & z) + T const& x, + T const& y, + T const& z) { return glm::max(glm::max(x, y), z); } - template class C> + template class C> GLM_FUNC_QUALIFIER C max ( - C const & x, - typename C::T const & y, - typename C::T const & z + C const& x, + typename C::T const& y, + typename C::T const& z ) { return glm::max(glm::max(x, y), z); } - template class C> + template class C> GLM_FUNC_QUALIFIER C max ( - C const & x, - C const & y, - C const & z + C const& x, + C const& y, + C const& z ) { return glm::max(glm::max(x, y), z); } - template + template GLM_FUNC_QUALIFIER T max ( - T const & x, - T const & y, - T const & z, - T const & w + T const& x, + T const& y, + T const& z, + T const& w ) { return glm::max(glm::max(x, y), glm::max(z, w)); } - template class C> + template class C> GLM_FUNC_QUALIFIER C max ( - C const & x, - typename C::T const & y, - typename C::T const & z, - typename C::T const & w + C const& x, + typename C::T const& y, + typename C::T const& z, + typename C::T const& w ) { return glm::max(glm::max(x, y), glm::max(z, w)); } - template class C> + template class C> GLM_FUNC_QUALIFIER C max ( - C const & x, - C const & y, - C const & z, - C const & w + C const& x, + C const& y, + C const& z, + C const& w ) { return glm::max(glm::max(x, y), glm::max(z, w)); } + // fmin +# if GLM_HAS_CXX11_STL + using std::fmin; +# else + template + GLM_FUNC_QUALIFIER genType fmin(genType x, genType y) + { + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'fmin' only accept floating-point input"); + + if (isnan(x)) + return y; + if (isnan(y)) + return x; + + return min(x, y); + } +# endif + + template + GLM_FUNC_QUALIFIER vec fmin(vec const& a, T b) + { + return detail::functor2::call(fmin, a, vec(b)); + } + + template + GLM_FUNC_QUALIFIER vec fmin(vec const& a, vec const& b) + { + return detail::functor2::call(fmin, a, b); + } + + // fmax +# if GLM_HAS_CXX11_STL + using std::fmax; +# else + template + GLM_FUNC_QUALIFIER genType fmax(genType x, genType y) + { + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'fmax' only accept floating-point input"); + + if (isnan(x)) + return y; + if (isnan(y)) + return x; + + return max(x, y); + } +# endif + + template + GLM_FUNC_QUALIFIER vec fmax(vec const& a, T b) + { + return detail::functor2::call(fmax, a, vec(b)); + } + + template + GLM_FUNC_QUALIFIER vec fmax(vec const& a, vec const& b) + { + return detail::functor2::call(fmax, a, b); + } + + // fclamp + template + GLM_FUNC_QUALIFIER genType fclamp(genType x, genType minVal, genType maxVal) + { + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'fclamp' only accept floating-point or integer inputs"); + return fmin(fmax(x, minVal), maxVal); + } + + template + GLM_FUNC_QUALIFIER vec fclamp(vec const& x, T minVal, T maxVal) + { + return fmin(fmax(x, vec(minVal)), vec(maxVal)); + } + + template + GLM_FUNC_QUALIFIER vec fclamp(vec const& x, vec const& minVal, vec const& maxVal) + { + return fmin(fmax(x, minVal), maxVal); + } }//namespace glm diff --git a/external/include/glm/gtx/exterior_product.hpp b/external/include/glm/gtx/exterior_product.hpp new file mode 100644 index 0000000..4223b65 --- /dev/null +++ b/external/include/glm/gtx/exterior_product.hpp @@ -0,0 +1,41 @@ +/// @ref gtx_exterior_product +/// @file glm/gtx/exterior_product.hpp +/// +/// @see core (dependence) +/// @see gtx_exterior_product (dependence) +/// +/// @defgroup gtx_exterior_product GLM_GTX_exterior_product +/// @ingroup gtx +/// +/// Include to use the features of this extension. +/// +/// @brief Allow to perform bit operations on integer values + +#pragma once + +// Dependencies +#include "../detail/setup.hpp" +#include "../detail/qualifier.hpp" + +#if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) +# pragma message("GLM: GLM_GTX_exterior_product extension included") +#endif + +namespace glm +{ + /// @addtogroup gtx_exterior_product + /// @{ + + /// Returns the cross product of x and y. + /// + /// @tparam T Floating-point scalar types + /// @tparam Q Value from qualifier enum + /// + /// @see Exterior product + template + GLM_FUNC_DECL T cross(vec<2, T, Q> const& v, vec<2, T, Q> const& u); + + /// @} +} //namespace glm + +#include "exterior_product.inl" diff --git a/external/include/glm/gtx/exterior_product.inl b/external/include/glm/gtx/exterior_product.inl new file mode 100644 index 0000000..b4b3634 --- /dev/null +++ b/external/include/glm/gtx/exterior_product.inl @@ -0,0 +1,27 @@ +/// @ref core +/// @file glm/detail/func_geometric.inl + +#include + +namespace glm { +namespace detail +{ + template + struct compute_cross_vec2 + { + GLM_FUNC_QUALIFIER static T call(vec<2, T, Q> const& v, vec<2, T, Q> const& u) + { + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'cross' accepts only floating-point inputs"); + + return v.x * u.y - u.x * v.y; + } + }; +}//namespace detail + + template + GLM_FUNC_QUALIFIER T cross(vec<2, T, Q> const& x, vec<2, T, Q> const& y) + { + return detail::compute_cross_vec2::value>::call(x, y); + } +}//namespace glm + diff --git a/external/include/glm/gtx/fast_exponential.hpp b/external/include/glm/gtx/fast_exponential.hpp index ed64a27..2d4918e 100644 --- a/external/include/glm/gtx/fast_exponential.hpp +++ b/external/include/glm/gtx/fast_exponential.hpp @@ -7,15 +7,19 @@ /// @defgroup gtx_fast_exponential GLM_GTX_fast_exponential /// @ingroup gtx /// -/// @brief Fast but less accurate implementations of exponential based functions. +/// Include to use the features of this extension. /// -/// need to be included to use these functionalities. +/// Fast but less accurate implementations of exponential based functions. #pragma once // Dependency: #include "../glm.hpp" +#ifndef GLM_ENABLE_EXPERIMENTAL +# error "GLM: GLM_GTX_fast_exponential is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." +#endif + #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) # pragma message("GLM: GLM_GTX_fast_exponential extension included") #endif @@ -27,63 +31,63 @@ namespace glm /// Faster than the common pow function but less accurate. /// @see gtx_fast_exponential - template + template GLM_FUNC_DECL genType fastPow(genType x, genType y); /// Faster than the common pow function but less accurate. /// @see gtx_fast_exponential - template class vecType> - GLM_FUNC_DECL vecType fastPow(vecType const & x, vecType const & y); + template + GLM_FUNC_DECL vec fastPow(vec const& x, vec const& y); /// Faster than the common pow function but less accurate. /// @see gtx_fast_exponential - template + template GLM_FUNC_DECL genTypeT fastPow(genTypeT x, genTypeU y); /// Faster than the common pow function but less accurate. /// @see gtx_fast_exponential - template class vecType> - GLM_FUNC_DECL vecType fastPow(vecType const & x); + template + GLM_FUNC_DECL vec fastPow(vec const& x); /// Faster than the common exp function but less accurate. /// @see gtx_fast_exponential - template + template GLM_FUNC_DECL T fastExp(T x); /// Faster than the common exp function but less accurate. /// @see gtx_fast_exponential - template class vecType> - GLM_FUNC_DECL vecType fastExp(vecType const & x); + template + GLM_FUNC_DECL vec fastExp(vec const& x); /// Faster than the common log function but less accurate. /// @see gtx_fast_exponential - template + template GLM_FUNC_DECL T fastLog(T x); /// Faster than the common exp2 function but less accurate. /// @see gtx_fast_exponential - template class vecType> - GLM_FUNC_DECL vecType fastLog(vecType const & x); + template + GLM_FUNC_DECL vec fastLog(vec const& x); /// Faster than the common exp2 function but less accurate. /// @see gtx_fast_exponential - template + template GLM_FUNC_DECL T fastExp2(T x); /// Faster than the common exp2 function but less accurate. /// @see gtx_fast_exponential - template class vecType> - GLM_FUNC_DECL vecType fastExp2(vecType const & x); + template + GLM_FUNC_DECL vec fastExp2(vec const& x); /// Faster than the common log2 function but less accurate. /// @see gtx_fast_exponential - template + template GLM_FUNC_DECL T fastLog2(T x); /// Faster than the common log2 function but less accurate. /// @see gtx_fast_exponential - template class vecType> - GLM_FUNC_DECL vecType fastLog2(vecType const & x); + template + GLM_FUNC_DECL vec fastLog2(vec const& x); /// @} }//namespace glm diff --git a/external/include/glm/gtx/fast_exponential.inl b/external/include/glm/gtx/fast_exponential.inl index 72f9f8f..9dfb109 100644 --- a/external/include/glm/gtx/fast_exponential.inl +++ b/external/include/glm/gtx/fast_exponential.inl @@ -4,19 +4,19 @@ namespace glm { // fastPow: - template + template GLM_FUNC_QUALIFIER genType fastPow(genType x, genType y) { return exp(y * log(x)); } - template class vecType> - GLM_FUNC_QUALIFIER vecType fastPow(vecType const & x, vecType const & y) + template + GLM_FUNC_QUALIFIER vec fastPow(vec const& x, vec const& y) { return exp(y * log(x)); } - template + template GLM_FUNC_QUALIFIER T fastPow(T x, int y) { T f = static_cast(1); @@ -25,10 +25,10 @@ namespace glm return f; } - template class vecType> - GLM_FUNC_QUALIFIER vecType fastPow(vecType const & x, vecType const & y) + template + GLM_FUNC_QUALIFIER vec fastPow(vec const& x, vec const& y) { - vecType Result(uninitialize); + vec Result; for(length_t i = 0, n = x.length(); i < n; ++i) Result[i] = fastPow(x[i], y[i]); return Result; @@ -36,7 +36,7 @@ namespace glm // fastExp // Note: This function provides accurate results only for value between -1 and 1, else avoid it. - template + template GLM_FUNC_QUALIFIER T fastExp(T x) { // This has a better looking and same performance in release mode than the following code. However, in debug mode it's slower. @@ -81,14 +81,14 @@ namespace glm } */ - template class vecType> - GLM_FUNC_QUALIFIER vecType fastExp(vecType const & x) + template + GLM_FUNC_QUALIFIER vec fastExp(vec const& x) { - return detail::functor1::call(fastExp, x); + return detail::functor1::call(fastExp, x); } // fastLog - template + template GLM_FUNC_QUALIFIER genType fastLog(genType x) { return std::log(x); @@ -103,35 +103,35 @@ namespace glm } */ - template class vecType> - GLM_FUNC_QUALIFIER vecType fastLog(vecType const & x) + template + GLM_FUNC_QUALIFIER vec fastLog(vec const& x) { - return detail::functor1::call(fastLog, x); + return detail::functor1::call(fastLog, x); } //fastExp2, ln2 = 0.69314718055994530941723212145818f - template + template GLM_FUNC_QUALIFIER genType fastExp2(genType x) { return fastExp(0.69314718055994530941723212145818f * x); } - template class vecType> - GLM_FUNC_QUALIFIER vecType fastExp2(vecType const & x) + template + GLM_FUNC_QUALIFIER vec fastExp2(vec const& x) { - return detail::functor1::call(fastExp2, x); + return detail::functor1::call(fastExp2, x); } // fastLog2, ln2 = 0.69314718055994530941723212145818f - template + template GLM_FUNC_QUALIFIER genType fastLog2(genType x) { return fastLog(x) / 0.69314718055994530941723212145818f; } - template class vecType> - GLM_FUNC_QUALIFIER vecType fastLog2(vecType const & x) + template + GLM_FUNC_QUALIFIER vec fastLog2(vec const& x) { - return detail::functor1::call(fastLog2, x); + return detail::functor1::call(fastLog2, x); } }//namespace glm diff --git a/external/include/glm/gtx/fast_square_root.hpp b/external/include/glm/gtx/fast_square_root.hpp index 35aa7f3..9e15cb0 100644 --- a/external/include/glm/gtx/fast_square_root.hpp +++ b/external/include/glm/gtx/fast_square_root.hpp @@ -6,11 +6,11 @@ /// @defgroup gtx_fast_square_root GLM_GTX_fast_square_root /// @ingroup gtx /// -/// @brief Fast but less accurate implementations of square root based functions. -/// - Sqrt optimisation based on Newton's method, -/// www.gamedev.net/community/forums/topic.asp?topic id=139956 +/// Include to use the features of this extension. /// -/// need to be included to use these functionalities. +/// Fast but less accurate implementations of square root based functions. +/// - Sqrt optimisation based on Newton's method, +/// www.gamedev.net/community/forums/topic.asp?topic id=139956 #pragma once @@ -19,6 +19,10 @@ #include "../exponential.hpp" #include "../geometric.hpp" +#ifndef GLM_ENABLE_EXPERIMENTAL +# error "GLM: GLM_GTX_fast_square_root is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." +#endif + #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) # pragma message("GLM: GLM_GTX_fast_square_root extension included") #endif @@ -31,56 +35,56 @@ namespace glm /// Faster than the common sqrt function but less accurate. /// /// @see gtx_fast_square_root extension. - template + template GLM_FUNC_DECL genType fastSqrt(genType x); /// Faster than the common sqrt function but less accurate. /// /// @see gtx_fast_square_root extension. - template class vecType> - GLM_FUNC_DECL vecType fastSqrt(vecType const & x); + template + GLM_FUNC_DECL vec fastSqrt(vec const& x); /// Faster than the common inversesqrt function but less accurate. /// /// @see gtx_fast_square_root extension. - template + template GLM_FUNC_DECL genType fastInverseSqrt(genType x); /// Faster than the common inversesqrt function but less accurate. /// /// @see gtx_fast_square_root extension. - template class vecType> - GLM_FUNC_DECL vecType fastInverseSqrt(vecType const & x); + template + GLM_FUNC_DECL vec fastInverseSqrt(vec const& x); /// Faster than the common length function but less accurate. /// /// @see gtx_fast_square_root extension. - template + template GLM_FUNC_DECL genType fastLength(genType x); /// Faster than the common length function but less accurate. /// /// @see gtx_fast_square_root extension. - template class vecType> - GLM_FUNC_DECL T fastLength(vecType const & x); + template + GLM_FUNC_DECL T fastLength(vec const& x); /// Faster than the common distance function but less accurate. /// /// @see gtx_fast_square_root extension. - template + template GLM_FUNC_DECL genType fastDistance(genType x, genType y); /// Faster than the common distance function but less accurate. /// /// @see gtx_fast_square_root extension. - template class vecType> - GLM_FUNC_DECL T fastDistance(vecType const & x, vecType const & y); + template + GLM_FUNC_DECL T fastDistance(vec const& x, vec const& y); /// Faster than the common normalize function but less accurate. /// /// @see gtx_fast_square_root extension. - template - GLM_FUNC_DECL genType fastNormalize(genType const & x); + template + GLM_FUNC_DECL genType fastNormalize(genType const& x); /// @} }// namespace glm diff --git a/external/include/glm/gtx/fast_square_root.inl b/external/include/glm/gtx/fast_square_root.inl index 73950ae..e988987 100644 --- a/external/include/glm/gtx/fast_square_root.inl +++ b/external/include/glm/gtx/fast_square_root.inl @@ -4,7 +4,7 @@ namespace glm { // fastSqrt - template + template GLM_FUNC_QUALIFIER genType fastSqrt(genType x) { GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'fastSqrt' only accept floating-point input"); @@ -12,32 +12,32 @@ namespace glm return genType(1) / fastInverseSqrt(x); } - template class vecType> - GLM_FUNC_QUALIFIER vecType fastSqrt(vecType const & x) + template + GLM_FUNC_QUALIFIER vec fastSqrt(vec const& x) { - return detail::functor1::call(fastSqrt, x); + return detail::functor1::call(fastSqrt, x); } // fastInversesqrt - template + template GLM_FUNC_QUALIFIER genType fastInverseSqrt(genType x) { # ifdef __CUDACC__ // Wordaround for a CUDA compiler bug up to CUDA6 - tvec1 tmp(detail::compute_inversesqrt::value>::call(tvec1(x))); + vec<1, T, Q> tmp(detail::compute_inversesqrt::value>::call(vec<1, genType, lowp>(x))); return tmp.x; # else - return detail::compute_inversesqrt::value>::call(tvec1(x)).x; + return detail::compute_inversesqrt<1, genType, lowp, detail::is_aligned::value>::call(vec<1, genType, lowp>(x)).x; # endif } - template class vecType> - GLM_FUNC_QUALIFIER vecType fastInverseSqrt(vecType const & x) + template + GLM_FUNC_QUALIFIER vec fastInverseSqrt(vec const& x) { - return detail::compute_inversesqrt::value>::call(x); + return detail::compute_inversesqrt::value>::call(x); } // fastLength - template + template GLM_FUNC_QUALIFIER genType fastLength(genType x) { GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'fastLength' only accept floating-point inputs"); @@ -45,8 +45,8 @@ namespace glm return abs(x); } - template class vecType> - GLM_FUNC_QUALIFIER T fastLength(vecType const & x) + template + GLM_FUNC_QUALIFIER T fastLength(vec const& x) { GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'fastLength' only accept floating-point inputs"); @@ -54,27 +54,27 @@ namespace glm } // fastDistance - template + template GLM_FUNC_QUALIFIER genType fastDistance(genType x, genType y) { return fastLength(y - x); } - template class vecType> - GLM_FUNC_QUALIFIER T fastDistance(vecType const & x, vecType const & y) + template + GLM_FUNC_QUALIFIER T fastDistance(vec const& x, vec const& y) { return fastLength(y - x); } // fastNormalize - template + template GLM_FUNC_QUALIFIER genType fastNormalize(genType x) { return x > genType(0) ? genType(1) : -genType(1); } - template class vecType> - GLM_FUNC_QUALIFIER vecType fastNormalize(vecType const & x) + template + GLM_FUNC_QUALIFIER vec fastNormalize(vec const& x) { return x * fastInverseSqrt(dot(x, x)); } diff --git a/external/include/glm/gtx/fast_trigonometry.hpp b/external/include/glm/gtx/fast_trigonometry.hpp index ccb1d22..4ec87c3 100644 --- a/external/include/glm/gtx/fast_trigonometry.hpp +++ b/external/include/glm/gtx/fast_trigonometry.hpp @@ -6,15 +6,19 @@ /// @defgroup gtx_fast_trigonometry GLM_GTX_fast_trigonometry /// @ingroup gtx /// -/// @brief Fast but less accurate implementations of trigonometric functions. +/// Include to use the features of this extension. /// -/// need to be included to use these functionalities. +/// Fast but less accurate implementations of trigonometric functions. #pragma once // Dependency: #include "../gtc/constants.hpp" +#ifndef GLM_ENABLE_EXPERIMENTAL +# error "GLM: GLM_GTX_fast_trigonometry is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." +#endif + #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) # pragma message("GLM: GLM_GTX_fast_trigonometry extension included") #endif @@ -26,47 +30,47 @@ namespace glm /// Wrap an angle to [0 2pi[ /// From GLM_GTX_fast_trigonometry extension. - template + template GLM_FUNC_DECL T wrapAngle(T angle); /// Faster than the common sin function but less accurate. /// From GLM_GTX_fast_trigonometry extension. - template + template GLM_FUNC_DECL T fastSin(T angle); /// Faster than the common cos function but less accurate. /// From GLM_GTX_fast_trigonometry extension. - template + template GLM_FUNC_DECL T fastCos(T angle); - /// Faster than the common tan function but less accurate. - /// Defined between -2pi and 2pi. + /// Faster than the common tan function but less accurate. + /// Defined between -2pi and 2pi. /// From GLM_GTX_fast_trigonometry extension. - template + template GLM_FUNC_DECL T fastTan(T angle); - /// Faster than the common asin function but less accurate. + /// Faster than the common asin function but less accurate. /// Defined between -2pi and 2pi. /// From GLM_GTX_fast_trigonometry extension. - template + template GLM_FUNC_DECL T fastAsin(T angle); - /// Faster than the common acos function but less accurate. - /// Defined between -2pi and 2pi. + /// Faster than the common acos function but less accurate. + /// Defined between -2pi and 2pi. /// From GLM_GTX_fast_trigonometry extension. - template + template GLM_FUNC_DECL T fastAcos(T angle); /// Faster than the common atan function but less accurate. - /// Defined between -2pi and 2pi. + /// Defined between -2pi and 2pi. /// From GLM_GTX_fast_trigonometry extension. - template + template GLM_FUNC_DECL T fastAtan(T y, T x); - /// Faster than the common atan function but less accurate. + /// Faster than the common atan function but less accurate. /// Defined between -2pi and 2pi. /// From GLM_GTX_fast_trigonometry extension. - template + template GLM_FUNC_DECL T fastAtan(T angle); /// @} diff --git a/external/include/glm/gtx/fast_trigonometry.inl b/external/include/glm/gtx/fast_trigonometry.inl index f576c17..a733160 100644 --- a/external/include/glm/gtx/fast_trigonometry.inl +++ b/external/include/glm/gtx/fast_trigonometry.inl @@ -4,45 +4,45 @@ namespace glm{ namespace detail { - template class vecType> - GLM_FUNC_QUALIFIER vecType taylorCos(vecType const & x) + template + GLM_FUNC_QUALIFIER vec taylorCos(vec const& x) { return static_cast(1) - - (x * x) / 2.f - + (x * x * x * x) / 24.f - - (x * x * x * x * x * x) / 720.f - + (x * x * x * x * x * x * x * x) / 40320.f; + - (x * x) * (1.f / 2.f) + + ((x * x) * (x * x)) * (1.f / 24.f) + - (((x * x) * (x * x)) * (x * x)) * (1.f / 720.f) + + (((x * x) * (x * x)) * ((x * x) * (x * x))) * (1.f / 40320.f); } - template + template GLM_FUNC_QUALIFIER T cos_52s(T x) { T const xx(x * x); return (T(0.9999932946) + xx * (T(-0.4999124376) + xx * (T(0.0414877472) + xx * T(-0.0012712095)))); } - template class vecType> - GLM_FUNC_QUALIFIER vecType cos_52s(vecType const & x) + template + GLM_FUNC_QUALIFIER vec cos_52s(vec const& x) { - return detail::functor1::call(cos_52s, x); + return detail::functor1::call(cos_52s, x); } }//namespace detail // wrapAngle - template + template GLM_FUNC_QUALIFIER T wrapAngle(T angle) { return abs(mod(angle, two_pi())); } - template class vecType> - GLM_FUNC_QUALIFIER vecType wrapAngle(vecType const & x) + template + GLM_FUNC_QUALIFIER vec wrapAngle(vec const& x) { - return detail::functor1::call(wrapAngle, x); + return detail::functor1::call(wrapAngle, x); } // cos - template + template GLM_FUNC_QUALIFIER T fastCos(T x) { T const angle(wrapAngle(x)); @@ -57,87 +57,87 @@ namespace detail return detail::cos_52s(two_pi() - angle); } - template class vecType> - GLM_FUNC_QUALIFIER vecType fastCos(vecType const & x) + template + GLM_FUNC_QUALIFIER vec fastCos(vec const& x) { - return detail::functor1::call(fastCos, x); + return detail::functor1::call(fastCos, x); } // sin - template + template GLM_FUNC_QUALIFIER T fastSin(T x) { return fastCos(half_pi() - x); } - template class vecType> - GLM_FUNC_QUALIFIER vecType fastSin(vecType const & x) + template + GLM_FUNC_QUALIFIER vec fastSin(vec const& x) { - return detail::functor1::call(fastSin, x); + return detail::functor1::call(fastSin, x); } // tan - template + template GLM_FUNC_QUALIFIER T fastTan(T x) { return x + (x * x * x * T(0.3333333333)) + (x * x * x * x * x * T(0.1333333333333)) + (x * x * x * x * x * x * x * T(0.0539682539)); } - template class vecType> - GLM_FUNC_QUALIFIER vecType fastTan(vecType const & x) + template + GLM_FUNC_QUALIFIER vec fastTan(vec const& x) { - return detail::functor1::call(fastTan, x); + return detail::functor1::call(fastTan, x); } // asin - template + template GLM_FUNC_QUALIFIER T fastAsin(T x) { return x + (x * x * x * T(0.166666667)) + (x * x * x * x * x * T(0.075)) + (x * x * x * x * x * x * x * T(0.0446428571)) + (x * x * x * x * x * x * x * x * x * T(0.0303819444));// + (x * x * x * x * x * x * x * x * x * x * x * T(0.022372159)); } - template class vecType> - GLM_FUNC_QUALIFIER vecType fastAsin(vecType const & x) + template + GLM_FUNC_QUALIFIER vec fastAsin(vec const& x) { - return detail::functor1::call(fastAsin, x); + return detail::functor1::call(fastAsin, x); } // acos - template + template GLM_FUNC_QUALIFIER T fastAcos(T x) { return T(1.5707963267948966192313216916398) - fastAsin(x); //(PI / 2) } - template class vecType> - GLM_FUNC_QUALIFIER vecType fastAcos(vecType const & x) + template + GLM_FUNC_QUALIFIER vec fastAcos(vec const& x) { - return detail::functor1::call(fastAcos, x); + return detail::functor1::call(fastAcos, x); } // atan - template + template GLM_FUNC_QUALIFIER T fastAtan(T y, T x) { T sgn = sign(y) * sign(x); return abs(fastAtan(y / x)) * sgn; } - template class vecType> - GLM_FUNC_QUALIFIER vecType fastAtan(vecType const & y, vecType const & x) + template + GLM_FUNC_QUALIFIER vec fastAtan(vec const& y, vec const& x) { - return detail::functor2::call(fastAtan, y, x); + return detail::functor2::call(fastAtan, y, x); } - template + template GLM_FUNC_QUALIFIER T fastAtan(T x) { return x - (x * x * x * T(0.333333333333)) + (x * x * x * x * x * T(0.2)) - (x * x * x * x * x * x * x * T(0.1428571429)) + (x * x * x * x * x * x * x * x * x * T(0.111111111111)) - (x * x * x * x * x * x * x * x * x * x * x * T(0.0909090909)); } - template class vecType> - GLM_FUNC_QUALIFIER vecType fastAtan(vecType const & x) + template + GLM_FUNC_QUALIFIER vec fastAtan(vec const& x) { - return detail::functor1::call(fastAtan, x); + return detail::functor1::call(fastAtan, x); } }//namespace glm diff --git a/external/include/glm/gtx/float_notmalize.inl b/external/include/glm/gtx/float_notmalize.inl index 4dde025..bceab10 100644 --- a/external/include/glm/gtx/float_notmalize.inl +++ b/external/include/glm/gtx/float_notmalize.inl @@ -5,10 +5,10 @@ namespace glm { - template class vecType> - GLM_FUNC_QUALIFIER vecType floatNormalize(vecType const & v) + template + GLM_FUNC_QUALIFIER vec floatNormalize(vec const& v) { - return vecType(v) / static_cast(std::numeric_limits::max()); + return vec(v) / static_cast(std::numeric_limits::max()); } }//namespace glm diff --git a/external/include/glm/gtx/functions.hpp b/external/include/glm/gtx/functions.hpp new file mode 100644 index 0000000..98b50d8 --- /dev/null +++ b/external/include/glm/gtx/functions.hpp @@ -0,0 +1,52 @@ +/// @ref gtx_functions +/// @file glm/gtx/functions.hpp +/// +/// @see core (dependence) +/// @see gtc_quaternion (dependence) +/// +/// @defgroup gtx_functions GLM_GTX_functions +/// @ingroup gtx +/// +/// Include to use the features of this extension. +/// +/// List of useful common functions. + +#pragma once + +// Dependencies +#include "../detail/setup.hpp" +#include "../detail/qualifier.hpp" +#include "../detail/type_vec2.hpp" + +#if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) +# pragma message("GLM: GLM_GTX_functions extension included") +#endif + +namespace glm +{ + /// @addtogroup gtx_functions + /// @{ + + /// 1D gauss function + /// + /// @see gtc_epsilon + template + GLM_FUNC_DECL T gauss( + T x, + T ExpectedValue, + T StandardDeviation); + + /// 2D gauss function + /// + /// @see gtc_epsilon + template + GLM_FUNC_DECL T gauss( + vec<2, T, Q> const& Coord, + vec<2, T, Q> const& ExpectedValue, + vec<2, T, Q> const& StandardDeviation); + + /// @} +}//namespace glm + +#include "functions.inl" + diff --git a/external/include/glm/gtx/functions.inl b/external/include/glm/gtx/functions.inl new file mode 100644 index 0000000..ac1e112 --- /dev/null +++ b/external/include/glm/gtx/functions.inl @@ -0,0 +1,31 @@ +/// @ref gtx_functions +/// @file glm/gtx/functions.inl + +#include "../exponential.hpp" + +namespace glm +{ + template + GLM_FUNC_QUALIFIER T gauss + ( + T x, + T ExpectedValue, + T StandardDeviation + ) + { + return exp(-((x - ExpectedValue) * (x - ExpectedValue)) / (static_cast(2) * StandardDeviation * StandardDeviation)) / (StandardDeviation * sqrt(static_cast(6.28318530717958647692528676655900576))); + } + + template + GLM_FUNC_QUALIFIER T gauss + ( + vec<2, T, Q> const& Coord, + vec<2, T, Q> const& ExpectedValue, + vec<2, T, Q> const& StandardDeviation + ) + { + vec<2, T, Q> const Squared = ((Coord - ExpectedValue) * (Coord - ExpectedValue)) / (static_cast(2) * StandardDeviation * StandardDeviation); + return exp(-(Squared.x + Squared.y)); + } +}//namespace glm + diff --git a/external/include/glm/gtx/gradient_paint.hpp b/external/include/glm/gtx/gradient_paint.hpp index de1f18d..2713cec 100644 --- a/external/include/glm/gtx/gradient_paint.hpp +++ b/external/include/glm/gtx/gradient_paint.hpp @@ -7,8 +7,9 @@ /// @defgroup gtx_gradient_paint GLM_GTX_gradient_paint /// @ingroup gtx /// -/// @brief Functions that return the color of procedural gradient for specific coordinates. -/// need to be included to use these functionalities. +/// Include to use the features of this extension. +/// +/// Functions that return the color of procedural gradient for specific coordinates. #pragma once @@ -16,6 +17,10 @@ #include "../glm.hpp" #include "../gtx/optimum_pow.hpp" +#ifndef GLM_ENABLE_EXPERIMENTAL +# error "GLM: GLM_GTX_gradient_paint is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." +#endif + #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) # pragma message("GLM: GLM_GTX_gradient_paint extension included") #endif @@ -27,20 +32,20 @@ namespace glm /// Return a color from a radial gradient. /// @see - gtx_gradient_paint - template + template GLM_FUNC_DECL T radialGradient( - tvec2 const & Center, - T const & Radius, - tvec2 const & Focal, - tvec2 const & Position); + vec<2, T, Q> const& Center, + T const& Radius, + vec<2, T, Q> const& Focal, + vec<2, T, Q> const& Position); /// Return a color from a linear gradient. /// @see - gtx_gradient_paint - template + template GLM_FUNC_DECL T linearGradient( - tvec2 const & Point0, - tvec2 const & Point1, - tvec2 const & Position); + vec<2, T, Q> const& Point0, + vec<2, T, Q> const& Point1, + vec<2, T, Q> const& Position); /// @} }// namespace glm diff --git a/external/include/glm/gtx/gradient_paint.inl b/external/include/glm/gtx/gradient_paint.inl index aaa5ce1..e2e92b5 100644 --- a/external/include/glm/gtx/gradient_paint.inl +++ b/external/include/glm/gtx/gradient_paint.inl @@ -3,17 +3,17 @@ namespace glm { - template + template GLM_FUNC_QUALIFIER T radialGradient ( - tvec2 const & Center, - T const & Radius, - tvec2 const & Focal, - tvec2 const & Position + vec<2, T, Q> const& Center, + T const& Radius, + vec<2, T, Q> const& Focal, + vec<2, T, Q> const& Position ) { - tvec2 F = Focal - Center; - tvec2 D = Position - Focal; + vec<2, T, Q> F = Focal - Center; + vec<2, T, Q> D = Position - Focal; T Radius2 = pow2(Radius); T Fx2 = pow2(F.x); T Fy2 = pow2(F.y); @@ -23,15 +23,15 @@ namespace glm return Numerator / Denominator; } - template + template GLM_FUNC_QUALIFIER T linearGradient ( - tvec2 const & Point0, - tvec2 const & Point1, - tvec2 const & Position + vec<2, T, Q> const& Point0, + vec<2, T, Q> const& Point1, + vec<2, T, Q> const& Position ) { - tvec2 Dist = Point1 - Point0; + vec<2, T, Q> Dist = Point1 - Point0; return (Dist.x * (Position.x - Point0.x) + Dist.y * (Position.y - Point0.y)) / glm::dot(Dist, Dist); } }//namespace glm diff --git a/external/include/glm/gtx/handed_coordinate_space.hpp b/external/include/glm/gtx/handed_coordinate_space.hpp index 2ee5175..1d0d410 100644 --- a/external/include/glm/gtx/handed_coordinate_space.hpp +++ b/external/include/glm/gtx/handed_coordinate_space.hpp @@ -6,15 +6,19 @@ /// @defgroup gtx_handed_coordinate_space GLM_GTX_handed_coordinate_space /// @ingroup gtx /// -/// @brief To know if a set of three basis vectors defines a right or left-handed coordinate system. +/// Include to use the features of this extension. /// -/// need to be included to use these functionalities. +/// To know if a set of three basis vectors defines a right or left-handed coordinate system. #pragma once // Dependency: #include "../glm.hpp" +#ifndef GLM_ENABLE_EXPERIMENTAL +# error "GLM: GLM_GTX_handed_coordinate_space is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." +#endif + #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) # pragma message("GLM: GLM_GTX_handed_coordinate_space extension included") #endif @@ -26,19 +30,19 @@ namespace glm //! Return if a trihedron right handed or not. //! From GLM_GTX_handed_coordinate_space extension. - template + template GLM_FUNC_DECL bool rightHanded( - tvec3 const & tangent, - tvec3 const & binormal, - tvec3 const & normal); + vec<3, T, Q> const& tangent, + vec<3, T, Q> const& binormal, + vec<3, T, Q> const& normal); //! Return if a trihedron left handed or not. //! From GLM_GTX_handed_coordinate_space extension. - template + template GLM_FUNC_DECL bool leftHanded( - tvec3 const & tangent, - tvec3 const & binormal, - tvec3 const & normal); + vec<3, T, Q> const& tangent, + vec<3, T, Q> const& binormal, + vec<3, T, Q> const& normal); /// @} }// namespace glm diff --git a/external/include/glm/gtx/handed_coordinate_space.inl b/external/include/glm/gtx/handed_coordinate_space.inl index 2e55653..1639245 100644 --- a/external/include/glm/gtx/handed_coordinate_space.inl +++ b/external/include/glm/gtx/handed_coordinate_space.inl @@ -3,23 +3,23 @@ namespace glm { - template + template GLM_FUNC_QUALIFIER bool rightHanded ( - tvec3 const & tangent, - tvec3 const & binormal, - tvec3 const & normal + vec<3, T, Q> const& tangent, + vec<3, T, Q> const& binormal, + vec<3, T, Q> const& normal ) { return dot(cross(normal, tangent), binormal) > T(0); } - template + template GLM_FUNC_QUALIFIER bool leftHanded ( - tvec3 const & tangent, - tvec3 const & binormal, - tvec3 const & normal + vec<3, T, Q> const& tangent, + vec<3, T, Q> const& binormal, + vec<3, T, Q> const& normal ) { return dot(cross(normal, tangent), binormal) < T(0); diff --git a/external/include/glm/gtx/hash.hpp b/external/include/glm/gtx/hash.hpp index 2262618..3196be7 100644 --- a/external/include/glm/gtx/hash.hpp +++ b/external/include/glm/gtx/hash.hpp @@ -5,13 +5,17 @@ /// /// @defgroup gtx_hash GLM_GTX_hash /// @ingroup gtx -/// -/// @brief Add std::hash support for glm types -/// -/// need to be included to use these functionalities. +/// +/// Include to use the features of this extension. +/// +/// Add std::hash support for glm types #pragma once +#ifndef GLM_ENABLE_EXPERIMENTAL +# error "GLM: GLM_GTX_hash is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." +#endif + #include #include "../vec2.hpp" @@ -40,94 +44,94 @@ namespace std { - template - struct hash > + template + struct hash > { - GLM_FUNC_DECL size_t operator()(glm::tvec1 const & v) const; + GLM_FUNC_DECL size_t operator()(glm::vec<1, T, Q> const& v) const; }; - template - struct hash > + template + struct hash > { - GLM_FUNC_DECL size_t operator()(glm::tvec2 const & v) const; + GLM_FUNC_DECL size_t operator()(glm::vec<2, T, Q> const& v) const; }; - template - struct hash > + template + struct hash > { - GLM_FUNC_DECL size_t operator()(glm::tvec3 const & v) const; + GLM_FUNC_DECL size_t operator()(glm::vec<3, T, Q> const& v) const; }; - template - struct hash > + template + struct hash > { - GLM_FUNC_DECL size_t operator()(glm::tvec4 const & v) const; + GLM_FUNC_DECL size_t operator()(glm::vec<4, T, Q> const& v) const; }; - template - struct hash> + template + struct hash> { - GLM_FUNC_DECL size_t operator()(glm::tquat const & q) const; + GLM_FUNC_DECL size_t operator()(glm::tquat const& q) const; }; - template - struct hash > + template + struct hash > { - GLM_FUNC_DECL size_t operator()(glm::tdualquat const & q) const; + GLM_FUNC_DECL size_t operator()(glm::tdualquat const& q) const; }; - template - struct hash > + template + struct hash > { - GLM_FUNC_DECL size_t operator()(glm::tmat2x2 const & m) const; + GLM_FUNC_DECL size_t operator()(glm::mat<2, 2, T,Q> const& m) const; }; - template - struct hash > + template + struct hash > { - GLM_FUNC_DECL size_t operator()(glm::tmat2x3 const & m) const; + GLM_FUNC_DECL size_t operator()(glm::mat<2, 3, T,Q> const& m) const; }; - template - struct hash > + template + struct hash > { - GLM_FUNC_DECL size_t operator()(glm::tmat2x4 const & m) const; + GLM_FUNC_DECL size_t operator()(glm::mat<2, 4, T,Q> const& m) const; }; - template - struct hash > + template + struct hash > { - GLM_FUNC_DECL size_t operator()(glm::tmat3x2 const & m) const; + GLM_FUNC_DECL size_t operator()(glm::mat<3, 2, T,Q> const& m) const; }; - template - struct hash > + template + struct hash > { - GLM_FUNC_DECL size_t operator()(glm::tmat3x3 const & m) const; + GLM_FUNC_DECL size_t operator()(glm::mat<3, 3, T,Q> const& m) const; }; - template - struct hash > + template + struct hash > { - GLM_FUNC_DECL size_t operator()(glm::tmat3x4 const & m) const; + GLM_FUNC_DECL size_t operator()(glm::mat<3, 4, T,Q> const& m) const; }; - template - struct hash > + template + struct hash > { - GLM_FUNC_DECL size_t operator()(glm::tmat4x2 const & m) const; + GLM_FUNC_DECL size_t operator()(glm::mat<4, 2, T,Q> const& m) const; }; - - template - struct hash > + + template + struct hash > { - GLM_FUNC_DECL size_t operator()(glm::tmat4x3 const & m) const; + GLM_FUNC_DECL size_t operator()(glm::mat<4, 3, T,Q> const& m) const; }; - template - struct hash > + template + struct hash > { - GLM_FUNC_DECL size_t operator()(glm::tmat4x4 const & m) const; + GLM_FUNC_DECL size_t operator()(glm::mat<4, 4, T,Q> const& m) const; }; } // namespace std diff --git a/external/include/glm/gtx/hash.inl b/external/include/glm/gtx/hash.inl index c42f4f0..32e7f12 100644 --- a/external/include/glm/gtx/hash.inl +++ b/external/include/glm/gtx/hash.inl @@ -8,7 +8,7 @@ /// /// @brief Add std::hash support for glm types /// -/// need to be included to use these functionalities. +/// need to be included to use the features of this extension. namespace glm { namespace detail @@ -22,15 +22,15 @@ namespace detail namespace std { - template - GLM_FUNC_QUALIFIER size_t hash>::operator()(glm::tvec1 const & v) const + template + GLM_FUNC_QUALIFIER size_t hash>::operator()(glm::vec<1, T, Q> const& v) const { hash hasher; return hasher(v.x); } - template - GLM_FUNC_QUALIFIER size_t hash>::operator()(glm::tvec2 const & v) const + template + GLM_FUNC_QUALIFIER size_t hash>::operator()(glm::vec<2, T, Q> const& v) const { size_t seed = 0; hash hasher; @@ -39,8 +39,8 @@ namespace std return seed; } - template - GLM_FUNC_QUALIFIER size_t hash>::operator()(glm::tvec3 const & v) const + template + GLM_FUNC_QUALIFIER size_t hash>::operator()(glm::vec<3, T, Q> const& v) const { size_t seed = 0; hash hasher; @@ -50,8 +50,8 @@ namespace std return seed; } - template - GLM_FUNC_QUALIFIER size_t hash>::operator()(glm::tvec4 const & v) const + template + GLM_FUNC_QUALIFIER size_t hash>::operator()(glm::vec<4, T, Q> const& v) const { size_t seed = 0; hash hasher; @@ -62,8 +62,8 @@ namespace std return seed; } - template - GLM_FUNC_QUALIFIER size_t hash>::operator()(glm::tquat const & q) const + template + GLM_FUNC_QUALIFIER size_t hash>::operator()(glm::tquat const& q) const { size_t seed = 0; hash hasher; @@ -74,84 +74,84 @@ namespace std return seed; } - template - GLM_FUNC_QUALIFIER size_t hash>::operator()(glm::tdualquat const & q) const + template + GLM_FUNC_QUALIFIER size_t hash>::operator()(glm::tdualquat const& q) const { size_t seed = 0; - hash> hasher; + hash> hasher; glm::detail::hash_combine(seed, hasher(q.real)); glm::detail::hash_combine(seed, hasher(q.dual)); return seed; } - template - GLM_FUNC_QUALIFIER size_t hash>::operator()(glm::tmat2x2 const & m) const + template + GLM_FUNC_QUALIFIER size_t hash>::operator()(glm::mat<2, 2, T, Q> const& m) const { size_t seed = 0; - hash> hasher; + hash> hasher; glm::detail::hash_combine(seed, hasher(m[0])); glm::detail::hash_combine(seed, hasher(m[1])); return seed; } - template - GLM_FUNC_QUALIFIER size_t hash>::operator()(glm::tmat2x3 const & m) const + template + GLM_FUNC_QUALIFIER size_t hash>::operator()(glm::mat<2, 3, T, Q> const& m) const { size_t seed = 0; - hash> hasher; + hash> hasher; glm::detail::hash_combine(seed, hasher(m[0])); glm::detail::hash_combine(seed, hasher(m[1])); return seed; } - template - GLM_FUNC_QUALIFIER size_t hash>::operator()(glm::tmat2x4 const & m) const + template + GLM_FUNC_QUALIFIER size_t hash>::operator()(glm::mat<2, 4, T, Q> const& m) const { size_t seed = 0; - hash> hasher; + hash> hasher; glm::detail::hash_combine(seed, hasher(m[0])); glm::detail::hash_combine(seed, hasher(m[1])); return seed; } - template - GLM_FUNC_QUALIFIER size_t hash>::operator()(glm::tmat3x2 const & m) const + template + GLM_FUNC_QUALIFIER size_t hash>::operator()(glm::mat<3, 2, T, Q> const& m) const { size_t seed = 0; - hash> hasher; + hash> hasher; glm::detail::hash_combine(seed, hasher(m[0])); glm::detail::hash_combine(seed, hasher(m[1])); glm::detail::hash_combine(seed, hasher(m[2])); return seed; } - template - GLM_FUNC_QUALIFIER size_t hash>::operator()(glm::tmat3x3 const & m) const + template + GLM_FUNC_QUALIFIER size_t hash>::operator()(glm::mat<3, 3, T, Q> const& m) const { size_t seed = 0; - hash> hasher; + hash> hasher; glm::detail::hash_combine(seed, hasher(m[0])); glm::detail::hash_combine(seed, hasher(m[1])); glm::detail::hash_combine(seed, hasher(m[2])); return seed; } - template - GLM_FUNC_QUALIFIER size_t hash>::operator()(glm::tmat3x4 const & m) const + template + GLM_FUNC_QUALIFIER size_t hash>::operator()(glm::mat<3, 4, T, Q> const& m) const { size_t seed = 0; - hash> hasher; + hash> hasher; glm::detail::hash_combine(seed, hasher(m[0])); glm::detail::hash_combine(seed, hasher(m[1])); glm::detail::hash_combine(seed, hasher(m[2])); return seed; } - template - GLM_FUNC_QUALIFIER size_t hash>::operator()(glm::tmat4x2 const & m) const + template + GLM_FUNC_QUALIFIER size_t hash>::operator()(glm::mat<4, 2, T,Q> const& m) const { size_t seed = 0; - hash> hasher; + hash> hasher; glm::detail::hash_combine(seed, hasher(m[0])); glm::detail::hash_combine(seed, hasher(m[1])); glm::detail::hash_combine(seed, hasher(m[2])); @@ -159,11 +159,11 @@ namespace std return seed; } - template - GLM_FUNC_QUALIFIER size_t hash>::operator()(glm::tmat4x3 const & m) const + template + GLM_FUNC_QUALIFIER size_t hash>::operator()(glm::mat<4, 3, T,Q> const& m) const { size_t seed = 0; - hash> hasher; + hash> hasher; glm::detail::hash_combine(seed, hasher(m[0])); glm::detail::hash_combine(seed, hasher(m[1])); glm::detail::hash_combine(seed, hasher(m[2])); @@ -171,11 +171,11 @@ namespace std return seed; } - template - GLM_FUNC_QUALIFIER size_t hash>::operator()(glm::tmat4x4 const & m) const + template + GLM_FUNC_QUALIFIER size_t hash>::operator()(glm::mat<4, 4, T, Q> const& m) const { size_t seed = 0; - hash> hasher; + hash> hasher; glm::detail::hash_combine(seed, hasher(m[0])); glm::detail::hash_combine(seed, hasher(m[1])); glm::detail::hash_combine(seed, hasher(m[2])); diff --git a/external/include/glm/gtx/integer.hpp b/external/include/glm/gtx/integer.hpp index 1173a58..7b80209 100644 --- a/external/include/glm/gtx/integer.hpp +++ b/external/include/glm/gtx/integer.hpp @@ -6,9 +6,9 @@ /// @defgroup gtx_integer GLM_GTX_integer /// @ingroup gtx /// -/// @brief Add support for integer for core functions +/// Include to use the features of this extension. /// -/// need to be included to use these functionalities. +/// Add support for integer for core functions #pragma once @@ -16,6 +16,10 @@ #include "../glm.hpp" #include "../gtc/integer.hpp" +#ifndef GLM_ENABLE_EXPERIMENTAL +# error "GLM: GLM_GTX_integer is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." +#endif + #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) # pragma message("GLM: GLM_GTX_integer extension included") #endif @@ -25,9 +29,9 @@ namespace glm /// @addtogroup gtx_integer /// @{ - //! Returns x raised to the y power. + //! Returns x raised to the y power. //! From GLM_GTX_integer extension. - GLM_FUNC_DECL int pow(int x, int y); + GLM_FUNC_DECL int pow(int x, uint y); //! Returns the positive square root of x. //! From GLM_GTX_integer extension. @@ -43,10 +47,10 @@ namespace glm //! Return the factorial value of a number (!12 max, integer only) //! From GLM_GTX_integer extension. - template - GLM_FUNC_DECL genType factorial(genType const & x); + template + GLM_FUNC_DECL genType factorial(genType const& x); - //! 32bit signed integer. + //! 32bit signed integer. //! From GLM_GTX_integer extension. typedef signed int sint; @@ -54,7 +58,7 @@ namespace glm //! From GLM_GTX_integer extension. GLM_FUNC_DECL uint pow(uint x, uint y); - //! Returns the positive square root of x. + //! Returns the positive square root of x. //! From GLM_GTX_integer extension. GLM_FUNC_DECL uint sqrt(uint x); diff --git a/external/include/glm/gtx/integer.inl b/external/include/glm/gtx/integer.inl index 3a479e6..c9fcb4e 100644 --- a/external/include/glm/gtx/integer.inl +++ b/external/include/glm/gtx/integer.inl @@ -4,12 +4,13 @@ namespace glm { // pow - GLM_FUNC_QUALIFIER int pow(int x, int y) + GLM_FUNC_QUALIFIER int pow(int x, uint y) { if(y == 0) - return 1; + return x >= 0 ? 1 : -1; + int result = x; - for(int i = 1; i < y; ++i) + for(uint i = 1; i < y; ++i) result *= x; return result; } @@ -69,8 +70,8 @@ namespace detail } // factorial (!12 max, integer only) - template - GLM_FUNC_QUALIFIER genType factorial(genType const & x) + template + GLM_FUNC_QUALIFIER genType factorial(genType const& x) { genType Temp = x; genType Result; @@ -79,30 +80,30 @@ namespace detail return Result; } - template - GLM_FUNC_QUALIFIER tvec2 factorial( - tvec2 const & x) + template + GLM_FUNC_QUALIFIER vec<2, T, Q> factorial( + vec<2, T, Q> const& x) { - return tvec2( + return vec<2, T, Q>( factorial(x.x), factorial(x.y)); } - template - GLM_FUNC_QUALIFIER tvec3 factorial( - tvec3 const & x) + template + GLM_FUNC_QUALIFIER vec<3, T, Q> factorial( + vec<3, T, Q> const& x) { - return tvec3( + return vec<3, T, Q>( factorial(x.x), factorial(x.y), factorial(x.z)); } - template - GLM_FUNC_QUALIFIER tvec4 factorial( - tvec4 const & x) + template + GLM_FUNC_QUALIFIER vec<4, T, Q> factorial( + vec<4, T, Q> const& x) { - return tvec4( + return vec<4, T, Q>( factorial(x.x), factorial(x.y), factorial(x.z), @@ -111,6 +112,9 @@ namespace detail GLM_FUNC_QUALIFIER uint pow(uint x, uint y) { + if (y == 0) + return 1u; + uint result = x; for(uint i = 1; i < y; ++i) result *= x; @@ -140,7 +144,7 @@ namespace detail #if(GLM_COMPILER & (GLM_COMPILER_VC | GLM_COMPILER_GCC)) - GLM_FUNC_QUALIFIER unsigned int nlz(unsigned int x) + GLM_FUNC_QUALIFIER unsigned int nlz(unsigned int x) { return 31u - findMSB(x); } @@ -148,7 +152,7 @@ namespace detail #else // Hackers Delight: http://www.hackersdelight.org/HDcode/nlz.c.txt - GLM_FUNC_QUALIFIER unsigned int nlz(unsigned int x) + GLM_FUNC_QUALIFIER unsigned int nlz(unsigned int x) { int y, m, n; diff --git a/external/include/glm/gtx/intersect.hpp b/external/include/glm/gtx/intersect.hpp index 33b6e99..cc7f929 100644 --- a/external/include/glm/gtx/intersect.hpp +++ b/external/include/glm/gtx/intersect.hpp @@ -7,9 +7,9 @@ /// @defgroup gtx_intersect GLM_GTX_intersect /// @ingroup gtx /// -/// @brief Add intersection functions +/// Include to use the features of this extension. /// -/// need to be included to use these functionalities. +/// Add intersection functions #pragma once @@ -21,6 +21,10 @@ #include "../gtx/closest_point.hpp" #include "../gtx/vector_query.hpp" +#ifndef GLM_ENABLE_EXPERIMENTAL +# error "GLM: GLM_GTX_closest_point is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." +#endif + #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) # pragma message("GLM: GLM_GTX_closest_point extension included") #endif @@ -33,52 +37,53 @@ namespace glm //! Compute the intersection of a ray and a plane. //! Ray direction and plane normal must be unit length. //! From GLM_GTX_intersect extension. - template + template GLM_FUNC_DECL bool intersectRayPlane( - genType const & orig, genType const & dir, - genType const & planeOrig, genType const & planeNormal, + genType const& orig, genType const& dir, + genType const& planeOrig, genType const& planeNormal, typename genType::value_type & intersectionDistance); //! Compute the intersection of a ray and a triangle. + /// Based om Tomas Möller implementation http://fileadmin.cs.lth.se/cs/Personal/Tomas_Akenine-Moller/raytri/ //! From GLM_GTX_intersect extension. - template + template GLM_FUNC_DECL bool intersectRayTriangle( - genType const & orig, genType const & dir, - genType const & vert0, genType const & vert1, genType const & vert2, - genType & baryPosition); + vec<3, T, Q> const& orig, vec<3, T, Q> const& dir, + vec<3, T, Q> const& v0, vec<3, T, Q> const& v1, vec<3, T, Q> const& v2, + vec<2, T, Q>& baryPosition, T& distance); //! Compute the intersection of a line and a triangle. //! From GLM_GTX_intersect extension. - template + template GLM_FUNC_DECL bool intersectLineTriangle( - genType const & orig, genType const & dir, - genType const & vert0, genType const & vert1, genType const & vert2, + genType const& orig, genType const& dir, + genType const& vert0, genType const& vert1, genType const& vert2, genType & position); - //! Compute the intersection distance of a ray and a sphere. + //! Compute the intersection distance of a ray and a sphere. //! The ray direction vector is unit length. //! From GLM_GTX_intersect extension. - template + template GLM_FUNC_DECL bool intersectRaySphere( - genType const & rayStarting, genType const & rayNormalizedDirection, - genType const & sphereCenter, typename genType::value_type const sphereRadiusSquered, + genType const& rayStarting, genType const& rayNormalizedDirection, + genType const& sphereCenter, typename genType::value_type const sphereRadiusSquered, typename genType::value_type & intersectionDistance); //! Compute the intersection of a ray and a sphere. //! From GLM_GTX_intersect extension. - template + template GLM_FUNC_DECL bool intersectRaySphere( - genType const & rayStarting, genType const & rayNormalizedDirection, - genType const & sphereCenter, const typename genType::value_type sphereRadius, + genType const& rayStarting, genType const& rayNormalizedDirection, + genType const& sphereCenter, const typename genType::value_type sphereRadius, genType & intersectionPosition, genType & intersectionNormal); //! Compute the intersection of a line and a sphere. //! From GLM_GTX_intersect extension - template + template GLM_FUNC_DECL bool intersectLineSphere( - genType const & point0, genType const & point1, - genType const & sphereCenter, typename genType::value_type sphereRadius, - genType & intersectionPosition1, genType & intersectionNormal1, + genType const& point0, genType const& point1, + genType const& sphereCenter, typename genType::value_type sphereRadius, + genType & intersectionPosition1, genType & intersectionNormal1, genType & intersectionPosition2 = genType(), genType & intersectionNormal2 = genType()); /// @} diff --git a/external/include/glm/gtx/intersect.inl b/external/include/glm/gtx/intersect.inl index 904d6cc..d10d65b 100644 --- a/external/include/glm/gtx/intersect.inl +++ b/external/include/glm/gtx/intersect.inl @@ -3,11 +3,11 @@ namespace glm { - template + template GLM_FUNC_QUALIFIER bool intersectRayPlane ( - genType const & orig, genType const & dir, - genType const & planeOrig, genType const & planeNormal, + genType const& orig, genType const& dir, + genType const& planeOrig, genType const& planeNormal, typename genType::value_type & intersectionDistance ) { @@ -23,21 +23,75 @@ namespace glm return false; } - template + template GLM_FUNC_QUALIFIER bool intersectRayTriangle ( - genType const & orig, genType const & dir, - genType const & v0, genType const & v1, genType const & v2, - genType & baryPosition + vec<3, T, Q> const& orig, vec<3, T, Q> const& dir, + vec<3, T, Q> const& vert0, vec<3, T, Q> const& vert1, vec<3, T, Q> const& vert2, + vec<2, T, Q>& baryPosition, T& distance ) { - genType e1 = v1 - v0; - genType e2 = v2 - v0; + // find vectors for two edges sharing vert0 + vec<3, T, Q> const edge1 = vert1 - vert0; + vec<3, T, Q> const edge2 = vert2 - vert0; - genType p = glm::cross(dir, e2); + // begin calculating determinant - also used to calculate U parameter + vec<3, T, Q> const p = glm::cross(dir, edge2); - typename genType::value_type a = glm::dot(e1, p); + // if determinant is near zero, ray lies in plane of triangle + T const det = glm::dot(edge1, p); + vec<3, T, Q> qvec; + + if(det > std::numeric_limits::epsilon()) + { + // calculate distance from vert0 to ray origin + vec<3, T, Q> const tvec = orig - vert0; + + // calculate U parameter and test bounds + baryPosition.x = glm::dot(tvec, p); + if(baryPosition.x < static_cast(0) || baryPosition.x > det) + return false; + + // prepare to test V parameter + qvec = glm::cross(tvec, edge1); + + // calculate V parameter and test bounds + baryPosition.y = glm::dot(dir, qvec); + if((baryPosition.y < static_cast(0)) || ((baryPosition.x + baryPosition.y) > det)) + return false; + } + else if(det < -std::numeric_limits::epsilon()) + { + // calculate distance from vert0 to ray origin + vec<3, T, Q> const tvec = orig - vert0; + + // calculate U parameter and test bounds + baryPosition.x = glm::dot(tvec, p); + if((baryPosition.x > static_cast(0)) || (baryPosition.x < det)) + return false; + + // prepare to test V parameter + qvec = glm::cross(tvec, edge1); + + // calculate V parameter and test bounds + baryPosition.y = glm::dot(dir, qvec); + if((baryPosition.y > static_cast(0)) || (baryPosition.x + baryPosition.y < det)) + return false; + } + else + return false; // ray is parallel to the plane of the triangle + + T inv_det = static_cast(1) / det; + + // calculate distance, ray intersects triangle + distance = glm::dot(edge2, qvec) * inv_det; + baryPosition *= inv_det; + + return true; + } + +/* typename genType::value_type Epsilon = std::numeric_limits::epsilon(); if(a < Epsilon && a > -Epsilon) return false; @@ -62,12 +116,13 @@ namespace glm return baryPosition.z >= typename genType::value_type(0.0f); } +*/ - template + template GLM_FUNC_QUALIFIER bool intersectLineTriangle ( - genType const & orig, genType const & dir, - genType const & vert0, genType const & vert1, genType const & vert2, + genType const& orig, genType const& dir, + genType const& vert0, genType const& vert1, genType const& vert2, genType & position ) { @@ -101,11 +156,11 @@ namespace glm return true; } - template + template GLM_FUNC_QUALIFIER bool intersectRaySphere ( - genType const & rayStarting, genType const & rayNormalizedDirection, - genType const & sphereCenter, const typename genType::value_type sphereRadiusSquered, + genType const& rayStarting, genType const& rayNormalizedDirection, + genType const& sphereCenter, const typename genType::value_type sphereRadiusSquered, typename genType::value_type & intersectionDistance ) { @@ -122,11 +177,11 @@ namespace glm return intersectionDistance > Epsilon; } - template + template GLM_FUNC_QUALIFIER bool intersectRaySphere ( - genType const & rayStarting, genType const & rayNormalizedDirection, - genType const & sphereCenter, const typename genType::value_type sphereRadius, + genType const& rayStarting, genType const& rayNormalizedDirection, + genType const& sphereCenter, const typename genType::value_type sphereRadius, genType & intersectionPosition, genType & intersectionNormal ) { @@ -140,12 +195,12 @@ namespace glm return false; } - template + template GLM_FUNC_QUALIFIER bool intersectLineSphere ( - genType const & point0, genType const & point1, - genType const & sphereCenter, typename genType::value_type sphereRadius, - genType & intersectionPoint1, genType & intersectionNormal1, + genType const& point0, genType const& point1, + genType const& sphereCenter, typename genType::value_type sphereRadius, + genType & intersectionPoint1, genType & intersectionNormal1, genType & intersectionPoint2, genType & intersectionNormal2 ) { diff --git a/external/include/glm/gtx/io.hpp b/external/include/glm/gtx/io.hpp index 6aa8415..93db75a 100644 --- a/external/include/glm/gtx/io.hpp +++ b/external/include/glm/gtx/io.hpp @@ -8,14 +8,14 @@ /// /// @defgroup gtx_io GLM_GTX_io /// @ingroup gtx -/// -/// @brief std::[w]ostream support for glm types /// -/// std::[w]ostream support for glm types + precision/width/etc. manipulators +/// Include to use the features of this extension. +/// +/// std::[w]ostream support for glm types +/// +/// std::[w]ostream support for glm types + qualifier/width/etc. manipulators /// based on howard hinnant's std::chrono io proposal /// [http://home.roadrunner.com/~hinnant/bloomington/chrono_io.html] -/// -/// needs to be included to use these functionalities. #pragma once @@ -23,6 +23,10 @@ #include "../glm.hpp" #include "../gtx/quaternion.hpp" +#ifndef GLM_ENABLE_EXPERIMENTAL +# error "GLM: GLM_GTX_io is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." +#endif + #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) # pragma message("GLM: GLM_GTX_io extension included") #endif @@ -40,7 +44,7 @@ namespace glm { enum order_type { column_major, row_major}; - template + template class format_punct : public std::locale::facet { typedef CTy char_type; @@ -63,7 +67,7 @@ namespace glm GLM_FUNC_DECL explicit format_punct(format_punct const&); }; - template > + template > class basic_state_saver { public: @@ -92,7 +96,7 @@ namespace glm typedef basic_state_saver state_saver; typedef basic_state_saver wstate_saver; - template > + template > class basic_format_saver { public: @@ -124,7 +128,7 @@ namespace glm GLM_FUNC_DECL explicit width(unsigned); }; - template + template struct delimeter { CTy value[3]; @@ -141,55 +145,55 @@ namespace glm // functions, inlined (inline) - template + template FTy const& get_facet(std::basic_ios&); - template + template std::basic_ios& formatted(std::basic_ios&); - template + template std::basic_ios& unformattet(std::basic_ios&); - template + template std::basic_ostream& operator<<(std::basic_ostream&, precision const&); - template + template std::basic_ostream& operator<<(std::basic_ostream&, width const&); - template + template std::basic_ostream& operator<<(std::basic_ostream&, delimeter const&); - template + template std::basic_ostream& operator<<(std::basic_ostream&, order const&); }//namespace io - template - GLM_FUNC_DECL std::basic_ostream& operator<<(std::basic_ostream&, tquat const&); - template - GLM_FUNC_DECL std::basic_ostream& operator<<(std::basic_ostream&, tvec1 const&); - template - GLM_FUNC_DECL std::basic_ostream& operator<<(std::basic_ostream&, tvec2 const&); - template - GLM_FUNC_DECL std::basic_ostream& operator<<(std::basic_ostream&, tvec3 const&); - template - GLM_FUNC_DECL std::basic_ostream& operator<<(std::basic_ostream&, tvec4 const&); - template - GLM_FUNC_DECL std::basic_ostream& operator<<(std::basic_ostream&, tmat2x2 const&); - template - GLM_FUNC_DECL std::basic_ostream& operator<<(std::basic_ostream&, tmat2x3 const&); - template - GLM_FUNC_DECL std::basic_ostream& operator<<(std::basic_ostream&, tmat2x4 const&); - template - GLM_FUNC_DECL std::basic_ostream& operator<<(std::basic_ostream&, tmat3x2 const&); - template - GLM_FUNC_DECL std::basic_ostream& operator<<(std::basic_ostream&, tmat3x3 const&); - template - GLM_FUNC_DECL std::basic_ostream& operator<<(std::basic_ostream&, tmat3x4 const&); - template - GLM_FUNC_DECL std::basic_ostream& operator<<(std::basic_ostream&, tmat4x2 const&); - template - GLM_FUNC_DECL std::basic_ostream& operator<<(std::basic_ostream&, tmat4x3 const&); - template - GLM_FUNC_DECL std::basic_ostream& operator<<(std::basic_ostream&, tmat4x4 const&); - - template + template + GLM_FUNC_DECL std::basic_ostream& operator<<(std::basic_ostream&, tquat const&); + template + GLM_FUNC_DECL std::basic_ostream& operator<<(std::basic_ostream&, vec<1, T, Q> const&); + template + GLM_FUNC_DECL std::basic_ostream& operator<<(std::basic_ostream&, vec<2, T, Q> const&); + template + GLM_FUNC_DECL std::basic_ostream& operator<<(std::basic_ostream&, vec<3, T, Q> const&); + template + GLM_FUNC_DECL std::basic_ostream& operator<<(std::basic_ostream&, vec<4, T, Q> const&); + template + GLM_FUNC_DECL std::basic_ostream& operator<<(std::basic_ostream&, mat<2, 2, T, Q> const&); + template + GLM_FUNC_DECL std::basic_ostream& operator<<(std::basic_ostream&, mat<2, 3, T, Q> const&); + template + GLM_FUNC_DECL std::basic_ostream& operator<<(std::basic_ostream&, mat<2, 4, T, Q> const&); + template + GLM_FUNC_DECL std::basic_ostream& operator<<(std::basic_ostream&, mat<3, 2, T, Q> const&); + template + GLM_FUNC_DECL std::basic_ostream& operator<<(std::basic_ostream&, mat<3, 3, T, Q> const&); + template + GLM_FUNC_DECL std::basic_ostream& operator<<(std::basic_ostream&, mat<3, 4, T, Q> const&); + template + GLM_FUNC_DECL std::basic_ostream& operator<<(std::basic_ostream&, mat<4, 2, T, Q> const&); + template + GLM_FUNC_DECL std::basic_ostream& operator<<(std::basic_ostream&, mat<4, 3, T, Q> const&); + template + GLM_FUNC_DECL std::basic_ostream& operator<<(std::basic_ostream&, mat<4, 4, T, Q> const&); + + template GLM_FUNC_DECL std::basic_ostream & operator<<(std::basic_ostream &, - std::pair const, tmat4x4 const> const &); + std::pair const, mat<4, 4, T, Q> const> const&); /// @} }//namespace glm diff --git a/external/include/glm/gtx/io.inl b/external/include/glm/gtx/io.inl index 9b70a5f..edb76bf 100644 --- a/external/include/glm/gtx/io.inl +++ b/external/include/glm/gtx/io.inl @@ -10,7 +10,7 @@ namespace glm{ namespace io { - template + template GLM_FUNC_QUALIFIER format_punct::format_punct(size_t a) : std::locale::facet(a) , formatted(true) @@ -24,7 +24,7 @@ namespace io , order(column_major) {} - template + template GLM_FUNC_QUALIFIER format_punct::format_punct(format_punct const& a) : std::locale::facet(0) , formatted(a.formatted) @@ -38,9 +38,9 @@ namespace io , order(a.order) {} - template std::locale::id format_punct::id; + template std::locale::id format_punct::id; - template + template GLM_FUNC_QUALIFIER basic_state_saver::basic_state_saver(std::basic_ios& a) : state_(a) , flags_(a.flags()) @@ -50,7 +50,7 @@ namespace io , locale_(a.getloc()) {} - template + template GLM_FUNC_QUALIFIER basic_state_saver::~basic_state_saver() { state_.imbue(locale_); @@ -60,14 +60,14 @@ namespace io state_.flags(flags_); } - template + template GLM_FUNC_QUALIFIER basic_format_saver::basic_format_saver(std::basic_ios& a) : bss_(a) { a.imbue(std::locale(a.getloc(), new format_punct(get_facet >(a)))); } - template + template GLM_FUNC_QUALIFIER basic_format_saver::~basic_format_saver() {} @@ -80,7 +80,7 @@ namespace io : value(a) {} - template + template GLM_FUNC_QUALIFIER delimeter::delimeter(CTy a, CTy b, CTy c) : value() { @@ -93,7 +93,7 @@ namespace io : value(a) {} - template + template GLM_FUNC_QUALIFIER FTy const& get_facet(std::basic_ios& ios) { if(!std::has_facet(ios.getloc())) @@ -102,35 +102,35 @@ namespace io return std::use_facet(ios.getloc()); } - template + template GLM_FUNC_QUALIFIER std::basic_ios& formatted(std::basic_ios& ios) { const_cast&>(get_facet >(ios)).formatted = true; return ios; } - template + template GLM_FUNC_QUALIFIER std::basic_ios& unformatted(std::basic_ios& ios) { const_cast&>(get_facet >(ios)).formatted = false; return ios; } - template + template GLM_FUNC_QUALIFIER std::basic_ostream& operator<<(std::basic_ostream& os, precision const& a) { const_cast&>(get_facet >(os)).precision = a.value; return os; } - template + template GLM_FUNC_QUALIFIER std::basic_ostream& operator<<(std::basic_ostream& os, width const& a) { const_cast&>(get_facet >(os)).width = a.value; return os; } - template + template GLM_FUNC_QUALIFIER std::basic_ostream& operator<<(std::basic_ostream& os, delimeter const& a) { format_punct & fmt(const_cast&>(get_facet >(os))); @@ -142,7 +142,7 @@ namespace io return os; } - template + template GLM_FUNC_QUALIFIER std::basic_ostream& operator<<(std::basic_ostream& os, order const& a) { const_cast&>(get_facet >(os)).order = a.value; @@ -152,17 +152,17 @@ namespace io namespace detail { - template class V, typename T, precision P> + template GLM_FUNC_QUALIFIER std::basic_ostream& - print_vector_on(std::basic_ostream& os, V const& a) + print_vector_on(std::basic_ostream& os, V const& a) { typename std::basic_ostream::sentry const cerberus(os); if(cerberus) { - io::format_punct const & fmt(io::get_facet >(os)); + io::format_punct const& fmt(io::get_facet >(os)); - length_t const& components(type::components); + length_t const& components(type::components); if(fmt.formatted) { @@ -195,49 +195,49 @@ namespace detail } }//namespace detail - template - GLM_FUNC_QUALIFIER std::basic_ostream& operator<<(std::basic_ostream& os, tquat const& a) + template + GLM_FUNC_QUALIFIER std::basic_ostream& operator<<(std::basic_ostream& os, tquat const& a) { return detail::print_vector_on(os, a); } - template - GLM_FUNC_QUALIFIER std::basic_ostream& operator<<(std::basic_ostream& os, tvec1 const& a) + template + GLM_FUNC_QUALIFIER std::basic_ostream& operator<<(std::basic_ostream& os, vec<1, T, Q> const& a) { return detail::print_vector_on(os, a); } - template - GLM_FUNC_QUALIFIER std::basic_ostream& operator<<(std::basic_ostream& os, tvec2 const& a) + template + GLM_FUNC_QUALIFIER std::basic_ostream& operator<<(std::basic_ostream& os, vec<2, T, Q> const& a) { return detail::print_vector_on(os, a); } - template - GLM_FUNC_QUALIFIER std::basic_ostream& operator<<(std::basic_ostream& os, tvec3 const& a) + template + GLM_FUNC_QUALIFIER std::basic_ostream& operator<<(std::basic_ostream& os, vec<3, T, Q> const& a) { return detail::print_vector_on(os, a); } - template - GLM_FUNC_QUALIFIER std::basic_ostream& operator<<(std::basic_ostream& os, tvec4 const& a) + template + GLM_FUNC_QUALIFIER std::basic_ostream& operator<<(std::basic_ostream& os, vec<4, T, Q> const& a) { return detail::print_vector_on(os, a); } namespace detail { - template class M, typename T, precision P> - GLM_FUNC_QUALIFIER std::basic_ostream& print_matrix_on(std::basic_ostream& os, M const& a) + template class M, length_t C, length_t R, typename T, qualifier Q> + GLM_FUNC_QUALIFIER std::basic_ostream& print_matrix_on(std::basic_ostream& os, M const& a) { typename std::basic_ostream::sentry const cerberus(os); if(cerberus) { - io::format_punct const & fmt(io::get_facet >(os)); + io::format_punct const& fmt(io::get_facet >(os)); - length_t const& cols(type::cols); - length_t const& rows(type::rows); + length_t const& cols(type >::cols); + length_t const& rows(type >::rows); if(fmt.formatted) { @@ -313,74 +313,74 @@ namespace detail } }//namespace detail - template - GLM_FUNC_QUALIFIER std::basic_ostream& operator<<(std::basic_ostream& os, tmat2x2 const& a) + template + GLM_FUNC_QUALIFIER std::basic_ostream& operator<<(std::basic_ostream& os, mat<2, 2, T, Q> const& a) { return detail::print_matrix_on(os, a); } - template - GLM_FUNC_QUALIFIER std::basic_ostream& operator<<(std::basic_ostream& os, tmat2x3 const& a) + template + GLM_FUNC_QUALIFIER std::basic_ostream& operator<<(std::basic_ostream& os, mat<2, 3, T, Q> const& a) { return detail::print_matrix_on(os, a); } - template - GLM_FUNC_QUALIFIER std::basic_ostream& operator<<(std::basic_ostream& os, tmat2x4 const& a) + template + GLM_FUNC_QUALIFIER std::basic_ostream& operator<<(std::basic_ostream& os, mat<2, 4, T, Q> const& a) { return detail::print_matrix_on(os, a); } - template - GLM_FUNC_QUALIFIER std::basic_ostream& operator<<(std::basic_ostream& os, tmat3x2 const& a) + template + GLM_FUNC_QUALIFIER std::basic_ostream& operator<<(std::basic_ostream& os, mat<3, 2, T, Q> const& a) { return detail::print_matrix_on(os, a); } - template - GLM_FUNC_QUALIFIER std::basic_ostream& operator<<(std::basic_ostream& os, tmat3x3 const& a) + template + GLM_FUNC_QUALIFIER std::basic_ostream& operator<<(std::basic_ostream& os, mat<3, 3, T, Q> const& a) { return detail::print_matrix_on(os, a); } - template - GLM_FUNC_QUALIFIER std::basic_ostream & operator<<(std::basic_ostream& os, tmat3x4 const& a) + template + GLM_FUNC_QUALIFIER std::basic_ostream & operator<<(std::basic_ostream& os, mat<3, 4, T, Q> const& a) { return detail::print_matrix_on(os, a); } - template - GLM_FUNC_QUALIFIER std::basic_ostream & operator<<(std::basic_ostream& os, tmat4x2 const& a) + template + GLM_FUNC_QUALIFIER std::basic_ostream & operator<<(std::basic_ostream& os, mat<4, 2, T, Q> const& a) { return detail::print_matrix_on(os, a); } - template - GLM_FUNC_QUALIFIER std::basic_ostream & operator<<(std::basic_ostream& os, tmat4x3 const& a) + template + GLM_FUNC_QUALIFIER std::basic_ostream & operator<<(std::basic_ostream& os, mat<4, 3, T, Q> const& a) { return detail::print_matrix_on(os, a); } - template - GLM_FUNC_QUALIFIER std::basic_ostream & operator<<(std::basic_ostream& os, tmat4x4 const& a) + template + GLM_FUNC_QUALIFIER std::basic_ostream & operator<<(std::basic_ostream& os, mat<4, 4, T, Q> const& a) { return detail::print_matrix_on(os, a); } namespace detail { - template class M, typename T, precision P> - GLM_FUNC_QUALIFIER std::basic_ostream& print_matrix_pair_on(std::basic_ostream& os, std::pair const, M const> const& a) + template class M, length_t C, length_t R, typename T, qualifier Q> + GLM_FUNC_QUALIFIER std::basic_ostream& print_matrix_pair_on(std::basic_ostream& os, std::pair const, M const> const& a) { typename std::basic_ostream::sentry const cerberus(os); if(cerberus) { io::format_punct const& fmt(io::get_facet >(os)); - M const& ml(a.first); - M const& mr(a.second); - length_t const& cols(type::cols); - length_t const& rows(type::rows); + M const& ml(a.first); + M const& mr(a.second); + length_t const& cols(type >::cols); + length_t const& rows(type >::rows); if(fmt.formatted) { @@ -409,7 +409,7 @@ namespace detail if(0 != i) os << fmt.space; - os << column(ml, i) << ((cols-1 != i) ? fmt.space : fmt.delim_right) << fmt.space << ((0 != i) ? fmt.space : fmt.delim_left) << column(mr, i); + os << column(ml, i) << ((cols-1 != i) ? fmt.space : fmt.delim_right) << fmt.space << ((0 != i) ? fmt.space : fmt.delim_left) << column(mr, i); if(cols-1 != i) os << fmt.newline; @@ -430,11 +430,11 @@ namespace detail } }//namespace detail - template + template GLM_FUNC_QUALIFIER std::basic_ostream& operator<<( std::basic_ostream & os, - std::pair const, - tmat4x4 const> const& a) + std::pair const, + mat<4, 4, T, Q> const> const& a) { return detail::print_matrix_pair_on(os, a); } diff --git a/external/include/glm/gtx/log_base.hpp b/external/include/glm/gtx/log_base.hpp index 7958fc3..e873e35 100644 --- a/external/include/glm/gtx/log_base.hpp +++ b/external/include/glm/gtx/log_base.hpp @@ -6,15 +6,19 @@ /// @defgroup gtx_log_base GLM_GTX_log_base /// @ingroup gtx /// -/// @brief Logarithm for any base. base can be a vector or a scalar. +/// Include to use the features of this extension. /// -/// need to be included to use these functionalities. +/// Logarithm for any base. base can be a vector or a scalar. #pragma once // Dependency: #include "../glm.hpp" +#ifndef GLM_ENABLE_EXPERIMENTAL +# error "GLM: GLM_GTX_log_base is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." +#endif + #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) # pragma message("GLM: GLM_GTX_log_base extension included") #endif @@ -26,17 +30,17 @@ namespace glm /// Logarithm for any base. /// From GLM_GTX_log_base. - template + template GLM_FUNC_DECL genType log( - genType const & x, - genType const & base); + genType const& x, + genType const& base); /// Logarithm for any base. /// From GLM_GTX_log_base. - template class vecType> - GLM_FUNC_DECL vecType sign( - vecType const & x, - vecType const & base); + template + GLM_FUNC_DECL vec sign( + vec const& x, + vec const& base); /// @} }//namespace glm diff --git a/external/include/glm/gtx/log_base.inl b/external/include/glm/gtx/log_base.inl index 8005d1b..981bacc 100644 --- a/external/include/glm/gtx/log_base.inl +++ b/external/include/glm/gtx/log_base.inl @@ -3,15 +3,15 @@ namespace glm { - template - GLM_FUNC_QUALIFIER genType log(genType const & x, genType const & base) + template + GLM_FUNC_QUALIFIER genType log(genType const& x, genType const& base) { - assert(x != genType(0)); + assert(!detail::compute_equal::call(x, static_cast(0))); return glm::log(x) / glm::log(base); } - template class vecType> - GLM_FUNC_QUALIFIER vecType log(vecType const & x, vecType const & base) + template + GLM_FUNC_QUALIFIER vec log(vec const& x, vec const& base) { return glm::log(x) / glm::log(base); } diff --git a/external/include/glm/gtx/matrix_cross_product.hpp b/external/include/glm/gtx/matrix_cross_product.hpp index d920f4e..dfad8c1 100644 --- a/external/include/glm/gtx/matrix_cross_product.hpp +++ b/external/include/glm/gtx/matrix_cross_product.hpp @@ -7,15 +7,19 @@ /// @defgroup gtx_matrix_cross_product GLM_GTX_matrix_cross_product /// @ingroup gtx /// -/// @brief Build cross product matrices +/// Include to use the features of this extension. /// -/// need to be included to use these functionalities. +/// Build cross product matrices #pragma once // Dependency: #include "../glm.hpp" +#ifndef GLM_ENABLE_EXPERIMENTAL +# error "GLM: GLM_GTX_matrix_cross_product is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." +#endif + #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) # pragma message("GLM: GLM_GTX_matrix_cross_product extension included") #endif @@ -27,15 +31,15 @@ namespace glm //! Build a cross product matrix. //! From GLM_GTX_matrix_cross_product extension. - template - GLM_FUNC_DECL tmat3x3 matrixCross3( - tvec3 const & x); - + template + GLM_FUNC_DECL mat<3, 3, T, Q> matrixCross3( + vec<3, T, Q> const& x); + //! Build a cross product matrix. //! From GLM_GTX_matrix_cross_product extension. - template - GLM_FUNC_DECL tmat4x4 matrixCross4( - tvec3 const & x); + template + GLM_FUNC_DECL mat<4, 4, T, Q> matrixCross4( + vec<3, T, Q> const& x); /// @} }//namespace glm diff --git a/external/include/glm/gtx/matrix_cross_product.inl b/external/include/glm/gtx/matrix_cross_product.inl index 16f07e9..d8ec11f 100644 --- a/external/include/glm/gtx/matrix_cross_product.inl +++ b/external/include/glm/gtx/matrix_cross_product.inl @@ -3,13 +3,13 @@ namespace glm { - template - GLM_FUNC_QUALIFIER tmat3x3 matrixCross3 + template + GLM_FUNC_QUALIFIER mat<3, 3, T, Q> matrixCross3 ( - tvec3 const & x + vec<3, T, Q> const& x ) { - tmat3x3 Result(T(0)); + mat<3, 3, T, Q> Result(T(0)); Result[0][1] = x.z; Result[1][0] = -x.z; Result[0][2] = -x.y; @@ -19,13 +19,13 @@ namespace glm return Result; } - template - GLM_FUNC_QUALIFIER tmat4x4 matrixCross4 + template + GLM_FUNC_QUALIFIER mat<4, 4, T, Q> matrixCross4 ( - tvec3 const & x + vec<3, T, Q> const& x ) { - tmat4x4 Result(T(0)); + mat<4, 4, T, Q> Result(T(0)); Result[0][1] = x.z; Result[1][0] = -x.z; Result[0][2] = -x.y; diff --git a/external/include/glm/gtx/matrix_decompose.hpp b/external/include/glm/gtx/matrix_decompose.hpp index e163f5a..85bb289 100644 --- a/external/include/glm/gtx/matrix_decompose.hpp +++ b/external/include/glm/gtx/matrix_decompose.hpp @@ -6,9 +6,9 @@ /// @defgroup gtx_matrix_decompose GLM_GTX_matrix_decompose /// @ingroup gtx /// -/// @brief Decomposes a model matrix to translations, rotation and scale components +/// Include to use the features of this extension. /// -/// need to be included to use these functionalities. +/// Decomposes a model matrix to translations, rotation and scale components #pragma once @@ -20,6 +20,10 @@ #include "../gtc/quaternion.hpp" #include "../gtc/matrix_transform.hpp" +#ifndef GLM_ENABLE_EXPERIMENTAL +# error "GLM: GLM_GTX_matrix_decompose is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." +#endif + #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) # pragma message("GLM: GLM_GTX_matrix_decompose extension included") #endif @@ -29,12 +33,12 @@ namespace glm /// @addtogroup gtx_matrix_decompose /// @{ - /// Decomposes a model matrix to translations, rotation and scale components + /// Decomposes a model matrix to translations, rotation and scale components /// @see gtx_matrix_decompose - template + template GLM_FUNC_DECL bool decompose( - tmat4x4 const & modelMatrix, - tvec3 & scale, tquat & orientation, tvec3 & translation, tvec3 & skew, tvec4 & perspective); + mat<4, 4, T, Q> const& modelMatrix, + vec<3, T, Q> & scale, tquat & orientation, vec<3, T, Q> & translation, vec<3, T, Q> & skew, vec<4, T, Q> & perspective); /// @} }//namespace glm diff --git a/external/include/glm/gtx/matrix_decompose.inl b/external/include/glm/gtx/matrix_decompose.inl index 7194e9d..02a5acc 100644 --- a/external/include/glm/gtx/matrix_decompose.inl +++ b/external/include/glm/gtx/matrix_decompose.inl @@ -1,22 +1,25 @@ /// @ref gtx_matrix_decompose /// @file glm/gtx/matrix_decompose.inl +#include "../gtc/constants.hpp" +#include "../gtc/epsilon.hpp" + namespace glm{ namespace detail { /// Make a linear combination of two vectors and return the result. // result = (a * ascl) + (b * bscl) - template - GLM_FUNC_QUALIFIER tvec3 combine( - tvec3 const & a, - tvec3 const & b, + template + GLM_FUNC_QUALIFIER vec<3, T, Q> combine( + vec<3, T, Q> const& a, + vec<3, T, Q> const& b, T ascl, T bscl) { return (a * ascl) + (b * bscl); } - template - GLM_FUNC_QUALIFIER tvec3 scale(tvec3 const& v, T desiredLength) + template + GLM_FUNC_QUALIFIER vec<3, T, Q> scale(vec<3, T, Q> const& v, T desiredLength) { return v * desiredLength / length(v); } @@ -26,13 +29,13 @@ namespace detail // http://www.opensource.apple.com/source/WebCore/WebCore-514/platform/graphics/transforms/TransformationMatrix.cpp // Decomposes the mode matrix to translations,rotation scale components - template - GLM_FUNC_QUALIFIER bool decompose(tmat4x4 const & ModelMatrix, tvec3 & Scale, tquat & Orientation, tvec3 & Translation, tvec3 & Skew, tvec4 & Perspective) + template + GLM_FUNC_QUALIFIER bool decompose(mat<4, 4, T, Q> const& ModelMatrix, vec<3, T, Q> & Scale, tquat & Orientation, vec<3, T, Q> & Translation, vec<3, T, Q> & Skew, vec<4, T, Q> & Perspective) { - tmat4x4 LocalMatrix(ModelMatrix); + mat<4, 4, T, Q> LocalMatrix(ModelMatrix); // Normalize the matrix. - if(LocalMatrix[3][3] == static_cast(0)) + if(epsilonEqual(LocalMatrix[3][3], static_cast(0), epsilon())) return false; for(length_t i = 0; i < 4; ++i) @@ -41,21 +44,24 @@ namespace detail // perspectiveMatrix is used to solve for perspective, but it also provides // an easy way to test for singularity of the upper 3x3 component. - tmat4x4 PerspectiveMatrix(LocalMatrix); + mat<4, 4, T, Q> PerspectiveMatrix(LocalMatrix); for(length_t i = 0; i < 3; i++) PerspectiveMatrix[i][3] = static_cast(0); PerspectiveMatrix[3][3] = static_cast(1); /// TODO: Fixme! - if(determinant(PerspectiveMatrix) == static_cast(0)) + if(epsilonEqual(determinant(PerspectiveMatrix), static_cast(0), epsilon())) return false; // First, isolate perspective. This is the messiest. - if(LocalMatrix[0][3] != static_cast(0) || LocalMatrix[1][3] != static_cast(0) || LocalMatrix[2][3] != static_cast(0)) + if( + epsilonNotEqual(LocalMatrix[0][3], static_cast(0), epsilon()) || + epsilonNotEqual(LocalMatrix[1][3], static_cast(0), epsilon()) || + epsilonNotEqual(LocalMatrix[2][3], static_cast(0), epsilon())) { // rightHandSide is the right hand side of the equation. - tvec4 RightHandSide; + vec<4, T, Q> RightHandSide; RightHandSide[0] = LocalMatrix[0][3]; RightHandSide[1] = LocalMatrix[1][3]; RightHandSide[2] = LocalMatrix[2][3]; @@ -64,8 +70,8 @@ namespace detail // Solve the equation by inverting PerspectiveMatrix and multiplying // rightHandSide by the inverse. (This is the easiest way, not // necessarily the best.) - tmat4x4 InversePerspectiveMatrix = glm::inverse(PerspectiveMatrix);// inverse(PerspectiveMatrix, inversePerspectiveMatrix); - tmat4x4 TransposedInversePerspectiveMatrix = glm::transpose(InversePerspectiveMatrix);// transposeMatrix4(inversePerspectiveMatrix, transposedInversePerspectiveMatrix); + mat<4, 4, T, Q> InversePerspectiveMatrix = glm::inverse(PerspectiveMatrix);// inverse(PerspectiveMatrix, inversePerspectiveMatrix); + mat<4, 4, T, Q> TransposedInversePerspectiveMatrix = glm::transpose(InversePerspectiveMatrix);// transposeMatrix4(inversePerspectiveMatrix, transposedInversePerspectiveMatrix); Perspective = TransposedInversePerspectiveMatrix * RightHandSide; // v4MulPointByMatrix(rightHandSide, transposedInversePerspectiveMatrix, perspectivePoint); @@ -77,19 +83,19 @@ namespace detail else { // No perspective. - Perspective = tvec4(0, 0, 0, 1); + Perspective = vec<4, T, Q>(0, 0, 0, 1); } // Next take care of translation (easy). - Translation = tvec3(LocalMatrix[3]); - LocalMatrix[3] = tvec4(0, 0, 0, LocalMatrix[3].w); + Translation = vec<3, T, Q>(LocalMatrix[3]); + LocalMatrix[3] = vec<4, T, Q>(0, 0, 0, LocalMatrix[3].w); - tvec3 Row[3], Pdum3; + vec<3, T, Q> Row[3], Pdum3; // Now get scale and shear. for(length_t i = 0; i < 3; ++i) - for(int j = 0; j < 3; ++j) - Row[i][j] = LocalMatrix[i][j]; + for(length_t j = 0; j < 3; ++j) + Row[i][j] = LocalMatrix[i][j]; // Compute X scale factor and normalize first row. Scale.x = length(Row[0]);// v3Length(Row[0]); @@ -147,47 +153,34 @@ namespace detail // ret.rotateZ = 0; // } - T s, t, x, y, z, w; - - t = Row[0][0] + Row[1][1] + Row[2][2] + static_cast(1); - - if(t > static_cast(1e-4)) + int i, j, k = 0; + float root, trace = Row[0].x + Row[1].y + Row[2].z; + if(trace > static_cast(0)) { - s = static_cast(0.5) / sqrt(t); - w = static_cast(0.25) / s; - x = (Row[2][1] - Row[1][2]) * s; - y = (Row[0][2] - Row[2][0]) * s; - z = (Row[1][0] - Row[0][1]) * s; - } - else if(Row[0][0] > Row[1][1] && Row[0][0] > Row[2][2]) - { - s = sqrt (static_cast(1) + Row[0][0] - Row[1][1] - Row[2][2]) * static_cast(2); // S=4*qx - x = static_cast(0.25) * s; - y = (Row[0][1] + Row[1][0]) / s; - z = (Row[0][2] + Row[2][0]) / s; - w = (Row[2][1] - Row[1][2]) / s; - } - else if(Row[1][1] > Row[2][2]) - { - s = sqrt (static_cast(1) + Row[1][1] - Row[0][0] - Row[2][2]) * static_cast(2); // S=4*qy - x = (Row[0][1] + Row[1][0]) / s; - y = static_cast(0.25) * s; - z = (Row[1][2] + Row[2][1]) / s; - w = (Row[0][2] - Row[2][0]) / s; - } + root = sqrt(trace + static_cast(1.0)); + Orientation.w = static_cast(0.5) * root; + root = static_cast(0.5) / root; + Orientation.x = root * (Row[1].z - Row[2].y); + Orientation.y = root * (Row[2].x - Row[0].z); + Orientation.z = root * (Row[0].y - Row[1].x); + } // End if > 0 else - { - s = sqrt(static_cast(1) + Row[2][2] - Row[0][0] - Row[1][1]) * static_cast(2); // S=4*qz - x = (Row[0][2] + Row[2][0]) / s; - y = (Row[1][2] + Row[2][1]) / s; - z = static_cast(0.25) * s; - w = (Row[1][0] - Row[0][1]) / s; - } - - Orientation.x = x; - Orientation.y = y; - Orientation.z = z; - Orientation.w = w; + { + static int Next[3] = {1, 2, 0}; + i = 0; + if(Row[1].y > Row[0].x) i = 1; + if(Row[2].z > Row[i][i]) i = 2; + j = Next[i]; + k = Next[j]; + + root = sqrt(Row[i][i] - Row[j][j] - Row[k][k] + static_cast(1.0)); + + Orientation[i] = static_cast(0.5) * root; + root = static_cast(0.5) / root; + Orientation[j] = root * (Row[i][j] + Row[j][i]); + Orientation[k] = root * (Row[i][k] + Row[k][i]); + Orientation.w = root * (Row[j][k] - Row[k][j]); + } // End if <= 0 return true; } diff --git a/external/include/glm/gtx/matrix_factorisation.hpp b/external/include/glm/gtx/matrix_factorisation.hpp new file mode 100644 index 0000000..e30a774 --- /dev/null +++ b/external/include/glm/gtx/matrix_factorisation.hpp @@ -0,0 +1,69 @@ +/// @ref gtx_matrix_factorisation +/// @file glm/gtx/matrix_factorisation.hpp +/// +/// @see core (dependence) +/// +/// @defgroup gtx_matrix_factorisation GLM_GTX_matrix_factorisation +/// @ingroup gtx +/// +/// Include to use the features of this extension. +/// +/// Functions to factor matrices in various forms + +#pragma once + +// Dependency: +#include "../glm.hpp" + +#ifndef GLM_ENABLE_EXPERIMENTAL +# error "GLM: GLM_GTX_matrix_factorisation is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." +#endif + +#if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) +# pragma message("GLM: GLM_GTX_matrix_factorisation extension included") +#endif + +/* +Suggestions: + - Move helper functions flipud and fliplr to another file: They may be helpful in more general circumstances. + - Implement other types of matrix factorisation, such as: QL and LQ, L(D)U, eigendecompositions, etc... +*/ + +namespace glm +{ + /// @addtogroup gtx_matrix_factorisation + /// @{ + + /// Flips the matrix rows up and down. + /// + /// From GLM_GTX_matrix_factorisation extension. + template + GLM_FUNC_DECL mat flipud(mat const& in); + + /// Flips the matrix columns right and left. + /// + /// From GLM_GTX_matrix_factorisation extension. + template + GLM_FUNC_DECL mat fliplr(mat const& in); + + /// Performs QR factorisation of a matrix. + /// Returns 2 matrices, q and r, such that the columns of q are orthonormal and span the same subspace than those of the input matrix, r is an upper triangular matrix, and q*r=in. + /// Given an n-by-m input matrix, q has dimensions min(n,m)-by-m, and r has dimensions n-by-min(n,m). + /// + /// From GLM_GTX_matrix_factorisation extension. + template + GLM_FUNC_DECL void qr_decompose(mat const& in, mat<(C < R ? C : R), R, T, Q>& q, mat& r); + + /// Performs RQ factorisation of a matrix. + /// Returns 2 matrices, r and q, such that r is an upper triangular matrix, the rows of q are orthonormal and span the same subspace than those of the input matrix, and r*q=in. + /// Note that in the context of RQ factorisation, the diagonal is seen as starting in the lower-right corner of the matrix, instead of the usual upper-left. + /// Given an n-by-m input matrix, r has dimensions min(n,m)-by-m, and q has dimensions n-by-min(n,m). + /// + /// From GLM_GTX_matrix_factorisation extension. + template + GLM_FUNC_DECL void rq_decompose(mat const& in, mat<(C < R ? C : R), R, T, Q>& r, mat& q); + + /// @} +} + +#include "matrix_factorisation.inl" diff --git a/external/include/glm/gtx/matrix_factorisation.inl b/external/include/glm/gtx/matrix_factorisation.inl new file mode 100644 index 0000000..f0d9560 --- /dev/null +++ b/external/include/glm/gtx/matrix_factorisation.inl @@ -0,0 +1,85 @@ +/// @ref gtx_matrix_factorisation +/// @file glm/gtx/matrix_factorisation.inl + +namespace glm +{ + template + GLM_FUNC_QUALIFIER mat flipud(mat const& in) + { + mat tin = transpose(in); + tin = fliplr(tin); + mat out = transpose(tin); + + return out; + } + + template + GLM_FUNC_QUALIFIER mat fliplr(mat const& in) + { + mat out; + for (length_t i = 0; i < C; i++) + { + out[i] = in[(C - i) - 1]; + } + + return out; + } + + template + GLM_FUNC_QUALIFIER void qr_decompose(mat const& in, mat<(C < R ? C : R), R, T, Q>& q, mat& r) + { + // Uses modified Gram-Schmidt method + // Source: https://en.wikipedia.org/wiki/Gram–Schmidt_process + // And https://en.wikipedia.org/wiki/QR_decomposition + + //For all the linearly independs columns of the input... + // (there can be no more linearly independents columns than there are rows.) + for (length_t i = 0; i < (C < R ? C : R); i++) + { + //Copy in Q the input's i-th column. + q[i] = in[i]; + + //j = [0,i[ + // Make that column orthogonal to all the previous ones by substracting to it the non-orthogonal projection of all the previous columns. + // Also: Fill the zero elements of R + for (length_t j = 0; j < i; j++) + { + q[i] -= dot(q[i], q[j])*q[j]; + r[j][i] = 0; + } + + //Now, Q i-th column is orthogonal to all the previous columns. Normalize it. + q[i] = normalize(q[i]); + + //j = [i,C[ + //Finally, compute the corresponding coefficients of R by computing the projection of the resulting column on the other columns of the input. + for (length_t j = i; j < C; j++) + { + r[j][i] = dot(in[j], q[i]); + } + } + } + + template + GLM_FUNC_QUALIFIER void rq_decompose(mat const& in, mat<(C < R ? C : R), R, T, Q>& r, mat& q) + { + // From https://en.wikipedia.org/wiki/QR_decomposition: + // The RQ decomposition transforms a matrix A into the product of an upper triangular matrix R (also known as right-triangular) and an orthogonal matrix Q. The only difference from QR decomposition is the order of these matrices. + // QR decomposition is Gram–Schmidt orthogonalization of columns of A, started from the first column. + // RQ decomposition is Gram–Schmidt orthogonalization of rows of A, started from the last row. + + mat tin = transpose(in); + tin = fliplr(tin); + + mat tr; + mat<(C < R ? C : R), C, T, Q> tq; + qr_decompose(tin, tq, tr); + + tr = fliplr(tr); + r = transpose(tr); + r = fliplr(r); + + tq = fliplr(tq); + q = transpose(tq); + } +} //namespace glm diff --git a/external/include/glm/gtx/matrix_interpolation.hpp b/external/include/glm/gtx/matrix_interpolation.hpp index 77a69ea..89c4596 100644 --- a/external/include/glm/gtx/matrix_interpolation.hpp +++ b/external/include/glm/gtx/matrix_interpolation.hpp @@ -7,15 +7,19 @@ /// @defgroup gtx_matrix_interpolation GLM_GTX_matrix_interpolation /// @ingroup gtx /// -/// @brief Allows to directly interpolate two exiciting matrices. +/// Include to use the features of this extension. /// -/// need to be included to use these functionalities. +/// Allows to directly interpolate two matrices. #pragma once // Dependency: #include "../glm.hpp" +#ifndef GLM_ENABLE_EXPERIMENTAL +# error "GLM: GLM_GTX_matrix_interpolation is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." +#endif + #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) # pragma message("GLM: GLM_GTX_matrix_interpolation extension included") #endif @@ -27,32 +31,32 @@ namespace glm /// Get the axis and angle of the rotation from a matrix. /// From GLM_GTX_matrix_interpolation extension. - template + template GLM_FUNC_DECL void axisAngle( - tmat4x4 const & mat, - tvec3 & axis, + mat<4, 4, T, Q> const& mat, + vec<3, T, Q> & axis, T & angle); /// Build a matrix from axis and angle. /// From GLM_GTX_matrix_interpolation extension. - template - GLM_FUNC_DECL tmat4x4 axisAngleMatrix( - tvec3 const & axis, + template + GLM_FUNC_DECL mat<4, 4, T, Q> axisAngleMatrix( + vec<3, T, Q> const& axis, T const angle); /// Extracts the rotation part of a matrix. /// From GLM_GTX_matrix_interpolation extension. - template - GLM_FUNC_DECL tmat4x4 extractMatrixRotation( - tmat4x4 const & mat); + template + GLM_FUNC_DECL mat<4, 4, T, Q> extractMatrixRotation( + mat<4, 4, T, Q> const& mat); /// Build a interpolation of 4 * 4 matrixes. /// From GLM_GTX_matrix_interpolation extension. /// Warning! works only with rotation and/or translation matrixes, scale will generate unexpected results. - template - GLM_FUNC_DECL tmat4x4 interpolate( - tmat4x4 const & m1, - tmat4x4 const & m2, + template + GLM_FUNC_DECL mat<4, 4, T, Q> interpolate( + mat<4, 4, T, Q> const& m1, + mat<4, 4, T, Q> const& m2, T const delta); /// @} diff --git a/external/include/glm/gtx/matrix_interpolation.inl b/external/include/glm/gtx/matrix_interpolation.inl index 8645f96..1f2915a 100644 --- a/external/include/glm/gtx/matrix_interpolation.inl +++ b/external/include/glm/gtx/matrix_interpolation.inl @@ -1,43 +1,43 @@ /// @ref gtx_matrix_interpolation /// @file glm/gtx/matrix_interpolation.hpp +#include "../gtc/constants.hpp" + namespace glm { - template - GLM_FUNC_QUALIFIER void axisAngle - ( - tmat4x4 const & mat, - tvec3 & axis, - T & angle - ) + template + GLM_FUNC_QUALIFIER void axisAngle(mat<4, 4, T, Q> const& mat, vec<3, T, Q> & axis, T & angle) { - T epsilon = (T)0.01; - T epsilon2 = (T)0.1; + T epsilon = static_cast(0.01); + T epsilon2 = static_cast(0.1); if((abs(mat[1][0] - mat[0][1]) < epsilon) && (abs(mat[2][0] - mat[0][2]) < epsilon) && (abs(mat[2][1] - mat[1][2]) < epsilon)) { - if ((abs(mat[1][0] + mat[0][1]) < epsilon2) && (abs(mat[2][0] + mat[0][2]) < epsilon2) && (abs(mat[2][1] + mat[1][2]) < epsilon2) && (abs(mat[0][0] + mat[1][1] + mat[2][2] - (T)3.0) < epsilon2)) + if ((abs(mat[1][0] + mat[0][1]) < epsilon2) && (abs(mat[2][0] + mat[0][2]) < epsilon2) && (abs(mat[2][1] + mat[1][2]) < epsilon2) && (abs(mat[0][0] + mat[1][1] + mat[2][2] - static_cast(3.0)) < epsilon2)) { - angle = (T)0.0; - axis.x = (T)1.0; - axis.y = (T)0.0; - axis.z = (T)0.0; + angle = static_cast(0.0); + axis.x = static_cast(1.0); + axis.y = static_cast(0.0); + axis.z = static_cast(0.0); return; } angle = static_cast(3.1415926535897932384626433832795); - T xx = (mat[0][0] + (T)1.0) / (T)2.0; - T yy = (mat[1][1] + (T)1.0) / (T)2.0; - T zz = (mat[2][2] + (T)1.0) / (T)2.0; - T xy = (mat[1][0] + mat[0][1]) / (T)4.0; - T xz = (mat[2][0] + mat[0][2]) / (T)4.0; - T yz = (mat[2][1] + mat[1][2]) / (T)4.0; + T xx = (mat[0][0] + static_cast(1.0)) * static_cast(0.5); + T yy = (mat[1][1] + static_cast(1.0)) * static_cast(0.5); + T zz = (mat[2][2] + static_cast(1.0)) * static_cast(0.5); + T xy = (mat[1][0] + mat[0][1]) * static_cast(0.25); + T xz = (mat[2][0] + mat[0][2]) * static_cast(0.25); + T yz = (mat[2][1] + mat[1][2]) * static_cast(0.25); if((xx > yy) && (xx > zz)) { - if (xx < epsilon) { - axis.x = (T)0.0; - axis.y = (T)0.7071; - axis.z = (T)0.7071; - } else { + if(xx < epsilon) + { + axis.x = static_cast(0.0); + axis.y = static_cast(0.7071); + axis.z = static_cast(0.7071); + } + else + { axis.x = sqrt(xx); axis.y = xy / axis.x; axis.z = xz / axis.x; @@ -45,11 +45,14 @@ namespace glm } else if (yy > zz) { - if (yy < epsilon) { - axis.x = (T)0.7071; - axis.y = (T)0.0; - axis.z = (T)0.7071; - } else { + if(yy < epsilon) + { + axis.x = static_cast(0.7071); + axis.y = static_cast(0.0); + axis.z = static_cast(0.7071); + } + else + { axis.y = sqrt(yy); axis.x = xy / axis.y; axis.z = yz / axis.y; @@ -57,11 +60,14 @@ namespace glm } else { - if (zz < epsilon) { - axis.x = (T)0.7071; - axis.y = (T)0.7071; - axis.z = (T)0.0; - } else { + if (zz < epsilon) + { + axis.x = static_cast(0.7071); + axis.y = static_cast(0.7071); + axis.z = static_cast(0.0); + } + else + { axis.z = sqrt(zz); axis.x = xz / axis.z; axis.y = yz / axis.z; @@ -71,61 +77,51 @@ namespace glm } T s = sqrt((mat[2][1] - mat[1][2]) * (mat[2][1] - mat[1][2]) + (mat[2][0] - mat[0][2]) * (mat[2][0] - mat[0][2]) + (mat[1][0] - mat[0][1]) * (mat[1][0] - mat[0][1])); if (glm::abs(s) < T(0.001)) - s = (T)1.0; - angle = acos((mat[0][0] + mat[1][1] + mat[2][2] - (T)1.0) / (T)2.0); + s = static_cast(1); + T const angleCos = (mat[0][0] + mat[1][1] + mat[2][2] - static_cast(1)) * static_cast(0.5); + if(angleCos - static_cast(1) < epsilon) + angle = pi() * static_cast(0.25); + else + angle = acos(angleCos); axis.x = (mat[1][2] - mat[2][1]) / s; axis.y = (mat[2][0] - mat[0][2]) / s; axis.z = (mat[0][1] - mat[1][0]) / s; } - template - GLM_FUNC_QUALIFIER tmat4x4 axisAngleMatrix - ( - tvec3 const & axis, - T const angle - ) + template + GLM_FUNC_QUALIFIER mat<4, 4, T, Q> axisAngleMatrix(vec<3, T, Q> const& axis, T const angle) { T c = cos(angle); T s = sin(angle); T t = static_cast(1) - c; - tvec3 n = normalize(axis); + vec<3, T, Q> n = normalize(axis); - return tmat4x4( - t * n.x * n.x + c, t * n.x * n.y + n.z * s, t * n.x * n.z - n.y * s, T(0), - t * n.x * n.y - n.z * s, t * n.y * n.y + c, t * n.y * n.z + n.x * s, T(0), - t * n.x * n.z + n.y * s, t * n.y * n.z - n.x * s, t * n.z * n.z + c, T(0), - T(0), T(0), T(0), T(1) - ); + return mat<4, 4, T, Q>( + t * n.x * n.x + c, t * n.x * n.y + n.z * s, t * n.x * n.z - n.y * s, static_cast(0.0), + t * n.x * n.y - n.z * s, t * n.y * n.y + c, t * n.y * n.z + n.x * s, static_cast(0.0), + t * n.x * n.z + n.y * s, t * n.y * n.z - n.x * s, t * n.z * n.z + c, static_cast(0.0), + static_cast(0.0), static_cast(0.0), static_cast(0.0), static_cast(1.0)); } - template - GLM_FUNC_QUALIFIER tmat4x4 extractMatrixRotation - ( - tmat4x4 const & mat - ) + template + GLM_FUNC_QUALIFIER mat<4, 4, T, Q> extractMatrixRotation(mat<4, 4, T, Q> const& m) { - return tmat4x4( - mat[0][0], mat[0][1], mat[0][2], 0.0, - mat[1][0], mat[1][1], mat[1][2], 0.0, - mat[2][0], mat[2][1], mat[2][2], 0.0, - 0.0, 0.0, 0.0, 1.0 - ); + return mat<4, 4, T, Q>( + m[0][0], m[0][1], m[0][2], static_cast(0.0), + m[1][0], m[1][1], m[1][2], static_cast(0.0), + m[2][0], m[2][1], m[2][2], static_cast(0.0), + static_cast(0.0), static_cast(0.0), static_cast(0.0), static_cast(1.0)); } - template - GLM_FUNC_QUALIFIER tmat4x4 interpolate - ( - tmat4x4 const & m1, - tmat4x4 const & m2, - T const delta - ) + template + GLM_FUNC_QUALIFIER mat<4, 4, T, Q> interpolate(mat<4, 4, T, Q> const& m1, mat<4, 4, T, Q> const& m2, T const delta) { - tmat4x4 m1rot = extractMatrixRotation(m1); - tmat4x4 dltRotation = m2 * transpose(m1rot); - tvec3 dltAxis; + mat<4, 4, T, Q> m1rot = extractMatrixRotation(m1); + mat<4, 4, T, Q> dltRotation = m2 * transpose(m1rot); + vec<3, T, Q> dltAxis; T dltAngle; axisAngle(dltRotation, dltAxis, dltAngle); - tmat4x4 out = axisAngleMatrix(dltAxis, dltAngle * delta) * m1rot; + mat<4, 4, T, Q> out = axisAngleMatrix(dltAxis, dltAngle * delta) * m1rot; out[3][0] = m1[3][0] + delta * (m2[3][0] - m1[3][0]); out[3][1] = m1[3][1] + delta * (m2[3][1] - m1[3][1]); out[3][2] = m1[3][2] + delta * (m2[3][2] - m1[3][2]); diff --git a/external/include/glm/gtx/matrix_major_storage.hpp b/external/include/glm/gtx/matrix_major_storage.hpp index 9402abe..3b922df 100644 --- a/external/include/glm/gtx/matrix_major_storage.hpp +++ b/external/include/glm/gtx/matrix_major_storage.hpp @@ -7,15 +7,19 @@ /// @defgroup gtx_matrix_major_storage GLM_GTX_matrix_major_storage /// @ingroup gtx /// -/// @brief Build matrices with specific matrix order, row or column +/// Include to use the features of this extension. /// -/// need to be included to use these functionalities. +/// Build matrices with specific matrix order, row or column #pragma once // Dependency: #include "../glm.hpp" +#ifndef GLM_ENABLE_EXPERIMENTAL +# error "GLM: GLM_GTX_matrix_major_storage is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." +#endif + #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) # pragma message("GLM: GLM_GTX_matrix_major_storage extension included") #endif @@ -27,87 +31,87 @@ namespace glm //! Build a row major matrix from row vectors. //! From GLM_GTX_matrix_major_storage extension. - template - GLM_FUNC_DECL tmat2x2 rowMajor2( - tvec2 const & v1, - tvec2 const & v2); - + template + GLM_FUNC_DECL mat<2, 2, T, Q> rowMajor2( + vec<2, T, Q> const& v1, + vec<2, T, Q> const& v2); + //! Build a row major matrix from other matrix. //! From GLM_GTX_matrix_major_storage extension. - template - GLM_FUNC_DECL tmat2x2 rowMajor2( - tmat2x2 const & m); + template + GLM_FUNC_DECL mat<2, 2, T, Q> rowMajor2( + mat<2, 2, T, Q> const& m); //! Build a row major matrix from row vectors. //! From GLM_GTX_matrix_major_storage extension. - template - GLM_FUNC_DECL tmat3x3 rowMajor3( - tvec3 const & v1, - tvec3 const & v2, - tvec3 const & v3); + template + GLM_FUNC_DECL mat<3, 3, T, Q> rowMajor3( + vec<3, T, Q> const& v1, + vec<3, T, Q> const& v2, + vec<3, T, Q> const& v3); //! Build a row major matrix from other matrix. //! From GLM_GTX_matrix_major_storage extension. - template - GLM_FUNC_DECL tmat3x3 rowMajor3( - tmat3x3 const & m); + template + GLM_FUNC_DECL mat<3, 3, T, Q> rowMajor3( + mat<3, 3, T, Q> const& m); //! Build a row major matrix from row vectors. //! From GLM_GTX_matrix_major_storage extension. - template - GLM_FUNC_DECL tmat4x4 rowMajor4( - tvec4 const & v1, - tvec4 const & v2, - tvec4 const & v3, - tvec4 const & v4); + template + GLM_FUNC_DECL mat<4, 4, T, Q> rowMajor4( + vec<4, T, Q> const& v1, + vec<4, T, Q> const& v2, + vec<4, T, Q> const& v3, + vec<4, T, Q> const& v4); //! Build a row major matrix from other matrix. //! From GLM_GTX_matrix_major_storage extension. - template - GLM_FUNC_DECL tmat4x4 rowMajor4( - tmat4x4 const & m); + template + GLM_FUNC_DECL mat<4, 4, T, Q> rowMajor4( + mat<4, 4, T, Q> const& m); //! Build a column major matrix from column vectors. //! From GLM_GTX_matrix_major_storage extension. - template - GLM_FUNC_DECL tmat2x2 colMajor2( - tvec2 const & v1, - tvec2 const & v2); - + template + GLM_FUNC_DECL mat<2, 2, T, Q> colMajor2( + vec<2, T, Q> const& v1, + vec<2, T, Q> const& v2); + //! Build a column major matrix from other matrix. //! From GLM_GTX_matrix_major_storage extension. - template - GLM_FUNC_DECL tmat2x2 colMajor2( - tmat2x2 const & m); + template + GLM_FUNC_DECL mat<2, 2, T, Q> colMajor2( + mat<2, 2, T, Q> const& m); //! Build a column major matrix from column vectors. //! From GLM_GTX_matrix_major_storage extension. - template - GLM_FUNC_DECL tmat3x3 colMajor3( - tvec3 const & v1, - tvec3 const & v2, - tvec3 const & v3); - + template + GLM_FUNC_DECL mat<3, 3, T, Q> colMajor3( + vec<3, T, Q> const& v1, + vec<3, T, Q> const& v2, + vec<3, T, Q> const& v3); + //! Build a column major matrix from other matrix. //! From GLM_GTX_matrix_major_storage extension. - template - GLM_FUNC_DECL tmat3x3 colMajor3( - tmat3x3 const & m); - + template + GLM_FUNC_DECL mat<3, 3, T, Q> colMajor3( + mat<3, 3, T, Q> const& m); + //! Build a column major matrix from column vectors. //! From GLM_GTX_matrix_major_storage extension. - template - GLM_FUNC_DECL tmat4x4 colMajor4( - tvec4 const & v1, - tvec4 const & v2, - tvec4 const & v3, - tvec4 const & v4); - + template + GLM_FUNC_DECL mat<4, 4, T, Q> colMajor4( + vec<4, T, Q> const& v1, + vec<4, T, Q> const& v2, + vec<4, T, Q> const& v3, + vec<4, T, Q> const& v4); + //! Build a column major matrix from other matrix. //! From GLM_GTX_matrix_major_storage extension. - template - GLM_FUNC_DECL tmat4x4 colMajor4( - tmat4x4 const & m); + template + GLM_FUNC_DECL mat<4, 4, T, Q> colMajor4( + mat<4, 4, T, Q> const& m); /// @} }//namespace glm diff --git a/external/include/glm/gtx/matrix_major_storage.inl b/external/include/glm/gtx/matrix_major_storage.inl index 7097739..8b1b1a8 100644 --- a/external/include/glm/gtx/matrix_major_storage.inl +++ b/external/include/glm/gtx/matrix_major_storage.inl @@ -3,14 +3,14 @@ namespace glm { - template - GLM_FUNC_QUALIFIER tmat2x2 rowMajor2 + template + GLM_FUNC_QUALIFIER mat<2, 2, T, Q> rowMajor2 ( - tvec2 const & v1, - tvec2 const & v2 + vec<2, T, Q> const& v1, + vec<2, T, Q> const& v2 ) { - tmat2x2 Result; + mat<2, 2, T, Q> Result; Result[0][0] = v1.x; Result[1][0] = v1.y; Result[0][1] = v2.x; @@ -18,11 +18,11 @@ namespace glm return Result; } - template - GLM_FUNC_QUALIFIER tmat2x2 rowMajor2( - const tmat2x2& m) + template + GLM_FUNC_QUALIFIER mat<2, 2, T, Q> rowMajor2( + const mat<2, 2, T, Q>& m) { - tmat2x2 Result; + mat<2, 2, T, Q> Result; Result[0][0] = m[0][0]; Result[0][1] = m[1][0]; Result[1][0] = m[0][1]; @@ -30,13 +30,13 @@ namespace glm return Result; } - template - GLM_FUNC_QUALIFIER tmat3x3 rowMajor3( - const tvec3& v1, - const tvec3& v2, - const tvec3& v3) + template + GLM_FUNC_QUALIFIER mat<3, 3, T, Q> rowMajor3( + const vec<3, T, Q>& v1, + const vec<3, T, Q>& v2, + const vec<3, T, Q>& v3) { - tmat3x3 Result; + mat<3, 3, T, Q> Result; Result[0][0] = v1.x; Result[1][0] = v1.y; Result[2][0] = v1.z; @@ -49,11 +49,11 @@ namespace glm return Result; } - template - GLM_FUNC_QUALIFIER tmat3x3 rowMajor3( - const tmat3x3& m) + template + GLM_FUNC_QUALIFIER mat<3, 3, T, Q> rowMajor3( + const mat<3, 3, T, Q>& m) { - tmat3x3 Result; + mat<3, 3, T, Q> Result; Result[0][0] = m[0][0]; Result[0][1] = m[1][0]; Result[0][2] = m[2][0]; @@ -66,14 +66,14 @@ namespace glm return Result; } - template - GLM_FUNC_QUALIFIER tmat4x4 rowMajor4( - const tvec4& v1, - const tvec4& v2, - const tvec4& v3, - const tvec4& v4) + template + GLM_FUNC_QUALIFIER mat<4, 4, T, Q> rowMajor4( + const vec<4, T, Q>& v1, + const vec<4, T, Q>& v2, + const vec<4, T, Q>& v3, + const vec<4, T, Q>& v4) { - tmat4x4 Result; + mat<4, 4, T, Q> Result; Result[0][0] = v1.x; Result[1][0] = v1.y; Result[2][0] = v1.z; @@ -93,11 +93,11 @@ namespace glm return Result; } - template - GLM_FUNC_QUALIFIER tmat4x4 rowMajor4( - const tmat4x4& m) + template + GLM_FUNC_QUALIFIER mat<4, 4, T, Q> rowMajor4( + const mat<4, 4, T, Q>& m) { - tmat4x4 Result; + mat<4, 4, T, Q> Result; Result[0][0] = m[0][0]; Result[0][1] = m[1][0]; Result[0][2] = m[2][0]; @@ -117,51 +117,51 @@ namespace glm return Result; } - template - GLM_FUNC_QUALIFIER tmat2x2 colMajor2( - const tvec2& v1, - const tvec2& v2) + template + GLM_FUNC_QUALIFIER mat<2, 2, T, Q> colMajor2( + const vec<2, T, Q>& v1, + const vec<2, T, Q>& v2) { - return tmat2x2(v1, v2); + return mat<2, 2, T, Q>(v1, v2); } - template - GLM_FUNC_QUALIFIER tmat2x2 colMajor2( - const tmat2x2& m) + template + GLM_FUNC_QUALIFIER mat<2, 2, T, Q> colMajor2( + const mat<2, 2, T, Q>& m) { - return tmat2x2(m); + return mat<2, 2, T, Q>(m); } - template - GLM_FUNC_QUALIFIER tmat3x3 colMajor3( - const tvec3& v1, - const tvec3& v2, - const tvec3& v3) + template + GLM_FUNC_QUALIFIER mat<3, 3, T, Q> colMajor3( + const vec<3, T, Q>& v1, + const vec<3, T, Q>& v2, + const vec<3, T, Q>& v3) { - return tmat3x3(v1, v2, v3); + return mat<3, 3, T, Q>(v1, v2, v3); } - template - GLM_FUNC_QUALIFIER tmat3x3 colMajor3( - const tmat3x3& m) + template + GLM_FUNC_QUALIFIER mat<3, 3, T, Q> colMajor3( + const mat<3, 3, T, Q>& m) { - return tmat3x3(m); + return mat<3, 3, T, Q>(m); } - template - GLM_FUNC_QUALIFIER tmat4x4 colMajor4( - const tvec4& v1, - const tvec4& v2, - const tvec4& v3, - const tvec4& v4) + template + GLM_FUNC_QUALIFIER mat<4, 4, T, Q> colMajor4( + const vec<4, T, Q>& v1, + const vec<4, T, Q>& v2, + const vec<4, T, Q>& v3, + const vec<4, T, Q>& v4) { - return tmat4x4(v1, v2, v3, v4); + return mat<4, 4, T, Q>(v1, v2, v3, v4); } - template - GLM_FUNC_QUALIFIER tmat4x4 colMajor4( - const tmat4x4& m) + template + GLM_FUNC_QUALIFIER mat<4, 4, T, Q> colMajor4( + const mat<4, 4, T, Q>& m) { - return tmat4x4(m); + return mat<4, 4, T, Q>(m); } }//namespace glm diff --git a/external/include/glm/gtx/matrix_operation.hpp b/external/include/glm/gtx/matrix_operation.hpp index 3192ae5..bce938b 100644 --- a/external/include/glm/gtx/matrix_operation.hpp +++ b/external/include/glm/gtx/matrix_operation.hpp @@ -6,15 +6,19 @@ /// @defgroup gtx_matrix_operation GLM_GTX_matrix_operation /// @ingroup gtx /// -/// @brief Build diagonal matrices from vectors. +/// Include to use the features of this extension. /// -/// need to be included to use these functionalities. +/// Build diagonal matrices from vectors. #pragma once // Dependency: #include "../glm.hpp" +#ifndef GLM_ENABLE_EXPERIMENTAL +# error "GLM: GLM_GTX_matrix_operation is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." +#endif + #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) # pragma message("GLM: GLM_GTX_matrix_operation extension included") #endif @@ -26,57 +30,57 @@ namespace glm //! Build a diagonal matrix. //! From GLM_GTX_matrix_operation extension. - template - GLM_FUNC_DECL tmat2x2 diagonal2x2( - tvec2 const & v); + template + GLM_FUNC_DECL mat<2, 2, T, Q> diagonal2x2( + vec<2, T, Q> const& v); //! Build a diagonal matrix. //! From GLM_GTX_matrix_operation extension. - template - GLM_FUNC_DECL tmat2x3 diagonal2x3( - tvec2 const & v); + template + GLM_FUNC_DECL mat<2, 3, T, Q> diagonal2x3( + vec<2, T, Q> const& v); //! Build a diagonal matrix. //! From GLM_GTX_matrix_operation extension. - template - GLM_FUNC_DECL tmat2x4 diagonal2x4( - tvec2 const & v); + template + GLM_FUNC_DECL mat<2, 4, T, Q> diagonal2x4( + vec<2, T, Q> const& v); //! Build a diagonal matrix. //! From GLM_GTX_matrix_operation extension. - template - GLM_FUNC_DECL tmat3x2 diagonal3x2( - tvec2 const & v); + template + GLM_FUNC_DECL mat<3, 2, T, Q> diagonal3x2( + vec<2, T, Q> const& v); //! Build a diagonal matrix. //! From GLM_GTX_matrix_operation extension. - template - GLM_FUNC_DECL tmat3x3 diagonal3x3( - tvec3 const & v); + template + GLM_FUNC_DECL mat<3, 3, T, Q> diagonal3x3( + vec<3, T, Q> const& v); //! Build a diagonal matrix. //! From GLM_GTX_matrix_operation extension. - template - GLM_FUNC_DECL tmat3x4 diagonal3x4( - tvec3 const & v); + template + GLM_FUNC_DECL mat<3, 4, T, Q> diagonal3x4( + vec<3, T, Q> const& v); //! Build a diagonal matrix. //! From GLM_GTX_matrix_operation extension. - template - GLM_FUNC_DECL tmat4x2 diagonal4x2( - tvec2 const & v); + template + GLM_FUNC_DECL mat<4, 2, T, Q> diagonal4x2( + vec<2, T, Q> const& v); //! Build a diagonal matrix. //! From GLM_GTX_matrix_operation extension. - template - GLM_FUNC_DECL tmat4x3 diagonal4x3( - tvec3 const & v); + template + GLM_FUNC_DECL mat<4, 3, T, Q> diagonal4x3( + vec<3, T, Q> const& v); //! Build a diagonal matrix. //! From GLM_GTX_matrix_operation extension. - template - GLM_FUNC_DECL tmat4x4 diagonal4x4( - tvec4 const & v); + template + GLM_FUNC_DECL mat<4, 4, T, Q> diagonal4x4( + vec<4, T, Q> const& v); /// @} }//namespace glm diff --git a/external/include/glm/gtx/matrix_operation.inl b/external/include/glm/gtx/matrix_operation.inl index 1553215..da1aab8 100644 --- a/external/include/glm/gtx/matrix_operation.inl +++ b/external/include/glm/gtx/matrix_operation.inl @@ -3,116 +3,116 @@ namespace glm { - template - GLM_FUNC_QUALIFIER tmat2x2 diagonal2x2 + template + GLM_FUNC_QUALIFIER mat<2, 2, T, Q> diagonal2x2 ( - tvec2 const & v + vec<2, T, Q> const& v ) { - tmat2x2 Result(static_cast(1)); + mat<2, 2, T, Q> Result(static_cast(1)); Result[0][0] = v[0]; Result[1][1] = v[1]; return Result; } - template - GLM_FUNC_QUALIFIER tmat2x3 diagonal2x3 + template + GLM_FUNC_QUALIFIER mat<2, 3, T, Q> diagonal2x3 ( - tvec2 const & v + vec<2, T, Q> const& v ) { - tmat2x3 Result(static_cast(1)); + mat<2, 3, T, Q> Result(static_cast(1)); Result[0][0] = v[0]; Result[1][1] = v[1]; return Result; } - template - GLM_FUNC_QUALIFIER tmat2x4 diagonal2x4 + template + GLM_FUNC_QUALIFIER mat<2, 4, T, Q> diagonal2x4 ( - tvec2 const & v + vec<2, T, Q> const& v ) { - tmat2x4 Result(static_cast(1)); + mat<2, 4, T, Q> Result(static_cast(1)); Result[0][0] = v[0]; Result[1][1] = v[1]; return Result; } - template - GLM_FUNC_QUALIFIER tmat3x2 diagonal3x2 + template + GLM_FUNC_QUALIFIER mat<3, 2, T, Q> diagonal3x2 ( - tvec2 const & v + vec<2, T, Q> const& v ) { - tmat3x2 Result(static_cast(1)); + mat<3, 2, T, Q> Result(static_cast(1)); Result[0][0] = v[0]; Result[1][1] = v[1]; return Result; } - template - GLM_FUNC_QUALIFIER tmat3x3 diagonal3x3 + template + GLM_FUNC_QUALIFIER mat<3, 3, T, Q> diagonal3x3 ( - tvec3 const & v + vec<3, T, Q> const& v ) { - tmat3x3 Result(static_cast(1)); + mat<3, 3, T, Q> Result(static_cast(1)); Result[0][0] = v[0]; Result[1][1] = v[1]; Result[2][2] = v[2]; return Result; } - template - GLM_FUNC_QUALIFIER tmat3x4 diagonal3x4 + template + GLM_FUNC_QUALIFIER mat<3, 4, T, Q> diagonal3x4 ( - tvec3 const & v + vec<3, T, Q> const& v ) { - tmat3x4 Result(static_cast(1)); + mat<3, 4, T, Q> Result(static_cast(1)); Result[0][0] = v[0]; Result[1][1] = v[1]; Result[2][2] = v[2]; return Result; } - template - GLM_FUNC_QUALIFIER tmat4x4 diagonal4x4 + template + GLM_FUNC_QUALIFIER mat<4, 4, T, Q> diagonal4x4 ( - tvec4 const & v + vec<4, T, Q> const& v ) { - tmat4x4 Result(static_cast(1)); + mat<4, 4, T, Q> Result(static_cast(1)); Result[0][0] = v[0]; Result[1][1] = v[1]; Result[2][2] = v[2]; Result[3][3] = v[3]; - return Result; + return Result; } - template - GLM_FUNC_QUALIFIER tmat4x3 diagonal4x3 + template + GLM_FUNC_QUALIFIER mat<4, 3, T, Q> diagonal4x3 ( - tvec3 const & v + vec<3, T, Q> const& v ) { - tmat4x3 Result(static_cast(1)); + mat<4, 3, T, Q> Result(static_cast(1)); Result[0][0] = v[0]; Result[1][1] = v[1]; Result[2][2] = v[2]; - return Result; + return Result; } - template - GLM_FUNC_QUALIFIER tmat4x2 diagonal4x2 + template + GLM_FUNC_QUALIFIER mat<4, 2, T, Q> diagonal4x2 ( - tvec2 const & v + vec<2, T, Q> const& v ) { - tmat4x2 Result(static_cast(1)); + mat<4, 2, T, Q> Result(static_cast(1)); Result[0][0] = v[0]; Result[1][1] = v[1]; - return Result; + return Result; } }//namespace glm diff --git a/external/include/glm/gtx/matrix_query.hpp b/external/include/glm/gtx/matrix_query.hpp index 2518274..4f7e855 100644 --- a/external/include/glm/gtx/matrix_query.hpp +++ b/external/include/glm/gtx/matrix_query.hpp @@ -7,9 +7,9 @@ /// @defgroup gtx_matrix_query GLM_GTX_matrix_query /// @ingroup gtx /// -/// @brief Query to evaluate matrix properties +/// Include to use the features of this extension. /// -/// need to be included to use these functionalities. +/// Query to evaluate matrix properties #pragma once @@ -18,6 +18,10 @@ #include "../gtx/vector_query.hpp" #include +#ifndef GLM_ENABLE_EXPERIMENTAL +# error "GLM: GLM_GTX_matrix_query is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." +#endif + #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) # pragma message("GLM: GLM_GTX_matrix_query extension included") #endif @@ -29,43 +33,43 @@ namespace glm /// Return whether a matrix a null matrix. /// From GLM_GTX_matrix_query extension. - template - GLM_FUNC_DECL bool isNull(tmat2x2 const & m, T const & epsilon); - + template + GLM_FUNC_DECL bool isNull(mat<2, 2, T, Q> const& m, T const& epsilon); + /// Return whether a matrix a null matrix. /// From GLM_GTX_matrix_query extension. - template - GLM_FUNC_DECL bool isNull(tmat3x3 const & m, T const & epsilon); - + template + GLM_FUNC_DECL bool isNull(mat<3, 3, T, Q> const& m, T const& epsilon); + /// Return whether a matrix is a null matrix. /// From GLM_GTX_matrix_query extension. - template - GLM_FUNC_DECL bool isNull(tmat4x4 const & m, T const & epsilon); - + template + GLM_FUNC_DECL bool isNull(mat<4, 4, T, Q> const& m, T const& epsilon); + /// Return whether a matrix is an identity matrix. /// From GLM_GTX_matrix_query extension. - template class matType> - GLM_FUNC_DECL bool isIdentity(matType const & m, T const & epsilon); + template class matType> + GLM_FUNC_DECL bool isIdentity(matType const& m, T const& epsilon); /// Return whether a matrix is a normalized matrix. /// From GLM_GTX_matrix_query extension. - template - GLM_FUNC_DECL bool isNormalized(tmat2x2 const & m, T const & epsilon); + template + GLM_FUNC_DECL bool isNormalized(mat<2, 2, T, Q> const& m, T const& epsilon); /// Return whether a matrix is a normalized matrix. /// From GLM_GTX_matrix_query extension. - template - GLM_FUNC_DECL bool isNormalized(tmat3x3 const & m, T const & epsilon); + template + GLM_FUNC_DECL bool isNormalized(mat<3, 3, T, Q> const& m, T const& epsilon); /// Return whether a matrix is a normalized matrix. /// From GLM_GTX_matrix_query extension. - template - GLM_FUNC_DECL bool isNormalized(tmat4x4 const & m, T const & epsilon); + template + GLM_FUNC_DECL bool isNormalized(mat<4, 4, T, Q> const& m, T const& epsilon); /// Return whether a matrix is an orthonormalized matrix. /// From GLM_GTX_matrix_query extension. - template class matType> - GLM_FUNC_DECL bool isOrthogonal(matType const & m, T const & epsilon); + template class matType> + GLM_FUNC_DECL bool isOrthogonal(matType const& m, T const& epsilon); /// @} }//namespace glm diff --git a/external/include/glm/gtx/matrix_query.inl b/external/include/glm/gtx/matrix_query.inl index 491b774..38b520f 100644 --- a/external/include/glm/gtx/matrix_query.inl +++ b/external/include/glm/gtx/matrix_query.inl @@ -3,8 +3,8 @@ namespace glm { - template - GLM_FUNC_QUALIFIER bool isNull(tmat2x2 const & m, T const & epsilon) + template + GLM_FUNC_QUALIFIER bool isNull(mat<2, 2, T, Q> const& m, T const& epsilon) { bool result = true; for(length_t i = 0; result && i < m.length() ; ++i) @@ -12,8 +12,8 @@ namespace glm return result; } - template - GLM_FUNC_QUALIFIER bool isNull(tmat3x3 const & m, T const & epsilon) + template + GLM_FUNC_QUALIFIER bool isNull(mat<3, 3, T, Q> const& m, T const& epsilon) { bool result = true; for(length_t i = 0; result && i < m.length() ; ++i) @@ -21,8 +21,8 @@ namespace glm return result; } - template - GLM_FUNC_QUALIFIER bool isNull(tmat4x4 const & m, T const & epsilon) + template + GLM_FUNC_QUALIFIER bool isNull(mat<4, 4, T, Q> const& m, T const& epsilon) { bool result = true; for(length_t i = 0; result && i < m.length() ; ++i) @@ -30,8 +30,8 @@ namespace glm return result; } - template class matType> - GLM_FUNC_QUALIFIER bool isIdentity(matType const & m, T const & epsilon) + template + GLM_FUNC_QUALIFIER bool isIdentity(mat const& m, T const& epsilon) { bool result = true; for(length_t i = 0; result && i < m[0].length() ; ++i) @@ -46,15 +46,15 @@ namespace glm return result; } - template - GLM_FUNC_QUALIFIER bool isNormalized(tmat2x2 const & m, T const & epsilon) + template + GLM_FUNC_QUALIFIER bool isNormalized(mat<2, 2, T, Q> const& m, T const& epsilon) { bool result(true); for(length_t i = 0; result && i < m.length(); ++i) result = isNormalized(m[i], epsilon); for(length_t i = 0; result && i < m.length(); ++i) { - typename tmat2x2::col_type v; + typename mat<2, 2, T, Q>::col_type v; for(length_t j = 0; j < m.length(); ++j) v[j] = m[j][i]; result = isNormalized(v, epsilon); @@ -62,15 +62,15 @@ namespace glm return result; } - template - GLM_FUNC_QUALIFIER bool isNormalized(tmat3x3 const & m, T const & epsilon) + template + GLM_FUNC_QUALIFIER bool isNormalized(mat<3, 3, T, Q> const& m, T const& epsilon) { bool result(true); for(length_t i = 0; result && i < m.length(); ++i) result = isNormalized(m[i], epsilon); for(length_t i = 0; result && i < m.length(); ++i) { - typename tmat3x3::col_type v; + typename mat<3, 3, T, Q>::col_type v; for(length_t j = 0; j < m.length(); ++j) v[j] = m[j][i]; result = isNormalized(v, epsilon); @@ -78,15 +78,15 @@ namespace glm return result; } - template - GLM_FUNC_QUALIFIER bool isNormalized(tmat4x4 const & m, T const & epsilon) + template + GLM_FUNC_QUALIFIER bool isNormalized(mat<4, 4, T, Q> const& m, T const& epsilon) { bool result(true); for(length_t i = 0; result && i < m.length(); ++i) result = isNormalized(m[i], epsilon); for(length_t i = 0; result && i < m.length(); ++i) { - typename tmat4x4::col_type v; + typename mat<4, 4, T, Q>::col_type v; for(length_t j = 0; j < m.length(); ++j) v[j] = m[j][i]; result = isNormalized(v, epsilon); @@ -94,17 +94,17 @@ namespace glm return result; } - template class matType> - GLM_FUNC_QUALIFIER bool isOrthogonal(matType const & m, T const & epsilon) + template + GLM_FUNC_QUALIFIER bool isOrthogonal(mat const& m, T const& epsilon) { - bool result(true); + bool result = true; for(length_t i(0); result && i < m.length() - 1; ++i) for(length_t j(i + 1); result && j < m.length(); ++j) result = areOrthogonal(m[i], m[j], epsilon); if(result) { - matType tmp = transpose(m); + mat tmp = transpose(m); for(length_t i(0); result && i < m.length() - 1 ; ++i) for(length_t j(i + 1); result && j < m.length(); ++j) result = areOrthogonal(tmp[i], tmp[j], epsilon); diff --git a/external/include/glm/gtx/matrix_transform_2d.hpp b/external/include/glm/gtx/matrix_transform_2d.hpp index 91f4834..56c9bb8 100644 --- a/external/include/glm/gtx/matrix_transform_2d.hpp +++ b/external/include/glm/gtx/matrix_transform_2d.hpp @@ -7,9 +7,9 @@ /// @defgroup gtx_matrix_transform_2d GLM_GTX_matrix_transform_2d /// @ingroup gtx /// -/// @brief Defines functions that generate common 2d transformation matrices. +/// Include to use the features of this extension. /// -/// need to be included to use these functionalities. +/// Defines functions that generate common 2d transformation matrices. #pragma once @@ -17,6 +17,9 @@ #include "../mat3x3.hpp" #include "../vec2.hpp" +#ifndef GLM_ENABLE_EXPERIMENTAL +# error "GLM: GLM_GTX_matrix_transform_2d is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." +#endif #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) # pragma message("GLM: GLM_GTX_matrix_transform_2d extension included") @@ -26,50 +29,50 @@ namespace glm { /// @addtogroup gtx_matrix_transform_2d /// @{ - + /// Builds a translation 3 * 3 matrix created from a vector of 2 components. /// /// @param m Input matrix multiplied by this translation matrix. - /// @param v Coordinates of a translation vector. - template - GLM_FUNC_QUALIFIER tmat3x3 translate( - tmat3x3 const & m, - tvec2 const & v); + /// @param v Coordinates of a translation vector. + template + GLM_FUNC_QUALIFIER mat<3, 3, T, Q> translate( + mat<3, 3, T, Q> const& m, + vec<2, T, Q> const& v); - /// Builds a rotation 3 * 3 matrix created from an angle. + /// Builds a rotation 3 * 3 matrix created from an angle. /// /// @param m Input matrix multiplied by this translation matrix. - /// @param angle Rotation angle expressed in radians if GLM_FORCE_RADIANS is defined or degrees otherwise. - template - GLM_FUNC_QUALIFIER tmat3x3 rotate( - tmat3x3 const & m, + /// @param angle Rotation angle expressed in radians. + template + GLM_FUNC_QUALIFIER mat<3, 3, T, Q> rotate( + mat<3, 3, T, Q> const& m, T angle); /// Builds a scale 3 * 3 matrix created from a vector of 2 components. /// /// @param m Input matrix multiplied by this translation matrix. - /// @param v Coordinates of a scale vector. - template - GLM_FUNC_QUALIFIER tmat3x3 scale( - tmat3x3 const & m, - tvec2 const & v); + /// @param v Coordinates of a scale vector. + template + GLM_FUNC_QUALIFIER mat<3, 3, T, Q> scale( + mat<3, 3, T, Q> const& m, + vec<2, T, Q> const& v); - /// Builds an horizontal (parallel to the x axis) shear 3 * 3 matrix. + /// Builds an horizontal (parallel to the x axis) shear 3 * 3 matrix. /// /// @param m Input matrix multiplied by this translation matrix. /// @param y Shear factor. - template - GLM_FUNC_QUALIFIER tmat3x3 shearX( - tmat3x3 const & m, + template + GLM_FUNC_QUALIFIER mat<3, 3, T, Q> shearX( + mat<3, 3, T, Q> const& m, T y); - /// Builds a vertical (parallel to the y axis) shear 3 * 3 matrix. + /// Builds a vertical (parallel to the y axis) shear 3 * 3 matrix. /// /// @param m Input matrix multiplied by this translation matrix. /// @param x Shear factor. - template - GLM_FUNC_QUALIFIER tmat3x3 shearY( - tmat3x3 const & m, + template + GLM_FUNC_QUALIFIER mat<3, 3, T, Q> shearY( + mat<3, 3, T, Q> const& m, T x); /// @} diff --git a/external/include/glm/gtx/matrix_transform_2d.inl b/external/include/glm/gtx/matrix_transform_2d.inl index bea5670..9ae83d9 100644 --- a/external/include/glm/gtx/matrix_transform_2d.inl +++ b/external/include/glm/gtx/matrix_transform_2d.inl @@ -6,62 +6,62 @@ namespace glm { - - template - GLM_FUNC_QUALIFIER tmat3x3 translate( - tmat3x3 const & m, - tvec2 const & v) + + template + GLM_FUNC_QUALIFIER mat<3, 3, T, Q> translate( + mat<3, 3, T, Q> const& m, + vec<2, T, Q> const& v) { - tmat3x3 Result(m); + mat<3, 3, T, Q> Result(m); Result[2] = m[0] * v[0] + m[1] * v[1] + m[2]; return Result; } - template - GLM_FUNC_QUALIFIER tmat3x3 rotate( - tmat3x3 const & m, + template + GLM_FUNC_QUALIFIER mat<3, 3, T, Q> rotate( + mat<3, 3, T, Q> const& m, T angle) { T const a = angle; T const c = cos(a); T const s = sin(a); - tmat3x3 Result(uninitialize); + mat<3, 3, T, Q> Result; Result[0] = m[0] * c + m[1] * s; Result[1] = m[0] * -s + m[1] * c; Result[2] = m[2]; return Result; } - template - GLM_FUNC_QUALIFIER tmat3x3 scale( - tmat3x3 const & m, - tvec2 const & v) + template + GLM_FUNC_QUALIFIER mat<3, 3, T, Q> scale( + mat<3, 3, T, Q> const& m, + vec<2, T, Q> const& v) { - tmat3x3 Result(uninitialize); + mat<3, 3, T, Q> Result; Result[0] = m[0] * v[0]; Result[1] = m[1] * v[1]; Result[2] = m[2]; return Result; } - template - GLM_FUNC_QUALIFIER tmat3x3 shearX( - tmat3x3 const & m, + template + GLM_FUNC_QUALIFIER mat<3, 3, T, Q> shearX( + mat<3, 3, T, Q> const& m, T y) { - tmat3x3 Result(1); + mat<3, 3, T, Q> Result(1); Result[0][1] = y; return m * Result; } - template - GLM_FUNC_QUALIFIER tmat3x3 shearY( - tmat3x3 const & m, + template + GLM_FUNC_QUALIFIER mat<3, 3, T, Q> shearY( + mat<3, 3, T, Q> const& m, T x) { - tmat3x3 Result(1); + mat<3, 3, T, Q> Result(1); Result[1][0] = x; return m * Result; } diff --git a/external/include/glm/gtx/mixed_product.hpp b/external/include/glm/gtx/mixed_product.hpp index 65861f7..f1ed6e0 100644 --- a/external/include/glm/gtx/mixed_product.hpp +++ b/external/include/glm/gtx/mixed_product.hpp @@ -6,15 +6,19 @@ /// @defgroup gtx_mixed_product GLM_GTX_mixed_producte /// @ingroup gtx /// -/// @brief Mixed product of 3 vectors. +/// Include to use the features of this extension. /// -/// need to be included to use these functionalities. +/// Mixed product of 3 vectors. #pragma once // Dependency: #include "../glm.hpp" +#ifndef GLM_ENABLE_EXPERIMENTAL +# error "GLM: GLM_GTX_mixed_product is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." +#endif + #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) # pragma message("GLM: GLM_GTX_mixed_product extension included") #endif @@ -25,11 +29,11 @@ namespace glm /// @{ /// @brief Mixed product of 3 vectors (from GLM_GTX_mixed_product extension) - template + template GLM_FUNC_DECL T mixedProduct( - tvec3 const & v1, - tvec3 const & v2, - tvec3 const & v3); + vec<3, T, Q> const& v1, + vec<3, T, Q> const& v2, + vec<3, T, Q> const& v3); /// @} }// namespace glm diff --git a/external/include/glm/gtx/mixed_product.inl b/external/include/glm/gtx/mixed_product.inl index a6ede59..01e94ec 100644 --- a/external/include/glm/gtx/mixed_product.inl +++ b/external/include/glm/gtx/mixed_product.inl @@ -3,12 +3,12 @@ namespace glm { - template + template GLM_FUNC_QUALIFIER T mixedProduct ( - tvec3 const & v1, - tvec3 const & v2, - tvec3 const & v3 + vec<3, T, Q> const& v1, + vec<3, T, Q> const& v2, + vec<3, T, Q> const& v3 ) { return dot(cross(v1, v2), v3); diff --git a/external/include/glm/gtx/norm.hpp b/external/include/glm/gtx/norm.hpp index b3cb528..2f106d8 100644 --- a/external/include/glm/gtx/norm.hpp +++ b/external/include/glm/gtx/norm.hpp @@ -7,16 +7,20 @@ /// @defgroup gtx_norm GLM_GTX_norm /// @ingroup gtx /// -/// @brief Various ways to compute vector norms. -/// -/// need to be included to use these functionalities. +/// Include to use the features of this extension. +/// +/// Various ways to compute vector norms. #pragma once // Dependency: -#include "../detail/func_geometric.hpp" +#include "../geometric.hpp" #include "../gtx/quaternion.hpp" +#ifndef GLM_ENABLE_EXPERIMENTAL +# error "GLM: GLM_GTX_norm is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." +#endif + #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) # pragma message("GLM: GLM_GTX_norm extension included") #endif @@ -28,57 +32,43 @@ namespace glm /// Returns the squared length of x. /// From GLM_GTX_norm extension. - template class vecType> - GLM_FUNC_DECL T length2( - vecType const & x); + template + GLM_FUNC_DECL T length2(vec const& x); /// Returns the squared distance between p0 and p1, i.e., length2(p0 - p1). /// From GLM_GTX_norm extension. - template class vecType> - GLM_FUNC_DECL T distance2( - vecType const & p0, - vecType const & p1); + template + GLM_FUNC_DECL T distance2(vec const& p0, vec const& p1); //! Returns the L1 norm between x and y. //! From GLM_GTX_norm extension. - template - GLM_FUNC_DECL T l1Norm( - tvec3 const & x, - tvec3 const & y); - + template + GLM_FUNC_DECL T l1Norm(vec<3, T, Q> const& x, vec<3, T, Q> const& y); + //! Returns the L1 norm of v. //! From GLM_GTX_norm extension. - template - GLM_FUNC_DECL T l1Norm( - tvec3 const & v); - + template + GLM_FUNC_DECL T l1Norm(vec<3, T, Q> const& v); + //! Returns the L2 norm between x and y. //! From GLM_GTX_norm extension. - template - GLM_FUNC_DECL T l2Norm( - tvec3 const & x, - tvec3 const & y); - + template + GLM_FUNC_DECL T l2Norm(vec<3, T, Q> const& x, vec<3, T, Q> const& y); + //! Returns the L2 norm of v. //! From GLM_GTX_norm extension. - template - GLM_FUNC_DECL T l2Norm( - tvec3 const & x); - + template + GLM_FUNC_DECL T l2Norm(vec<3, T, Q> const& x); + //! Returns the L norm between x and y. //! From GLM_GTX_norm extension. - template - GLM_FUNC_DECL T lxNorm( - tvec3 const & x, - tvec3 const & y, - unsigned int Depth); + template + GLM_FUNC_DECL T lxNorm(vec<3, T, Q> const& x, vec<3, T, Q> const& y, unsigned int Depth); //! Returns the L norm of v. //! From GLM_GTX_norm extension. - template - GLM_FUNC_DECL T lxNorm( - tvec3 const & x, - unsigned int Depth); + template + GLM_FUNC_DECL T lxNorm(vec<3, T, Q> const& x, unsigned int Depth); /// @} }//namespace glm diff --git a/external/include/glm/gtx/norm.inl b/external/include/glm/gtx/norm.inl index 20954ec..7bd64e8 100644 --- a/external/include/glm/gtx/norm.inl +++ b/external/include/glm/gtx/norm.inl @@ -1,104 +1,82 @@ /// @ref gtx_norm /// @file glm/gtx/norm.inl -#include "../detail/precision.hpp" +#include "../detail/qualifier.hpp" namespace glm{ namespace detail { - template