Browse Source

Reduced #includes in headers.

Magnum.h now doesn't include anything except OpenGL headers, thus
changes in Math library don't trigger recompilation of everything, but
only of things really depending on it.

Math constants moved to separate file for similar reasons, de-inlined
some functions to remove the need for some #includes.
vectorfields
Vladimír Vondruš 14 years ago
parent
commit
fe62f547de
  1. 2
      src/AbstractImage.h
  2. 2
      src/AbstractShaderProgram.cpp
  3. 8
      src/AbstractShaderProgram.h
  4. 2
      src/Buffer.h
  5. 5
      src/Contexts/AbstractXContext.h
  6. 2
      src/Contexts/ExtensionWrangler.cpp
  7. 4
      src/Contexts/GlutContext.h
  8. 1
      src/Contexts/GlxInterface.cpp
  9. 2
      src/Contexts/Sdl2Context.h
  10. 3
      src/Framebuffer.cpp
  11. 14
      src/Framebuffer.h
  12. 2
      src/IndexedMesh.cpp
  13. 20
      src/Magnum.h
  14. 1
      src/Math/CMakeLists.txt
  15. 79
      src/Math/Constants.h
  16. 2
      src/Math/Geometry/Test/DistanceTest.cpp
  17. 48
      src/Math/Math.h
  18. 4
      src/Math/Test/CMakeLists.txt
  19. 46
      src/Math/Test/ConstantsTest.cpp
  20. 32
      src/Math/Test/ConstantsTest.h
  21. 18
      src/Math/Test/MathTest.cpp
  22. 2
      src/Math/Test/MathTest.h
  23. 2
      src/Math/Test/Matrix3Test.cpp
  24. 2
      src/Math/Test/Matrix4Test.cpp
  25. 2
      src/Math/Test/VectorTest.cpp
  26. 3
      src/Mesh.cpp
  27. 1
      src/MeshTools/Clean.h
  28. 2
      src/MeshTools/FlipNormals.cpp
  29. 3
      src/MeshTools/FlipNormals.h
  30. 1
      src/MeshTools/GenerateFlatNormals.cpp
  31. 2
      src/MeshTools/GenerateFlatNormals.h
  32. 1
      src/MeshTools/Test/FlipNormalsTest.cpp
  33. 2
      src/MeshTools/Test/GenerateFlatNormalsTest.cpp
  34. 1
      src/Physics/AbstractShape.h
  35. 2
      src/Physics/AxisAlignedBox.cpp
  36. 1
      src/Physics/AxisAlignedBox.h
  37. 5
      src/Physics/Capsule.cpp
  38. 6
      src/Physics/Capsule.h
  39. 2
      src/Physics/Line.cpp
  40. 1
      src/Physics/Line.h
  41. 2
      src/Physics/Plane.cpp
  42. 7
      src/Physics/Plane.h
  43. 1
      src/Physics/Point.h
  44. 3
      src/Physics/ShapeGroup.h
  45. 5
      src/Physics/Sphere.cpp
  46. 8
      src/Physics/Sphere.h
  47. 1
      src/Physics/Test/AbstractShapeTest.h
  48. 2
      src/Physics/Test/AxisAlignedBoxTest.cpp
  49. 3
      src/Physics/Test/CapsuleTest.cpp
  50. 2
      src/Physics/Test/LineTest.cpp
  51. 3
      src/Physics/Test/PlaneTest.cpp
  52. 1
      src/Physics/Test/PointTest.cpp
  53. 1
      src/Physics/Test/ShapeGroupTest.cpp
  54. 3
      src/Physics/Test/SphereTest.cpp
  55. 5
      src/Primitives/Capsule.cpp
  56. 2
      src/Primitives/Capsule.h
  57. 2
      src/Primitives/Cube.cpp
  58. 3
      src/Primitives/Cylinder.cpp
  59. 3
      src/Primitives/Cylinder.h
  60. 2
      src/Primitives/Icosphere.cpp
  61. 3
      src/Primitives/Icosphere.h
  62. 2
      src/Primitives/Plane.cpp
  63. 5
      src/Primitives/Test/CapsuleTest.cpp
  64. 1
      src/Primitives/Test/CylinderTest.cpp
  65. 1
      src/Primitives/Test/UVSphereTest.cpp
  66. 4
      src/Primitives/UVSphere.cpp
  67. 2
      src/Query.h
  68. 3
      src/Renderbuffer.h
  69. 1
      src/SceneGraph/Object.h
  70. 1
      src/SceneGraph/Test/CameraTest.cpp
  71. 6
      src/SceneGraph/Test/ObjectTest.cpp
  72. 1
      src/Shader.cpp
  73. 6
      src/Shader.h
  74. 2
      src/Shaders/PhongShader.cpp
  75. 1
      src/Shaders/PhongShader.h
  76. 3
      src/SizeTraits.h
  77. 3
      src/Trade/AbstractImporter.cpp
  78. 7
      src/Trade/AbstractImporter.h
  79. 1
      src/Trade/ImageData.h
  80. 2
      src/Trade/MeshData.cpp
  81. 2
      src/Trade/MeshData.h
  82. 1
      src/Trade/ObjectData.h
  83. 1
      src/Trade/PhongMaterialData.h
  84. 6
      src/TypeTraits.h

2
src/AbstractImage.h

@ -21,6 +21,8 @@
#include "Magnum.h"
#include "magnumVisibility.h"
namespace Magnum {
/**

2
src/AbstractShaderProgram.cpp

@ -17,6 +17,8 @@
#include <fstream>
#include "Shader.h"
#define LINKER_MESSAGE_MAX_LENGTH 1024
using namespace std;

8
src/AbstractShaderProgram.h

@ -21,10 +21,16 @@
#include <map>
#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

2
src/Buffer.h

@ -19,6 +19,8 @@
* @brief Class Magnum::Buffer
*/
#include <vector>
#include "Magnum.h"
namespace Magnum {

5
src/Contexts/AbstractXContext.h

@ -19,6 +19,8 @@
* @brief Class Magnum::Contexts::AbstractXContext
*/
#include <Containers/EnumSet.h>
#include "Magnum.h"
#include <X11/Xlib.h>
@ -27,8 +29,7 @@
#undef None
#undef Always
#include <Containers/EnumSet.h>
#include "Math/Vector2.h"
#include "AbstractContext.h"
#include "AbstractGlInterface.h"

2
src/Contexts/ExtensionWrangler.cpp

@ -15,6 +15,8 @@
#include "ExtensionWrangler.h"
#include <Utility/Debug.h>
#include "Magnum.h"
namespace Magnum { namespace Contexts {

4
src/Contexts/GlutContext.h

@ -19,7 +19,11 @@
* @brief Class Magnum::Contexts::GlutContext
*/
#include <string>
#include "Math/Vector2.h"
#include "Magnum.h"
#include <GL/freeglut.h>
#include "AbstractContext.h"

1
src/Contexts/GlxInterface.cpp

@ -16,6 +16,7 @@
#include "GlxInterface.h"
#include <GL/glxext.h>
#include <Utility/Debug.h>
namespace Magnum { namespace Contexts {

2
src/Contexts/Sdl2Context.h

@ -19,7 +19,9 @@
* @brief Class Magnum::Contexts::Sdl2Context
*/
#include "Math/Vector2.h"
#include "Magnum.h"
#include <SDL2/SDL.h>
#include <SDL2/SDL_scancode.h>

3
src/Framebuffer.cpp

@ -15,6 +15,9 @@
#include "Framebuffer.h"
#include "BufferedImage.h"
#include "Image.h"
namespace Magnum {
#ifndef MAGNUM_TARGET_GLES

14
src/Framebuffer.h

@ -21,14 +21,24 @@
#include <Containers/EnumSet.h>
#include "BufferedImage.h"
#include "AbstractImage.h"
#include "Buffer.h"
#include "CubeMapTexture.h"
#include "Color.h"
#include "Image.h"
#include "Renderbuffer.h"
namespace Magnum {
template<size_t> class BufferedImage;
template<size_t> 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

2
src/IndexedMesh.cpp

@ -15,6 +15,8 @@
#include "IndexedMesh.h"
#include <Utility/Debug.h>
namespace Magnum {
void IndexedMesh::draw() {

20
src/Magnum.h

@ -27,11 +27,25 @@
#include <GLES2/gl2.h>
#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> class Vector2;
template<class> class Vector3;
template<class> class Vector4;
template<class> class Matrix3;
template<class> class Matrix4;
template<class T> constexpr T deg(T value);
template<class T> constexpr T rad(T value);
}
/* Bring debugging facility from Corrade::Utility namespace */
using Corrade::Utility::Debug;

1
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

79
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š <mosra@centrum.cz>
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<class T> 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<double> {
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<float> {
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<class T> inline constexpr T deg(T value) { return value*Constants<T>::pi()/180; }
/**
* @brief Angle in radians
*
* See deg() for more information.
*/
template<class T> inline constexpr T rad(T value) { return value; }
}}
#endif

2
src/Math/Geometry/Test/DistanceTest.cpp

@ -17,7 +17,7 @@
#include <limits>
#include "Math.h"
#include "Constants.h"
#include "Distance.h"
CORRADE_TEST_MAIN(Magnum::Math::Geometry::Test::DistanceTest)

48
src/Math/Math.h

@ -15,7 +15,6 @@
GNU Lesser General Public License version 3 for more details.
*/
#include <cstddef>
#include <cmath>
#include <type_traits>
#include <limits>
@ -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<class T> 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<double> {
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<float> {
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<size_t exponent> struct Pow {
template<class T> inline constexpr T operator()(T base) const {
@ -135,27 +110,6 @@ template<class T> 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<class T> inline constexpr T deg(T value) { return value*Constants<T>::pi()/180; }
/**
* @brief Angle in radians
*
* See deg() for more information.
*/
template<class T> inline constexpr T rad(T value) { return value; }
}}
#endif

4
src/Math/Test/CMakeLists.txt

@ -1,3 +1,5 @@
corrade_add_test2(MathConstantsTest ConstantsTest.cpp)
corrade_add_test2(MathTest MathTest.cpp $<TARGET_OBJECTS:MagnumMathObjects>)
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 $<TARGET_OBJECTS:MagnumMathObjects>)

46
src/Math/Test/ConstantsTest.cpp

@ -0,0 +1,46 @@
/*
Copyright © 2010, 2011, 2012 Vladimír Vondruš <mosra@centrum.cz>
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<float>::sqrt2()), 2.0f);
CORRADE_COMPARE(Math::pow<2>(Constants<float>::sqrt3()), 3.0f);
CORRADE_COMPARE(Math::pow<2>(Constants<double>::sqrt2()), 2.0);
CORRADE_COMPARE(Math::pow<2>(Constants<double>::sqrt3()), 3.0);
}
void ConstantsTest::degrad() {
CORRADE_COMPARE(deg(90.0), Constants<double>::pi()/2);
CORRADE_COMPARE(deg(90.0f), Constants<float>::pi()/2);
CORRADE_COMPARE(rad(Constants<double>::pi()/2), Constants<double>::pi()/2);
}
}}}

32
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š <mosra@centrum.cz>
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 <TestSuite/Tester.h>
namespace Magnum { namespace Math { namespace Test {
class ConstantsTest: public Corrade::TestSuite::Tester<ConstantsTest> {
public:
ConstantsTest();
void constants();
void degrad();
};
}}}
#endif

18
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<float>::sqrt2()), 2.0f);
CORRADE_COMPARE(Math::pow<2>(Constants<float>::sqrt3()), 3.0f);
CORRADE_COMPARE(Math::pow<2>(Constants<double>::sqrt2()), 2.0);
CORRADE_COMPARE(Math::pow<2>(Constants<double>::sqrt3()), 3.0);
}
void MathTest::degrad() {
CORRADE_COMPARE(deg(90.0), Constants<double>::pi()/2);
CORRADE_COMPARE(deg(90.0f), Constants<float>::pi()/2);
CORRADE_COMPARE(rad(Constants<double>::pi()/2), Constants<double>::pi()/2);
}
void MathTest::normalize() {
/* Range for signed and unsigned */
CORRADE_COMPARE((Math::normalize<float, char>(-128)), 0.0f);

2
src/Math/Test/MathTest.h

@ -23,8 +23,6 @@ class MathTest: public Corrade::TestSuite::Tester<MathTest> {
public:
MathTest();
void constants();
void degrad();
void normalize();
void denormalize();
void clamp();

2
src/Math/Test/Matrix3Test.cpp

@ -17,8 +17,8 @@
#include <sstream>
#include "Constants.h"
#include "Matrix3.h"
#include "Math.h"
CORRADE_TEST_MAIN(Magnum::Math::Test::Matrix3Test)

2
src/Math/Test/Matrix4Test.cpp

@ -17,8 +17,8 @@
#include <sstream>
#include "Constants.h"
#include "Matrix4.h"
#include "Math.h"
CORRADE_TEST_MAIN(Magnum::Math::Test::Matrix4Test)

2
src/Math/Test/VectorTest.cpp

@ -17,8 +17,8 @@
#include <sstream>
#include "Constants.h"
#include "Vector.h"
#include "Math.h"
CORRADE_TEST_MAIN(Magnum::Math::Test::VectorTest)

3
src/Mesh.cpp

@ -14,6 +14,9 @@
*/
#include "Mesh.h"
#include <Utility/Debug.h>
#include "Buffer.h"
using namespace std;

1
src/MeshTools/Clean.h

@ -23,6 +23,7 @@
#include <limits>
#include <Utility/MurmurHash2.h>
#include "Math/Vector.h"
#include "TypeTraits.h"
namespace Magnum { namespace MeshTools {

2
src/MeshTools/FlipNormals.cpp

@ -15,6 +15,8 @@
#include "FlipNormals.h"
#include "Math/Vector3.h"
using namespace std;
namespace Magnum { namespace MeshTools {

3
src/MeshTools/FlipNormals.h

@ -19,7 +19,10 @@
* @brief Function Magnum::MeshTools::flipNormals()
*/
#include <vector>
#include "Magnum.h"
#include "magnumMeshToolsVisibility.h"
namespace Magnum { namespace MeshTools {

1
src/MeshTools/GenerateFlatNormals.cpp

@ -15,6 +15,7 @@
#include "GenerateFlatNormals.h"
#include "Math/Vector4.h"
#include "MeshTools/Clean.h"
using namespace std;

2
src/MeshTools/GenerateFlatNormals.h

@ -20,8 +20,10 @@
*/
#include <tuple>
#include <vector>
#include "Magnum.h"
#include "magnumMeshToolsVisibility.h"
namespace Magnum { namespace MeshTools {

1
src/MeshTools/Test/FlipNormalsTest.cpp

@ -17,6 +17,7 @@
#include <sstream>
#include "Math/Vector3.h"
#include "MeshTools/FlipNormals.h"
CORRADE_TEST_MAIN(Magnum::MeshTools::Test::FlipNormalsTest)

2
src/MeshTools/Test/GenerateFlatNormalsTest.cpp

@ -17,6 +17,7 @@
#include <sstream>
#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<unsigned int>{
0, 0, 0,
1, 1, 1

1
src/Physics/AbstractShape.h

@ -20,6 +20,7 @@
*/
#include "Magnum.h"
#include "magnumPhysicsVisibility.h"
namespace Magnum { namespace Physics {

2
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) {

1
src/Physics/AxisAlignedBox.h

@ -19,6 +19,7 @@
* @brief Class Magnum::Physics::AxisAlignedBox
*/
#include "Math/Vector3.h"
#include "AbstractShape.h"
namespace Magnum { namespace Physics {

5
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;

6
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

2
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) {

1
src/Physics/Line.h

@ -19,6 +19,7 @@
* @brief Class Magnum::Physics::Line
*/
#include "Math/Vector3.h"
#include "AbstractShape.h"
namespace Magnum { namespace Physics {

2
src/Physics/Plane.cpp

@ -17,7 +17,9 @@
#include <limits>
#include "Math/Matrix4.h"
#include "Math/Geometry/Intersection.h"
#include "LineSegment.h"
using namespace std;
using namespace Magnum::Math::Geometry;

7
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:

1
src/Physics/Point.h

@ -19,6 +19,7 @@
* @brief Class Magnum::Physics::Point
*/
#include "Math/Vector3.h"
#include "AbstractShape.h"
namespace Magnum { namespace Physics {

3
src/Physics/ShapeGroup.h

@ -21,6 +21,9 @@
#include "AbstractShape.h"
#include <type_traits>
#include <utility>
namespace Magnum { namespace Physics {
#ifndef DOXYGEN_GENERATING_OUTPUT

5
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;

8
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

1
src/Physics/Test/AbstractShapeTest.h

@ -17,6 +17,7 @@
#include <TestSuite/Tester.h>
#include "Math/Matrix4.h"
#include "Magnum.h"
namespace Magnum { namespace Physics { namespace Test {

2
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)

3
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)

2
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)

3
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)

1
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)

1
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"

3
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)

5
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<unsigned int>, {new std::vector<Vector4>()}, {new std::vector<Vector3>()}, textureCoords == TextureCoords::Generate ? std::vector<std::vector<Vector2>*>{new std::vector<Vector2>()} : std::vector<std::vector<Vector2>*>()), 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});

2
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<unsigned int>, {new std::vector<Vector4>()}, {new std::vector<Vector3>()}, textureCoords == TextureCoords::Generate ? std::vector<std::vector<Vector2>*>{new std::vector<Vector2>()} : std::vector<std::vector<Vector2>*>()), 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);

2
src/Primitives/Cube.cpp

@ -15,6 +15,8 @@
#include "Cube.h"
#include "Math/Vector4.h"
using namespace std;
namespace Magnum { namespace Primitives {

3
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 {

3
src/Primitives/Cylinder.h

@ -19,9 +19,10 @@
* @brief Class Magnum::Primitives::UVSphere
*/
#include "Primitives/Capsule.h"
#include <Containers/EnumSet.h>
#include "Primitives/Capsule.h"
namespace Magnum { namespace Primitives {
/** @brief Cylinder primitive */

2
src/Primitives/Icosphere.cpp

@ -15,6 +15,8 @@
#include "Icosphere.h"
#include "Math/Vector4.h"
using namespace std;
namespace Magnum { namespace Primitives {

3
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 {

2
src/Primitives/Plane.cpp

@ -15,6 +15,8 @@
#include "Plane.h"
#include "Math/Vector4.h"
using namespace std;
namespace Magnum { namespace Primitives {

5
src/Primitives/Test/CapsuleTest.cpp

@ -16,10 +16,11 @@
/* Less precision */
#define FLOAT_EQUALITY_PRECISION 1.0e-5
#include <TestSuite/Compare/Container.h>
#include "CapsuleTest.h"
#include <TestSuite/Compare/Container.h>
#include "Math/Vector4.h"
#include "Primitives/Capsule.h"
using namespace std;

1
src/Primitives/Test/CylinderTest.cpp

@ -17,6 +17,7 @@
#include <TestSuite/Compare/Container.h>
#include "Math/Vector4.h"
#include "Primitives/Cylinder.h"
using namespace std;

1
src/Primitives/Test/UVSphereTest.cpp

@ -17,6 +17,7 @@
#include <TestSuite/Compare/Container.h>
#include "Math/Vector4.h"
#include "Primitives/UVSphere.h"
using namespace std;

4
src/Primitives/UVSphere.cpp

@ -15,6 +15,10 @@
#include "UVSphere.h"
#include <Utility/Debug.h>
#include "Math/Constants.h"
using namespace std;
namespace Magnum { namespace Primitives {

2
src/Query.h

@ -21,6 +21,8 @@
#include "Magnum.h"
#include "magnumVisibility.h"
namespace Magnum {
#ifndef MAGNUM_TARGET_GLES

3
src/Renderbuffer.h

@ -19,8 +19,11 @@
* @brief Class Magnum::Renderbuffer
*/
#include "Math/Vector2.h"
#include "Magnum.h"
#include "magnumVisibility.h"
namespace Magnum {
/**

1
src/SceneGraph/Object.h

@ -21,6 +21,7 @@
#include <Containers/LinkedList.h>
#include "Math/Matrix4.h"
#include "Magnum.h"
#include "magnumSceneGraphVisibility.h"

1
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)

6
src/SceneGraph/Test/ObjectTest.cpp

@ -14,11 +14,13 @@
*/
#include "ObjectTest.h"
#include "SceneGraph/Camera.h"
#include "SceneGraph/Scene.h"
#include <sstream>
#include "Math/Constants.h"
#include "SceneGraph/Camera.h"
#include "SceneGraph/Scene.h"
using namespace std;
CORRADE_TEST_MAIN(Magnum::SceneGraph::Test::ObjectTest)

1
src/Shader.cpp

@ -16,6 +16,7 @@
#include "Shader.h"
#include <fstream>
#include <Utility/Debug.h>
#define COMPILER_MESSAGE_MAX_LENGTH 1024

6
src/Shader.h

@ -19,11 +19,13 @@
* @brief Class Magnum::Shader
*/
#include "Magnum.h"
#include <vector>
#include <string>
#include "Magnum.h"
#include "magnumVisibility.h"
namespace Magnum {
/**

2
src/Shaders/PhongShader.cpp

@ -17,6 +17,8 @@
#include <Utility/Resource.h>
#include "Shader.h"
namespace Magnum { namespace Shaders {
PhongShader::PhongShader() {

1
src/Shaders/PhongShader.h

@ -20,6 +20,7 @@
*/
#include "AbstractShaderProgram.h"
#include "magnumShadersVisibility.h"
namespace Magnum { namespace Shaders {

3
src/SizeTraits.h

@ -19,6 +19,9 @@
* @brief Class Magnum::SizeTraits, Magnum::SizeBasedCall, Magnum::Pow, Magnum::Log
*/
#include <Utility/Debug.h>
#include "Math/Math.h"
#include "Magnum.h"
namespace Magnum {

3
src/Trade/AbstractImporter.cpp

@ -15,7 +15,10 @@
#include "AbstractImporter.h"
#include <Utility/Debug.h>
using namespace std;
using namespace Corrade::Utility;
namespace Magnum { namespace Trade {

7
src/Trade/AbstractImporter.h

@ -22,18 +22,23 @@
#include <Containers/EnumSet.h>
#include <PluginManager/Plugin.h>
#include "ImageData.h"
#include "magnumVisibility.h"
namespace Magnum { namespace Trade {
class AbstractMaterialData;
class CameraData;
template<size_t> 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

1
src/Trade/ImageData.h

@ -19,6 +19,7 @@
* @brief Class Magnum::Trade::ImageData
*/
#include "Math/Vector.h"
#include "AbstractImage.h"
#include "TypeTraits.h"

2
src/Trade/MeshData.cpp

@ -15,6 +15,8 @@
#include "MeshData.h"
#include "Math/Vector4.h"
namespace Magnum { namespace Trade {
MeshData::~MeshData() {

2
src/Trade/MeshData.h

@ -19,6 +19,8 @@
* @brief Class Magnum::Trade::MeshData
*/
#include <string>
#include "Mesh.h"
namespace Magnum { namespace Trade {

1
src/Trade/ObjectData.h

@ -19,6 +19,7 @@
* @brief Class Magnum::Trade::ObjectData
*/
#include "Math/Matrix4.h"
#include "Magnum.h"
namespace Magnum { namespace Trade {

1
src/Trade/PhongMaterialData.h

@ -19,6 +19,7 @@
* @brief Class Magnum::Trade::PhongMaterialData
*/
#include "Math/Vector3.h"
#include "Magnum.h"
#include "AbstractMaterialData.h"

6
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<size_t, class> class Vector;
template<size_t, class> class Matrix;
}
/**
@brief Traits class for plain OpenGL types

Loading…
Cancel
Save