From 18c157f48ddd35283a9142b9272adbd862b81976 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Fri, 3 Jul 2020 23:02:10 +0200 Subject: [PATCH] singles: update MagnumMath for 2020.06 features. --- src/singles/MagnumMath.hpp | 127 +++++++++++++++++++++++++++++++++++-- 1 file changed, 121 insertions(+), 6 deletions(-) diff --git a/src/singles/MagnumMath.hpp b/src/singles/MagnumMath.hpp index 32f080ed0..d8c0d8883 100644 --- a/src/singles/MagnumMath.hpp +++ b/src/singles/MagnumMath.hpp @@ -15,6 +15,22 @@ - GitHub project page — https://github.com/mosra/magnum - GitHub Singles repository — https://github.com/mosra/magnum-singles + v2020.06-0-gfac6f4da2 (2020-06-27) + - Various fixes for Clang-CL compatibility + - Expanding the APIs to work with Half and long double types + - Magnum::Math::NoInit is now Magnum::NoInit + - Minor changes for faster performance of dot() and cross() in Debug + - Added reflect() and refract() functions + - slerp() / slerpShortestPath() falls back to linear interpolation for + quaternions that are close together, instead or always returning the + first + - Added Quaternion::toEuler() + - Added transformVector() to DualComplex and DualQuaternion to have the + the same set of APIs as with Matrix3 / Matrix4 + - Mutable access to Frustum planes + - Fixed implicit conversion of std::pair to Range*D + - New BoolVector[234], 8-/16-bit and half-float vector and matrix + convenience typedefs v2019.10-0-g8412e8f99 (2019-10-24) - New IsScalar, IsVector, IsIntegral, IsFloatingPoint type traits, correct handling of Deg and Rad types in all APIs @@ -45,23 +61,31 @@ #endif // {{includes}} #include -#if (!defined(CORRADE_ASSERT) || !defined(CORRADE_CONSTEXPR_ASSERT) || !defined(CORRADE_INTERNAL_ASSERT_OUTPUT) || !defined(CORRADE_ASSERT_UNREACHABLE)) && !defined(NDEBUG) +#if (!defined(CORRADE_ASSERT) || !defined(CORRADE_CONSTEXPR_ASSERT) || !defined(CORRADE_INTERNAL_ASSERT_OUTPUT) || !defined(CORRADE_INTERNAL_ASSERT_UNREACHABLE)) && !defined(NDEBUG) #include #endif +/* Combined copyrights because the rool isn't able to merge those on its own: + + Copyright © 2016, 2018, 2020 Jonathan Hale + +*/ + /* We're taking stuff from integration as well */ #pragma ACME path ../../../magnum-integration/src -#pragma ACME revision magnum-integration/src echo "$(git describe --match 'v*') ($(date -d @$(git log -1 --format=%at) +%Y-%m-%d))" +#pragma ACME revision magnum-integration/src echo "$(git describe --long --match 'v*') ($(date -d @$(git log -1 --format=%at) +%Y-%m-%d))" /* Disable asserts that are not used. CORRADE_ASSERT, CORRADE_CONSTEXPR_ASSERT, - CORRADE_INTERNAL_ASSERT_OUTPUT and CORRADE_ASSERT_UNREACHABLE are used, - wrapping the #include above. When enabling additional asserts, be - sure to update them above as well. */ + CORRADE_INTERNAL_ASSERT_OUTPUT and CORRADE_INTERNAL_ASSERT_UNREACHABLE are + used, wrapping the #include above. When enabling additional + asserts, be sure to update them above as well. */ +#pragma ACME enable CORRADE_ASSUME #pragma ACME enable CORRADE_ASSERT_OUTPUT +#pragma ACME enable CORRADE_ASSERT_UNREACHABLE #pragma ACME enable CORRADE_INTERNAL_ASSERT #pragma ACME enable CORRADE_INTERNAL_CONSTEXPR_ASSERT -/* We don't need anything from configure.h here */ +/* We don't need everything from configure.h here */ #pragma ACME enable Corrade_configure_h #pragma ACME enable Magnum_configure_h #if defined(_MSC_VER) && _MSC_VER <= 1920 @@ -80,6 +104,46 @@ #define CORRADE_TARGET_ANDROID #endif +/* CORRADE_TARGET_LIBSTDCXX needed for CORRADE_STD_IS_TRIVIALLY_TRAITS_SUPPORTED, + and because it's so complex to check for it I can as well pull in the whole + thing */ +#include +#ifdef _LIBCPP_VERSION +#define CORRADE_TARGET_LIBCXX +#elif defined(_CPPLIB_VER) +#define CORRADE_TARGET_DINKUMWARE +#elif defined(__GLIBCXX__) +#define CORRADE_TARGET_LIBSTDCXX +/* GCC's provides the __GLIBCXX__ macro only since 6.1, so on older + versions we'll try to get it from bits/c++config.h */ +#elif defined(__has_include) + #if __has_include() + #include + #ifdef __GLIBCXX__ + #define CORRADE_TARGET_LIBSTDCXX + #endif + #endif +/* GCC < 5.0 doesn't have __has_include, so on these versions we'll just assume + it's libstdc++ as I don't think those versions are used with anything else + nowadays anyway. Clang reports itself as GCC 4.4, so exclude that one. */ +#elif defined(__GNUC__) && !defined(__clang__) && __GNUC__ < 5 +#define CORRADE_TARGET_LIBSTDCXX +#else +/* Otherwise no idea. */ +#endif + +#ifdef _MSC_VER +#define CORRADE_TARGET_MSVC +#endif +#if defined(__clang__) && defined(_MSC_VER) +#define CORRADE_TARGET_CLANG_CL +#endif +/* Needed by TypeTraits::equal() */ +#if defined(CORRADE_TARGET_MSVC) || (defined(CORRADE_TARGET_ANDROID) && !__LP64__) || (defined(CORRADE_TARGET_EMSCRIPTEN) && __LDBL_DIG__ == __DBL_DIG__) +#define CORRADE_LONG_DOUBLE_SAME_AS_DOUBLE +#endif +/* CORRADE_TARGET_SSE2 or CORRADE_TARGET_BIG_ENDIAN not used anywhere yet */ + /* Our own subset of visibility macros */ #pragma ACME enable Magnum_visibility_h #pragma ACME enable Corrade_Utility_VisibilityMacros_h @@ -97,9 +161,24 @@ namespace Magnum { typedef Math::Half Half; +typedef Math::BoolVector<2> BoolVector2; +typedef Math::BoolVector<3> BoolVector3; +typedef Math::BoolVector<4> BoolVector4; typedef Math::Vector2 Vector2; typedef Math::Vector3 Vector3; typedef Math::Vector4 Vector4; +typedef Math::Vector2 Vector2ub; +typedef Math::Vector3 Vector3ub; +typedef Math::Vector4 Vector4ub; +typedef Math::Vector2 Vector2b; +typedef Math::Vector3 Vector3b; +typedef Math::Vector4 Vector4b; +typedef Math::Vector2 Vector2us; +typedef Math::Vector3 Vector3us; +typedef Math::Vector4 Vector4us; +typedef Math::Vector2 Vector2s; +typedef Math::Vector3 Vector3s; +typedef Math::Vector4 Vector4s; typedef Math::Vector2 Vector2ui; typedef Math::Vector3 Vector3ui; typedef Math::Vector4 Vector4ui; @@ -110,6 +189,8 @@ typedef Math::Color3 Color3; typedef Math::Color4 Color4; typedef Math::Color3 Color3ub; typedef Math::Color4 Color4ub; +typedef Math::Color3 Color3us; +typedef Math::Color4 Color4us; typedef Math::Matrix3 Matrix3; typedef Math::Matrix4 Matrix4; typedef Math::Matrix2x2 Matrix2x2; @@ -121,6 +202,24 @@ typedef Math::Matrix2x4 Matrix2x4; typedef Math::Matrix4x2 Matrix4x2; typedef Math::Matrix3x4 Matrix3x4; typedef Math::Matrix4x3 Matrix4x3; +typedef Math::Matrix2x2 Matrix2x2b; +typedef Math::Matrix2x3 Matrix2x3b; +typedef Math::Matrix2x4 Matrix2x4b; +typedef Math::Matrix3x2 Matrix3x2b; +typedef Math::Matrix3x3 Matrix3x3b; +typedef Math::Matrix3x4 Matrix3x4b; +typedef Math::Matrix4x2 Matrix4x2b; +typedef Math::Matrix4x3 Matrix4x3b; +typedef Math::Matrix4x4 Matrix4x4b; +typedef Math::Matrix2x2 Matrix2x2s; +typedef Math::Matrix2x3 Matrix2x3s; +typedef Math::Matrix2x4 Matrix2x4s; +typedef Math::Matrix3x2 Matrix3x2s; +typedef Math::Matrix3x3 Matrix3x3s; +typedef Math::Matrix3x4 Matrix3x4s; +typedef Math::Matrix4x2 Matrix4x2s; +typedef Math::Matrix4x3 Matrix4x3s; +typedef Math::Matrix4x4 Matrix4x4s; typedef Math::QuadraticBezier2D QuadraticBezier2D; typedef Math::QuadraticBezier3D QuadraticBezier3D; typedef Math::CubicBezier2D CubicBezier2D; @@ -144,6 +243,20 @@ typedef Math::Range1D Range1Di; typedef Math::Range2D Range2Di; typedef Math::Range3D Range3Di; typedef Math::Frustum Frustum; +typedef Math::Vector2 Vector2h; +typedef Math::Vector3 Vector3h; +typedef Math::Vector4 Vector4h; +typedef Math::Color3 Color3h; +typedef Math::Color4 Color4h; +typedef Math::Matrix2x2 Matrix2x2h; +typedef Math::Matrix2x3 Matrix2x3h; +typedef Math::Matrix2x4 Matrix2x4h; +typedef Math::Matrix3x2 Matrix3x2h; +typedef Math::Matrix3x3 Matrix3x3h; +typedef Math::Matrix3x4 Matrix3x4h; +typedef Math::Matrix4x2 Matrix4x2h; +typedef Math::Matrix4x3 Matrix4x3h; +typedef Math::Matrix4x4 Matrix4x4h; typedef Math::Vector2 Vector2d; typedef Math::Vector3 Vector3d; typedef Math::Vector4 Vector4d; @@ -195,12 +308,14 @@ typedef Math::Frustum Frustumd; #include "Magnum/Math/DualQuaternion.h" #include "Magnum/Math/Frustum.h" #include "Magnum/Math/Functions.h" +// TODO: FunctionsBatch (separate library because of StridedArrayView dep?) #include "Magnum/Math/Half.h" #include "Magnum/Math/Intersection.h" #include "Magnum/Math/Matrix.h" #include "Magnum/Math/Matrix3.h" #include "Magnum/Math/Matrix4.h" #include "Magnum/Math/Packing.h" +// TODO: PackingBatch (separate library because of StridedArrayView dep?) #include "Magnum/Math/Quaternion.h" #include "Magnum/Math/Range.h" #include "Magnum/Math/RectangularMatrix.h"