mirror of https://github.com/mosra/magnum.git
8 changed files with 444 additions and 8 deletions
@ -0,0 +1,102 @@
|
||||
/* |
||||
This file is part of Magnum. |
||||
|
||||
Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019 |
||||
Vladimír Vondruš <mosra@centrum.cz> |
||||
|
||||
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. |
||||
*/ |
||||
|
||||
namespace Magnum { |
||||
|
||||
/** @page singles Single-header libraries |
||||
@brief Magnum functionality exposed in easy-to-integrate single-header libraries |
||||
|
||||
@m_footernavigation |
||||
|
||||
Selected Magnum functionality is also available as single-header libraries, |
||||
with the goal of providing significantly smaller, faster-compiling and |
||||
generally better alternatives to commonly available implementations while being |
||||
as easy as possible to integrate into existing projects. The general rule is |
||||
having preprocessed size not not exceeding 10k lines --- to put this in |
||||
perspective, not even the `<string>` header can fit there. |
||||
|
||||
So far, the following classes and libraries are provided as single-header libs, |
||||
all of them available for download through the [magnum-singles](https://github.com/mosra/magnum-singles) |
||||
repository. Each of them is automatically generated from unmodified Magnum |
||||
sources using the builtin @ref acme "single-header generator tool". |
||||
|
||||
@m_class{m-fullwidth m-flat} |
||||
|
||||
Class or library | Single-header version |
||||
--------------------------- | ---------------------------- |
||||
@ref Math, \n @ref EigenIntegration, \n @ref GlmIntegration | [MagnumMath.hpp](https://github.com/mosra/magnum-singles/tree/master/MagnumMath.hpp) |
||||
|
||||
There are also @ref corrade-singles "single-header libraries for Corrade APIs". |
||||
|
||||
@section singles-behavior Behavior |
||||
|
||||
To keep file size small, the single-header versions have all the comments and |
||||
documentation stripped away, except for a short description and a single |
||||
top-level license block, containing also credit information for all |
||||
contributors. Documentation is meant to be retrieved online, the wrapping |
||||
namespaces and all API naming stay completely the same as when using Magnum |
||||
directly. |
||||
|
||||
The files retain their own include guards, which makes it possible to mix them |
||||
together. However, when combining more than one, make sure to have all files |
||||
from the same revision to avoid API mismatches. The concrete revision that was |
||||
used to generate each library is printed in its header comment. |
||||
|
||||
There are two kinds of libraries, distinguished with file extension: |
||||
|
||||
<ul><li> |
||||
The `*.h` extension denotes libraries that have everything inline in the |
||||
header. A simple @cpp #include @ce is all you need. |
||||
</li><li> |
||||
The `*.hpp` extension denotes libraries that have a separate implementation |
||||
part with non-inline definitions. Desired usage is to build the |
||||
implementation *just once* by defining a macro before including the library |
||||
header: |
||||
|
||||
@code{cpp} |
||||
#define MAGNUM_LIBRARYNAME_IMPLEMENTATION |
||||
#include <MagnumLibraryName.hpp> |
||||
@endcode |
||||
|
||||
In all other files the library is meant to be included without defining the |
||||
macro. Thanks to this approach, complex implementation details don't |
||||
inflate compile times while still keeping the library as a single file. |
||||
</li></ul> |
||||
|
||||
@section singles-customization Customization points |
||||
|
||||
All headers above are created with @ref CORRADE_STANDARD_ASSERT enabled to |
||||
avoid dragging the whole @ref Corrade::Utility::Debug class along. Apart from |
||||
that, every header includes only the assertion macros it actually needs and |
||||
it's possible to override them by providing e.g. your own |
||||
@cpp #define CORRADE_ASSERT @ce before including the file. See the |
||||
@ref Corrade/Utility/Assert.h file documentation for more information. |
||||
|
||||
Some files contain additional disabled-by-default functionality (for example |
||||
integration with GLM and Eigen for @ref Math types), see documentation of each |
||||
library for detailed library-specific behavior. |
||||
*/ |
||||
|
||||
} |
||||
@ -0,0 +1,213 @@
|
||||
/*
|
||||
Magnum::Math |
||||
— a graphics-focused vector math library |
||||
|
||||
https://doc.magnum.graphics/magnum/namespaceMagnum_1_1Math.html
|
||||
https://doc.magnum.graphics/magnum/namespaceMagnum_1_1EigenIntegration.html
|
||||
https://doc.magnum.graphics/magnum/namespaceMagnum_1_1GlmIntegration.html
|
||||
|
||||
This is a single-header library generated from the Magnum project. With the |
||||
goal being easy integration, it's deliberately free of all comments to keep |
||||
the file size small. More info, changelogs and full docs here: |
||||
|
||||
- Project homepage — https://magnum.graphics/magnum/
|
||||
- Documentation — https://doc.magnum.graphics/
|
||||
- GitHub project page — https://github.com/mosra/magnum
|
||||
- GitHub Singles repository — https://github.com/mosra/magnum-singles
|
||||
|
||||
Generated from Corrade {{revision:corrade/src}}, |
||||
Magnum {{revision:magnum/src}} and |
||||
Magnum Integration {{revision:magnum-integration/src}}, {{stats:loc}} / {{stats:preprocessed}} LoC |
||||
*/ |
||||
|
||||
#include "base.h" |
||||
// {{includes}}
|
||||
#if (!defined(CORRADE_ASSERT) || !defined(CORRADE_CONSTEXPR_ASSERT) || !defined(CORRADE_INTERNAL_ASSERT_OUTPUT) || !defined(CORRADE_ASSERT_UNREACHABLE)) && !defined(NDEBUG) |
||||
#include <cassert> |
||||
#endif |
||||
|
||||
/* 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))" |
||||
|
||||
/* Disable asserts that are not used. CORRADE_ASSERT, CORRADE_CONSTEXPR_ASSERT,
|
||||
CORRADE_INTERNAL_ASSERT_OUTPUT and CORRADE_ASSERT_UNREACHABLE are used, |
||||
wrapping the #include <cassert> above. When enabling additional asserts, be |
||||
sure to update them above as well. */ |
||||
#pragma ACME enable CORRADE_ASSERT_OUTPUT |
||||
#pragma ACME enable CORRADE_INTERNAL_ASSERT |
||||
#pragma ACME enable CORRADE_INTERNAL_CONSTEXPR_ASSERT |
||||
|
||||
/* We don't need anything from configure.h here */ |
||||
#pragma ACME enable Corrade_configure_h |
||||
#pragma ACME enable Magnum_configure_h |
||||
#if defined(_MSC_VER) && _MSC_VER <= 1920 |
||||
#define CORRADE_MSVC2017_COMPATIBILITY |
||||
#endif |
||||
#if defined(_MSC_VER) && _MSC_VER <= 1910 |
||||
#define CORRADE_MSVC2015_COMPATIBILITY |
||||
#endif |
||||
#ifdef _WIN32 |
||||
#define CORRADE_TARGET_WINDOWS |
||||
#endif |
||||
#ifdef __EMSCRIPTEN__ |
||||
#define CORRADE_TARGET_EMSCRIPTEN |
||||
#endif |
||||
#ifdef __ANDROID__ |
||||
#define CORRADE_TARGET_ANDROID |
||||
#endif |
||||
|
||||
/* Our own subset of visibility macros */ |
||||
#pragma ACME enable Magnum_visibility_h |
||||
#pragma ACME enable Corrade_Utility_VisibilityMacros_h |
||||
#ifndef MAGNUM_EXPORT |
||||
#define MAGNUM_EXPORT |
||||
#endif |
||||
|
||||
/* Our own subset of Containers.h and Magnum.h */ |
||||
#pragma ACME enable Corrade_Containers_Containers_h |
||||
#pragma ACME enable Magnum_Magnum_h |
||||
#include "Magnum/Math/Math.h" |
||||
#ifndef MagnumMath_hpp |
||||
#define MagnumMath_hpp |
||||
|
||||
namespace Magnum { |
||||
|
||||
typedef Math::Half Half; |
||||
typedef Math::Vector2<Float> Vector2; |
||||
typedef Math::Vector3<Float> Vector3; |
||||
typedef Math::Vector4<Float> Vector4; |
||||
typedef Math::Vector2<UnsignedInt> Vector2ui; |
||||
typedef Math::Vector3<UnsignedInt> Vector3ui; |
||||
typedef Math::Vector4<UnsignedInt> Vector4ui; |
||||
typedef Math::Vector2<Int> Vector2i; |
||||
typedef Math::Vector3<Int> Vector3i; |
||||
typedef Math::Vector4<Int> Vector4i; |
||||
typedef Math::Color3<Float> Color3; |
||||
typedef Math::Color4<Float> Color4; |
||||
typedef Math::Color3<UnsignedByte> Color3ub; |
||||
typedef Math::Color4<UnsignedByte> Color4ub; |
||||
typedef Math::Matrix3<Float> Matrix3; |
||||
typedef Math::Matrix4<Float> Matrix4; |
||||
typedef Math::Matrix2x2<Float> Matrix2x2; |
||||
typedef Math::Matrix3x3<Float> Matrix3x3; |
||||
typedef Math::Matrix4x4<Float> Matrix4x4; |
||||
typedef Math::Matrix2x3<Float> Matrix2x3; |
||||
typedef Math::Matrix3x2<Float> Matrix3x2; |
||||
typedef Math::Matrix2x4<Float> Matrix2x4; |
||||
typedef Math::Matrix4x2<Float> Matrix4x2; |
||||
typedef Math::Matrix3x4<Float> Matrix3x4; |
||||
typedef Math::Matrix4x3<Float> Matrix4x3; |
||||
typedef Math::QuadraticBezier2D<Float> QuadraticBezier2D; |
||||
typedef Math::QuadraticBezier3D<Float> QuadraticBezier3D; |
||||
typedef Math::CubicBezier2D<Float> CubicBezier2D; |
||||
typedef Math::CubicBezier3D<Float> CubicBezier3D; |
||||
typedef Math::CubicHermite1D<Float> CubicHermite1D; |
||||
typedef Math::CubicHermite2D<Float> CubicHermite2D; |
||||
typedef Math::CubicHermite3D<Float> CubicHermite3D; |
||||
typedef Math::CubicHermiteComplex<Float> CubicHermiteComplex; |
||||
typedef Math::CubicHermiteQuaternion<Float> CubicHermiteQuaternion; |
||||
typedef Math::Complex<Float> Complex; |
||||
typedef Math::DualComplex<Float> DualComplex; |
||||
typedef Math::Quaternion<Float> Quaternion; |
||||
typedef Math::DualQuaternion<Float> DualQuaternion; |
||||
typedef Math::Constants<Float> Constants; |
||||
typedef Math::Deg<Float> Deg; |
||||
typedef Math::Rad<Float> Rad; |
||||
typedef Math::Range1D<Float> Range1D; |
||||
typedef Math::Range2D<Float> Range2D; |
||||
typedef Math::Range3D<Float> Range3D; |
||||
typedef Math::Range1D<Int> Range1Di; |
||||
typedef Math::Range2D<Int> Range2Di; |
||||
typedef Math::Range3D<Int> Range3Di; |
||||
typedef Math::Frustum<Float> Frustum; |
||||
typedef Math::Vector2<Double> Vector2d; |
||||
typedef Math::Vector3<Double> Vector3d; |
||||
typedef Math::Vector4<Double> Vector4d; |
||||
typedef Math::Matrix3<Double> Matrix3d; |
||||
typedef Math::Matrix4<Double> Matrix4d; |
||||
typedef Math::Matrix2x2<Double> Matrix2x2d; |
||||
typedef Math::Matrix3x3<Double> Matrix3x3d; |
||||
typedef Math::Matrix4x4<Double> Matrix4x4d; |
||||
typedef Math::Matrix2x3<Double> Matrix2x3d; |
||||
typedef Math::Matrix3x2<Double> Matrix3x2d; |
||||
typedef Math::Matrix2x4<Double> Matrix2x4d; |
||||
typedef Math::Matrix4x2<Double> Matrix4x2d; |
||||
typedef Math::Matrix3x4<Double> Matrix3x4d; |
||||
typedef Math::Matrix4x3<Double> Matrix4x3d; |
||||
typedef Math::QuadraticBezier2D<Float> QuadraticBezier2Dd; |
||||
typedef Math::QuadraticBezier3D<Float> QuadraticBezier3Dd; |
||||
typedef Math::CubicBezier2D<Float> CubicBezier2Dd; |
||||
typedef Math::CubicBezier3D<Float> CubicBezier3Dd; |
||||
typedef Math::CubicHermite1D<Double> CubicHermite1Dd; |
||||
typedef Math::CubicHermite2D<Double> CubicHermite2Dd; |
||||
typedef Math::CubicHermite3D<Double> CubicHermite3Dd; |
||||
typedef Math::CubicHermiteComplex<Double> CubicHermiteComplexd; |
||||
typedef Math::CubicHermiteQuaternion<Double> CubicHermiteQuaterniond; |
||||
typedef Math::Complex<Double> Complexd; |
||||
typedef Math::DualComplex<Double> DualComplexd; |
||||
typedef Math::Quaternion<Double> Quaterniond; |
||||
typedef Math::DualQuaternion<Double> DualQuaterniond; |
||||
typedef Math::Constants<Double> Constantsd; |
||||
typedef Math::Deg<Double> Degd; |
||||
typedef Math::Rad<Double> Radd; |
||||
typedef Math::Range1D<Double> Range1Dd; |
||||
typedef Math::Range2D<Double> Range2Dd; |
||||
typedef Math::Range3D<Double> Range3Dd; |
||||
typedef Math::Frustum<Double> Frustumd; |
||||
|
||||
} |
||||
|
||||
#endif |
||||
#include "Magnum/Magnum.h" |
||||
#include "Magnum/Math/Angle.h" |
||||
#include "Magnum/Math/Bezier.h" |
||||
#include "Magnum/Math/Color.h" |
||||
#include "Magnum/Math/Complex.h" |
||||
#include "Magnum/Math/Constants.h" |
||||
#include "Magnum/Math/CubicHermite.h" |
||||
#include "Magnum/Math/Distance.h" |
||||
#include "Magnum/Math/Dual.h" |
||||
#include "Magnum/Math/DualComplex.h" |
||||
#include "Magnum/Math/DualQuaternion.h" |
||||
#include "Magnum/Math/Frustum.h" |
||||
#include "Magnum/Math/Functions.h" |
||||
#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" |
||||
#include "Magnum/Math/Quaternion.h" |
||||
#include "Magnum/Math/Range.h" |
||||
#include "Magnum/Math/RectangularMatrix.h" |
||||
#include "Magnum/Math/StrictWeakOrdering.h" |
||||
#include "Magnum/Math/Swizzle.h" |
||||
#include "Magnum/Math/Tags.h" |
||||
#include "Magnum/Math/TypeTraits.h" |
||||
#include "Magnum/Math/Unit.h" |
||||
#include "Magnum/Math/Vector.h" |
||||
#include "Magnum/Math/Vector2.h" |
||||
#include "Magnum/Math/Vector3.h" |
||||
#include "Magnum/Math/Vector4.h" |
||||
#include "Magnum/Math/Algorithms/GaussJordan.h" |
||||
#include "Magnum/Math/Algorithms/GramSchmidt.h" |
||||
#include "Magnum/Math/Algorithms/KahanSum.h" |
||||
#include "Magnum/Math/Algorithms/Qr.h" |
||||
//#include "Magnum/Math/Algorithms/Svd.h" // TODO: uses <tuple>
|
||||
#ifdef MAGNUM_MATH_GLM_INTEGRATION |
||||
// {{includes}}
|
||||
#include "Magnum/GlmIntegration/Integration.h" |
||||
#include "Magnum/GlmIntegration/GtcIntegration.h" |
||||
#include "Magnum/GlmIntegration/GtxIntegration.h" |
||||
#endif |
||||
#ifdef MAGNUM_MATH_EIGEN_INTEGRATION |
||||
// {{includes}}
|
||||
#include "Magnum/EigenIntegration/Integration.h" |
||||
#include "Magnum/EigenIntegration/GeometryIntegration.h" |
||||
#endif |
||||
#ifdef MAGNUM_MATH_IMPLEMENTATION |
||||
// {{ includes }}
|
||||
#include "Magnum/Math/Functions.cpp" |
||||
#include "Magnum/Math/Packing.cpp" |
||||
#endif |
||||
@ -0,0 +1,54 @@
|
||||
/*
|
||||
This file is part of Magnum. |
||||
|
||||
{{copyright}} |
||||
|
||||
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. |
||||
*/ |
||||
|
||||
// {{includes}}
|
||||
|
||||
#pragma ACME comments off |
||||
|
||||
#pragma ACME path ../ |
||||
#pragma ACME path ../../../corrade/src |
||||
#pragma ACME local Corrade |
||||
#pragma ACME local Magnum |
||||
|
||||
/* For Corrade/configure.h and Magnum/configure.h */ |
||||
#pragma ACME path ../../build/src |
||||
#pragma ACME path ../../../corrade/build/src |
||||
|
||||
#pragma ACME disable CORRADE_BUILD_DEPRECATED |
||||
#pragma ACME disable MAGNUM_BUILD_DEPRECATED |
||||
|
||||
#pragma ACME disable CORRADE_NO_ASSERT |
||||
#pragma ACME enable CORRADE_STANDARD_ASSERT |
||||
#pragma ACME enable CORRADE_NO_DEBUG |
||||
#pragma ACME enable CORRADE_NO_TWEAKABLE |
||||
#pragma ACME disable CORRADE_GRACEFUL_ASSERT |
||||
#pragma ACME disable DOXYGEN_GENERATING_OUTPUT |
||||
|
||||
/* Make it possible to include Assert.h multiple times */ |
||||
#pragma ACME disable Corrade_Utility_Assert_h |
||||
|
||||
#pragma ACME revision corrade/src echo "$(git describe --match 'v*') ($(date -d @$(git log -1 --format=%at) +%Y-%m-%d))" |
||||
#pragma ACME revision magnum/src echo "$(git describe --match 'v*') ($(date -d @$(git log -1 --format=%at) +%Y-%m-%d))" |
||||
#pragma ACME stats loc wc -l |
||||
#pragma ACME stats preprocessed g++ -std=c++11 -P -E -x c++ - | wc -l |
||||
Loading…
Reference in new issue