diff --git a/external/glm/copying.txt b/external/glm/copying.txt new file mode 100644 index 00000000..4ff49c7a --- /dev/null +++ b/external/glm/copying.txt @@ -0,0 +1,54 @@ +================================================================================ +OpenGL Mathematics (GLM) +-------------------------------------------------------------------------------- +GLM can be distributed and/or modified under the terms of either +a) The Happy Bunny License, or b) the MIT License. + +================================================================================ +The Happy Bunny License (Modified MIT License) +-------------------------------------------------------------------------------- +Copyright (c) 2005 - 2015 G-Truc Creation + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +Restrictions: By making use of the Software for military purposes, you choose +to make a Bunny unhappy. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +================================================================================ +The MIT License +-------------------------------------------------------------------------------- +Copyright (c) 2005 - 2015 G-Truc Creation + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/external/glm/glm/detail/func_geometric.inl b/external/glm/glm/detail/func_geometric.inl index 0673718b..6c1663d3 100644 --- a/external/glm/glm/detail/func_geometric.inl +++ b/external/glm/glm/detail/func_geometric.inl @@ -86,7 +86,7 @@ namespace detail template GLM_FUNC_QUALIFIER genType length(genType x) { - GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'length' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'length' accepts only floating-point inputs"); return abs(x); } @@ -94,7 +94,7 @@ namespace detail template class vecType> GLM_FUNC_QUALIFIER T length(vecType const & v) { - GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'length' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'length' accepts only floating-point inputs"); return sqrt(dot(v, v)); } @@ -103,7 +103,7 @@ namespace detail template GLM_FUNC_QUALIFIER genType distance(genType const & p0, genType const & p1) { - GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'distance' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'distance' accepts only floating-point inputs"); return length(p1 - p0); } @@ -118,14 +118,14 @@ namespace detail template GLM_FUNC_QUALIFIER T dot(T x, T y) { - GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'dot' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'dot' accepts only floating-point inputs"); return x * y; } template class vecType> GLM_FUNC_QUALIFIER T dot(vecType const & x, vecType const & y) { - GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'dot' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'dot' accepts only floating-point inputs"); return detail::compute_dot::call(x, y); } @@ -133,7 +133,7 @@ namespace detail template GLM_FUNC_QUALIFIER tvec3 cross(tvec3 const & x, tvec3 const & y) { - GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'cross' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'cross' accepts only floating-point inputs"); return tvec3( x.y * y.z - y.y * x.z, @@ -145,7 +145,7 @@ namespace detail template GLM_FUNC_QUALIFIER genType normalize(genType const & x) { - GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'normalize' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'normalize' accepts only floating-point inputs"); return x < genType(0) ? genType(-1) : genType(1); } @@ -153,7 +153,7 @@ namespace detail template class vecType> GLM_FUNC_QUALIFIER vecType normalize(vecType const & x) { - GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'normalize' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'normalize' accepts only floating-point inputs"); return x * inversesqrt(dot(x, x)); } @@ -182,7 +182,7 @@ namespace detail template GLM_FUNC_QUALIFIER genType refract(genType const & I, genType const & N, genType const & eta) { - GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'refract' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'refract' accepts only floating-point inputs"); genType const dotValue(dot(N, I)); genType const k(static_cast(1) - eta * eta * (static_cast(1) - dotValue * dotValue)); @@ -192,7 +192,7 @@ namespace detail template class vecType> GLM_FUNC_QUALIFIER vecType refract(vecType const & I, vecType const & N, T eta) { - GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'refract' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'refract' accepts only floating-point inputs"); T const dotValue(dot(N, I)); T const k(static_cast(1) - eta * eta * (static_cast(1) - dotValue * dotValue)); diff --git a/external/glm/glm/detail/func_matrix.hpp b/external/glm/glm/detail/func_matrix.hpp index 5a9cb11f..56d16d2b 100644 --- a/external/glm/glm/detail/func_matrix.hpp +++ b/external/glm/glm/detail/func_matrix.hpp @@ -72,19 +72,19 @@ namespace detail template struct outerProduct_trait { - typedef tmat2x3 type; + typedef tmat3x2 type; }; template struct outerProduct_trait { - typedef tmat2x4 type; + typedef tmat4x2 type; }; template struct outerProduct_trait { - typedef tmat3x2 type; + typedef tmat2x3 type; }; template @@ -96,19 +96,19 @@ namespace detail template struct outerProduct_trait { - typedef tmat3x4 type; + typedef tmat4x3 type; }; template struct outerProduct_trait { - typedef tmat4x2 type; + typedef tmat2x4 type; }; template struct outerProduct_trait { - typedef tmat4x3 type; + typedef tmat3x4 type; }; template diff --git a/external/glm/glm/detail/func_trigonometric.inl b/external/glm/glm/detail/func_trigonometric.inl index f723de47..e350ba7a 100644 --- a/external/glm/glm/detail/func_trigonometric.inl +++ b/external/glm/glm/detail/func_trigonometric.inl @@ -123,7 +123,7 @@ namespace glm template class vecType> GLM_FUNC_QUALIFIER vecType atan(vecType const & a, vecType const & b) { - return detail::functor2::call(atan2, a, b); + return detail::functor2::call(::std::atan2, a, b); } using std::atan; @@ -170,7 +170,7 @@ namespace glm { GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'asinh' only accept floating-point input"); - return (x < static_cast(0) ? static_cast(-1) : (x > static_cast(0) ? static_cast(1) : static_cast(0))) * log(abs(x) + sqrt(static_cast(1) + x * x)); + return (x < static_cast(0) ? static_cast(-1) : (x > static_cast(0) ? static_cast(1) : static_cast(0))) * log(std::abs(x) + sqrt(static_cast(1) + x * x)); } # endif @@ -210,7 +210,7 @@ namespace glm { GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'atanh' only accept floating-point input"); - if(abs(x) >= static_cast(1)) + if(std::abs(x) >= static_cast(1)) return 0; return static_cast(0.5) * log((static_cast(1) + x) / (static_cast(1) - x)); } diff --git a/external/glm/glm/detail/precision.hpp b/external/glm/glm/detail/precision.hpp index c657d031..32785b94 100644 --- a/external/glm/glm/detail/precision.hpp +++ b/external/glm/glm/detail/precision.hpp @@ -42,4 +42,12 @@ namespace glm simd, defaultp = highp }; + + template class genType> + struct type + { + static bool const is_vec = false; + static bool const is_mat = false; + static bool const is_quat = false; + }; }//namespace glm diff --git a/external/glm/glm/detail/setup.hpp b/external/glm/glm/detail/setup.hpp index f8378ee0..6182f62b 100644 --- a/external/glm/glm/detail/setup.hpp +++ b/external/glm/glm/detail/setup.hpp @@ -38,15 +38,15 @@ /////////////////////////////////////////////////////////////////////////////////// // Version -#define GLM_VERSION 97 +#define GLM_VERSION 98 #define GLM_VERSION_MAJOR 0 #define GLM_VERSION_MINOR 9 -#define GLM_VERSION_PATCH 7 -#define GLM_VERSION_REVISION 3 +#define GLM_VERSION_PATCH 8 +#define GLM_VERSION_REVISION 0 #if(defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_VERSION_DISPLAYED)) # define GLM_MESSAGE_VERSION_DISPLAYED -# pragma message ("GLM: version 0.9.7.3") +# pragma message ("GLM: version 0.9.8.0") #endif//GLM_MESSAGE /////////////////////////////////////////////////////////////////////////////////// @@ -662,7 +662,7 @@ # define GLM_HAS_CXX11_STL ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && \ ((GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC48)) || \ ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2013)) || \ - ((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_COMPILER >= GLM_COMPILER_INTEL15))) + ((GLM_PLATFORM != GLM_PLATFORM_WINDOWS) && (GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_COMPILER >= GLM_COMPILER_INTEL15))) #endif // N1720 @@ -892,6 +892,39 @@ # endif #endif//GLM_MESSAGE +/////////////////////////////////////////////////////////////////////////////////// +// Clip control + +#ifdef GLM_DEPTH_ZERO_TO_ONE // Legacy 0.9.8 development +# error Define GLM_FORCE_DEPTH_ZERO_TO_ONE instead of GLM_DEPTH_ZERO_TO_ONE to use 0 to 1 clip space. +#endif + +#define GLM_DEPTH_ZERO_TO_ONE 0x00000001 +#define GLM_DEPTH_NEGATIVE_ONE_TO_ONE 0x00000002 + +#ifdef GLM_FORCE_DEPTH_ZERO_TO_ONE +# define GLM_DEPTH_CLIP_SPACE GLM_DEPTH_ZERO_TO_ONE +#else +# define GLM_DEPTH_CLIP_SPACE GLM_DEPTH_NEGATIVE_ONE_TO_ONE +#endif + +/////////////////////////////////////////////////////////////////////////////////// +// Coordinate system, define GLM_FORCE_LEFT_HANDED before including GLM +// to use left handed coordinate system by default. + +#ifdef GLM_LEFT_HANDED // Legacy 0.9.8 development +# error Define GLM_FORCE_LEFT_HANDED instead of GLM_LEFT_HANDED left handed coordinate system by default. +#endif + +#define GLM_LEFT_HANDED 0x00000001 // For DirectX, Metal, Vulkan +#define GLM_RIGHT_HANDED 0x00000002 // For OpenGL, default in GLM + +#ifdef GLM_FORCE_LEFT_HANDED +# define GLM_COORDINATE_SYSTEM GLM_LEFT_HANDED +#else +# define GLM_COORDINATE_SYSTEM GLM_RIGHT_HANDED +#endif + /////////////////////////////////////////////////////////////////////////////////// // Qualifiers diff --git a/external/glm/glm/detail/type_mat2x2.hpp b/external/glm/glm/detail/type_mat2x2.hpp index 9761adfe..a263d54d 100644 --- a/external/glm/glm/detail/type_mat2x2.hpp +++ b/external/glm/glm/detail/type_mat2x2.hpp @@ -61,6 +61,10 @@ namespace glm static GLM_RELAXED_CONSTEXPR precision prec = P; # endif//GLM_META_PROG_HELPERS +# ifdef GLM_STATIC_CONST_MEMBERS + static const type ZERO; + static const type IDENTITY; +# endif private: col_type value[2]; @@ -98,14 +102,14 @@ namespace glm template GLM_FUNC_DECL GLM_EXPLICIT tmat2x2(tmat2x2 const & m); - GLM_FUNC_DECL explicit tmat2x2(tmat3x3 const & x); - GLM_FUNC_DECL explicit tmat2x2(tmat4x4 const & x); - GLM_FUNC_DECL explicit tmat2x2(tmat2x3 const & x); - GLM_FUNC_DECL explicit tmat2x2(tmat3x2 const & x); - GLM_FUNC_DECL explicit tmat2x2(tmat2x4 const & x); - GLM_FUNC_DECL explicit tmat2x2(tmat4x2 const & x); - GLM_FUNC_DECL explicit tmat2x2(tmat3x4 const & x); - GLM_FUNC_DECL explicit tmat2x2(tmat4x3 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat2x2(tmat3x3 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat2x2(tmat4x4 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat2x2(tmat2x3 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat2x2(tmat3x2 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat2x2(tmat2x4 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat2x2(tmat4x2 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat2x2(tmat3x4 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat2x2(tmat4x3 const & x); // -- Accesses -- @@ -225,6 +229,16 @@ namespace glm template GLM_FUNC_DECL bool operator!=(tmat2x2 const & m1, tmat2x2 const & m2); + + // -- Is type -- + + template + struct type + { + static bool const is_vec = false; + static bool const is_mat = true; + static bool const is_quat = false; + }; } //namespace glm #ifndef GLM_EXTERNAL_TEMPLATE diff --git a/external/glm/glm/detail/type_mat2x2.inl b/external/glm/glm/detail/type_mat2x2.inl index 960fee57..3f215e3f 100644 --- a/external/glm/glm/detail/type_mat2x2.inl +++ b/external/glm/glm/detail/type_mat2x2.inl @@ -50,6 +50,13 @@ namespace detail } }//namespace detail +# ifdef GLM_STATIC_CONST_MEMBERS + template + const tmat2x2 tmat2x2::ZERO(static_cast(0)); + + template + const tmat2x2 tmat2x2::IDENTITY(static_cast(1)); +# endif // -- Constructors -- # if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT) diff --git a/external/glm/glm/detail/type_mat2x3.hpp b/external/glm/glm/detail/type_mat2x3.hpp index eeb69ad2..7fc67faa 100644 --- a/external/glm/glm/detail/type_mat2x3.hpp +++ b/external/glm/glm/detail/type_mat2x3.hpp @@ -57,6 +57,11 @@ namespace glm static GLM_RELAXED_CONSTEXPR precision prec = P; # endif//GLM_META_PROG_HELPERS +# ifdef GLM_STATIC_CONST_MEMBERS + static const type ZERO; + static const type IDENTITY; +# endif + private: col_type value[2]; @@ -94,14 +99,14 @@ namespace glm template GLM_FUNC_DECL GLM_EXPLICIT tmat2x3(tmat2x3 const & m); - GLM_FUNC_DECL explicit tmat2x3(tmat2x2 const & x); - GLM_FUNC_DECL explicit tmat2x3(tmat3x3 const & x); - GLM_FUNC_DECL explicit tmat2x3(tmat4x4 const & x); - GLM_FUNC_DECL explicit tmat2x3(tmat2x4 const & x); - GLM_FUNC_DECL explicit tmat2x3(tmat3x2 const & x); - GLM_FUNC_DECL explicit tmat2x3(tmat3x4 const & x); - GLM_FUNC_DECL explicit tmat2x3(tmat4x2 const & x); - GLM_FUNC_DECL explicit tmat2x3(tmat4x3 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat2x3(tmat2x2 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat2x3(tmat3x3 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat2x3(tmat4x4 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat2x3(tmat2x4 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat2x3(tmat3x2 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat2x3(tmat3x4 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat2x3(tmat4x2 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat2x3(tmat4x3 const & x); // -- Accesses -- @@ -202,6 +207,16 @@ namespace glm template GLM_FUNC_DECL bool operator!=(tmat2x3 const & m1, tmat2x3 const & m2); + + // -- Is type -- + + template + struct type + { + static bool const is_vec = false; + static bool const is_mat = true; + static bool const is_quat = false; + }; }//namespace glm #ifndef GLM_EXTERNAL_TEMPLATE diff --git a/external/glm/glm/detail/type_mat2x3.inl b/external/glm/glm/detail/type_mat2x3.inl index 76c00f50..e7cabb72 100644 --- a/external/glm/glm/detail/type_mat2x3.inl +++ b/external/glm/glm/detail/type_mat2x3.inl @@ -32,6 +32,13 @@ namespace glm { +# ifdef GLM_STATIC_CONST_MEMBERS + template + const tmat2x3 tmat2x3::ZERO(static_cast(0)); + + template + const tmat2x3 tmat2x3::IDENTITY(static_cast(1)); +# endif // -- Constructors -- # if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT) diff --git a/external/glm/glm/detail/type_mat2x4.hpp b/external/glm/glm/detail/type_mat2x4.hpp index 8e3c616a..e03e0948 100644 --- a/external/glm/glm/detail/type_mat2x4.hpp +++ b/external/glm/glm/detail/type_mat2x4.hpp @@ -57,6 +57,11 @@ namespace glm static GLM_RELAXED_CONSTEXPR precision prec = P; # endif//GLM_META_PROG_HELPERS +# ifdef GLM_STATIC_CONST_MEMBERS + static const type ZERO; + static const type IDENTITY; +# endif + private: col_type value[2]; @@ -96,14 +101,14 @@ namespace glm template GLM_FUNC_DECL GLM_EXPLICIT tmat2x4(tmat2x4 const & m); - GLM_FUNC_DECL explicit tmat2x4(tmat2x2 const & x); - GLM_FUNC_DECL explicit tmat2x4(tmat3x3 const & x); - GLM_FUNC_DECL explicit tmat2x4(tmat4x4 const & x); - GLM_FUNC_DECL explicit tmat2x4(tmat2x3 const & x); - GLM_FUNC_DECL explicit tmat2x4(tmat3x2 const & x); - GLM_FUNC_DECL explicit tmat2x4(tmat3x4 const & x); - GLM_FUNC_DECL explicit tmat2x4(tmat4x2 const & x); - GLM_FUNC_DECL explicit tmat2x4(tmat4x3 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat2x4(tmat2x2 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat2x4(tmat3x3 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat2x4(tmat4x4 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat2x4(tmat2x3 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat2x4(tmat3x2 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat2x4(tmat3x4 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat2x4(tmat4x2 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat2x4(tmat4x3 const & x); // -- Accesses -- @@ -192,7 +197,7 @@ namespace glm GLM_FUNC_DECL tmat3x4 operator*(tmat2x4 const & m1, tmat3x2 const & m2); template - GLM_FUNC_DECL tmat2x4 operator/(tmat2x4 const & m, T s); + GLM_FUNC_DECL tmat2x4 operator/(tmat2x4 const & m, const T& s); template GLM_FUNC_DECL tmat2x4 operator/(T s, tmat2x4 const & m); @@ -204,6 +209,16 @@ namespace glm template GLM_FUNC_DECL bool operator!=(tmat2x4 const & m1, tmat2x4 const & m2); + + // -- Is type -- + + template + struct type + { + static bool const is_vec = false; + static bool const is_mat = true; + static bool const is_quat = false; + }; }//namespace glm #ifndef GLM_EXTERNAL_TEMPLATE diff --git a/external/glm/glm/detail/type_mat2x4.inl b/external/glm/glm/detail/type_mat2x4.inl index 42299787..f92b4df5 100644 --- a/external/glm/glm/detail/type_mat2x4.inl +++ b/external/glm/glm/detail/type_mat2x4.inl @@ -32,6 +32,13 @@ namespace glm { +# ifdef GLM_STATIC_CONST_MEMBERS + template + const tmat2x4 tmat2x4::ZERO(static_cast(0)); + + template + const tmat2x4 tmat2x4::IDENTITY(static_cast(1)); +# endif // -- Constructors -- # if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT) @@ -493,7 +500,7 @@ namespace glm } template - GLM_FUNC_QUALIFIER tmat2x4 operator/(tmat2x4 const & m, T s) + GLM_FUNC_QUALIFIER tmat2x4 operator/(tmat2x4 const & m, const T& s) { return tmat2x4( m[0] / s, diff --git a/external/glm/glm/detail/type_mat3x2.hpp b/external/glm/glm/detail/type_mat3x2.hpp index fedf8c9e..2f594bb1 100644 --- a/external/glm/glm/detail/type_mat3x2.hpp +++ b/external/glm/glm/detail/type_mat3x2.hpp @@ -57,6 +57,11 @@ namespace glm static GLM_RELAXED_CONSTEXPR precision prec = P; # endif//GLM_META_PROG_HELPERS +# ifdef GLM_STATIC_CONST_MEMBERS + static const type ZERO; + static const type IDENTITY; +# endif + private: col_type value[3]; @@ -101,14 +106,14 @@ namespace glm template GLM_FUNC_DECL GLM_EXPLICIT tmat3x2(tmat3x2 const & m); - GLM_FUNC_DECL explicit tmat3x2(tmat2x2 const & x); - GLM_FUNC_DECL explicit tmat3x2(tmat3x3 const & x); - GLM_FUNC_DECL explicit tmat3x2(tmat4x4 const & x); - GLM_FUNC_DECL explicit tmat3x2(tmat2x3 const & x); - GLM_FUNC_DECL explicit tmat3x2(tmat2x4 const & x); - GLM_FUNC_DECL explicit tmat3x2(tmat3x4 const & x); - GLM_FUNC_DECL explicit tmat3x2(tmat4x2 const & x); - GLM_FUNC_DECL explicit tmat3x2(tmat4x3 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat3x2(tmat2x2 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat3x2(tmat3x3 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat3x2(tmat4x4 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat3x2(tmat2x3 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat3x2(tmat2x4 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat3x2(tmat3x4 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat3x2(tmat4x2 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat3x2(tmat4x3 const & x); // -- Accesses -- @@ -209,6 +214,16 @@ namespace glm template GLM_FUNC_DECL bool operator!=(tmat3x2 const & m1, tmat3x2 const & m2); + + // -- Is type -- + + template + struct type + { + static bool const is_vec = false; + static bool const is_mat = true; + static bool const is_quat = false; + }; }//namespace glm #ifndef GLM_EXTERNAL_TEMPLATE diff --git a/external/glm/glm/detail/type_mat3x2.inl b/external/glm/glm/detail/type_mat3x2.inl index f497e395..24079cfe 100644 --- a/external/glm/glm/detail/type_mat3x2.inl +++ b/external/glm/glm/detail/type_mat3x2.inl @@ -32,6 +32,13 @@ namespace glm { +# ifdef GLM_STATIC_CONST_MEMBERS + template + const tmat3x2 tmat3x2::ZERO(static_cast(0)); + + template + const tmat3x2 tmat3x2::IDENTITY(static_cast(1)); +# endif // -- Constructors -- # if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT) diff --git a/external/glm/glm/detail/type_mat3x3.hpp b/external/glm/glm/detail/type_mat3x3.hpp index e7e2e6de..2aaae21e 100644 --- a/external/glm/glm/detail/type_mat3x3.hpp +++ b/external/glm/glm/detail/type_mat3x3.hpp @@ -56,6 +56,11 @@ namespace glm static GLM_RELAXED_CONSTEXPR precision prec = P; # endif//GLM_META_PROG_HELPERS +# ifdef GLM_STATIC_CONST_MEMBERS + static const type ZERO; + static const type IDENTITY; +# endif + template friend tvec3 operator/(tmat3x3 const & m, tvec3 const & v); template @@ -105,14 +110,14 @@ namespace glm template GLM_FUNC_DECL GLM_EXPLICIT tmat3x3(tmat3x3 const & m); - GLM_FUNC_DECL explicit tmat3x3(tmat2x2 const & x); - GLM_FUNC_DECL explicit tmat3x3(tmat4x4 const & x); - GLM_FUNC_DECL explicit tmat3x3(tmat2x3 const & x); - GLM_FUNC_DECL explicit tmat3x3(tmat3x2 const & x); - GLM_FUNC_DECL explicit tmat3x3(tmat2x4 const & x); - GLM_FUNC_DECL explicit tmat3x3(tmat4x2 const & x); - GLM_FUNC_DECL explicit tmat3x3(tmat3x4 const & x); - GLM_FUNC_DECL explicit tmat3x3(tmat4x3 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat3x3(tmat2x2 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat3x3(tmat4x4 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat3x3(tmat2x3 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat3x3(tmat3x2 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat3x3(tmat2x4 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat3x3(tmat4x2 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat3x3(tmat3x4 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat3x3(tmat4x3 const & x); // -- Accesses -- @@ -232,6 +237,16 @@ namespace glm template GLM_FUNC_DECL bool operator!=(tmat3x3 const & m1, tmat3x3 const & m2); + + // -- Is type -- + + template + struct type + { + static bool const is_vec = false; + static bool const is_mat = true; + static bool const is_quat = false; + }; }//namespace glm #ifndef GLM_EXTERNAL_TEMPLATE diff --git a/external/glm/glm/detail/type_mat3x3.inl b/external/glm/glm/detail/type_mat3x3.inl index 9ee0111e..c3b07108 100644 --- a/external/glm/glm/detail/type_mat3x3.inl +++ b/external/glm/glm/detail/type_mat3x3.inl @@ -56,6 +56,14 @@ namespace detail } }//namespace detail +# ifdef GLM_STATIC_CONST_MEMBERS + template + const tmat3x3 tmat3x3::ZERO(static_cast(0)); + + template + const tmat3x3 tmat3x3::IDENTITY(static_cast(1)); +# endif + // -- Constructors -- # if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT) diff --git a/external/glm/glm/detail/type_mat3x4.hpp b/external/glm/glm/detail/type_mat3x4.hpp index 11261589..6b5c1dbe 100644 --- a/external/glm/glm/detail/type_mat3x4.hpp +++ b/external/glm/glm/detail/type_mat3x4.hpp @@ -57,6 +57,11 @@ namespace glm static GLM_RELAXED_CONSTEXPR precision prec = P; # endif//GLM_META_PROG_HELPERS +# ifdef GLM_STATIC_CONST_MEMBERS + static const type ZERO; + static const type IDENTITY; +# endif + private: col_type value[3]; @@ -101,14 +106,14 @@ namespace glm template GLM_FUNC_DECL GLM_EXPLICIT tmat3x4(tmat3x4 const & m); - GLM_FUNC_DECL explicit tmat3x4(tmat2x2 const & x); - GLM_FUNC_DECL explicit tmat3x4(tmat3x3 const & x); - GLM_FUNC_DECL explicit tmat3x4(tmat4x4 const & x); - GLM_FUNC_DECL explicit tmat3x4(tmat2x3 const & x); - GLM_FUNC_DECL explicit tmat3x4(tmat3x2 const & x); - GLM_FUNC_DECL explicit tmat3x4(tmat2x4 const & x); - GLM_FUNC_DECL explicit tmat3x4(tmat4x2 const & x); - GLM_FUNC_DECL explicit tmat3x4(tmat4x3 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat3x4(tmat2x2 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat3x4(tmat3x3 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat3x4(tmat4x4 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat3x4(tmat2x3 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat3x4(tmat3x2 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat3x4(tmat2x4 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat3x4(tmat4x2 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat3x4(tmat4x3 const & x); // -- Accesses -- @@ -209,6 +214,16 @@ namespace glm template GLM_FUNC_DECL bool operator!=(tmat3x4 const & m1, tmat3x4 const & m2); + + // -- Is type -- + + template + struct type + { + static bool const is_vec = false; + static bool const is_mat = true; + static bool const is_quat = false; + }; }//namespace glm #ifndef GLM_EXTERNAL_TEMPLATE diff --git a/external/glm/glm/detail/type_mat3x4.inl b/external/glm/glm/detail/type_mat3x4.inl index 3991d95d..dd1f0563 100644 --- a/external/glm/glm/detail/type_mat3x4.inl +++ b/external/glm/glm/detail/type_mat3x4.inl @@ -32,6 +32,13 @@ namespace glm { +# ifdef GLM_STATIC_CONST_MEMBERS + template + const tmat3x4 tmat3x4::ZERO(static_cast(0)); + + template + const tmat3x4 tmat3x4::IDENTITY(static_cast(1)); +# endif // -- Constructors -- # if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT) diff --git a/external/glm/glm/detail/type_mat4x2.hpp b/external/glm/glm/detail/type_mat4x2.hpp index 62cd7aed..a52675b8 100644 --- a/external/glm/glm/detail/type_mat4x2.hpp +++ b/external/glm/glm/detail/type_mat4x2.hpp @@ -57,6 +57,11 @@ namespace glm static GLM_RELAXED_CONSTEXPR precision prec = P; # endif//GLM_META_PROG_HELPERS +# ifdef GLM_STATIC_CONST_MEMBERS + static const type ZERO; + static const type IDENTITY; +# endif + private: col_type value[4]; @@ -106,14 +111,14 @@ namespace glm template GLM_FUNC_DECL GLM_EXPLICIT tmat4x2(tmat4x2 const & m); - GLM_FUNC_DECL explicit tmat4x2(tmat2x2 const & x); - GLM_FUNC_DECL explicit tmat4x2(tmat3x3 const & x); - GLM_FUNC_DECL explicit tmat4x2(tmat4x4 const & x); - GLM_FUNC_DECL explicit tmat4x2(tmat2x3 const & x); - GLM_FUNC_DECL explicit tmat4x2(tmat3x2 const & x); - GLM_FUNC_DECL explicit tmat4x2(tmat2x4 const & x); - GLM_FUNC_DECL explicit tmat4x2(tmat4x3 const & x); - GLM_FUNC_DECL explicit tmat4x2(tmat3x4 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat4x2(tmat2x2 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat4x2(tmat3x3 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat4x2(tmat4x4 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat4x2(tmat2x3 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat4x2(tmat3x2 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat4x2(tmat2x4 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat4x2(tmat4x3 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat4x2(tmat3x4 const & x); // -- Accesses -- @@ -214,6 +219,16 @@ namespace glm template GLM_FUNC_DECL bool operator!=(tmat4x2 const & m1, tmat4x2 const & m2); + + // -- Is type -- + + template + struct type + { + static bool const is_vec = false; + static bool const is_mat = true; + static bool const is_quat = false; + }; }//namespace glm #ifndef GLM_EXTERNAL_TEMPLATE diff --git a/external/glm/glm/detail/type_mat4x2.inl b/external/glm/glm/detail/type_mat4x2.inl index 811f4622..2040d4a6 100644 --- a/external/glm/glm/detail/type_mat4x2.inl +++ b/external/glm/glm/detail/type_mat4x2.inl @@ -32,6 +32,13 @@ namespace glm { +# ifdef GLM_STATIC_CONST_MEMBERS + template + const tmat4x2 tmat4x2::ZERO(static_cast(0)); + + template + const tmat4x2 tmat4x2::IDENTITY(static_cast(1)); +# endif // -- Constructors -- # if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT) diff --git a/external/glm/glm/detail/type_mat4x3.hpp b/external/glm/glm/detail/type_mat4x3.hpp index eea24667..9ee26169 100644 --- a/external/glm/glm/detail/type_mat4x3.hpp +++ b/external/glm/glm/detail/type_mat4x3.hpp @@ -57,6 +57,11 @@ namespace glm static GLM_RELAXED_CONSTEXPR precision prec = P; # endif//GLM_META_PROG_HELPERS +# ifdef GLM_STATIC_CONST_MEMBERS + static const type ZERO; + static const type IDENTITY; +# endif + private: col_type value[4]; @@ -106,14 +111,14 @@ namespace glm template GLM_FUNC_DECL GLM_EXPLICIT tmat4x3(tmat4x3 const & m); - GLM_FUNC_DECL explicit tmat4x3(tmat2x2 const & x); - GLM_FUNC_DECL explicit tmat4x3(tmat3x3 const & x); - GLM_FUNC_DECL explicit tmat4x3(tmat4x4 const & x); - GLM_FUNC_DECL explicit tmat4x3(tmat2x3 const & x); - GLM_FUNC_DECL explicit tmat4x3(tmat3x2 const & x); - GLM_FUNC_DECL explicit tmat4x3(tmat2x4 const & x); - GLM_FUNC_DECL explicit tmat4x3(tmat4x2 const & x); - GLM_FUNC_DECL explicit tmat4x3(tmat3x4 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat4x3(tmat2x2 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat4x3(tmat3x3 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat4x3(tmat4x4 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat4x3(tmat2x3 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat4x3(tmat3x2 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat4x3(tmat2x4 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat4x3(tmat4x2 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat4x3(tmat3x4 const & x); // -- Accesses -- @@ -214,6 +219,16 @@ namespace glm template GLM_FUNC_DECL bool operator!=(tmat4x3 const & m1, tmat4x3 const & m2); + + // -- Is type -- + + template + struct type + { + static bool const is_vec = false; + static bool const is_mat = true; + static bool const is_quat = false; + }; }//namespace glm #ifndef GLM_EXTERNAL_TEMPLATE diff --git a/external/glm/glm/detail/type_mat4x3.inl b/external/glm/glm/detail/type_mat4x3.inl index c2979782..58eeb6f9 100644 --- a/external/glm/glm/detail/type_mat4x3.inl +++ b/external/glm/glm/detail/type_mat4x3.inl @@ -32,6 +32,13 @@ namespace glm { +# ifdef GLM_STATIC_CONST_MEMBERS + template + const tmat4x3 tmat4x3::ZERO(static_cast(0)); + + template + const tmat4x3 tmat4x3::IDENTITY(static_cast(1)); +# endif // -- Constructors -- # if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT) diff --git a/external/glm/glm/detail/type_mat4x4.hpp b/external/glm/glm/detail/type_mat4x4.hpp index 1690bf1d..bb5fba0b 100644 --- a/external/glm/glm/detail/type_mat4x4.hpp +++ b/external/glm/glm/detail/type_mat4x4.hpp @@ -56,6 +56,11 @@ namespace glm static GLM_RELAXED_CONSTEXPR precision prec = P; # endif//GLM_META_PROG_HELPERS +# ifdef GLM_STATIC_CONST_MEMBERS + static const type ZERO; + static const type IDENTITY; +# endif + template friend tvec4 operator/(tmat4x4 const & m, tvec4 const & v); template @@ -110,14 +115,14 @@ namespace glm template GLM_FUNC_DECL GLM_EXPLICIT tmat4x4(tmat4x4 const & m); - GLM_FUNC_DECL explicit tmat4x4(tmat2x2 const & x); - GLM_FUNC_DECL explicit tmat4x4(tmat3x3 const & x); - GLM_FUNC_DECL explicit tmat4x4(tmat2x3 const & x); - GLM_FUNC_DECL explicit tmat4x4(tmat3x2 const & x); - GLM_FUNC_DECL explicit tmat4x4(tmat2x4 const & x); - GLM_FUNC_DECL explicit tmat4x4(tmat4x2 const & x); - GLM_FUNC_DECL explicit tmat4x4(tmat3x4 const & x); - GLM_FUNC_DECL explicit tmat4x4(tmat4x3 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat4x4(tmat2x2 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat4x4(tmat3x3 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat4x4(tmat2x3 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat4x4(tmat3x2 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat4x4(tmat2x4 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat4x4(tmat4x2 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat4x4(tmat3x4 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat4x4(tmat4x3 const & x); // -- Accesses -- @@ -237,6 +242,16 @@ namespace glm template GLM_FUNC_DECL bool operator!=(tmat4x4 const & m1, tmat4x4 const & m2); + + // -- Is type -- + + template + struct type + { + static bool const is_vec = false; + static bool const is_mat = true; + static bool const is_quat = false; + }; }//namespace glm #ifndef GLM_EXTERNAL_TEMPLATE diff --git a/external/glm/glm/detail/type_mat4x4.inl b/external/glm/glm/detail/type_mat4x4.inl index 319325a7..acfa318c 100644 --- a/external/glm/glm/detail/type_mat4x4.inl +++ b/external/glm/glm/detail/type_mat4x4.inl @@ -92,6 +92,13 @@ namespace detail } }//namespace detail +# ifdef GLM_STATIC_CONST_MEMBERS + template + const tmat4x4 tmat4x4::ZERO(static_cast(0)); + + template + const tmat4x4 tmat4x4::IDENTITY(static_cast(1)); +# endif // -- Constructors -- # if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT) diff --git a/external/glm/glm/detail/type_vec1.hpp b/external/glm/glm/detail/type_vec1.hpp index 6c30a438..2e811a36 100644 --- a/external/glm/glm/detail/type_vec1.hpp +++ b/external/glm/glm/detail/type_vec1.hpp @@ -59,6 +59,10 @@ namespace glm static GLM_RELAXED_CONSTEXPR precision prec = P; # endif//GLM_META_PROG_HELPERS +# ifdef GLM_STATIC_CONST_MEMBERS + static const type ZERO; + static const type X; +# endif // -- Data -- # if GLM_HAS_ANONYMOUS_UNION @@ -122,13 +126,13 @@ namespace glm /// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) template - GLM_FUNC_DECL explicit tvec1(tvec2 const & v); + GLM_FUNC_DECL GLM_EXPLICIT tvec1(tvec2 const & v); /// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) template - GLM_FUNC_DECL explicit tvec1(tvec3 const & v); + GLM_FUNC_DECL GLM_EXPLICIT tvec1(tvec3 const & v); /// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) template - GLM_FUNC_DECL explicit tvec1(tvec4 const & v); + GLM_FUNC_DECL GLM_EXPLICIT tvec1(tvec4 const & v); /// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) template @@ -312,6 +316,22 @@ namespace glm template GLM_FUNC_DECL bool operator!=(tvec1 const & v1, tvec1 const & v2); + + template + GLM_FUNC_DECL tvec1 operator&&(tvec1 const & v1, tvec1 const & v2); + + template + GLM_FUNC_DECL tvec1 operator||(tvec1 const & v1, tvec1 const & v2); + + // -- Is type -- + + template + struct type + { + static bool const is_vec = true; + static bool const is_mat = false; + static bool const is_quat = false; + }; }//namespace glm #ifndef GLM_EXTERNAL_TEMPLATE diff --git a/external/glm/glm/detail/type_vec1.inl b/external/glm/glm/detail/type_vec1.inl index effac06f..9d397d64 100644 --- a/external/glm/glm/detail/type_vec1.inl +++ b/external/glm/glm/detail/type_vec1.inl @@ -32,6 +32,13 @@ namespace glm { +# ifdef GLM_STATIC_CONST_MEMBERS + template + const tvec1 tvec1::X(static_cast(1)); + + template + const tvec1 tvec1::ZERO(static_cast(0)); +# endif // -- Implicit basic constructors -- # if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT) @@ -600,4 +607,16 @@ namespace glm { return (v1.x != v2.x); } + + template + GLM_FUNC_QUALIFIER tvec1 operator&&(tvec1 const & v1, tvec1 const & v2) + { + return tvec1(v1.x && v2.x); + } + + template + GLM_FUNC_QUALIFIER tvec1 operator||(tvec1 const & v1, tvec1 const & v2) + { + return tvec1(v1.x || v2.x); + } }//namespace glm diff --git a/external/glm/glm/detail/type_vec2.hpp b/external/glm/glm/detail/type_vec2.hpp index 76029f49..13c5d05f 100644 --- a/external/glm/glm/detail/type_vec2.hpp +++ b/external/glm/glm/detail/type_vec2.hpp @@ -58,6 +58,13 @@ namespace glm static GLM_RELAXED_CONSTEXPR precision prec = P; # endif//GLM_META_PROG_HELPERS +# ifdef GLM_STATIC_CONST_MEMBERS + static const type ZERO; + static const type X; + static const type Y; + static const type XY; +# endif + // -- Data -- # if GLM_HAS_ANONYMOUS_UNION @@ -131,10 +138,10 @@ namespace glm /// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) template - GLM_FUNC_DECL explicit tvec2(tvec3 const & v); + GLM_FUNC_DECL GLM_EXPLICIT tvec2(tvec3 const & v); /// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) template - GLM_FUNC_DECL explicit tvec2(tvec4 const & v); + GLM_FUNC_DECL GLM_EXPLICIT tvec2(tvec4 const & v); /// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) template @@ -401,6 +408,22 @@ namespace glm template GLM_FUNC_DECL bool operator!=(tvec2 const & v1, tvec2 const & v2); + + template + GLM_FUNC_DECL tvec2 operator&&(tvec2 const & v1, tvec2 const & v2); + + template + GLM_FUNC_DECL tvec2 operator||(tvec2 const & v1, tvec2 const & v2); + + // -- Is type -- + + template + struct type + { + static bool const is_vec = true; + static bool const is_mat = false; + static bool const is_quat = false; + }; }//namespace glm #ifndef GLM_EXTERNAL_TEMPLATE diff --git a/external/glm/glm/detail/type_vec2.inl b/external/glm/glm/detail/type_vec2.inl index b8cb1ff8..dfb3a33a 100644 --- a/external/glm/glm/detail/type_vec2.inl +++ b/external/glm/glm/detail/type_vec2.inl @@ -28,6 +28,19 @@ namespace glm { +# ifdef GLM_STATIC_CONST_MEMBERS + template + const tvec2 tvec2::ZERO(static_cast(0), static_cast(0)); + + template + const tvec2 tvec2::X(static_cast(1), static_cast(0)); + + template + const tvec2 tvec2::Y(static_cast(0), static_cast(1)); + + template + const tvec2 tvec2::XY(static_cast(1), static_cast(1)); +# endif // -- Implicit basic constructors -- # if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT) @@ -919,4 +932,16 @@ namespace glm { return (v1.x != v2.x) || (v1.y != v2.y); } + + template + GLM_FUNC_QUALIFIER tvec2 operator&&(tvec2 const & v1, tvec2 const & v2) + { + return tvec2(v1.x && v2.x, v1.y && v2.y); + } + + template + GLM_FUNC_QUALIFIER tvec2 operator||(tvec2 const & v1, tvec2 const & v2) + { + return tvec2(v1.x || v2.x, v1.y || v2.y); + } }//namespace glm diff --git a/external/glm/glm/detail/type_vec3.hpp b/external/glm/glm/detail/type_vec3.hpp index f155b076..72d32286 100644 --- a/external/glm/glm/detail/type_vec3.hpp +++ b/external/glm/glm/detail/type_vec3.hpp @@ -58,6 +58,17 @@ namespace glm static GLM_RELAXED_CONSTEXPR precision prec = P; # endif//GLM_META_PROG_HELPERS +# ifdef GLM_STATIC_CONST_MEMBERS + static const type ZERO; + static const type X; + static const type Y; + static const type Z; + static const type XY; + static const type XZ; + static const type YZ; + static const type XYZ; +# endif + // -- Data -- # if GLM_HAS_ANONYMOUS_UNION @@ -132,19 +143,19 @@ namespace glm /// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) template - GLM_FUNC_DECL explicit tvec3(tvec2 const & a, B const & b); + GLM_FUNC_DECL tvec3(tvec2 const & a, B const & b); /// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) template - GLM_FUNC_DECL explicit tvec3(tvec2 const & a, tvec1 const & b); + GLM_FUNC_DECL tvec3(tvec2 const & a, tvec1 const & b); /// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) template - GLM_FUNC_DECL explicit tvec3(A const & a, tvec2 const & b); + GLM_FUNC_DECL tvec3(A const & a, tvec2 const & b); /// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) template - GLM_FUNC_DECL explicit tvec3(tvec1 const & a, tvec2 const & b); + GLM_FUNC_DECL tvec3(tvec1 const & a, tvec2 const & b); /// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) template - GLM_FUNC_DECL explicit tvec3(tvec4 const & v); + GLM_FUNC_DECL GLM_EXPLICIT tvec3(tvec4 const & v); /// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) template @@ -420,6 +431,22 @@ namespace glm template GLM_FUNC_DECL bool operator!=(tvec3 const & v1, tvec3 const & v2); + + template + GLM_FUNC_DECL tvec3 operator&&(tvec3 const & v1, tvec3 const & v2); + + template + GLM_FUNC_DECL tvec3 operator||(tvec3 const & v1, tvec3 const & v2); + + // -- Is type -- + + template + struct type + { + static bool const is_vec = true; + static bool const is_mat = false; + static bool const is_quat = false; + }; }//namespace glm #ifndef GLM_EXTERNAL_TEMPLATE diff --git a/external/glm/glm/detail/type_vec3.inl b/external/glm/glm/detail/type_vec3.inl index fa8102c8..38104a3a 100644 --- a/external/glm/glm/detail/type_vec3.inl +++ b/external/glm/glm/detail/type_vec3.inl @@ -32,6 +32,32 @@ namespace glm { + +# ifdef GLM_STATIC_CONST_MEMBERS + template + const tvec3 tvec3::ZERO(static_cast(0), static_cast(0), static_cast(0)); + + template + const tvec3 tvec3::X(static_cast(1), static_cast(0), static_cast(0)); + + template + const tvec3 tvec3::Y(static_cast(0), static_cast(1), static_cast(0)); + + template + const tvec3 tvec3::Z(static_cast(0), static_cast(0), static_cast(1)); + + template + const tvec3 tvec3::XY(static_cast(1), static_cast(1), static_cast(0)); + + template + const tvec3 tvec3::XZ(static_cast(1), static_cast(0), static_cast(1)); + + template + const tvec3 tvec3::YZ(static_cast(0), static_cast(1), static_cast(1)); + + template + const tvec3 tvec3::XYZ(static_cast(1), static_cast(1), static_cast(1)); +# endif // -- Implicit basic constructors -- # if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT) @@ -1038,4 +1064,16 @@ namespace glm { return (v1.x != v2.x) || (v1.y != v2.y) || (v1.z != v2.z); } + + template + GLM_FUNC_QUALIFIER tvec3 operator&&(tvec3 const & v1, tvec3 const & v2) + { + return tvec3(v1.x && v2.x, v1.y && v2.y, v1.z && v2.z); + } + + template + GLM_FUNC_QUALIFIER tvec3 operator||(tvec3 const & v1, tvec3 const & v2) + { + return tvec3(v1.x || v2.x, v1.y || v2.y, v1.z || v2.z); + } }//namespace glm diff --git a/external/glm/glm/detail/type_vec4.hpp b/external/glm/glm/detail/type_vec4.hpp index e9fe6c1d..fe7235ac 100644 --- a/external/glm/glm/detail/type_vec4.hpp +++ b/external/glm/glm/detail/type_vec4.hpp @@ -112,6 +112,25 @@ namespace detail static GLM_RELAXED_CONSTEXPR precision prec = P; # endif//GLM_META_PROG_HELPERS +# ifdef GLM_STATIC_CONST_MEMBERS + static const type ZERO; + static const type X; + static const type Y; + static const type Z; + static const type W; + static const type XY; + static const type XZ; + static const type XW; + static const type YZ; + static const type YW; + static const type ZW; + static const type XYZ; + static const type XYW; + static const type XZW; + static const type YZW; + static const type XYZW; +# endif + // -- Data -- # if GLM_HAS_ANONYMOUS_UNION && GLM_NOT_BUGGY_VC32BITS @@ -189,37 +208,37 @@ namespace detail /// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) template - GLM_FUNC_DECL explicit tvec4(tvec2 const & a, B b, C c); + GLM_FUNC_DECL tvec4(tvec2 const & a, B b, C c); /// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) template - GLM_FUNC_DECL explicit tvec4(tvec2 const & a, tvec1 const & b, tvec1 const & c); + GLM_FUNC_DECL tvec4(tvec2 const & a, tvec1 const & b, tvec1 const & c); /// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) template - GLM_FUNC_DECL explicit tvec4(A a, tvec2 const & b, C c); + GLM_FUNC_DECL tvec4(A a, tvec2 const & b, C c); /// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) template - GLM_FUNC_DECL explicit tvec4(tvec1 const & a, tvec2 const & b, tvec1 const & c); + GLM_FUNC_DECL tvec4(tvec1 const & a, tvec2 const & b, tvec1 const & c); /// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) template - GLM_FUNC_DECL explicit tvec4(A a, B b, tvec2 const & c); + GLM_FUNC_DECL tvec4(A a, B b, tvec2 const & c); /// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) template - GLM_FUNC_DECL explicit tvec4(tvec1 const & a, tvec1 const & b, tvec2 const & c); + GLM_FUNC_DECL tvec4(tvec1 const & a, tvec1 const & b, tvec2 const & c); /// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) template - GLM_FUNC_DECL explicit tvec4(tvec3 const & a, B b); + GLM_FUNC_DECL tvec4(tvec3 const & a, B b); /// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) template - GLM_FUNC_DECL explicit tvec4(tvec3 const & a, tvec1 const & b); + GLM_FUNC_DECL tvec4(tvec3 const & a, tvec1 const & b); /// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) template - GLM_FUNC_DECL explicit tvec4(A a, tvec3 const & b); + GLM_FUNC_DECL tvec4(A a, tvec3 const & b); /// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) template - GLM_FUNC_DECL explicit tvec4(tvec1 const & a, tvec3 const & b); + GLM_FUNC_DECL tvec4(tvec1 const & a, tvec3 const & b); /// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) template - GLM_FUNC_DECL explicit tvec4(tvec2 const & a, tvec2 const & b); + GLM_FUNC_DECL tvec4(tvec2 const & a, tvec2 const & b); /// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) template @@ -360,7 +379,7 @@ namespace detail // -- Binary operators -- template - GLM_FUNC_DECL tvec4 operator+(tvec4 const & v, T scalar); + GLM_FUNC_DECL tvec4 operator+(tvec4 const & v, const T& scalar); template GLM_FUNC_DECL tvec4 operator+(tvec4 const & v, tvec1 const & scalar); @@ -375,7 +394,7 @@ namespace detail GLM_FUNC_DECL tvec4 operator+(tvec4 const & v1, tvec4 const & v2); template - GLM_FUNC_DECL tvec4 operator-(tvec4 const & v, T scalar); + GLM_FUNC_DECL tvec4 operator-(tvec4 const & v, const T& scalar); template GLM_FUNC_DECL tvec4 operator-(tvec4 const & v, tvec1 const & scalar); @@ -390,7 +409,7 @@ namespace detail GLM_FUNC_DECL tvec4 operator-(tvec4 const & v1, tvec4 const & v2); template - GLM_FUNC_DECL tvec4 operator*(tvec4 const & v, T scalar); + GLM_FUNC_DECL tvec4 operator*(tvec4 const & v, const T& scalar); template GLM_FUNC_DECL tvec4 operator*(tvec4 const & v, tvec1 const & scalar); @@ -405,7 +424,7 @@ namespace detail GLM_FUNC_DECL tvec4 operator*(tvec4 const & v1, tvec4 const & v2); template - GLM_FUNC_DECL tvec4 operator/(tvec4 const & v, T scalar); + GLM_FUNC_DECL tvec4 operator/(tvec4 const & v, const T& scalar); template GLM_FUNC_DECL tvec4 operator/(tvec4 const & v, tvec1 const & scalar); @@ -525,6 +544,22 @@ namespace detail template GLM_FUNC_DECL bool operator!=(tvec4 const & v1, tvec4 const & v2); + + template + GLM_FUNC_DECL tvec4 operator&&(tvec4 const & v1, tvec4 const & v2); + + template + GLM_FUNC_DECL tvec4 operator||(tvec4 const & v1, tvec4 const & v2); + + // -- Is type -- + + template + struct type + { + static bool const is_vec = true; + static bool const is_mat = false; + static bool const is_quat = false; + }; }//namespace glm #ifndef GLM_EXTERNAL_TEMPLATE diff --git a/external/glm/glm/detail/type_vec4.inl b/external/glm/glm/detail/type_vec4.inl index 8e215d00..6712ce33 100644 --- a/external/glm/glm/detail/type_vec4.inl +++ b/external/glm/glm/detail/type_vec4.inl @@ -32,6 +32,72 @@ namespace glm { + +# ifdef GLM_STATIC_CONST_MEMBERS + template + const tvec4 tvec4::ZERO + (static_cast(0), static_cast(0), static_cast(0), static_cast(0)); + + template + const tvec4 tvec4::X + (static_cast(1), static_cast(0), static_cast(0), static_cast(0)); + + template + const tvec4 tvec4::Y + (static_cast(0), static_cast(1), static_cast(0), static_cast(0)); + + template + const tvec4 tvec4::Z + (static_cast(0), static_cast(0), static_cast(1), static_cast(0)); + + template + const tvec4 tvec4::W + (static_cast(0), static_cast(0), static_cast(0), static_cast(1)); + + template + const tvec4 tvec4::XY + (static_cast(1), static_cast(1), static_cast(0), static_cast(0)); + + template + const tvec4 tvec4::XZ + (static_cast(1), static_cast(0), static_cast(1), static_cast(0)); + + template + const tvec4 tvec4::XW + (static_cast(1), static_cast(0), static_cast(0), static_cast(1)); + + template + const tvec4 tvec4::YZ + (static_cast(0), static_cast(1), static_cast(1), static_cast(0)); + + template + const tvec4 tvec4::YW + (static_cast(0), static_cast(1), static_cast(0), static_cast(1)); + + template + const tvec4 tvec4::ZW + (static_cast(0), static_cast(0), static_cast(1), static_cast(1)); + + template + const tvec4 tvec4::XYZ + (static_cast(1), static_cast(1), static_cast(1), static_cast(0)); + + template + const tvec4 tvec4::XYW + (static_cast(1), static_cast(1), static_cast(0), static_cast(1)); + + template + const tvec4 tvec4::XZW + (static_cast(1), static_cast(0), static_cast(1), static_cast(1)); + + template + const tvec4 tvec4::YZW + (static_cast(0), static_cast(1), static_cast(1), static_cast(1)); + + template + const tvec4 tvec4::XYZW + (static_cast(1), static_cast(1), static_cast(1), static_cast(1)); +# endif // -- Implicit basic constructors -- # if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT) @@ -664,7 +730,7 @@ namespace glm // -- Binary arithmetic operators -- template - GLM_FUNC_QUALIFIER tvec4 operator+(tvec4 const & v, T scalar) + GLM_FUNC_QUALIFIER tvec4 operator+(tvec4 const & v, const T& scalar) { return tvec4( v.x + scalar, @@ -694,7 +760,7 @@ namespace glm } template - GLM_FUNC_QUALIFIER tvec4 operator-(tvec4 const & v, T scalar) + GLM_FUNC_QUALIFIER tvec4 operator-(tvec4 const & v, const T& scalar) { return tvec4( v.x - scalar, @@ -724,7 +790,7 @@ namespace glm } template - GLM_FUNC_QUALIFIER tvec4 operator*(tvec4 const & v, T scalar) + GLM_FUNC_QUALIFIER tvec4 operator*(tvec4 const & v, const T& scalar) { return tvec4( v.x * scalar, @@ -754,7 +820,7 @@ namespace glm } template - GLM_FUNC_QUALIFIER tvec4 operator/(tvec4 const & v, T scalar) + GLM_FUNC_QUALIFIER tvec4 operator/(tvec4 const & v, const T& scalar) { return tvec4( v.x / scalar, @@ -1108,6 +1174,18 @@ namespace glm { return (v1.x != v2.x) || (v1.y != v2.y) || (v1.z != v2.z) || (v1.w != v2.w); } + + template + GLM_FUNC_QUALIFIER tvec4 operator&&(tvec4 const & v1, tvec4 const & v2) + { + return tvec4(v1.x && v2.x, v1.y && v2.y, v1.z && v2.z, v1.w && v2.w); + } + + template + GLM_FUNC_QUALIFIER tvec4 operator||(tvec4 const & v1, tvec4 const & v2) + { + return tvec4(v1.x || v2.x, v1.y || v2.y, v1.z || v2.z, v1.w || v2.w); + } }//namespace glm #if GLM_HAS_ANONYMOUS_UNION && GLM_NOT_BUGGY_VC32BITS diff --git a/external/glm/glm/ext.hpp b/external/glm/glm/ext.hpp index bdf050a9..5f662761 100644 --- a/external/glm/glm/ext.hpp +++ b/external/glm/glm/ext.hpp @@ -90,7 +90,7 @@ #include "./gtx/dual_quaternion.hpp" #include "./gtx/euler_angles.hpp" #include "./gtx/extend.hpp" -#include "./gtx/extented_min_max.hpp" +#include "./gtx/extended_min_max.hpp" #include "./gtx/fast_exponential.hpp" #include "./gtx/fast_square_root.hpp" #include "./gtx/fast_trigonometry.hpp" diff --git a/external/glm/glm/gtc/bitfield.inl b/external/glm/glm/gtc/bitfield.inl index a9eeb2eb..a5ef69be 100644 --- a/external/glm/glm/gtc/bitfield.inl +++ b/external/glm/glm/gtc/bitfield.inl @@ -87,20 +87,20 @@ namespace detail glm::uint64 REG1(x); glm::uint64 REG2(y); - REG1 = ((REG1 << 16) | REG1) & glm::uint64(0x0000FFFF0000FFFF); - REG2 = ((REG2 << 16) | REG2) & glm::uint64(0x0000FFFF0000FFFF); + REG1 = ((REG1 << 16) | REG1) & glm::uint64(0x0000FFFF0000FFFFull); + REG2 = ((REG2 << 16) | REG2) & glm::uint64(0x0000FFFF0000FFFFull); - REG1 = ((REG1 << 8) | REG1) & glm::uint64(0x00FF00FF00FF00FF); - REG2 = ((REG2 << 8) | REG2) & glm::uint64(0x00FF00FF00FF00FF); + REG1 = ((REG1 << 8) | REG1) & glm::uint64(0x00FF00FF00FF00FFull); + REG2 = ((REG2 << 8) | REG2) & glm::uint64(0x00FF00FF00FF00FFull); - REG1 = ((REG1 << 4) | REG1) & glm::uint64(0x0F0F0F0F0F0F0F0F); - REG2 = ((REG2 << 4) | REG2) & glm::uint64(0x0F0F0F0F0F0F0F0F); + REG1 = ((REG1 << 4) | REG1) & glm::uint64(0x0F0F0F0F0F0F0F0Full); + REG2 = ((REG2 << 4) | REG2) & glm::uint64(0x0F0F0F0F0F0F0F0Full); - REG1 = ((REG1 << 2) | REG1) & glm::uint64(0x3333333333333333); - REG2 = ((REG2 << 2) | REG2) & glm::uint64(0x3333333333333333); + REG1 = ((REG1 << 2) | REG1) & glm::uint64(0x3333333333333333ull); + REG2 = ((REG2 << 2) | REG2) & glm::uint64(0x3333333333333333ull); - REG1 = ((REG1 << 1) | REG1) & glm::uint64(0x5555555555555555); - REG2 = ((REG2 << 1) | REG2) & glm::uint64(0x5555555555555555); + REG1 = ((REG1 << 1) | REG1) & glm::uint64(0x5555555555555555ull); + REG2 = ((REG2 << 1) | REG2) & glm::uint64(0x5555555555555555ull); return REG1 | (REG2 << 1); } diff --git a/external/glm/glm/gtc/matrix_transform.hpp b/external/glm/glm/gtc/matrix_transform.hpp index b9f8098c..ebaf5e1f 100644 --- a/external/glm/glm/gtc/matrix_transform.hpp +++ b/external/glm/glm/gtc/matrix_transform.hpp @@ -116,14 +116,14 @@ namespace glm tmat4x4 const & m, tvec3 const & v); - /// Creates a matrix for an orthographic parallel viewing volume. - /// - /// @param left - /// @param right - /// @param bottom - /// @param top - /// @param zNear - /// @param zFar + /// Creates a matrix for an orthographic parallel viewing volume, using the default handedness. + /// + /// @param left + /// @param right + /// @param bottom + /// @param top + /// @param zNear + /// @param zFar /// @tparam T Value type used to build the matrix. Currently supported: half (not recommanded), float or double. /// @see gtc_matrix_transform /// @see - glm::ortho(T const & left, T const & right, T const & bottom, T const & top) @@ -136,12 +136,52 @@ namespace glm T zNear, T zFar); + /// Creates a matrix for an orthographic parallel viewing volume, using left-handedness. + /// + /// @param left + /// @param right + /// @param bottom + /// @param top + /// @param zNear + /// @param zFar + /// @tparam T Value type used to build the matrix. Currently supported: half (not recommanded), float or double. + /// @see gtc_matrix_transform + /// @see - glm::ortho(T const & left, T const & right, T const & bottom, T const & top) + template + GLM_FUNC_DECL tmat4x4 orthoLH( + T left, + T right, + T bottom, + T top, + T zNear, + T zFar); + + /// Creates a matrix for an orthographic parallel viewing volume, using right-handedness. + /// + /// @param left + /// @param right + /// @param bottom + /// @param top + /// @param zNear + /// @param zFar + /// @tparam T Value type used to build the matrix. Currently supported: half (not recommanded), float or double. + /// @see gtc_matrix_transform + /// @see - glm::ortho(T const & left, T const & right, T const & bottom, T const & top) + template + GLM_FUNC_DECL tmat4x4 orthoRH( + T left, + T right, + T bottom, + T top, + T zNear, + T zFar); + /// Creates a matrix for projecting two-dimensional coordinates onto the screen. - /// - /// @param left - /// @param right - /// @param bottom - /// @param top + /// + /// @param left + /// @param right + /// @param bottom + /// @param top /// @tparam T Value type used to build the matrix. Currently supported: half (not recommanded), float or double. /// @see gtc_matrix_transform /// @see - glm::ortho(T const & left, T const & right, T const & bottom, T const & top, T const & zNear, T const & zFar) @@ -152,14 +192,14 @@ namespace glm T bottom, T top); - /// Creates a frustum matrix. - /// - /// @param left - /// @param right - /// @param bottom - /// @param top - /// @param near - /// @param far + /// Creates a frustum matrix with default handedness. + /// + /// @param left + /// @param right + /// @param bottom + /// @param top + /// @param near + /// @param far /// @tparam T Value type used to build the matrix. Currently supported: half (not recommanded), float or double. /// @see gtc_matrix_transform template @@ -171,6 +211,44 @@ namespace glm T near, T far); + /// Creates a left handed frustum matrix. + /// + /// @param left + /// @param right + /// @param bottom + /// @param top + /// @param near + /// @param far + /// @tparam T Value type used to build the matrix. Currently supported: half (not recommanded), float or double. + /// @see gtc_matrix_transform + template + GLM_FUNC_DECL tmat4x4 frustumLH( + T left, + T right, + T bottom, + T top, + T near, + T far); + + /// Creates a right handed frustum matrix. + /// + /// @param left + /// @param right + /// @param bottom + /// @param top + /// @param near + /// @param far + /// @tparam T Value type used to build the matrix. Currently supported: half (not recommanded), float or double. + /// @see gtc_matrix_transform + template + GLM_FUNC_DECL tmat4x4 frustumRH( + T left, + T right, + T bottom, + T top, + T near, + T far); + /// Creates a matrix for a symetric perspective-view frustum based on the default handedness. /// /// @param fovy Specifies the field of view angle in the y direction. Expressed in radians. @@ -267,8 +345,8 @@ namespace glm T near, T far); - /// Creates a matrix for a symmetric perspective-view frustum with far plane at infinite. - /// + /// Creates a matrix for a symmetric perspective-view frustum with far plane at infinite with default handedness. + /// /// @param fovy Specifies the field of view angle, in degrees, in the y direction. Expressed in radians. /// @param aspect Specifies the aspect ratio that determines the field of view in the x direction. The aspect ratio is the ratio of x (width) to y (height). /// @param near Specifies the distance from the viewer to the near clipping plane (always positive). @@ -278,6 +356,28 @@ namespace glm GLM_FUNC_DECL tmat4x4 infinitePerspective( T fovy, T aspect, T near); + /// Creates a matrix for a left handed, symmetric perspective-view frustum with far plane at infinite. + /// + /// @param fovy Specifies the field of view angle, in degrees, in the y direction. Expressed in radians. + /// @param aspect Specifies the aspect ratio that determines the field of view in the x direction. The aspect ratio is the ratio of x (width) to y (height). + /// @param near Specifies the distance from the viewer to the near clipping plane (always positive). + /// @tparam T Value type used to build the matrix. Currently supported: half (not recommanded), float or double. + /// @see gtc_matrix_transform + template + GLM_FUNC_DECL tmat4x4 infinitePerspectiveLH( + T fovy, T aspect, T near); + + /// Creates a matrix for a right handed, symmetric perspective-view frustum with far plane at infinite. + /// + /// @param fovy Specifies the field of view angle, in degrees, in the y direction. Expressed in radians. + /// @param aspect Specifies the aspect ratio that determines the field of view in the x direction. The aspect ratio is the ratio of x (width) to y (height). + /// @param near Specifies the distance from the viewer to the near clipping plane (always positive). + /// @tparam T Value type used to build the matrix. Currently supported: half (not recommanded), float or double. + /// @see gtc_matrix_transform + template + GLM_FUNC_DECL tmat4x4 infinitePerspectiveRH( + T fovy, T aspect, T near); + /// Creates a matrix for a symmetric perspective-view frustum with far plane at infinite for graphics hardware that doesn't support depth clamping. /// /// @param fovy Specifies the field of view angle, in degrees, in the y direction. Expressed in radians. diff --git a/external/glm/glm/gtc/matrix_transform.inl b/external/glm/glm/gtc/matrix_transform.inl index d60494e3..d8929c81 100644 --- a/external/glm/glm/gtc/matrix_transform.inl +++ b/external/glm/glm/gtc/matrix_transform.inl @@ -150,31 +150,73 @@ namespace glm template GLM_FUNC_QUALIFIER tmat4x4 ortho ( - T left, - T right, - T bottom, - T top, - T zNear, - T zFar + T left, T right, + T bottom, T top, + T zNear, T zFar + ) + { +# if GLM_COORDINATE_SYSTEM == GLM_LEFT_HANDED + return orthoLH(left, right, bottom, top, zNear, zFar); +# else + return orthoRH(left, right, bottom, top, zNear, zFar); +# endif + } + + template + GLM_FUNC_QUALIFIER tmat4x4 orthoLH + ( + T left, T right, + T bottom, T top, + T zNear, T zFar ) { tmat4x4 Result(1); Result[0][0] = static_cast(2) / (right - left); Result[1][1] = static_cast(2) / (top - bottom); - Result[2][2] = - static_cast(2) / (zFar - zNear); Result[3][0] = - (right + left) / (right - left); Result[3][1] = - (top + bottom) / (top - bottom); - Result[3][2] = - (zFar + zNear) / (zFar - zNear); + +# if GLM_DEPTH_CLIP_SPACE == GLM_DEPTH_ZERO_TO_ONE + Result[2][2] = static_cast(1) / (zFar - zNear); + Result[3][2] = - zNear / (zFar - zNear); +# else + Result[2][2] = static_cast(2) / (zFar - zNear); + Result[3][2] = - (zFar + zNear) / (zFar - zNear); +# endif + + return Result; + } + + template + GLM_FUNC_QUALIFIER tmat4x4 orthoRH + ( + T left, T right, + T bottom, T top, + T zNear, T zFar + ) + { + tmat4x4 Result(1); + Result[0][0] = static_cast(2) / (right - left); + Result[1][1] = static_cast(2) / (top - bottom); + Result[3][0] = - (right + left) / (right - left); + Result[3][1] = - (top + bottom) / (top - bottom); + +# if GLM_DEPTH_CLIP_SPACE == GLM_DEPTH_ZERO_TO_ONE + Result[2][2] = - static_cast(1) / (zFar - zNear); + Result[3][2] = - zNear / (zFar - zNear); +# else + Result[2][2] = - static_cast(2) / (zFar - zNear); + Result[3][2] = - (zFar + zNear) / (zFar - zNear); +# endif + return Result; } template GLM_FUNC_QUALIFIER tmat4x4 ortho ( - T left, - T right, - T bottom, - T top + T left, T right, + T bottom, T top ) { tmat4x4 Result(1); @@ -189,12 +231,50 @@ namespace glm template GLM_FUNC_QUALIFIER tmat4x4 frustum ( - T left, - T right, - T bottom, - T top, - T nearVal, - T farVal + T left, T right, + T bottom, T top, + T nearVal, T farVal + ) + { +# if GLM_COORDINATE_SYSTEM == GLM_LEFT_HANDED + return frustumLH(left, right, bottom, top, nearVal, farVal); +# else + return frustumRH(left, right, bottom, top, nearVal, farVal); +# endif + } + + template + GLM_FUNC_QUALIFIER tmat4x4 frustumLH + ( + T left, T right, + T bottom, T top, + T nearVal, T farVal + ) + { + tmat4x4 Result(0); + Result[0][0] = (static_cast(2) * nearVal) / (right - left); + Result[1][1] = (static_cast(2) * nearVal) / (top - bottom); + Result[2][0] = (right + left) / (right - left); + Result[2][1] = (top + bottom) / (top - bottom); + Result[2][3] = static_cast(1); + +# if GLM_DEPTH_CLIP_SPACE == GLM_DEPTH_ZERO_TO_ONE + Result[2][2] = farVal / (farVal - nearVal); + Result[3][2] = -(farVal * nearVal) / (farVal - nearVal); +# else + Result[2][2] = (farVal + nearVal) / (farVal - nearVal); + Result[3][2] = - (static_cast(2) * farVal * nearVal) / (farVal - nearVal); +# endif + + return Result; + } + + template + GLM_FUNC_QUALIFIER tmat4x4 frustumRH + ( + T left, T right, + T bottom, T top, + T nearVal, T farVal ) { tmat4x4 Result(0); @@ -202,9 +282,16 @@ namespace glm Result[1][1] = (static_cast(2) * nearVal) / (top - bottom); Result[2][0] = (right + left) / (right - left); Result[2][1] = (top + bottom) / (top - bottom); - Result[2][2] = -(farVal + nearVal) / (farVal - nearVal); Result[2][3] = static_cast(-1); - Result[3][2] = -(static_cast(2) * farVal * nearVal) / (farVal - nearVal); + +# if GLM_DEPTH_CLIP_SPACE == GLM_DEPTH_ZERO_TO_ONE + Result[2][2] = farVal / (nearVal - farVal); + Result[3][2] = -(farVal * nearVal) / (farVal - nearVal); +# else + Result[2][2] = - (farVal + nearVal) / (farVal - nearVal); + Result[3][2] = - (static_cast(2) * farVal * nearVal) / (farVal - nearVal); +# endif + return Result; } @@ -217,11 +304,11 @@ namespace glm T zFar ) { - #ifdef GLM_LEFT_HANDED +# if GLM_COORDINATE_SYSTEM == GLM_LEFT_HANDED return perspectiveLH(fovy, aspect, zNear, zFar); - #else +# else return perspectiveRH(fovy, aspect, zNear, zFar); - #endif +# endif } template @@ -229,8 +316,7 @@ namespace glm ( T fovy, T aspect, - T zNear, - T zFar + T zNear, T zFar ) { assert(abs(aspect - std::numeric_limits::epsilon()) > static_cast(0)); @@ -240,20 +326,26 @@ namespace glm tmat4x4 Result(static_cast(0)); Result[0][0] = static_cast(1) / (aspect * tanHalfFovy); Result[1][1] = static_cast(1) / (tanHalfFovy); - Result[2][2] = - (zFar + zNear) / (zFar - zNear); Result[2][3] = - static_cast(1); - Result[3][2] = - (static_cast(2) * zFar * zNear) / (zFar - zNear); + +# if GLM_DEPTH_CLIP_SPACE == GLM_DEPTH_ZERO_TO_ONE + Result[2][2] = zFar / (zNear - zFar); + Result[3][2] = -(zFar * zNear) / (zFar - zNear); +# else + Result[2][2] = - (zFar + zNear) / (zFar - zNear); + Result[3][2] = - (static_cast(2) * zFar * zNear) / (zFar - zNear); +# endif + return Result; } template GLM_FUNC_QUALIFIER tmat4x4 perspectiveLH - ( + ( T fovy, T aspect, - T zNear, - T zFar - ) + T zNear, T zFar + ) { assert(abs(aspect - std::numeric_limits::epsilon()) > static_cast(0)); @@ -262,9 +354,16 @@ namespace glm tmat4x4 Result(static_cast(0)); Result[0][0] = static_cast(1) / (aspect * tanHalfFovy); Result[1][1] = static_cast(1) / (tanHalfFovy); - Result[2][2] = (zFar + zNear) / (zFar - zNear); Result[2][3] = static_cast(1); - Result[3][2] = -(static_cast(2) * zFar * zNear) / (zFar - zNear); + +# if GLM_DEPTH_CLIP_SPACE == GLM_DEPTH_ZERO_TO_ONE + Result[2][2] = zFar / (zFar - zNear); + Result[3][2] = -(zFar * zNear) / (zFar - zNear); +# else + Result[2][2] = (zFar + zNear) / (zFar - zNear); + Result[3][2] = - (static_cast(2) * zFar * zNear) / (zFar - zNear); +# endif + return Result; } @@ -272,27 +371,23 @@ namespace glm GLM_FUNC_QUALIFIER tmat4x4 perspectiveFov ( T fov, - T width, - T height, - T zNear, - T zFar + T width, T height, + T zNear, T zFar ) { - #ifdef GLM_LEFT_HANDED +# if GLM_COORDINATE_SYSTEM == GLM_LEFT_HANDED return perspectiveFovLH(fov, width, height, zNear, zFar); - #else +# else return perspectiveFovRH(fov, width, height, zNear, zFar); - #endif +# endif } template GLM_FUNC_QUALIFIER tmat4x4 perspectiveFovRH ( T fov, - T width, - T height, - T zNear, - T zFar + T width, T height, + T zNear, T zFar ) { assert(width > static_cast(0)); @@ -306,9 +401,16 @@ namespace glm tmat4x4 Result(static_cast(0)); Result[0][0] = w; Result[1][1] = h; - Result[2][2] = - (zFar + zNear) / (zFar - zNear); Result[2][3] = - static_cast(1); - Result[3][2] = - (static_cast(2) * zFar * zNear) / (zFar - zNear); + +# if GLM_DEPTH_CLIP_SPACE == GLM_DEPTH_ZERO_TO_ONE + Result[2][2] = zFar / (zNear - zFar); + Result[3][2] = -(zFar * zNear) / (zFar - zNear); +# else + Result[2][2] = - (zFar + zNear) / (zFar - zNear); + Result[3][2] = - (static_cast(2) * zFar * zNear) / (zFar - zNear); +# endif + return Result; } @@ -316,10 +418,8 @@ namespace glm GLM_FUNC_QUALIFIER tmat4x4 perspectiveFovLH ( T fov, - T width, - T height, - T zNear, - T zFar + T width, T height, + T zNear, T zFar ) { assert(width > static_cast(0)); @@ -333,9 +433,16 @@ namespace glm tmat4x4 Result(static_cast(0)); Result[0][0] = w; Result[1][1] = h; - Result[2][2] = (zFar + zNear) / (zFar - zNear); Result[2][3] = static_cast(1); - Result[3][2] = - (static_cast(2) * zFar * zNear) / (zFar - zNear); + +# if GLM_DEPTH_CLIP_SPACE == GLM_DEPTH_ZERO_TO_ONE + Result[2][2] = zFar / (zFar - zNear); + Result[3][2] = -(zFar * zNear) / (zFar - zNear); +# else + Result[2][2] = (zFar + zNear) / (zFar - zNear); + Result[3][2] = - (static_cast(2) * zFar * zNear) / (zFar - zNear); +# endif + return Result; } @@ -346,6 +453,21 @@ namespace glm T aspect, T zNear ) + { +# if GLM_COORDINATE_SYSTEM == GLM_LEFT_HANDED + return infinitePerspectiveLH(fovy, aspect, zNear); +# else + return infinitePerspectiveRH(fovy, aspect, zNear); +# endif + } + + template + GLM_FUNC_QUALIFIER tmat4x4 infinitePerspectiveRH + ( + T fovy, + T aspect, + T zNear + ) { T const range = tan(fovy / T(2)) * zNear; T const left = -range * aspect; @@ -362,6 +484,29 @@ namespace glm return Result; } + template + GLM_FUNC_QUALIFIER tmat4x4 infinitePerspectiveLH + ( + T fovy, + T aspect, + T zNear + ) + { + T const range = tan(fovy / T(2)) * zNear; + T const left = -range * aspect; + T const right = range * aspect; + T const bottom = -range; + T const top = range; + + tmat4x4 Result(T(0)); + Result[0][0] = (T(2) * zNear) / (right - left); + Result[1][1] = (T(2) * zNear) / (top - bottom); + Result[2][2] = T(1); + Result[2][3] = T(1); + Result[3][2] = - T(2) * zNear; + return Result; + } + // Infinite projection matrix: http://www.terathon.com/gdc07_lengyel.pdf template GLM_FUNC_QUALIFIER tmat4x4 tweakedInfinitePerspective @@ -412,7 +557,12 @@ namespace glm tmp = proj * tmp; tmp /= tmp.w; - tmp = tmp * T(0.5) + T(0.5); +# if GLM_DEPTH_CLIP_SPACE == GLM_DEPTH_ZERO_TO_ONE + tmp.x = tmp.x * T(0.5) + T(0.5); + tmp.y = tmp.y * T(0.5) + T(0.5); +# else + tmp = tmp * T(0.5) + T(0.5); +# endif tmp[0] = tmp[0] * T(viewport[2]) + T(viewport[0]); tmp[1] = tmp[1] * T(viewport[3]) + T(viewport[1]); @@ -433,7 +583,12 @@ namespace glm tvec4 tmp = tvec4(win, T(1)); tmp.x = (tmp.x - T(viewport[0])) / T(viewport[2]); tmp.y = (tmp.y - T(viewport[1])) / T(viewport[3]); - tmp = tmp * T(2) - T(1); +# if GLM_DEPTH_CLIP_SPACE == GLM_DEPTH_ZERO_TO_ONE + tmp.x = tmp.x * T(2) - T(1); + tmp.y = tmp.y * T(2) - T(1); +# else + tmp = tmp * T(2) - T(1); +# endif tvec4 obj = Inverse * tmp; obj /= obj.w; @@ -473,11 +628,11 @@ namespace glm tvec3 const & up ) { - #ifdef GLM_LEFT_HANDED +# if GLM_COORDINATE_SYSTEM == GLM_LEFT_HANDED return lookAtLH(eye, center, up); - #else +# else return lookAtRH(eye, center, up); - #endif +# endif } template diff --git a/external/glm/glm/gtc/packing.hpp b/external/glm/glm/gtc/packing.hpp index 8808aa4f..b016eb15 100644 --- a/external/glm/glm/gtc/packing.hpp +++ b/external/glm/glm/gtc/packing.hpp @@ -472,6 +472,136 @@ namespace glm /// @see uint32 packF2x11_1x10(vec3 const & v) GLM_FUNC_DECL vec3 unpackF2x11_1x10(uint32 p); + + /// First, converts the first two components of the normalized floating-point value v into 11-bit signless floating-point values. + /// Then, converts the third component of the normalized floating-point value v into a 10-bit signless floating-point value. + /// Then, the results are packed into the returned 32-bit unsigned integer. + /// + /// The first vector component specifies the 11 least-significant bits of the result; + /// the last component specifies the 10 most-significant bits. + /// + /// @see gtc_packing + /// @see vec3 unpackF3x9_E1x5(uint32 const & p) + GLM_FUNC_DECL uint32 packF3x9_E1x5(vec3 const & v); + + /// First, unpacks a single 32-bit unsigned integer p into two 11-bit signless floating-point values and one 10-bit signless floating-point value . + /// Then, each component is converted to a normalized floating-point value to generate the returned three-component vector. + /// + /// The first component of the returned vector will be extracted from the least significant bits of the input; + /// the last component will be extracted from the most significant bits. + /// + /// @see gtc_packing + /// @see uint32 packF3x9_E1x5(vec3 const & v) + GLM_FUNC_DECL vec3 unpackF3x9_E1x5(uint32 p); + + /// Returns an unsigned integer vector obtained by converting the components of a floating-point vector + /// to the 16-bit floating-point representation found in the OpenGL Specification. + /// The first vector component specifies the 16 least-significant bits of the result; + /// the forth component specifies the 16 most-significant bits. + /// + /// @see gtc_packing + /// @see vecType unpackHalf(vecType const & p) + /// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions + template class vecType> + GLM_FUNC_DECL vecType packHalf(vecType const & v); + + /// Returns a floating-point vector with components obtained by reinterpreting an integer vector as 16-bit floating-point numbers and converting them to 32-bit floating-point values. + /// The first component of the vector is obtained from the 16 least-significant bits of v; + /// the forth component is obtained from the 16 most-significant bits of v. + /// + /// @see gtc_packing + /// @see vecType packHalf(vecType const & v) + /// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions + template class vecType> + GLM_FUNC_DECL vecType unpackHalf(vecType const & p); + + /// Convert each component of the normalized floating-point vector into unsigned integer values. + /// + /// @see gtc_packing + /// @see vecType unpackUnorm(vecType const & p); + template class vecType> + GLM_FUNC_DECL vecType packUnorm(vecType const & v); + + /// Convert each unsigned integer components of a vector to normalized floating-point values. + /// + /// @see gtc_packing + /// @see vecType packUnorm(vecType const & v) + template class vecType> + GLM_FUNC_DECL vecType unpackUnorm(vecType const & v); + + /// Convert each component of the normalized floating-point vector into signed integer values. + /// + /// @see gtc_packing + /// @see vecType unpackSnorm(vecType const & p); + template class vecType> + GLM_FUNC_DECL vecType packSnorm(vecType const & v); + + /// Convert each signed integer components of a vector to normalized floating-point values. + /// + /// @see gtc_packing + /// @see vecType packSnorm(vecType const & v) + template class vecType> + GLM_FUNC_DECL vecType unpackSnorm(vecType const & v); + + /// Convert each component of the normalized floating-point vector into unsigned integer values. + /// + /// @see gtc_packing + /// @see vec2 unpackUnorm2x4(uint8 p) + GLM_FUNC_DECL uint8 packUnorm2x4(vec2 const & v); + + /// Convert each unsigned integer components of a vector to normalized floating-point values. + /// + /// @see gtc_packing + /// @see uint8 packUnorm2x4(vec2 const & v) + GLM_FUNC_DECL vec2 unpackUnorm2x4(uint8 p); + + /// Convert each component of the normalized floating-point vector into unsigned integer values. + /// + /// @see gtc_packing + /// @see vec4 unpackUnorm4x4(uint16 p) + GLM_FUNC_DECL uint16 packUnorm4x4(vec4 const & v); + + /// Convert each unsigned integer components of a vector to normalized floating-point values. + /// + /// @see gtc_packing + /// @see uint16 packUnorm4x4(vec4 const & v) + GLM_FUNC_DECL vec4 unpackUnorm4x4(uint16 p); + + /// Convert each component of the normalized floating-point vector into unsigned integer values. + /// + /// @see gtc_packing + /// @see vec3 unpackUnorm1x5_1x6_1x5(uint16 p) + GLM_FUNC_DECL uint16 packUnorm1x5_1x6_1x5(vec3 const & v); + + /// Convert each unsigned integer components of a vector to normalized floating-point values. + /// + /// @see gtc_packing + /// @see uint16 packUnorm1x5_1x6_1x5(vec3 const & v) + GLM_FUNC_DECL vec3 unpackUnorm1x5_1x6_1x5(uint16 p); + + /// Convert each component of the normalized floating-point vector into unsigned integer values. + /// + /// @see gtc_packing + /// @see vec4 unpackUnorm3x5_1x1(uint16 p) + GLM_FUNC_DECL uint16 packUnorm3x5_1x1(vec4 const & v); + + /// Convert each unsigned integer components of a vector to normalized floating-point values. + /// + /// @see gtc_packing + /// @see uint16 packUnorm3x5_1x1(vec4 const & v) + GLM_FUNC_DECL vec4 unpackUnorm3x5_1x1(uint16 p); + + /// Convert each component of the normalized floating-point vector into unsigned integer values. + /// + /// @see gtc_packing + /// @see vec3 unpackUnorm2x3_1x2(uint8 p) + GLM_FUNC_DECL uint8 packUnorm2x3_1x2(vec3 const & v); + + /// Convert each unsigned integer components of a vector to normalized floating-point values. + /// + /// @see gtc_packing + /// @see uint8 packUnorm2x3_1x2(vec3 const & v) + GLM_FUNC_DECL vec3 unpackUnorm2x3_1x2(uint8 p); /// @} }// namespace glm diff --git a/external/glm/glm/gtc/packing.inl b/external/glm/glm/gtc/packing.inl index 6f351a8f..5c6667af 100644 --- a/external/glm/glm/gtc/packing.inl +++ b/external/glm/glm/gtc/packing.inl @@ -36,6 +36,7 @@ #include "../vec4.hpp" #include "../detail/type_half.hpp" #include +#include namespace glm{ namespace detail @@ -224,6 +225,62 @@ namespace detail // return ((floatTo11bit(x) & ((1 << 11) - 1)) << 0) | ((floatTo11bit(y) & ((1 << 11) - 1)) << 11) | ((floatTo10bit(z) & ((1 << 10) - 1)) << 22); // } + union u3u3u2 + { + struct + { + uint x : 3; + uint y : 3; + uint z : 2; + } data; + uint8 pack; + }; + + union u4u4 + { + struct + { + uint x : 4; + uint y : 4; + } data; + uint8 pack; + }; + + union u4u4u4u4 + { + struct + { + uint x : 4; + uint y : 4; + uint z : 4; + uint w : 4; + } data; + uint16 pack; + }; + + union u5u6u5 + { + struct + { + uint x : 5; + uint y : 6; + uint z : 5; + } data; + uint16 pack; + }; + + union u5u5u5u1 + { + struct + { + uint x : 5; + uint y : 5; + uint z : 5; + uint w : 1; + } data; + uint16 pack; + }; + union u10u10u10u2 { struct @@ -248,6 +305,99 @@ namespace detail uint32 pack; }; + union u9u9u9e5 + { + struct + { + uint x : 9; + uint y : 9; + uint z : 9; + uint w : 5; + } data; + uint32 pack; + }; + + template class vecType> + struct compute_half + {}; + + template + struct compute_half + { + GLM_FUNC_QUALIFIER static tvec1 pack(tvec1 const & v) + { + int16 const Unpacked(detail::toFloat16(v.x)); + return tvec1(reinterpret_cast(Unpacked)); + } + + GLM_FUNC_QUALIFIER static tvec1 unpack(tvec1 const & v) + { + return tvec1(detail::toFloat32(reinterpret_cast(v.x))); + } + }; + + template + struct compute_half + { + GLM_FUNC_QUALIFIER static tvec2 pack(tvec2 const & v) + { + tvec2 const Unpacked(detail::toFloat16(v.x), detail::toFloat16(v.y)); + return tvec2( + reinterpret_cast(Unpacked.x), + reinterpret_cast(Unpacked.y)); + } + + GLM_FUNC_QUALIFIER static tvec2 unpack(tvec2 const & v) + { + return tvec2( + detail::toFloat32(reinterpret_cast(v.x)), + detail::toFloat32(reinterpret_cast(v.y))); + } + }; + + template + struct compute_half + { + GLM_FUNC_QUALIFIER static tvec3 pack(tvec3 const & v) + { + tvec3 const Unpacked(detail::toFloat16(v.x), detail::toFloat16(v.y), detail::toFloat16(v.z)); + return tvec3( + reinterpret_cast(Unpacked.x), + reinterpret_cast(Unpacked.y), + reinterpret_cast(Unpacked.z)); + } + + GLM_FUNC_QUALIFIER static tvec3 unpack(tvec3 const & v) + { + return tvec3( + detail::toFloat32(reinterpret_cast(v.x)), + detail::toFloat32(reinterpret_cast(v.y)), + detail::toFloat32(reinterpret_cast(v.z))); + } + }; + + template + struct compute_half + { + GLM_FUNC_QUALIFIER static tvec4 pack(tvec4 const & v) + { + tvec4 const Unpacked(detail::toFloat16(v.x), detail::toFloat16(v.y), detail::toFloat16(v.z), detail::toFloat16(v.w)); + return tvec4( + reinterpret_cast(Unpacked.x), + reinterpret_cast(Unpacked.y), + reinterpret_cast(Unpacked.z), + reinterpret_cast(Unpacked.w)); + } + + GLM_FUNC_QUALIFIER static tvec4 unpack(tvec4 const & v) + { + return tvec4( + detail::toFloat32(reinterpret_cast(v.x)), + detail::toFloat32(reinterpret_cast(v.y)), + detail::toFloat32(reinterpret_cast(v.z)), + detail::toFloat32(reinterpret_cast(v.w))); + } + }; }//namespace detail GLM_FUNC_QUALIFIER uint8 packUnorm1x8(float v) @@ -300,7 +450,7 @@ namespace detail Unpack * 0.00787401574803149606299212598425f, // 1.0f / 127.0f -1.0f, 1.0f); } - + GLM_FUNC_QUALIFIER uint16 packUnorm1x16(float s) { return static_cast(round(clamp(s, 0.0f, 1.0f) * 65535.0f)); @@ -486,4 +636,171 @@ namespace detail detail::packed10bitToFloat(v >> 22)); } + GLM_FUNC_QUALIFIER uint32 packF3x9_E1x5(vec3 const & v) + { + float const SharedExpMax = (pow(2.0f, 9.0f - 1.0f) / pow(2.0f, 9.0f)) * pow(2.0f, 31.f - 15.f); + vec3 const Color = clamp(v, 0.0f, SharedExpMax); + float const MaxColor = max(Color.x, max(Color.y, Color.z)); + + float const ExpSharedP = max(-15.f - 1.f, floor(log2(MaxColor))) + 1.0f + 15.f; + float const MaxShared = floor(MaxColor / pow(2.0f, (ExpSharedP - 16.f - 9.f)) + 0.5f); + float const ExpShared = MaxShared == pow(2.0f, 9.0f) ? ExpSharedP + 1.0f : ExpSharedP; + + uvec3 const ColorComp(floor(Color / pow(2.f, (ExpShared - 15.f - 9.f)) + 0.5f)); + + detail::u9u9u9e5 Unpack; + Unpack.data.x = ColorComp.x; + Unpack.data.y = ColorComp.y; + Unpack.data.z = ColorComp.z; + Unpack.data.w = uint(ExpShared); + return Unpack.pack; + } + + GLM_FUNC_QUALIFIER vec3 unpackF3x9_E1x5(uint32 v) + { + detail::u9u9u9e5 Unpack; + Unpack.pack = v; + + return vec3(Unpack.data.x, Unpack.data.y, Unpack.data.z) * pow(2.0f, Unpack.data.w - 15.f - 9.f); + } + + template class vecType> + GLM_FUNC_QUALIFIER vecType packHalf(vecType const & v) + { + return detail::compute_half::pack(v); + } + + template class vecType> + GLM_FUNC_QUALIFIER vecType unpackHalf(vecType const & v) + { + return detail::compute_half::unpack(v); + } + + template class vecType> + GLM_FUNC_QUALIFIER vecType packUnorm(vecType const & v) + { + GLM_STATIC_ASSERT(std::numeric_limits::is_integer, "uintType must be an integer type"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "floatType must be a floating point type"); + + return vecType(round(clamp(v, static_cast(0), static_cast(1)) * static_cast(std::numeric_limits::max()))); + } + + template class vecType> + GLM_FUNC_QUALIFIER vecType unpackUnorm(vecType const & v) + { + GLM_STATIC_ASSERT(std::numeric_limits::is_integer, "uintType must be an integer type"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "floatType must be a floating point type"); + + return vecType(v) * (static_cast(1) / static_cast(std::numeric_limits::max())); + } + + template class vecType> + GLM_FUNC_QUALIFIER vecType packSnorm(vecType const & v) + { + GLM_STATIC_ASSERT(std::numeric_limits::is_integer, "uintType must be an integer type"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "floatType must be a floating point type"); + + return vecType(round(clamp(v , static_cast(-1), static_cast(1)) * static_cast(std::numeric_limits::max()))); + } + + template class vecType> + GLM_FUNC_QUALIFIER vecType unpackSnorm(vecType const & v) + { + GLM_STATIC_ASSERT(std::numeric_limits::is_integer, "uintType must be an integer type"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "floatType must be a floating point type"); + + return clamp(vecType(v) * (static_cast(1) / static_cast(std::numeric_limits::max())), static_cast(-1), static_cast(1)); + } + + GLM_FUNC_QUALIFIER uint8 packUnorm2x4(vec2 const & v) + { + u32vec2 const Unpack(round(clamp(v, 0.0f, 1.0f) * 15.0f)); + detail::u4u4 Result; + Result.data.x = Unpack.x; + Result.data.y = Unpack.y; + return Result.pack; + } + + GLM_FUNC_QUALIFIER vec2 unpackUnorm2x4(uint8 v) + { + float const ScaleFactor(1.f / 15.f); + detail::u4u4 Unpack; + Unpack.pack = v; + return vec2(Unpack.data.x, Unpack.data.y) * ScaleFactor; + } + + GLM_FUNC_QUALIFIER uint16 packUnorm4x4(vec4 const & v) + { + u32vec4 const Unpack(round(clamp(v, 0.0f, 1.0f) * 15.0f)); + detail::u4u4u4u4 Result; + Result.data.x = Unpack.x; + Result.data.y = Unpack.y; + Result.data.z = Unpack.z; + Result.data.w = Unpack.w; + return Result.pack; + } + + GLM_FUNC_QUALIFIER vec4 unpackUnorm4x4(uint16 v) + { + float const ScaleFactor(1.f / 15.f); + detail::u4u4u4u4 Unpack; + Unpack.pack = v; + return vec4(Unpack.data.x, Unpack.data.y, Unpack.data.z, Unpack.data.w) * ScaleFactor; + } + + GLM_FUNC_QUALIFIER uint16 packUnorm1x5_1x6_1x5(vec3 const & v) + { + u32vec3 const Unpack(round(clamp(v, 0.0f, 1.0f) * vec3(15.f, 31.f, 15.f))); + detail::u5u6u5 Result; + Result.data.x = Unpack.x; + Result.data.y = Unpack.y; + Result.data.z = Unpack.z; + return Result.pack; + } + + GLM_FUNC_QUALIFIER vec3 unpackUnorm1x5_1x6_1x5(uint16 v) + { + vec3 const ScaleFactor(1.f / 15.f, 1.f / 31.f, 1.f / 15.f); + detail::u5u6u5 Unpack; + Unpack.pack = v; + return vec3(Unpack.data.x, Unpack.data.y, Unpack.data.z) * ScaleFactor; + } + + GLM_FUNC_QUALIFIER uint16 packUnorm3x5_1x1(vec4 const & v) + { + u32vec4 const Unpack(round(clamp(v, 0.0f, 1.0f) * vec4(15.f, 15.f, 15.f, 1.f))); + detail::u5u5u5u1 Result; + Result.data.x = Unpack.x; + Result.data.y = Unpack.y; + Result.data.z = Unpack.z; + Result.data.w = Unpack.w; + return Result.pack; + } + + GLM_FUNC_QUALIFIER vec4 unpackUnorm3x5_1x1(uint16 v) + { + vec4 const ScaleFactor(1.f / 15.f, 1.f / 15.f, 1.f / 15.f, 1.f); + detail::u5u5u5u1 Unpack; + Unpack.pack = v; + return vec4(Unpack.data.x, Unpack.data.y, Unpack.data.z, Unpack.data.w) * ScaleFactor; + } + + GLM_FUNC_QUALIFIER uint8 packUnorm2x3_1x2(vec3 const & v) + { + u32vec3 const Unpack(round(clamp(v, 0.0f, 1.0f) * vec3(7.f, 7.f, 3.f))); + detail::u3u3u2 Result; + Result.data.x = Unpack.x; + Result.data.y = Unpack.y; + Result.data.z = Unpack.z; + return Result.pack; + } + + GLM_FUNC_QUALIFIER vec3 unpackUnorm2x3_1x2(uint8 v) + { + vec3 const ScaleFactor(1.f / 7.f, 1.f / 7.f, 1.f / 3.f); + detail::u3u3u2 Unpack; + Unpack.pack = v; + return vec3(Unpack.data.x, Unpack.data.y, Unpack.data.z) * ScaleFactor; + } }//namespace glm + diff --git a/external/glm/glm/gtc/quaternion.hpp b/external/glm/glm/gtc/quaternion.hpp index 6fae5cc6..431228d7 100644 --- a/external/glm/glm/gtc/quaternion.hpp +++ b/external/glm/glm/gtc/quaternion.hpp @@ -76,6 +76,26 @@ namespace glm T x, y, z, w; +# ifdef GLM_STATIC_CONST_MEMBERS + static const type ZERO; + static const type IDENTITY; + static const type X; + static const type Y; + static const type Z; + static const type W; + static const type XY; + static const type XZ; + static const type XW; + static const type YZ; + static const type YW; + static const type ZW; + static const type XYZ; + static const type XYW; + static const type XZW; + static const type YZW; + static const type XYZW; +# endif + // -- Component accesses -- # ifdef GLM_FORCE_SIZE_FUNC @@ -104,7 +124,7 @@ namespace glm // -- Explicit basic constructors -- GLM_FUNC_DECL explicit tquat(ctor); - GLM_FUNC_DECL explicit tquat(T const & s, tvec3 const & v); + GLM_FUNC_DECL tquat(T const & s, tvec3 const & v); GLM_FUNC_DECL tquat(T const & w, T const & x, T const & y, T const & z); // -- Conversion constructors -- @@ -124,12 +144,12 @@ namespace glm /// @param v A second normalized axis /// @see gtc_quaternion /// @see http://lolengine.net/blog/2013/09/18/beautiful-maths-quaternion-from-vectors - GLM_FUNC_DECL explicit tquat(tvec3 const & u, tvec3 const & v); + GLM_FUNC_DECL tquat(tvec3 const & u, tvec3 const & v); /// Build a quaternion from euler angles (pitch, yaw, roll), in radians. - GLM_FUNC_DECL explicit tquat(tvec3 const & eulerAngles); - GLM_FUNC_DECL explicit tquat(tmat3x3 const & m); - GLM_FUNC_DECL explicit tquat(tmat4x4 const & m); + GLM_FUNC_DECL GLM_EXPLICIT tquat(tvec3 const & eulerAngles); + GLM_FUNC_DECL GLM_EXPLICIT tquat(tmat3x3 const & m); + GLM_FUNC_DECL GLM_EXPLICIT tquat(tmat4x4 const & m); // -- Unary arithmetic operators -- @@ -259,7 +279,7 @@ namespace glm template GLM_FUNC_DECL tquat rotate(tquat const & q, T const & angle, tvec3 const & axis); - /// Returns euler angles, yitch as x, yaw as y, roll as z. + /// Returns euler angles, pitch as x, yaw as y, roll as z. /// The result is expressed in radians if GLM_FORCE_RADIANS is defined or degrees otherwise. /// /// @see gtc_quaternion @@ -377,6 +397,16 @@ namespace glm template GLM_FUNC_DECL tvec4 notEqual(tquat const & x, tquat const & y); /// @} + + // -- Is type -- + + template + struct type + { + static bool const is_vec = false; + static bool const is_mat = false; + static bool const is_quat = true; + }; } //namespace glm #include "quaternion.inl" diff --git a/external/glm/glm/gtc/quaternion.inl b/external/glm/glm/gtc/quaternion.inl index 83a1b66f..b46cd62c 100644 --- a/external/glm/glm/gtc/quaternion.inl +++ b/external/glm/glm/gtc/quaternion.inl @@ -49,6 +49,73 @@ namespace detail }; }//namespace detail +# ifdef GLM_STATIC_CONST_MEMBERS + template + const tquat tquat::ZERO + (static_cast(0), static_cast(0), static_cast(0), static_cast(0)); + + template const tquat tquat::IDENTITY; + + template + const tquat tquat::X + (static_cast(0), static_cast(1), static_cast(0), static_cast(0)); + + template + const tquat tquat::Y + (static_cast(0), static_cast(0), static_cast(1), static_cast(0)); + + template + const tquat tquat::Z + (static_cast(0), static_cast(0), static_cast(0), static_cast(1)); + + template + const tquat tquat::W + (static_cast(1), static_cast(0), static_cast(0), static_cast(0)); + + template + const tquat tquat::XY + (static_cast(0), static_cast(1), static_cast(1), static_cast(0)); + + template + const tquat tquat::XZ + (static_cast(0), static_cast(0), static_cast(1), static_cast(1)); + + template + const tquat tquat::XW + (static_cast(1), static_cast(1), static_cast(0), static_cast(0)); + + template + const tquat tquat::YZ + (static_cast(0), static_cast(0), static_cast(1), static_cast(1)); + + template + const tquat tquat::YW + (static_cast(1), static_cast(0), static_cast(1), static_cast(0)); + + template + const tquat tquat::ZW + (static_cast(1), static_cast(0), static_cast(0), static_cast(1)); + + template + const tquat tquat::XYZ + (static_cast(0), static_cast(1), static_cast(1), static_cast(1)); + + template + const tquat tquat::XYW + (static_cast(1), static_cast(1), static_cast(1), static_cast(0)); + + template + const tquat tquat::XZW + (static_cast(1), static_cast(1), static_cast(0), static_cast(1)); + + template + const tquat tquat::YZW + (static_cast(1), static_cast(0), static_cast(1), static_cast(1)); + + template + const tquat tquat::XYZW + (static_cast(1), static_cast(1), static_cast(1), static_cast(1)); +# endif // -- Component accesses -- # ifdef GLM_FORCE_SIZE_FUNC @@ -597,7 +664,7 @@ namespace detail template GLM_FUNC_QUALIFIER T yaw(tquat const & q) { - return asin(T(-2) * (q.x * q.z - q.w * q.y)); + return asin(clamp(T(-2) * (q.x * q.z - q.w * q.y), T(-1), T(1))); } template diff --git a/external/glm/glm/gtc/random.hpp b/external/glm/glm/gtc/random.hpp index a9254c01..7e77202e 100644 --- a/external/glm/glm/gtc/random.hpp +++ b/external/glm/glm/gtc/random.hpp @@ -60,13 +60,20 @@ namespace glm /// /// @param Min /// @param Max - /// @tparam genType Value type. Currently supported: half (not recommanded), float or double scalars and vectors. + /// @tparam genType Value type. Currently supported: float or double scalars. /// @see gtc_random template GLM_FUNC_DECL genTYpe linearRand( genTYpe Min, genTYpe Max); + /// Generate random numbers in the interval [Min, Max], according a linear distribution + /// + /// @param Min + /// @param Max + /// @tparam T Value type. Currently supported: float or double. + /// @tparam vecType A vertor type: tvec1, tvec2, tvec3, tvec4 or compatible + /// @see gtc_random template class vecType> GLM_FUNC_DECL vecType linearRand( vecType const & Min, diff --git a/external/glm/glm/gtc/reciprocal.hpp b/external/glm/glm/gtc/reciprocal.hpp index 72480788..916dfb40 100644 --- a/external/glm/glm/gtc/reciprocal.hpp +++ b/external/glm/glm/gtc/reciprocal.hpp @@ -56,77 +56,107 @@ namespace glm /// Secant function. /// hypotenuse / adjacent or 1 / cos(x) /// + /// @tparam genType Floating-point scalar or vector types. + /// /// @see gtc_reciprocal template - GLM_FUNC_DECL genType sec(genType const & angle); + GLM_FUNC_DECL genType sec(genType angle); /// Cosecant function. /// hypotenuse / opposite or 1 / sin(x) /// + /// @tparam genType Floating-point scalar or vector types. + /// /// @see gtc_reciprocal template - GLM_FUNC_DECL genType csc(genType const & angle); + GLM_FUNC_DECL genType csc(genType angle); /// Cotangent function. /// adjacent / opposite or 1 / tan(x) /// + /// @tparam genType Floating-point scalar or vector types. + /// /// @see gtc_reciprocal template - GLM_FUNC_DECL genType cot(genType const & angle); + GLM_FUNC_DECL genType cot(genType angle); /// Inverse secant function. /// + /// @return Return an angle expressed in radians. + /// @tparam genType Floating-point scalar or vector types. + /// /// @see gtc_reciprocal template - GLM_FUNC_DECL genType asec(genType const & x); + GLM_FUNC_DECL genType asec(genType x); /// Inverse cosecant function. /// + /// @return Return an angle expressed in radians. + /// @tparam genType Floating-point scalar or vector types. + /// /// @see gtc_reciprocal template - GLM_FUNC_DECL genType acsc(genType const & x); + GLM_FUNC_DECL genType acsc(genType x); /// Inverse cotangent function. /// + /// @return Return an angle expressed in radians. + /// @tparam genType Floating-point scalar or vector types. + /// /// @see gtc_reciprocal template - GLM_FUNC_DECL genType acot(genType const & x); + GLM_FUNC_DECL genType acot(genType x); /// Secant hyperbolic function. /// + /// @tparam genType Floating-point scalar or vector types. + /// /// @see gtc_reciprocal template - GLM_FUNC_DECL genType sech(genType const & angle); + GLM_FUNC_DECL genType sech(genType angle); /// Cosecant hyperbolic function. /// + /// @tparam genType Floating-point scalar or vector types. + /// /// @see gtc_reciprocal template - GLM_FUNC_DECL genType csch(genType const & angle); + GLM_FUNC_DECL genType csch(genType angle); /// Cotangent hyperbolic function. /// + /// @tparam genType Floating-point scalar or vector types. + /// /// @see gtc_reciprocal template - GLM_FUNC_DECL genType coth(genType const & angle); + GLM_FUNC_DECL genType coth(genType angle); /// Inverse secant hyperbolic function. /// + /// @return Return an angle expressed in radians. + /// @tparam genType Floating-point scalar or vector types. + /// /// @see gtc_reciprocal template - GLM_FUNC_DECL genType asech(genType const & x); + GLM_FUNC_DECL genType asech(genType x); /// Inverse cosecant hyperbolic function. /// - /// @see gtc_reciprocal - template - GLM_FUNC_DECL genType acsch(genType const & x); - - /// Inverse cotangent hyperbolic function. + /// @return Return an angle expressed in radians. + /// @tparam genType Floating-point scalar or vector types. /// /// @see gtc_reciprocal template - GLM_FUNC_DECL genType acoth(genType const & x); + GLM_FUNC_DECL genType acsch(genType x); + + /// Inverse cotangent hyperbolic function. + /// + /// @return Return an angle expressed in radians. + /// @tparam genType Floating-point scalar or vector types. + /// + /// @see gtc_reciprocal + template + GLM_FUNC_DECL genType acoth(genType x); /// @} }//namespace glm diff --git a/external/glm/glm/gtx/component_wise.hpp b/external/glm/glm/gtx/component_wise.hpp index d5b3d818..4f90c4ff 100644 --- a/external/glm/glm/gtx/component_wise.hpp +++ b/external/glm/glm/gtx/component_wise.hpp @@ -54,29 +54,37 @@ namespace glm /// @addtogroup gtx_component_wise /// @{ + /// 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. + /// @see gtx_component_wise + template class vecType> + GLM_FUNC_DECL vecType compNormalize(vecType 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. + /// @see gtx_component_wise + template class vecType> + GLM_FUNC_DECL vecType compScale(vecType const & v); + /// Add all vector components together. /// @see gtx_component_wise template - GLM_FUNC_DECL typename genType::value_type compAdd( - genType const & v); + GLM_FUNC_DECL typename genType::value_type compAdd(genType const & v); /// Multiply all vector components together. /// @see gtx_component_wise template - GLM_FUNC_DECL typename genType::value_type compMul( - genType const & v); + 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); + 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); + GLM_FUNC_DECL typename genType::value_type compMax(genType const & v); /// @} }//namespace glm diff --git a/external/glm/glm/gtx/component_wise.inl b/external/glm/glm/gtx/component_wise.inl index f944faeb..42a641da 100644 --- a/external/glm/glm/gtx/component_wise.inl +++ b/external/glm/glm/gtx/component_wise.inl @@ -30,8 +30,95 @@ /// @author Christophe Riccio /////////////////////////////////////////////////////////////////////////////////////////////////// -namespace glm +#include + +namespace glm{ +namespace detail { + template class vecType, bool isInteger, bool signedType> + struct compute_compNormalize + {}; + + template class vecType> + struct compute_compNormalize + { + GLM_FUNC_QUALIFIER static vecType call(vecType 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); + } + }; + + template class vecType> + struct compute_compNormalize + { + GLM_FUNC_QUALIFIER static vecType call(vecType const & v) + { + return vecType(v) / static_cast(std::numeric_limits::max()); + } + }; + + template class vecType> + struct compute_compNormalize + { + GLM_FUNC_QUALIFIER static vecType call(vecType const & v) + { + return v; + } + }; + + template class vecType, bool isInteger, bool signedType> + struct compute_compScale + {}; + + template class vecType> + struct compute_compScale + { + GLM_FUNC_QUALIFIER static vecType call(vecType 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)); + return Result; + } + }; + + template class vecType> + struct compute_compScale + { + GLM_FUNC_QUALIFIER static vecType call(vecType const & v) + { + return vecType(vecType(v) * static_cast(std::numeric_limits::max())); + } + }; + + template class vecType> + struct compute_compScale + { + GLM_FUNC_QUALIFIER static vecType call(vecType const & v) + { + return v; + } + }; +}//namespace detail + + template class vecType> + GLM_FUNC_QUALIFIER vecType compNormalize(vecType 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); + } + + template class vecType> + GLM_FUNC_QUALIFIER vecType compScale(vecType 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); + } + template class vecType> GLM_FUNC_QUALIFIER T compAdd(vecType const & v) { diff --git a/external/glm/glm/gtx/dual_quaternion.hpp b/external/glm/glm/gtx/dual_quaternion.hpp index 0b083295..35a5d850 100644 --- a/external/glm/glm/gtx/dual_quaternion.hpp +++ b/external/glm/glm/gtx/dual_quaternion.hpp @@ -103,7 +103,7 @@ namespace glm // -- Explicit basic constructors -- GLM_FUNC_DECL explicit tdualquat(ctor); - GLM_FUNC_DECL explicit tdualquat(tquat const & real); + GLM_FUNC_DECL tdualquat(tquat const & real); GLM_FUNC_DECL tdualquat(tquat const & orientation, tvec3 const & translation); GLM_FUNC_DECL tdualquat(tquat const & real, tquat const & dual); @@ -112,8 +112,8 @@ namespace glm template GLM_FUNC_DECL GLM_EXPLICIT tdualquat(tdualquat const & q); - GLM_FUNC_DECL explicit tdualquat(tmat2x4 const & holder_mat); - GLM_FUNC_DECL explicit tdualquat(tmat3x4 const & aug_mat); + GLM_FUNC_DECL GLM_EXPLICIT tdualquat(tmat2x4 const & holder_mat); + GLM_FUNC_DECL GLM_EXPLICIT tdualquat(tmat3x4 const & aug_mat); // -- Unary arithmetic operators -- @@ -295,6 +295,16 @@ namespace glm #endif /// @} + + // -- Is type -- + + template + struct type + { + static bool const is_vec = false; + static bool const is_mat = false; + static bool const is_quat = true; + }; } //namespace glm #include "dual_quaternion.inl" diff --git a/external/glm/glm/gtx/euler_angles.hpp b/external/glm/glm/gtx/euler_angles.hpp index e772bbf0..c1d5683d 100644 --- a/external/glm/glm/gtx/euler_angles.hpp +++ b/external/glm/glm/gtx/euler_angles.hpp @@ -161,7 +161,7 @@ namespace glm /// Extracts the (X * Y * Z) Euler angles from the rotation matrix M /// @see gtx_euler_angles template - GLM_FUNC_DECL void extractEulerAngleXYZ(tmat4x4 & M, + GLM_FUNC_DECL void extractEulerAngleXYZ(tmat4x4 const & M, T & t1, T & t2, T & t3); diff --git a/external/glm/glm/gtx/euler_angles.inl b/external/glm/glm/gtx/euler_angles.inl index 80b30dbe..0b417000 100644 --- a/external/glm/glm/gtx/euler_angles.inl +++ b/external/glm/glm/gtx/euler_angles.inl @@ -323,7 +323,7 @@ namespace glm } template - GLM_FUNC_DECL void extractEulerAngleXYZ(tmat4x4 & M, + GLM_FUNC_DECL void extractEulerAngleXYZ(tmat4x4 const & M, T & t1, T & t2, T & t3) diff --git a/external/glm/glm/gtx/extented_min_max.hpp b/external/glm/glm/gtx/extended_min_max.hpp similarity index 97% rename from external/glm/glm/gtx/extented_min_max.hpp rename to external/glm/glm/gtx/extended_min_max.hpp index 08d56f17..dacf5d42 100644 --- a/external/glm/glm/gtx/extented_min_max.hpp +++ b/external/glm/glm/gtx/extended_min_max.hpp @@ -24,8 +24,8 @@ /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN /// THE SOFTWARE. /// -/// @ref gtx_extented_min_max -/// @file glm/gtx/extented_min_max.hpp +/// @ref gtx_extended_min_max +/// @file glm/gtx/extended_min_max.hpp /// @date 2007-03-14 / 2011-06-07 /// @author Christophe Riccio /// @@ -159,4 +159,4 @@ namespace glm /// @} }//namespace glm -#include "extented_min_max.inl" +#include "extended_min_max.inl" diff --git a/external/glm/glm/gtx/extented_min_max.inl b/external/glm/glm/gtx/extended_min_max.inl similarity index 98% rename from external/glm/glm/gtx/extented_min_max.inl rename to external/glm/glm/gtx/extended_min_max.inl index e54c8479..f8dd0e20 100644 --- a/external/glm/glm/gtx/extented_min_max.inl +++ b/external/glm/glm/gtx/extended_min_max.inl @@ -24,8 +24,8 @@ /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN /// THE SOFTWARE. /// -/// @ref gtx_extented_min_max -/// @file glm/gtx/extented_min_max.inl +/// @ref gtx_extended_min_max +/// @file glm/gtx/extended_min_max.inl /// @date 2007-03-14 / 2011-06-07 /// @author Christophe Riccio /////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/external/glm/glm/gtx/float_notmalize.inl b/external/glm/glm/gtx/float_notmalize.inl new file mode 100644 index 00000000..361c8829 --- /dev/null +++ b/external/glm/glm/gtx/float_notmalize.inl @@ -0,0 +1,43 @@ +/////////////////////////////////////////////////////////////////////////////////// +/// OpenGL Mathematics (glm.g-truc.net) +/// +/// Copyright (c) 2005 - 2015 G-Truc Creation (www.g-truc.net) +/// Permission is hereby granted, free of charge, to any person obtaining a copy +/// of this software and associated documentation files (the "Software"), to deal +/// in the Software without restriction, including without limitation the rights +/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +/// copies of the Software, and to permit persons to whom the Software is +/// furnished to do so, subject to the following conditions: +/// +/// The above copyright notice and this permission notice shall be included in +/// all copies or substantial portions of the Software. +/// +/// Restrictions: +/// By making use of the Software for military purposes, you choose to make +/// a Bunny unhappy. +/// +/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +/// THE SOFTWARE. +/// +/// @ref gtx_float_normalize +/// @file glm/gtx/float_normalize.inl +/// @date 2015-09-25 / 2015-09-25 +/// @author Christophe Riccio +/////////////////////////////////////////////////////////////////////////////////// + +#include + +namespace glm +{ + template class vecType> + GLM_FUNC_QUALIFIER vecType floatNormalize(vecType const & v) + { + return vecType(v) / static_cast(std::numeric_limits::max()); + } + +}//namespace glm diff --git a/external/glm/glm/gtx/intersect.inl b/external/glm/glm/gtx/intersect.inl index 3b1b9e8c..ac6304e0 100644 --- a/external/glm/glm/gtx/intersect.inl +++ b/external/glm/glm/gtx/intersect.inl @@ -45,7 +45,7 @@ namespace glm typename genType::value_type a = glm::dot(e1, p); typename genType::value_type Epsilon = std::numeric_limits::epsilon(); - if(a < Epsilon) + if(a < Epsilon && a > -Epsilon) return false; typename genType::value_type f = typename genType::value_type(1.0f) / a; @@ -69,43 +69,6 @@ namespace glm return baryPosition.z >= typename genType::value_type(0.0f); } - //template - //GLM_FUNC_QUALIFIER bool intersectRayTriangle - //( - // genType const & orig, genType const & dir, - // genType const & vert0, genType const & vert1, genType const & vert2, - // genType & position - //) - //{ - // typename genType::value_type Epsilon = std::numeric_limits::epsilon(); - // - // genType edge1 = vert1 - vert0; - // genType edge2 = vert2 - vert0; - // - // genType pvec = cross(dir, edge2); - // - // float det = dot(edge1, pvec); - // if(det < Epsilon) - // return false; - // - // genType tvec = orig - vert0; - // - // position.y = dot(tvec, pvec); - // if (position.y < typename genType::value_type(0) || position.y > det) - // return typename genType::value_type(0); - // - // genType qvec = cross(tvec, edge1); - // - // position.z = dot(dir, qvec); - // if (position.z < typename genType::value_type(0) || position.y + position.z > det) - // return typename genType::value_type(0); - // - // position.x = dot(edge2, qvec); - // position *= typename genType::value_type(1) / det; - // - // return typename genType::value_type(1); - //} - template GLM_FUNC_QUALIFIER bool intersectLineTriangle ( diff --git a/external/glm/glm/gtx/matrix_decompose.hpp b/external/glm/glm/gtx/matrix_decompose.hpp index e7fc83e2..e68ab498 100644 --- a/external/glm/glm/gtx/matrix_decompose.hpp +++ b/external/glm/glm/gtx/matrix_decompose.hpp @@ -45,6 +45,7 @@ #include "../mat4x4.hpp" #include "../vec3.hpp" #include "../vec4.hpp" +#include "../geometric.hpp" #include "../gtc/quaternion.hpp" #include "../gtc/matrix_transform.hpp" diff --git a/external/glm/glm/gtx/matrix_decompose.inl b/external/glm/glm/gtx/matrix_decompose.inl index dec79572..47986660 100644 --- a/external/glm/glm/gtx/matrix_decompose.inl +++ b/external/glm/glm/gtx/matrix_decompose.inl @@ -30,7 +30,8 @@ /// @author Christophe Riccio /////////////////////////////////////////////////////////////////////////////////// -namespace glm +namespace glm{ +namespace detail { /// Make a linear combination of two vectors and return the result. // result = (a * ascl) + (b * bscl) @@ -44,24 +45,15 @@ namespace glm } template - GLM_FUNC_QUALIFIER void v3Scale(tvec3 & v, T desiredLength) + GLM_FUNC_QUALIFIER tvec3 scale(tvec3 const& v, T desiredLength) { - T len = glm::length(v); - if(len != 0) - { - T l = desiredLength / len; - v[0] *= l; - v[1] *= l; - v[2] *= l; - } + return v * desiredLength / length(v); } +}//namespace detail - /** - * Matrix decompose - * http://www.opensource.apple.com/source/WebCore/WebCore-514/platform/graphics/transforms/TransformationMatrix.cpp - * Decomposes the mode matrix to translations,rotation scale components - * - */ + // Matrix decompose + // 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) @@ -131,26 +123,26 @@ namespace glm // Compute X scale factor and normalize first row. Scale.x = length(Row[0]);// v3Length(Row[0]); - v3Scale(Row[0], static_cast(1)); + Row[0] = detail::scale(Row[0], static_cast(1)); // Compute XY shear factor and make 2nd row orthogonal to 1st. Skew.z = dot(Row[0], Row[1]); - Row[1] = combine(Row[1], Row[0], static_cast(1), -Skew.z); + Row[1] = detail::combine(Row[1], Row[0], static_cast(1), -Skew.z); // Now, compute Y scale and normalize 2nd row. Scale.y = length(Row[1]); - v3Scale(Row[1], static_cast(1)); + Row[1] = detail::scale(Row[1], static_cast(1)); Skew.z /= Scale.y; // Compute XZ and YZ shears, orthogonalize 3rd row. Skew.y = glm::dot(Row[0], Row[2]); - Row[2] = combine(Row[2], Row[0], static_cast(1), -Skew.y); + Row[2] = detail::combine(Row[2], Row[0], static_cast(1), -Skew.y); Skew.x = glm::dot(Row[1], Row[2]); - Row[2] = combine(Row[2], Row[1], static_cast(1), -Skew.x); + Row[2] = detail::combine(Row[2], Row[1], static_cast(1), -Skew.x); // Next, get Z scale and normalize 3rd row. Scale.z = length(Row[2]); - v3Scale(Row[2], static_cast(1)); + Row[2] = detail::scale(Row[2], static_cast(1)); Skew.y /= Scale.z; Skew.x /= Scale.z; diff --git a/external/glm/glm/gtx/polar_coordinates.inl b/external/glm/glm/gtx/polar_coordinates.inl index d1afbb23..9d7f6aea 100644 --- a/external/glm/glm/gtx/polar_coordinates.inl +++ b/external/glm/glm/gtx/polar_coordinates.inl @@ -43,7 +43,7 @@ namespace glm T const xz_dist(sqrt(tmp.x * tmp.x + tmp.z * tmp.z)); return tvec3( - atan(xz_dist, tmp.y), // latitude + asin(tmp.y), // latitude atan(tmp.x, tmp.z), // longitude xz_dist); // xz distance } diff --git a/external/glm/glm/gtx/quaternion.hpp b/external/glm/glm/gtx/quaternion.hpp index 34d940a1..b34c3be8 100644 --- a/external/glm/glm/gtx/quaternion.hpp +++ b/external/glm/glm/gtx/quaternion.hpp @@ -57,7 +57,7 @@ namespace glm /// @addtogroup gtx_quaternion /// @{ - //! Compute a cross product between a quaternion and a vector. + /// Compute a cross product between a quaternion and a vector. /// /// @see gtx_quaternion template diff --git a/external/glm/glm/gtx/simd_mat4.hpp b/external/glm/glm/gtx/simd_mat4.hpp index 04198333..e1567610 100644 --- a/external/glm/glm/gtx/simd_mat4.hpp +++ b/external/glm/glm/gtx/simd_mat4.hpp @@ -83,6 +83,11 @@ namespace detail static GLM_RELAXED_CONSTEXPR precision prec = defaultp; # endif//GLM_META_PROG_HELPERS +# ifdef GLM_STATIC_CONST_MEMBERS + static const type ZERO; + static const type IDENTITY; +# endif + GLM_FUNC_DECL length_t length() const; fvec4SIMD Data[4]; diff --git a/external/glm/glm/gtx/simd_mat4.inl b/external/glm/glm/gtx/simd_mat4.inl index 13dcb20f..c436ab1f 100644 --- a/external/glm/glm/gtx/simd_mat4.inl +++ b/external/glm/glm/gtx/simd_mat4.inl @@ -61,6 +61,11 @@ GLM_FUNC_QUALIFIER fvec4SIMD const & fmat4x4SIMD::operator[] return this->Data[i]; } +#ifdef GLM_STATIC_CONST_MEMBERS + const fmat4x4SIMD fmat4x4SIMD::ZERO(static_cast(0)); + const fmat4x4SIMD fmat4x4SIMD::IDENTITY(static_cast(1)); +#endif + ////////////////////////////////////////////////////////////// // Constructors diff --git a/external/glm/glm/gtx/simd_quat.hpp b/external/glm/glm/gtx/simd_quat.hpp index 97075ba6..16782081 100644 --- a/external/glm/glm/gtx/simd_quat.hpp +++ b/external/glm/glm/gtx/simd_quat.hpp @@ -91,6 +91,26 @@ namespace detail __m128 Data; #endif +# ifdef GLM_STATIC_CONST_MEMBERS + static const type ZERO; + static const type IDENTITY; + static const type X; + static const type Y; + static const type Z; + static const type W; + static const type XY; + static const type XZ; + static const type XW; + static const type YZ; + static const type YW; + static const type ZW; + static const type XYZ; + static const type XYW; + static const type XZW; + static const type YZW; + static const type XYZW; +# endif + ////////////////////////////////////// // Implicit basic constructors diff --git a/external/glm/glm/gtx/simd_quat.inl b/external/glm/glm/gtx/simd_quat.inl index 2fcc7fe4..c301988a 100644 --- a/external/glm/glm/gtx/simd_quat.inl +++ b/external/glm/glm/gtx/simd_quat.inl @@ -51,6 +51,25 @@ void print(const fvec4SIMD &v) } #endif +# ifdef GLM_STATIC_CONST_MEMBERS + const fquatSIMD fquatSIMD::ZERO(0, 0, 0, 0); + const fquatSIMD fquatSIMD::IDENTITY(1, 0, 0, 0); + const fquatSIMD fquatSIMD::X(0, 1, 0, 0); + const fquatSIMD fquatSIMD::Y(0, 0, 1, 0); + const fquatSIMD fquatSIMD::Z(0, 0, 0, 1); + const fquatSIMD fquatSIMD::W(1, 0, 0, 0); + const fquatSIMD fquatSIMD::XY(0, 1, 1, 0); + const fquatSIMD fquatSIMD::XZ(0, 1, 0, 1); + const fquatSIMD fquatSIMD::XW(1, 1, 0, 0); + const fquatSIMD fquatSIMD::YZ(0, 0, 1, 1); + const fquatSIMD fquatSIMD::YW(1, 0, 1, 0); + const fquatSIMD fquatSIMD::ZW(1, 0, 0, 1); + const fquatSIMD fquatSIMD::XYZ(0, 1, 1, 1); + const fquatSIMD fquatSIMD::XYW(1, 1, 1, 0); + const fquatSIMD fquatSIMD::XZW(1, 1, 0, 1); + const fquatSIMD fquatSIMD::YZW(1, 0, 1, 1); + const fquatSIMD fquatSIMD::XYZW(1, 1, 1, 1); +# endif ////////////////////////////////////// // Implicit basic constructors diff --git a/external/glm/glm/gtx/simd_vec4.hpp b/external/glm/glm/gtx/simd_vec4.hpp index cb084852..3877f821 100644 --- a/external/glm/glm/gtx/simd_vec4.hpp +++ b/external/glm/glm/gtx/simd_vec4.hpp @@ -114,6 +114,25 @@ namespace detail __m128 Data; #endif +# ifdef GLM_STATIC_CONST_MEMBERS + static const type ZERO; + static const type X; + static const type Y; + static const type Z; + static const type W; + static const type XY; + static const type XZ; + static const type XW; + static const type YZ; + static const type YW; + static const type ZW; + static const type XYZ; + static const type XYW; + static const type XZW; + static const type YZW; + static const type XYZW; +# endif + ////////////////////////////////////// // Implicit basic constructors @@ -167,15 +186,15 @@ namespace detail ////////////////////////////////////// // Swizzle operators - template + template fvec4SIMD& swizzle(); - template + template fvec4SIMD swizzle() const; - template + template fvec4SIMD swizzle() const; - template + template fvec4SIMD swizzle() const; - template + template fvec4SIMD swizzle() const; }; }//namespace detail diff --git a/external/glm/glm/gtx/simd_vec4.inl b/external/glm/glm/gtx/simd_vec4.inl index e375073f..b1413eea 100644 --- a/external/glm/glm/gtx/simd_vec4.inl +++ b/external/glm/glm/gtx/simd_vec4.inl @@ -16,6 +16,25 @@ struct shuffle_mask enum{value = Value}; }; +# ifdef GLM_STATIC_CONST_MEMBERS + const fvec4SIMD fvec4SIMD::ZERO(0, 0, 0, 0); + const fvec4SIMD fvec4SIMD::X(1, 0, 0, 0); + const fvec4SIMD fvec4SIMD::Y(0, 1, 0, 0); + const fvec4SIMD fvec4SIMD::Z(0, 0, 1, 0); + const fvec4SIMD fvec4SIMD::W(0, 0, 0, 1); + const fvec4SIMD fvec4SIMD::XY(1, 1, 0, 0); + const fvec4SIMD fvec4SIMD::XZ(1, 0, 1, 0); + const fvec4SIMD fvec4SIMD::XW(1, 0, 0, 1); + const fvec4SIMD fvec4SIMD::YZ(0, 1, 1, 0); + const fvec4SIMD fvec4SIMD::YW(0, 1, 0, 1); + const fvec4SIMD fvec4SIMD::ZW(0, 0, 1, 1); + const fvec4SIMD fvec4SIMD::XYZ(1, 1, 1, 0); + const fvec4SIMD fvec4SIMD::XYW(1, 1, 0, 1); + const fvec4SIMD fvec4SIMD::XZW(1, 0, 1, 1); + const fvec4SIMD fvec4SIMD::YZW(0, 1, 1, 1); + const fvec4SIMD fvec4SIMD::XYZW(1, 1, 1, 1); +# endif + ////////////////////////////////////// // Implicit basic constructors @@ -167,21 +186,21 @@ GLM_FUNC_QUALIFIER fvec4SIMD& fvec4SIMD::operator--() ////////////////////////////////////// // Swizzle operators -template +template GLM_FUNC_QUALIFIER fvec4SIMD fvec4SIMD::swizzle() const { __m128 Data = _mm_shuffle_ps( this->Data, this->Data, - shuffle_mask<(W << 6) | (Z << 4) | (Y << 2) | (X << 0)>::value); + shuffle_mask<(W_ << 6) | (Z_ << 4) | (Y_ << 2) | (X_ << 0)>::value); return fvec4SIMD(Data); } -template +template GLM_FUNC_QUALIFIER fvec4SIMD& fvec4SIMD::swizzle() { this->Data = _mm_shuffle_ps( this->Data, this->Data, - shuffle_mask<(W << 6) | (Z << 4) | (Y << 2) | (X << 0)>::value); + shuffle_mask<(W_ << 6) | (Z_ << 4) | (Y_ << 2) | (X_ << 0)>::value); return *this; }