diff --git a/src/AbstractImage.h b/src/AbstractImage.h index 1a86e4313..a71b06e81 100644 --- a/src/AbstractImage.h +++ b/src/AbstractImage.h @@ -21,6 +21,8 @@ #include "Magnum.h" +#include "magnumVisibility.h" + namespace Magnum { /** diff --git a/src/AbstractShaderProgram.cpp b/src/AbstractShaderProgram.cpp index 47ea3eeb4..eb7541f9d 100644 --- a/src/AbstractShaderProgram.cpp +++ b/src/AbstractShaderProgram.cpp @@ -17,6 +17,8 @@ #include +#include "Shader.h" + #define LINKER_MESSAGE_MAX_LENGTH 1024 using namespace std; diff --git a/src/AbstractShaderProgram.h b/src/AbstractShaderProgram.h index e9fc0d8ab..510850e18 100644 --- a/src/AbstractShaderProgram.h +++ b/src/AbstractShaderProgram.h @@ -21,10 +21,16 @@ #include -#include "Shader.h" +#include "Math/Matrix4.h" +#include "Math/Vector4.h" +#include "Magnum.h" + +#include "magnumVisibility.h" namespace Magnum { +class Shader; + /** @brief Base class for shaders diff --git a/src/Buffer.h b/src/Buffer.h index 54af31cf4..4c3607234 100644 --- a/src/Buffer.h +++ b/src/Buffer.h @@ -19,6 +19,8 @@ * @brief Class Magnum::Buffer */ +#include + #include "Magnum.h" namespace Magnum { diff --git a/src/Contexts/AbstractXContext.h b/src/Contexts/AbstractXContext.h index 620a777ac..622e81ef3 100644 --- a/src/Contexts/AbstractXContext.h +++ b/src/Contexts/AbstractXContext.h @@ -19,6 +19,8 @@ * @brief Class Magnum::Contexts::AbstractXContext */ +#include + #include "Magnum.h" #include @@ -27,8 +29,7 @@ #undef None #undef Always -#include - +#include "Math/Vector2.h" #include "AbstractContext.h" #include "AbstractGlInterface.h" diff --git a/src/Contexts/ExtensionWrangler.cpp b/src/Contexts/ExtensionWrangler.cpp index f9c6dc47e..927b66628 100644 --- a/src/Contexts/ExtensionWrangler.cpp +++ b/src/Contexts/ExtensionWrangler.cpp @@ -15,6 +15,8 @@ #include "ExtensionWrangler.h" +#include + #include "Magnum.h" namespace Magnum { namespace Contexts { diff --git a/src/Contexts/GlutContext.h b/src/Contexts/GlutContext.h index 73e32569f..960775a94 100644 --- a/src/Contexts/GlutContext.h +++ b/src/Contexts/GlutContext.h @@ -19,7 +19,11 @@ * @brief Class Magnum::Contexts::GlutContext */ +#include + +#include "Math/Vector2.h" #include "Magnum.h" + #include #include "AbstractContext.h" diff --git a/src/Contexts/GlxInterface.cpp b/src/Contexts/GlxInterface.cpp index a8fb92680..a9ce9aba0 100644 --- a/src/Contexts/GlxInterface.cpp +++ b/src/Contexts/GlxInterface.cpp @@ -16,6 +16,7 @@ #include "GlxInterface.h" #include +#include namespace Magnum { namespace Contexts { diff --git a/src/Contexts/Sdl2Context.h b/src/Contexts/Sdl2Context.h index 112b434b8..5f91d9e75 100644 --- a/src/Contexts/Sdl2Context.h +++ b/src/Contexts/Sdl2Context.h @@ -19,7 +19,9 @@ * @brief Class Magnum::Contexts::Sdl2Context */ +#include "Math/Vector2.h" #include "Magnum.h" + #include #include diff --git a/src/Framebuffer.cpp b/src/Framebuffer.cpp index e6117caec..d0e158e08 100644 --- a/src/Framebuffer.cpp +++ b/src/Framebuffer.cpp @@ -15,6 +15,9 @@ #include "Framebuffer.h" +#include "BufferedImage.h" +#include "Image.h" + namespace Magnum { #ifndef MAGNUM_TARGET_GLES diff --git a/src/Framebuffer.h b/src/Framebuffer.h index 0ee1750bf..f9eb59fce 100644 --- a/src/Framebuffer.h +++ b/src/Framebuffer.h @@ -21,14 +21,24 @@ #include -#include "BufferedImage.h" +#include "AbstractImage.h" +#include "Buffer.h" #include "CubeMapTexture.h" #include "Color.h" -#include "Image.h" #include "Renderbuffer.h" namespace Magnum { +template class BufferedImage; +template class Image; + +typedef BufferedImage<1> BufferedImage1D; +typedef BufferedImage<2> BufferedImage2D; +typedef BufferedImage<3> BufferedImage3D; +typedef Image<1> Image1D; +typedef Image<2> Image2D; +typedef Image<3> Image3D; + /** @nosubgrouping @brief %Framebuffer diff --git a/src/IndexedMesh.cpp b/src/IndexedMesh.cpp index 05a9b009a..6e9e96549 100644 --- a/src/IndexedMesh.cpp +++ b/src/IndexedMesh.cpp @@ -15,6 +15,8 @@ #include "IndexedMesh.h" +#include + namespace Magnum { void IndexedMesh::draw() { diff --git a/src/Magnum.h b/src/Magnum.h index 630b962c7..03f25bcf5 100644 --- a/src/Magnum.h +++ b/src/Magnum.h @@ -27,11 +27,25 @@ #include #endif -#include "Math/Math.h" -#include "Math/Matrix4.h" -#include "Math/Vector2.h" +namespace Corrade { + namespace Utility { + class Debug; + class Warning; + class Error; + } +} namespace Magnum { + namespace Math { + template class Vector2; + template class Vector3; + template class Vector4; + template class Matrix3; + template class Matrix4; + + template constexpr T deg(T value); + template constexpr T rad(T value); + } /* Bring debugging facility from Corrade::Utility namespace */ using Corrade::Utility::Debug; diff --git a/src/Math/CMakeLists.txt b/src/Math/CMakeLists.txt index cf24e5d0b..edcfe14ac 100644 --- a/src/Math/CMakeLists.txt +++ b/src/Math/CMakeLists.txt @@ -1,6 +1,7 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR}) set(MagnumMath_HEADERS + Constants.h Math.h MathTypeTraits.h Matrix.h diff --git a/src/Math/Constants.h b/src/Math/Constants.h new file mode 100644 index 000000000..a4c8a50e5 --- /dev/null +++ b/src/Math/Constants.h @@ -0,0 +1,79 @@ +#ifndef Magnum_Math_Constants_h +#define Magnum_Math_Constants_h +/* + Copyright © 2010, 2011, 2012 Vladimír Vondruš + + This file is part of Magnum. + + Magnum is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License version 3 + only, as published by the Free Software Foundation. + + Magnum is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License version 3 for more details. +*/ + +/** @file + * @brief Class Magnum::Math::Constants, functions Magnum::Math::deg(), Magnum::Math::rad() + */ + +namespace Magnum { namespace Math { + +/** +@brief Numeric constants + +@internal See MathTypeTraits class for implementation notes. +*/ +template struct Constants { + #ifdef DOXYGEN_GENERATING_OUTPUT + /** + * @brief Pi + * + * @see deg(), rad() + */ + static inline constexpr T pi(); + + static inline constexpr T sqrt2(); /**< @brief Square root of 2 */ + static inline constexpr T sqrt3(); /**< @brief Square root of 3 */ + #endif +}; + +#ifndef DOXYGEN_GENERATING_OUTPUT +template<> struct Constants { + static inline constexpr double pi() { return 3.141592653589793; } + static inline constexpr double sqrt2() { return 1.414213562373095; } + static inline constexpr double sqrt3() { return 1.732050807568877; } +}; +template<> struct Constants { + static inline constexpr float pi() { return 3.141592654f; } + static inline constexpr float sqrt2() { return 1.414213562f; } + static inline constexpr float sqrt3() { return 1.732050808f; } +}; +#endif + +/** +@brief Angle in degrees + +Function to make angle entering less error-prone. Converts the value to +radians at compile time. For example `deg(180.0f)` is converted to `3.14f`. + +Usable for entering e.g. rotation: +@code +Matrix4::rotation(deg(30.0f), Vector3::yAxis()); +@endcode +@see Constants, rad() + */ +template inline constexpr T deg(T value) { return value*Constants::pi()/180; } + +/** + * @brief Angle in radians + * + * See deg() for more information. + */ +template inline constexpr T rad(T value) { return value; } + +}} + +#endif diff --git a/src/Math/Geometry/Test/DistanceTest.cpp b/src/Math/Geometry/Test/DistanceTest.cpp index 5f14c0aa4..240ad21eb 100644 --- a/src/Math/Geometry/Test/DistanceTest.cpp +++ b/src/Math/Geometry/Test/DistanceTest.cpp @@ -17,7 +17,7 @@ #include -#include "Math.h" +#include "Constants.h" #include "Distance.h" CORRADE_TEST_MAIN(Magnum::Math::Geometry::Test::DistanceTest) diff --git a/src/Math/Math.h b/src/Math/Math.h index 8c37df308..5f475d598 100644 --- a/src/Math/Math.h +++ b/src/Math/Math.h @@ -15,7 +15,6 @@ GNU Lesser General Public License version 3 for more details. */ -#include #include #include #include @@ -24,7 +23,7 @@ #include "magnumVisibility.h" /** @file - * @brief Math constants and utilities + * @brief Math utilities */ namespace Magnum { namespace Math { @@ -36,31 +35,7 @@ namespace Magnum { namespace Math { matrices) */ -/** -@brief Numeric constants - -@internal See MathTypeTraits class for implementation notes. -*/ -template struct Constants { - #ifdef DOXYGEN_GENERATING_OUTPUT - static inline constexpr T pi(); /**< @brief Pi */ - static inline constexpr T sqrt2(); /**< @brief Square root of 2 */ - static inline constexpr T sqrt3(); /**< @brief Square root of 3 */ - #endif -}; - #ifndef DOXYGEN_GENERATING_OUTPUT -template<> struct Constants { - static inline constexpr double pi() { return 3.141592653589793; } - static inline constexpr double sqrt2() { return 1.414213562373095; } - static inline constexpr double sqrt3() { return 1.732050807568877; } -}; -template<> struct Constants { - static inline constexpr float pi() { return 3.141592654f; } - static inline constexpr float sqrt2() { return 1.414213562f; } - static inline constexpr float sqrt3() { return 1.732050808f; } -}; - namespace Implementation { template struct Pow { template inline constexpr T operator()(T base) const { @@ -135,27 +110,6 @@ template inline T clamp(T value, T min, T max) { return std::min(std::max(value, min), max); } -/** -@brief Angle in degrees - -Function to make angle entering less error-prone. Converts the value to -radians at compile time. For example `deg(180.0f)` is converted to `3.14f`. - -Usable for entering e.g. rotation: -@code -Matrix4::rotation(deg(30.0f), Vector3::yAxis()); -@endcode -@see rad() - */ -template inline constexpr T deg(T value) { return value*Constants::pi()/180; } - -/** - * @brief Angle in radians - * - * See deg() for more information. - */ -template inline constexpr T rad(T value) { return value; } - }} #endif diff --git a/src/Math/Test/CMakeLists.txt b/src/Math/Test/CMakeLists.txt index 784a73776..8f3690ea8 100644 --- a/src/Math/Test/CMakeLists.txt +++ b/src/Math/Test/CMakeLists.txt @@ -1,3 +1,5 @@ +corrade_add_test2(MathConstantsTest ConstantsTest.cpp) +corrade_add_test2(MathTest MathTest.cpp $) corrade_add_test2(MathMathTypeTraitsTest MathTypeTraitsTest.cpp) corrade_add_test2(MathRectangularMatrixTest RectangularMatrixTest.cpp) @@ -11,5 +13,3 @@ corrade_add_test2(MathVector4Test Vector4Test.cpp) corrade_add_test2(MathMatrixTest MatrixTest.cpp) corrade_add_test2(MathMatrix3Test Matrix3Test.cpp) corrade_add_test2(MathMatrix4Test Matrix4Test.cpp) - -corrade_add_test2(MathTest MathTest.cpp $) diff --git a/src/Math/Test/ConstantsTest.cpp b/src/Math/Test/ConstantsTest.cpp new file mode 100644 index 000000000..fb24fd8be --- /dev/null +++ b/src/Math/Test/ConstantsTest.cpp @@ -0,0 +1,46 @@ +/* + Copyright © 2010, 2011, 2012 Vladimír Vondruš + + This file is part of Magnum. + + Magnum is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License version 3 + only, as published by the Free Software Foundation. + + Magnum is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License version 3 for more details. +*/ + +#include "ConstantsTest.h" + +#include "Constants.h" +#include "Math.h" + +using namespace std; + +CORRADE_TEST_MAIN(Magnum::Math::Test::ConstantsTest) + +namespace Magnum { namespace Math { namespace Test { + +ConstantsTest::ConstantsTest() { + addTests(&ConstantsTest::constants, + &ConstantsTest::degrad); +} + +void ConstantsTest::constants() { + CORRADE_COMPARE(Math::pow<2>(Constants::sqrt2()), 2.0f); + CORRADE_COMPARE(Math::pow<2>(Constants::sqrt3()), 3.0f); + + CORRADE_COMPARE(Math::pow<2>(Constants::sqrt2()), 2.0); + CORRADE_COMPARE(Math::pow<2>(Constants::sqrt3()), 3.0); +} + +void ConstantsTest::degrad() { + CORRADE_COMPARE(deg(90.0), Constants::pi()/2); + CORRADE_COMPARE(deg(90.0f), Constants::pi()/2); + CORRADE_COMPARE(rad(Constants::pi()/2), Constants::pi()/2); +} + +}}} diff --git a/src/Math/Test/ConstantsTest.h b/src/Math/Test/ConstantsTest.h new file mode 100644 index 000000000..a52c49543 --- /dev/null +++ b/src/Math/Test/ConstantsTest.h @@ -0,0 +1,32 @@ +#ifndef Magnum_Math_Test_ConstantsTest_h +#define Magnum_Math_Test_ConstantsTest_h +/* + Copyright © 2010, 2011, 2012 Vladimír Vondruš + + This file is part of Magnum. + + Magnum is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License version 3 + only, as published by the Free Software Foundation. + + Magnum is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License version 3 for more details. +*/ + +#include + +namespace Magnum { namespace Math { namespace Test { + +class ConstantsTest: public Corrade::TestSuite::Tester { + public: + ConstantsTest(); + + void constants(); + void degrad(); +}; + +}}} + +#endif diff --git a/src/Math/Test/MathTest.cpp b/src/Math/Test/MathTest.cpp index cfdc49243..862f1a15b 100644 --- a/src/Math/Test/MathTest.cpp +++ b/src/Math/Test/MathTest.cpp @@ -24,29 +24,13 @@ CORRADE_TEST_MAIN(Magnum::Math::Test::MathTest) namespace Magnum { namespace Math { namespace Test { MathTest::MathTest() { - addTests(&MathTest::constants, - &MathTest::degrad, - &MathTest::normalize, + addTests(&MathTest::normalize, &MathTest::denormalize, &MathTest::clamp, &MathTest::pow, &MathTest::log); } -void MathTest::constants() { - CORRADE_COMPARE(Math::pow<2>(Constants::sqrt2()), 2.0f); - CORRADE_COMPARE(Math::pow<2>(Constants::sqrt3()), 3.0f); - - CORRADE_COMPARE(Math::pow<2>(Constants::sqrt2()), 2.0); - CORRADE_COMPARE(Math::pow<2>(Constants::sqrt3()), 3.0); -} - -void MathTest::degrad() { - CORRADE_COMPARE(deg(90.0), Constants::pi()/2); - CORRADE_COMPARE(deg(90.0f), Constants::pi()/2); - CORRADE_COMPARE(rad(Constants::pi()/2), Constants::pi()/2); -} - void MathTest::normalize() { /* Range for signed and unsigned */ CORRADE_COMPARE((Math::normalize(-128)), 0.0f); diff --git a/src/Math/Test/MathTest.h b/src/Math/Test/MathTest.h index 568c0b148..658d47690 100644 --- a/src/Math/Test/MathTest.h +++ b/src/Math/Test/MathTest.h @@ -23,8 +23,6 @@ class MathTest: public Corrade::TestSuite::Tester { public: MathTest(); - void constants(); - void degrad(); void normalize(); void denormalize(); void clamp(); diff --git a/src/Math/Test/Matrix3Test.cpp b/src/Math/Test/Matrix3Test.cpp index 840e75c92..225b62171 100644 --- a/src/Math/Test/Matrix3Test.cpp +++ b/src/Math/Test/Matrix3Test.cpp @@ -17,8 +17,8 @@ #include +#include "Constants.h" #include "Matrix3.h" -#include "Math.h" CORRADE_TEST_MAIN(Magnum::Math::Test::Matrix3Test) diff --git a/src/Math/Test/Matrix4Test.cpp b/src/Math/Test/Matrix4Test.cpp index 9cc253cc6..03111d207 100644 --- a/src/Math/Test/Matrix4Test.cpp +++ b/src/Math/Test/Matrix4Test.cpp @@ -17,8 +17,8 @@ #include +#include "Constants.h" #include "Matrix4.h" -#include "Math.h" CORRADE_TEST_MAIN(Magnum::Math::Test::Matrix4Test) diff --git a/src/Math/Test/VectorTest.cpp b/src/Math/Test/VectorTest.cpp index 4e18e3b69..7a3ef084b 100644 --- a/src/Math/Test/VectorTest.cpp +++ b/src/Math/Test/VectorTest.cpp @@ -17,8 +17,8 @@ #include +#include "Constants.h" #include "Vector.h" -#include "Math.h" CORRADE_TEST_MAIN(Magnum::Math::Test::VectorTest) diff --git a/src/Mesh.cpp b/src/Mesh.cpp index 93d789c0c..bd763af43 100644 --- a/src/Mesh.cpp +++ b/src/Mesh.cpp @@ -14,6 +14,9 @@ */ #include "Mesh.h" + +#include + #include "Buffer.h" using namespace std; diff --git a/src/MeshTools/Clean.h b/src/MeshTools/Clean.h index bca23aeb9..9a4a0d6b8 100644 --- a/src/MeshTools/Clean.h +++ b/src/MeshTools/Clean.h @@ -23,6 +23,7 @@ #include #include +#include "Math/Vector.h" #include "TypeTraits.h" namespace Magnum { namespace MeshTools { diff --git a/src/MeshTools/FlipNormals.cpp b/src/MeshTools/FlipNormals.cpp index 1a38ede06..ddfe16dd0 100644 --- a/src/MeshTools/FlipNormals.cpp +++ b/src/MeshTools/FlipNormals.cpp @@ -15,6 +15,8 @@ #include "FlipNormals.h" +#include "Math/Vector3.h" + using namespace std; namespace Magnum { namespace MeshTools { diff --git a/src/MeshTools/FlipNormals.h b/src/MeshTools/FlipNormals.h index 191177945..673b43a32 100644 --- a/src/MeshTools/FlipNormals.h +++ b/src/MeshTools/FlipNormals.h @@ -19,7 +19,10 @@ * @brief Function Magnum::MeshTools::flipNormals() */ +#include + #include "Magnum.h" + #include "magnumMeshToolsVisibility.h" namespace Magnum { namespace MeshTools { diff --git a/src/MeshTools/GenerateFlatNormals.cpp b/src/MeshTools/GenerateFlatNormals.cpp index 1e70162e7..50866eb18 100644 --- a/src/MeshTools/GenerateFlatNormals.cpp +++ b/src/MeshTools/GenerateFlatNormals.cpp @@ -15,6 +15,7 @@ #include "GenerateFlatNormals.h" +#include "Math/Vector4.h" #include "MeshTools/Clean.h" using namespace std; diff --git a/src/MeshTools/GenerateFlatNormals.h b/src/MeshTools/GenerateFlatNormals.h index 20a94b494..48f289e19 100644 --- a/src/MeshTools/GenerateFlatNormals.h +++ b/src/MeshTools/GenerateFlatNormals.h @@ -20,8 +20,10 @@ */ #include +#include #include "Magnum.h" + #include "magnumMeshToolsVisibility.h" namespace Magnum { namespace MeshTools { diff --git a/src/MeshTools/Test/FlipNormalsTest.cpp b/src/MeshTools/Test/FlipNormalsTest.cpp index ec97f1da5..59f3a757d 100644 --- a/src/MeshTools/Test/FlipNormalsTest.cpp +++ b/src/MeshTools/Test/FlipNormalsTest.cpp @@ -17,6 +17,7 @@ #include +#include "Math/Vector3.h" #include "MeshTools/FlipNormals.h" CORRADE_TEST_MAIN(Magnum::MeshTools::Test::FlipNormalsTest) diff --git a/src/MeshTools/Test/GenerateFlatNormalsTest.cpp b/src/MeshTools/Test/GenerateFlatNormalsTest.cpp index 8b4cec77f..8cf127a46 100644 --- a/src/MeshTools/Test/GenerateFlatNormalsTest.cpp +++ b/src/MeshTools/Test/GenerateFlatNormalsTest.cpp @@ -17,6 +17,7 @@ #include +#include "Math/Vector4.h" #include "MeshTools/GenerateFlatNormals.h" CORRADE_TEST_MAIN(Magnum::MeshTools::Test::GenerateFlatNormalsTest) @@ -58,7 +59,6 @@ void GenerateFlatNormalsTest::generate() { {1.0f, 0.0f, 0.0f} }); - CORRADE_COMPARE(indices, (vector{ 0, 0, 0, 1, 1, 1 diff --git a/src/Physics/AbstractShape.h b/src/Physics/AbstractShape.h index 2af5cda40..363a685be 100644 --- a/src/Physics/AbstractShape.h +++ b/src/Physics/AbstractShape.h @@ -20,6 +20,7 @@ */ #include "Magnum.h" + #include "magnumPhysicsVisibility.h" namespace Magnum { namespace Physics { diff --git a/src/Physics/AxisAlignedBox.cpp b/src/Physics/AxisAlignedBox.cpp index faa81e229..b0ef33339 100644 --- a/src/Physics/AxisAlignedBox.cpp +++ b/src/Physics/AxisAlignedBox.cpp @@ -15,6 +15,8 @@ #include "AxisAlignedBox.h" +#include "Math/Matrix4.h" + namespace Magnum { namespace Physics { void AxisAlignedBox::applyTransformation(const Matrix4& transformation) { diff --git a/src/Physics/AxisAlignedBox.h b/src/Physics/AxisAlignedBox.h index a9ef1c13b..ce3505582 100644 --- a/src/Physics/AxisAlignedBox.h +++ b/src/Physics/AxisAlignedBox.h @@ -19,6 +19,7 @@ * @brief Class Magnum::Physics::AxisAlignedBox */ +#include "Math/Vector3.h" #include "AbstractShape.h" namespace Magnum { namespace Physics { diff --git a/src/Physics/Capsule.cpp b/src/Physics/Capsule.cpp index 7c40dc206..3f7936901 100644 --- a/src/Physics/Capsule.cpp +++ b/src/Physics/Capsule.cpp @@ -15,7 +15,12 @@ #include "Capsule.h" +#include "Math/Constants.h" +#include "Math/Math.h" +#include "Math/Matrix4.h" #include "Math/Geometry/Distance.h" +#include "Point.h" +#include "Sphere.h" using namespace Magnum::Math::Geometry; diff --git a/src/Physics/Capsule.h b/src/Physics/Capsule.h index 25ced6b53..d85cef641 100644 --- a/src/Physics/Capsule.h +++ b/src/Physics/Capsule.h @@ -19,12 +19,14 @@ * @brief Class Magnum::Physics::Capsule */ +#include "Math/Vector3.h" #include "AbstractShape.h" -#include "Point.h" -#include "Sphere.h" namespace Magnum { namespace Physics { +class Point; +class Sphere; + /** @brief %Capsule defined by cylinder start and end point and radius diff --git a/src/Physics/Line.cpp b/src/Physics/Line.cpp index 0cf2ecc15..010cf5c37 100644 --- a/src/Physics/Line.cpp +++ b/src/Physics/Line.cpp @@ -15,6 +15,8 @@ #include "Line.h" +#include "Math/Matrix4.h" + namespace Magnum { namespace Physics { void Line::applyTransformation(const Matrix4& transformation) { diff --git a/src/Physics/Line.h b/src/Physics/Line.h index 05b5c7f16..22897adf5 100644 --- a/src/Physics/Line.h +++ b/src/Physics/Line.h @@ -19,6 +19,7 @@ * @brief Class Magnum::Physics::Line */ +#include "Math/Vector3.h" #include "AbstractShape.h" namespace Magnum { namespace Physics { diff --git a/src/Physics/Plane.cpp b/src/Physics/Plane.cpp index f8529bbf1..5ca9d49c3 100644 --- a/src/Physics/Plane.cpp +++ b/src/Physics/Plane.cpp @@ -17,7 +17,9 @@ #include +#include "Math/Matrix4.h" #include "Math/Geometry/Intersection.h" +#include "LineSegment.h" using namespace std; using namespace Magnum::Math::Geometry; diff --git a/src/Physics/Plane.h b/src/Physics/Plane.h index 883fc899e..dd363b1c7 100644 --- a/src/Physics/Plane.h +++ b/src/Physics/Plane.h @@ -19,13 +19,14 @@ * @brief Class Magnum::Physics::Plane */ +#include "Math/Vector3.h" #include "AbstractShape.h" -#include "Line.h" -#include "LineSegment.h" - namespace Magnum { namespace Physics { +class Line; +class LineSegment; + /** @brief Infinite plane, defined by position and normal */ class PHYSICS_EXPORT Plane: public AbstractShape { public: diff --git a/src/Physics/Point.h b/src/Physics/Point.h index 32f5e5d4b..787236b6b 100644 --- a/src/Physics/Point.h +++ b/src/Physics/Point.h @@ -19,6 +19,7 @@ * @brief Class Magnum::Physics::Point */ +#include "Math/Vector3.h" #include "AbstractShape.h" namespace Magnum { namespace Physics { diff --git a/src/Physics/ShapeGroup.h b/src/Physics/ShapeGroup.h index 074474719..35be57000 100644 --- a/src/Physics/ShapeGroup.h +++ b/src/Physics/ShapeGroup.h @@ -21,6 +21,9 @@ #include "AbstractShape.h" +#include +#include + namespace Magnum { namespace Physics { #ifndef DOXYGEN_GENERATING_OUTPUT diff --git a/src/Physics/Sphere.cpp b/src/Physics/Sphere.cpp index 334982b07..54a656168 100644 --- a/src/Physics/Sphere.cpp +++ b/src/Physics/Sphere.cpp @@ -15,7 +15,12 @@ #include "Sphere.h" +#include "Math/Constants.h" +#include "Math/Math.h" +#include "Math/Matrix4.h" #include "Math/Geometry/Distance.h" +#include "LineSegment.h" +#include "Point.h" using namespace Magnum::Math::Geometry; diff --git a/src/Physics/Sphere.h b/src/Physics/Sphere.h index 20961d6b7..ddc317603 100644 --- a/src/Physics/Sphere.h +++ b/src/Physics/Sphere.h @@ -19,13 +19,15 @@ * @brief Class Magnum::Physics::Sphere */ +#include "Math/Vector3.h" #include "AbstractShape.h" -#include "Point.h" -#include "Line.h" -#include "LineSegment.h" namespace Magnum { namespace Physics { +class Line; +class LineSegment; +class Point; + /** @brief %Sphere defined by position and radius diff --git a/src/Physics/Test/AbstractShapeTest.h b/src/Physics/Test/AbstractShapeTest.h index 6d2096ae1..ea8d1ff06 100644 --- a/src/Physics/Test/AbstractShapeTest.h +++ b/src/Physics/Test/AbstractShapeTest.h @@ -17,6 +17,7 @@ #include +#include "Math/Matrix4.h" #include "Magnum.h" namespace Magnum { namespace Physics { namespace Test { diff --git a/src/Physics/Test/AxisAlignedBoxTest.cpp b/src/Physics/Test/AxisAlignedBoxTest.cpp index e62e3df6f..81d6eba57 100644 --- a/src/Physics/Test/AxisAlignedBoxTest.cpp +++ b/src/Physics/Test/AxisAlignedBoxTest.cpp @@ -15,6 +15,8 @@ #include "AxisAlignedBoxTest.h" +#include "Math/Constants.h" +#include "Math/Matrix4.h" #include "Physics/AxisAlignedBox.h" CORRADE_TEST_MAIN(Magnum::Physics::Test::AxisAlignedBoxTest) diff --git a/src/Physics/Test/CapsuleTest.cpp b/src/Physics/Test/CapsuleTest.cpp index 3c4d2ba8d..17feb9204 100644 --- a/src/Physics/Test/CapsuleTest.cpp +++ b/src/Physics/Test/CapsuleTest.cpp @@ -15,7 +15,10 @@ #include "CapsuleTest.h" +#include "Math/Constants.h" #include "Physics/Capsule.h" +#include "Physics/Point.h" +#include "Physics/Sphere.h" CORRADE_TEST_MAIN(Magnum::Physics::Test::CapsuleTest) diff --git a/src/Physics/Test/LineTest.cpp b/src/Physics/Test/LineTest.cpp index b4badfba4..1e06ccb4b 100644 --- a/src/Physics/Test/LineTest.cpp +++ b/src/Physics/Test/LineTest.cpp @@ -15,6 +15,8 @@ #include "LineTest.h" +#include "Math/Constants.h" +#include "Math/Matrix4.h" #include "Physics/Line.h" CORRADE_TEST_MAIN(Magnum::Physics::Test::LineTest) diff --git a/src/Physics/Test/PlaneTest.cpp b/src/Physics/Test/PlaneTest.cpp index 8b8e4ac4c..f2f799189 100644 --- a/src/Physics/Test/PlaneTest.cpp +++ b/src/Physics/Test/PlaneTest.cpp @@ -15,6 +15,9 @@ #include "PlaneTest.h" +#include "Math/Constants.h" +#include "Physics/LineSegment.h" +#include "Physics/Point.h" #include "Physics/Plane.h" CORRADE_TEST_MAIN(Magnum::Physics::Test::PlaneTest) diff --git a/src/Physics/Test/PointTest.cpp b/src/Physics/Test/PointTest.cpp index 5edff1469..ed191dfc5 100644 --- a/src/Physics/Test/PointTest.cpp +++ b/src/Physics/Test/PointTest.cpp @@ -15,6 +15,7 @@ #include "PointTest.h" +#include "Math/Matrix4.h" #include "Physics/Point.h" CORRADE_TEST_MAIN(Magnum::Physics::Test::PointTest) diff --git a/src/Physics/Test/ShapeGroupTest.cpp b/src/Physics/Test/ShapeGroupTest.cpp index 866a52cbd..a78ddc9d6 100644 --- a/src/Physics/Test/ShapeGroupTest.cpp +++ b/src/Physics/Test/ShapeGroupTest.cpp @@ -15,6 +15,7 @@ #include "ShapeGroupTest.h" +#include "Math/Matrix4.h" #include "Physics/Point.h" #include "Physics/Sphere.h" #include "Physics/ShapeGroup.h" diff --git a/src/Physics/Test/SphereTest.cpp b/src/Physics/Test/SphereTest.cpp index 432c99db7..d78291a2c 100644 --- a/src/Physics/Test/SphereTest.cpp +++ b/src/Physics/Test/SphereTest.cpp @@ -15,6 +15,9 @@ #include "SphereTest.h" +#include "Math/Constants.h" +#include "Physics/LineSegment.h" +#include "Physics/Point.h" #include "Physics/Sphere.h" CORRADE_TEST_MAIN(Magnum::Physics::Test::SphereTest) diff --git a/src/Primitives/Capsule.cpp b/src/Primitives/Capsule.cpp index 24b9967d4..11fa8f9f0 100644 --- a/src/Primitives/Capsule.cpp +++ b/src/Primitives/Capsule.cpp @@ -15,6 +15,9 @@ #include "Capsule.h" +#include "Math/Constants.h" +#include "Math/Vector4.h" + using namespace std; namespace Magnum { namespace Primitives { @@ -47,6 +50,8 @@ Capsule::Capsule(unsigned int hemisphereRings, unsigned int cylinderRings, unsig topFaceRing(); } +Capsule::Capsule(unsigned int segments, TextureCoords textureCoords): MeshData("", Mesh::Primitive::Triangles, new std::vector, {new std::vector()}, {new std::vector()}, textureCoords == TextureCoords::Generate ? std::vector*>{new std::vector()} : std::vector*>()), segments(segments), textureCoords(textureCoords) {} + void Capsule::capVertex(GLfloat y, GLfloat normalY, GLfloat textureCoordsV) { positions(0)->push_back({0.0f, y, 0.0f}); normals(0)->push_back({0.0f, normalY, 0.0f}); diff --git a/src/Primitives/Capsule.h b/src/Primitives/Capsule.h index 9bb2820d1..bb496ea00 100644 --- a/src/Primitives/Capsule.h +++ b/src/Primitives/Capsule.h @@ -55,7 +55,7 @@ class Capsule: public Trade::MeshData { Capsule(unsigned int hemisphereRings, unsigned int cylinderRings, unsigned int segments, GLfloat length, TextureCoords textureCoords = TextureCoords::DontGenerate); private: - inline Capsule(unsigned int segments, TextureCoords textureCoords): MeshData("", Mesh::Primitive::Triangles, new std::vector, {new std::vector()}, {new std::vector()}, textureCoords == TextureCoords::Generate ? std::vector*>{new std::vector()} : std::vector*>()), segments(segments), textureCoords(textureCoords) {} + Capsule(unsigned int segments, TextureCoords textureCoords); void capVertex(GLfloat y, GLfloat normalY, GLfloat textureCoordsV); void hemisphereVertexRings(unsigned int count, GLfloat centerY, GLfloat startRingAngle, GLfloat ringAngleIncrement, GLfloat startTextureCoordsV, GLfloat textureCoordsVIncrement); diff --git a/src/Primitives/Cube.cpp b/src/Primitives/Cube.cpp index 467bfd942..c524fb77e 100644 --- a/src/Primitives/Cube.cpp +++ b/src/Primitives/Cube.cpp @@ -15,6 +15,8 @@ #include "Cube.h" +#include "Math/Vector4.h" + using namespace std; namespace Magnum { namespace Primitives { diff --git a/src/Primitives/Cylinder.cpp b/src/Primitives/Cylinder.cpp index 19c85f8b1..30a031538 100644 --- a/src/Primitives/Cylinder.cpp +++ b/src/Primitives/Cylinder.cpp @@ -15,6 +15,9 @@ #include "Cylinder.h" +#include "Math/Constants.h" +#include "Math/Vector4.h" + using namespace std; namespace Magnum { namespace Primitives { diff --git a/src/Primitives/Cylinder.h b/src/Primitives/Cylinder.h index 260b3c021..f68993b70 100644 --- a/src/Primitives/Cylinder.h +++ b/src/Primitives/Cylinder.h @@ -19,9 +19,10 @@ * @brief Class Magnum::Primitives::UVSphere */ -#include "Primitives/Capsule.h" #include +#include "Primitives/Capsule.h" + namespace Magnum { namespace Primitives { /** @brief Cylinder primitive */ diff --git a/src/Primitives/Icosphere.cpp b/src/Primitives/Icosphere.cpp index 640a360c1..436937906 100644 --- a/src/Primitives/Icosphere.cpp +++ b/src/Primitives/Icosphere.cpp @@ -15,6 +15,8 @@ #include "Icosphere.h" +#include "Math/Vector4.h" + using namespace std; namespace Magnum { namespace Primitives { diff --git a/src/Primitives/Icosphere.h b/src/Primitives/Icosphere.h index eec4a50b1..22d854576 100644 --- a/src/Primitives/Icosphere.h +++ b/src/Primitives/Icosphere.h @@ -19,9 +19,10 @@ * @brief Class Magnum::Primitives::Icosphere */ -#include "Trade/MeshData.h" +#include "Math/Vector3.h" #include "MeshTools/Subdivide.h" #include "MeshTools/Clean.h" +#include "Trade/MeshData.h" namespace Magnum { namespace Primitives { diff --git a/src/Primitives/Plane.cpp b/src/Primitives/Plane.cpp index e6216bf37..6db0eec5c 100644 --- a/src/Primitives/Plane.cpp +++ b/src/Primitives/Plane.cpp @@ -15,6 +15,8 @@ #include "Plane.h" +#include "Math/Vector4.h" + using namespace std; namespace Magnum { namespace Primitives { diff --git a/src/Primitives/Test/CapsuleTest.cpp b/src/Primitives/Test/CapsuleTest.cpp index d0b743714..983a8ed1f 100644 --- a/src/Primitives/Test/CapsuleTest.cpp +++ b/src/Primitives/Test/CapsuleTest.cpp @@ -16,10 +16,11 @@ /* Less precision */ #define FLOAT_EQUALITY_PRECISION 1.0e-5 -#include - #include "CapsuleTest.h" +#include + +#include "Math/Vector4.h" #include "Primitives/Capsule.h" using namespace std; diff --git a/src/Primitives/Test/CylinderTest.cpp b/src/Primitives/Test/CylinderTest.cpp index 28a89641b..43efb5845 100644 --- a/src/Primitives/Test/CylinderTest.cpp +++ b/src/Primitives/Test/CylinderTest.cpp @@ -17,6 +17,7 @@ #include +#include "Math/Vector4.h" #include "Primitives/Cylinder.h" using namespace std; diff --git a/src/Primitives/Test/UVSphereTest.cpp b/src/Primitives/Test/UVSphereTest.cpp index 71321865c..3ffd66937 100644 --- a/src/Primitives/Test/UVSphereTest.cpp +++ b/src/Primitives/Test/UVSphereTest.cpp @@ -17,6 +17,7 @@ #include +#include "Math/Vector4.h" #include "Primitives/UVSphere.h" using namespace std; diff --git a/src/Primitives/UVSphere.cpp b/src/Primitives/UVSphere.cpp index 724242a03..7a881cd43 100644 --- a/src/Primitives/UVSphere.cpp +++ b/src/Primitives/UVSphere.cpp @@ -15,6 +15,10 @@ #include "UVSphere.h" +#include + +#include "Math/Constants.h" + using namespace std; namespace Magnum { namespace Primitives { diff --git a/src/Query.h b/src/Query.h index 32413b2bf..41c59415c 100644 --- a/src/Query.h +++ b/src/Query.h @@ -21,6 +21,8 @@ #include "Magnum.h" +#include "magnumVisibility.h" + namespace Magnum { #ifndef MAGNUM_TARGET_GLES diff --git a/src/Renderbuffer.h b/src/Renderbuffer.h index 35854aba3..5a255ee5c 100644 --- a/src/Renderbuffer.h +++ b/src/Renderbuffer.h @@ -19,8 +19,11 @@ * @brief Class Magnum::Renderbuffer */ +#include "Math/Vector2.h" #include "Magnum.h" +#include "magnumVisibility.h" + namespace Magnum { /** diff --git a/src/SceneGraph/Object.h b/src/SceneGraph/Object.h index b6a0d3861..e4afc6814 100644 --- a/src/SceneGraph/Object.h +++ b/src/SceneGraph/Object.h @@ -21,6 +21,7 @@ #include +#include "Math/Matrix4.h" #include "Magnum.h" #include "magnumSceneGraphVisibility.h" diff --git a/src/SceneGraph/Test/CameraTest.cpp b/src/SceneGraph/Test/CameraTest.cpp index 09e58dd7c..f7a111cf1 100644 --- a/src/SceneGraph/Test/CameraTest.cpp +++ b/src/SceneGraph/Test/CameraTest.cpp @@ -15,6 +15,7 @@ #include "CameraTest.h" +#include "Math/Constants.h" #include "SceneGraph/Camera.h" CORRADE_TEST_MAIN(Magnum::SceneGraph::Test::CameraTest) diff --git a/src/SceneGraph/Test/ObjectTest.cpp b/src/SceneGraph/Test/ObjectTest.cpp index 77f5a7afa..c838704f8 100644 --- a/src/SceneGraph/Test/ObjectTest.cpp +++ b/src/SceneGraph/Test/ObjectTest.cpp @@ -14,11 +14,13 @@ */ #include "ObjectTest.h" -#include "SceneGraph/Camera.h" -#include "SceneGraph/Scene.h" #include +#include "Math/Constants.h" +#include "SceneGraph/Camera.h" +#include "SceneGraph/Scene.h" + using namespace std; CORRADE_TEST_MAIN(Magnum::SceneGraph::Test::ObjectTest) diff --git a/src/Shader.cpp b/src/Shader.cpp index 6646b2d47..2bf2bf948 100644 --- a/src/Shader.cpp +++ b/src/Shader.cpp @@ -16,6 +16,7 @@ #include "Shader.h" #include +#include #define COMPILER_MESSAGE_MAX_LENGTH 1024 diff --git a/src/Shader.h b/src/Shader.h index cdb19b456..75c3a0f63 100644 --- a/src/Shader.h +++ b/src/Shader.h @@ -19,11 +19,13 @@ * @brief Class Magnum::Shader */ -#include "Magnum.h" - #include #include +#include "Magnum.h" + +#include "magnumVisibility.h" + namespace Magnum { /** diff --git a/src/Shaders/PhongShader.cpp b/src/Shaders/PhongShader.cpp index 378a3e664..bf2ce456e 100644 --- a/src/Shaders/PhongShader.cpp +++ b/src/Shaders/PhongShader.cpp @@ -17,6 +17,8 @@ #include +#include "Shader.h" + namespace Magnum { namespace Shaders { PhongShader::PhongShader() { diff --git a/src/Shaders/PhongShader.h b/src/Shaders/PhongShader.h index da5201fee..a27b5d047 100644 --- a/src/Shaders/PhongShader.h +++ b/src/Shaders/PhongShader.h @@ -20,6 +20,7 @@ */ #include "AbstractShaderProgram.h" + #include "magnumShadersVisibility.h" namespace Magnum { namespace Shaders { diff --git a/src/SizeTraits.h b/src/SizeTraits.h index 5b156c576..62f984d39 100644 --- a/src/SizeTraits.h +++ b/src/SizeTraits.h @@ -19,6 +19,9 @@ * @brief Class Magnum::SizeTraits, Magnum::SizeBasedCall, Magnum::Pow, Magnum::Log */ +#include + +#include "Math/Math.h" #include "Magnum.h" namespace Magnum { diff --git a/src/Trade/AbstractImporter.cpp b/src/Trade/AbstractImporter.cpp index cfd07c7a3..ec68d9c21 100644 --- a/src/Trade/AbstractImporter.cpp +++ b/src/Trade/AbstractImporter.cpp @@ -15,7 +15,10 @@ #include "AbstractImporter.h" +#include + using namespace std; +using namespace Corrade::Utility; namespace Magnum { namespace Trade { diff --git a/src/Trade/AbstractImporter.h b/src/Trade/AbstractImporter.h index 2b7ed2528..e39fada1f 100644 --- a/src/Trade/AbstractImporter.h +++ b/src/Trade/AbstractImporter.h @@ -22,18 +22,23 @@ #include #include -#include "ImageData.h" +#include "magnumVisibility.h" namespace Magnum { namespace Trade { class AbstractMaterialData; class CameraData; +template class ImageData; class LightData; class MeshData; class ObjectData; class SceneData; class TextureData; +typedef ImageData<1> ImageData1D; +typedef ImageData<2> ImageData2D; +typedef ImageData<3> ImageData3D; + /** @brief Base class for importer plugins diff --git a/src/Trade/ImageData.h b/src/Trade/ImageData.h index f054f6464..98a4345a4 100644 --- a/src/Trade/ImageData.h +++ b/src/Trade/ImageData.h @@ -19,6 +19,7 @@ * @brief Class Magnum::Trade::ImageData */ +#include "Math/Vector.h" #include "AbstractImage.h" #include "TypeTraits.h" diff --git a/src/Trade/MeshData.cpp b/src/Trade/MeshData.cpp index 4d735f80f..24f2043fe 100644 --- a/src/Trade/MeshData.cpp +++ b/src/Trade/MeshData.cpp @@ -15,6 +15,8 @@ #include "MeshData.h" +#include "Math/Vector4.h" + namespace Magnum { namespace Trade { MeshData::~MeshData() { diff --git a/src/Trade/MeshData.h b/src/Trade/MeshData.h index d39afacc1..daf4f3cfa 100644 --- a/src/Trade/MeshData.h +++ b/src/Trade/MeshData.h @@ -19,6 +19,8 @@ * @brief Class Magnum::Trade::MeshData */ +#include + #include "Mesh.h" namespace Magnum { namespace Trade { diff --git a/src/Trade/ObjectData.h b/src/Trade/ObjectData.h index 3da9cd9ad..53da3f783 100644 --- a/src/Trade/ObjectData.h +++ b/src/Trade/ObjectData.h @@ -19,6 +19,7 @@ * @brief Class Magnum::Trade::ObjectData */ +#include "Math/Matrix4.h" #include "Magnum.h" namespace Magnum { namespace Trade { diff --git a/src/Trade/PhongMaterialData.h b/src/Trade/PhongMaterialData.h index 7aa7cf453..21896cba3 100644 --- a/src/Trade/PhongMaterialData.h +++ b/src/Trade/PhongMaterialData.h @@ -19,6 +19,7 @@ * @brief Class Magnum::Trade::PhongMaterialData */ +#include "Math/Vector3.h" #include "Magnum.h" #include "AbstractMaterialData.h" diff --git a/src/TypeTraits.h b/src/TypeTraits.h index 3e95eec12..11dfea0c4 100644 --- a/src/TypeTraits.h +++ b/src/TypeTraits.h @@ -19,10 +19,16 @@ * @brief Enum Magnum::Type, class Magnum::TypeOf, Magnum::TypeInfo, Magnum::TypeTraits */ +#include "Math/MathTypeTraits.h" #include "AbstractImage.h" namespace Magnum { +namespace Math { + template class Vector; + template class Matrix; +} + /** @brief Traits class for plain OpenGL types