Browse Source

Deprecate the Shapes library and everything that depends on it.

Scheduled for removal in ~6 months if all goes well.
pull/280/head
Vladimír Vondruš 8 years ago
parent
commit
8efc6b39e9
  1. 2
      CMakeLists.txt
  2. 10
      doc/building.dox
  3. 10
      doc/changelog.dox
  4. 2
      doc/cmake.dox
  5. 3
      doc/features.dox
  6. 20
      doc/namespaces.dox
  7. 10
      doc/shapes.dox
  8. 16
      modules/FindMagnum.cmake
  9. 4
      src/Magnum/DebugTools/CMakeLists.txt
  10. 12
      src/Magnum/DebugTools/DebugTools.h
  11. 4
      src/Magnum/DebugTools/Implementation/AbstractBoxRenderer.cpp
  12. 2
      src/Magnum/DebugTools/Implementation/AbstractBoxRenderer.h
  13. 4
      src/Magnum/DebugTools/Implementation/AbstractShapeRenderer.cpp
  14. 6
      src/Magnum/DebugTools/Implementation/AbstractShapeRenderer.h
  15. 4
      src/Magnum/DebugTools/Implementation/AxisAlignedBoxRenderer.cpp
  16. 2
      src/Magnum/DebugTools/Implementation/AxisAlignedBoxRenderer.h
  17. 4
      src/Magnum/DebugTools/Implementation/BoxRenderer.cpp
  18. 2
      src/Magnum/DebugTools/Implementation/BoxRenderer.h
  19. 4
      src/Magnum/DebugTools/Implementation/CapsuleRenderer.cpp
  20. 2
      src/Magnum/DebugTools/Implementation/CapsuleRenderer.h
  21. 2
      src/Magnum/DebugTools/Implementation/CapsuleRendererTransformation.h
  22. 4
      src/Magnum/DebugTools/Implementation/CylinderRenderer.cpp
  23. 2
      src/Magnum/DebugTools/Implementation/CylinderRenderer.h
  24. 2
      src/Magnum/DebugTools/Implementation/CylinderRendererTransformation.h
  25. 4
      src/Magnum/DebugTools/Implementation/LineSegmentRenderer.cpp
  26. 2
      src/Magnum/DebugTools/Implementation/LineSegmentRenderer.h
  27. 2
      src/Magnum/DebugTools/Implementation/LineSegmentRendererTransformation.h
  28. 4
      src/Magnum/DebugTools/Implementation/PointRenderer.cpp
  29. 2
      src/Magnum/DebugTools/Implementation/PointRenderer.h
  30. 4
      src/Magnum/DebugTools/Implementation/SphereRenderer.cpp
  31. 2
      src/Magnum/DebugTools/Implementation/SphereRenderer.h
  32. 23
      src/Magnum/DebugTools/ResourceManager.cpp
  33. 27
      src/Magnum/DebugTools/ResourceManager.h
  34. 4
      src/Magnum/DebugTools/ShapeRenderer.cpp
  35. 72
      src/Magnum/DebugTools/ShapeRenderer.h
  36. 2
      src/Magnum/DebugTools/Test/CapsuleRendererTest.cpp
  37. 2
      src/Magnum/DebugTools/Test/CylinderRendererTest.cpp
  38. 2
      src/Magnum/DebugTools/Test/LineSegmentRendererTest.cpp
  39. 4
      src/Magnum/Shapes/AbstractShape.cpp
  40. 55
      src/Magnum/Shapes/AbstractShape.h
  41. 4
      src/Magnum/Shapes/AxisAlignedBox.cpp
  42. 68
      src/Magnum/Shapes/AxisAlignedBox.h
  43. 4
      src/Magnum/Shapes/Box.cpp
  44. 55
      src/Magnum/Shapes/Box.h
  45. 4
      src/Magnum/Shapes/CMakeLists.txt
  46. 4
      src/Magnum/Shapes/Capsule.cpp
  47. 82
      src/Magnum/Shapes/Capsule.h
  48. 55
      src/Magnum/Shapes/Collision.h
  49. 4
      src/Magnum/Shapes/Composition.cpp
  50. 130
      src/Magnum/Shapes/Composition.h
  51. 4
      src/Magnum/Shapes/Cylinder.cpp
  52. 82
      src/Magnum/Shapes/Cylinder.h
  53. 4
      src/Magnum/Shapes/Implementation/CollisionDispatch.cpp
  54. 2
      src/Magnum/Shapes/Implementation/CollisionDispatch.h
  55. 4
      src/Magnum/Shapes/Line.cpp
  56. 56
      src/Magnum/Shapes/Line.h
  57. 54
      src/Magnum/Shapes/LineSegment.h
  58. 4
      src/Magnum/Shapes/Plane.cpp
  59. 47
      src/Magnum/Shapes/Plane.h
  60. 4
      src/Magnum/Shapes/Point.cpp
  61. 55
      src/Magnum/Shapes/Point.h
  62. 4
      src/Magnum/Shapes/Shape.cpp
  63. 26
      src/Magnum/Shapes/Shape.h
  64. 4
      src/Magnum/Shapes/ShapeGroup.cpp
  65. 46
      src/Magnum/Shapes/ShapeGroup.h
  66. 109
      src/Magnum/Shapes/Shapes.h
  67. 4
      src/Magnum/Shapes/Sphere.cpp
  68. 206
      src/Magnum/Shapes/Sphere.h
  69. 4
      src/Magnum/Shapes/Test/AxisAlignedBoxTest.cpp
  70. 4
      src/Magnum/Shapes/Test/BoxTest.cpp
  71. 4
      src/Magnum/Shapes/Test/CapsuleTest.cpp
  72. 4
      src/Magnum/Shapes/Test/CollisionTest.cpp
  73. 4
      src/Magnum/Shapes/Test/CompositionTest.cpp
  74. 4
      src/Magnum/Shapes/Test/CylinderTest.cpp
  75. 4
      src/Magnum/Shapes/Test/LineTest.cpp
  76. 4
      src/Magnum/Shapes/Test/PlaneTest.cpp
  77. 4
      src/Magnum/Shapes/Test/PointTest.cpp
  78. 4
      src/Magnum/Shapes/Test/ShapeImplementationTest.cpp
  79. 4
      src/Magnum/Shapes/Test/ShapeTest.cpp
  80. 4
      src/Magnum/Shapes/Test/SphereTest.cpp
  81. 4
      src/Magnum/Shapes/shapeImplementation.cpp
  82. 2
      src/Magnum/Shapes/shapeImplementation.h

2
CMakeLists.txt

@ -108,7 +108,7 @@ cmake_dependent_option(WITH_TGAIMPORTER "Build TgaImporter plugin" OFF "NOT WITH
cmake_dependent_option(WITH_AUDIO "Build Audio library" OFF "NOT WITH_AL_INFO;NOT WITH_ANYAUDIOIMPORTER;NOT WITH_WAVAUDIOIMPORTER" ON)
option(WITH_DEBUGTOOLS "Build DebugTools library" ON)
cmake_dependent_option(WITH_MESHTOOLS "Build MeshTools library" ON "NOT WITH_OBJIMPORTER" ON)
option(WITH_SHAPES "Build Shapes library" ON)
option(WITH_SHAPES "Build Shapes library" OFF)
cmake_dependent_option(WITH_SCENEGRAPH "Build SceneGraph library" ON "NOT WITH_SHAPES" ON)
option(WITH_SHADERS "Build Shaders library" ON)
cmake_dependent_option(WITH_TEXT "Build Text library" ON "NOT WITH_FONTCONVERTER;NOT WITH_MAGNUMFONT;NOT WITH_MAGNUMFONTCONVERTER" ON)

10
doc/building.dox

@ -452,9 +452,9 @@ information. See also @ref corrade-cmake and @ref Corrade/Corrade.h for
related info for the Corrade library.
By default the engine is built with nearly everything except the @ref Audio
library, plugins, command-line utilities and application libraries (see below).
Using the following `WITH_*` CMake options you can specify which parts will
be built and which not:
and @ref Shapes libraries, plugins, command-line utilities and application
libraries (see below). Using the following `WITH_*` CMake options you can
specify which parts will be built and which not:
- `WITH_AUDIO` --- Build the @ref Audio library. Depends on
[OpenAL](https://www.openal.org/), not built by default.
@ -469,8 +469,8 @@ be built and which not:
automatically if `WITH_SHAPES` is enabled.
- `WITH_SHADERS` --- Build the @ref Shaders library. Enables also building of
the GL library.
- `WITH_SHAPES` --- Build the @ref Shapes library. Enables also building of
the SceneGraph library.
- `WITH_SHAPES` @m_class{m-label m-danger} **deprecated** --- Build the
@ref Shapes library. Enables also building of the SceneGraph library.
- `WITH_TEXT` --- Build the @ref Text library. Enables also building of
the TextureTools and GL libraries.
- `WITH_TEXTURETOOLS` --- Build the @ref TextureTools library. Enabled

10
doc/changelog.dox

@ -315,6 +315,14 @@ See also:
@subsection changelog-latest-deprecated Deprecated APIs
- The @ref Magnum::Shapes library is a failed design experiment and is
scheduled for removal in a future release, together with
@ref DebugTools::ShapeRenderer. Related geometry algorithms were moved to
@ref Magnum::Math::Distance and @ref Magnum::Math::Intersection; if you
need a full-fledged physics library, please have look at
[Bullet](https://bulletphysics.org), which has Magnum integration in
@ref Magnum::BulletIntegration, or at [Box2D](https://box2d.org/), which
has a @ref examples-box2d "Magnum example" as well.
- @ref Platform::GlutApplication is based on an outdated toolkit and thus
scheduled for removal in a future release. Please consider switching to
@ref Platform::Sdl2Application or @ref Platform::GlfwApplication as soon as
@ -347,6 +355,8 @@ See also:
@subsection changelog-latest-compatibility Potential compatibility breakages, removed APIs
- The @ref Magnum::Shapes library is not built by default anymore due to its
deprecated status
- @ref Audio::Playable is now by default omnidirectional instead of having
source in direction of negative Z axis (the direction has effect only when
setting inner and outer cone properties of @ref Audio::Source).

2
doc/cmake.dox

@ -112,7 +112,7 @@ the components. The optional components are:
- `Primitives` --- @ref Primitives library
- `SceneGraph` --- @ref SceneGraph library
- `Shaders` --- @ref Shaders library
- `Shapes` --- @ref Shapes library
- `Shapes` @m_class{m-label m-danger} **deprecated** --- @ref Shapes library
- `Text` --- @ref Text library
- `TextureTools` --- @ref TextureTools library
- `Trade` --- @ref Trade library

3
doc/features.dox

@ -39,7 +39,8 @@ necessary to read through everything, pick only what you need.
- @subpage opengl-wrapping --- @copybrief opengl-wrapping
- @subpage shaders --- @copybrief shaders
- @subpage scenegraph --- @copybrief scenegraph
- @subpage shapes --- @copybrief shapes
- @subpage shapes @m_class{m-label m-danger} **deprecated** ---
@copybrief shapes
- @subpage debug-tools --- @copybrief debug-tools
- @subpage ui --- @copybrief ui
*/

20
doc/namespaces.dox

@ -356,11 +356,27 @@ See @ref building, @ref cmake and @ref shaders for more information.
*/
/** @dir Magnum/Shapes
* @brief Namespace @ref Magnum::Shapes
*/
@brief Namespace @ref Magnum::Shapes
@deprecated The @ref Magnum::Shapes library is a failed design experiment and
is scheduled for removal in a future release. Related geometry algorithms
were moved to @ref Magnum::Math::Distance and @ref Magnum::Math::Intersection;
if you need a full-fledged physics library, please have look at
[Bullet](https://bulletphysics.org), which has Magnum integration in
@ref Magnum::BulletIntegration, or at [Box2D](https://box2d.org/), which
has a @ref examples-box2d "Magnum example" as well.
*/
/** @namespace Magnum::Shapes
@brief Shape library
@deprecated This library is a failed design experiment and is scheduled for
removal in a future release. Related geometry algorithms were moved to
@ref Math::Distance and @ref Math::Intersection; if you need a full-fledged
physics library, please have look at [Bullet](https://bulletphysics.org),
which has Magnum integration in @ref BulletIntegration, or at
[Box2D](https://box2d.org/), which has a @ref examples-box2d "Magnum example"
as well.
Collision detection system.
This library is built if `WITH_SHAPES` is enabled when building Magnum. To use

10
doc/shapes.dox

@ -30,6 +30,16 @@ namespace Magnum {
@tableofcontents
@m_footernavigation
@deprecated This library is a failed design experiment and is scheduled for
removal in a future release. Related geometry algorithms were moved to
@ref Magnum::Math::Distance "Math::Distance" and
@ref Magnum::Math::Intersection "Math::Intersection"; if you need a
full-fledged physics library, please have look at
[Bullet](https://bulletphysics.org), which has Magnum integration in
@ref Magnum::BulletIntegration "BulletIntegration" or at
[Box2D](https://box2d.org/), which has a @ref examples-box2d "Magnum example"
as well.
The essential thing in collision detection is to define a complex object with
collection of simple shapes, for which it is easy to detect collisions. The
library is contained in @ref Shapes namespace, see its documentation for more

16
modules/FindMagnum.cmake

@ -342,13 +342,16 @@ endif()
# Component distinction (listing them explicitly to avoid mistakes with finding
# components from other repositories)
set(_MAGNUM_LIBRARY_COMPONENT_LIST
Audio DebugTools GL MeshTools Primitives SceneGraph Shaders Shapes Text
Audio DebugTools GL MeshTools Primitives SceneGraph Shaders Text
TextureTools Trade Vk
AndroidApplication GlfwApplication GlutApplication GlxApplication
Sdl2Application XEglApplication WindowlessCglApplication
WindowlessEglApplication WindowlessGlxApplication WindowlessIosApplication WindowlessWglApplication WindowlessWindowsEglApplication
CglContext EglContext GlxContext WglContext
OpenGLTester)
if(MAGNUM_BUILD_DEPRECATED)
list(APPEND _MAGNUM_LIBRARY_COMPONENT_LIST Shapes)
endif()
set(_MAGNUM_PLUGIN_COMPONENT_LIST
AnyAudioImporter AnyImageConverter AnyImageImporter AnySceneImporter
MagnumFont MagnumFontConverter ObjImporter TgaImageConverter TgaImporter
@ -364,14 +367,17 @@ if(MAGNUM_TARGET_GL)
# MeshTools, Primitives, SceneGraph, Shaders and Shapes are used only for
# GL renderers. All of this is optional, compiled in only if the base
# library was selected.
list(APPEND _MAGNUM_DebugTools_DEPENDENCIES MeshTools Primitives SceneGraph Shaders Shapes Trade GL)
list(APPEND _MAGNUM_DebugTools_DEPENDENCIES MeshTools Primitives SceneGraph Shaders Trade GL)
set(_MAGNUM_DebugTools_MeshTools_DEPENDENCY_IS_OPTIONAL ON)
set(_MAGNUM_DebugTools_Primitives_DEPENDENCY_IS_OPTIONAL ON)
set(_MAGNUM_DebugTools_SceneGraph_DEPENDENCY_IS_OPTIONAL ON)
set(_MAGNUM_DebugTools_Shaders_DEPENDENCY_IS_OPTIONAL ON)
set(_MAGNUM_DebugTools_Shapes_DEPENDENCY_IS_OPTIONAL ON)
set(_MAGNUM_DebugTools_Trade_DEPENDENCY_IS_OPTIONAL ON)
set(_MAGNUM_DebugTools_GL_DEPENDENCY_IS_OPTIONAL ON)
if(MAGNUM_BUILD_DEPRECATED)
list(APPEND _MAGNUM_DebugTools_DEPENDENCIES Shapes)
set(_MAGNUM_DebugTools_Shapes_DEPENDENCY_IS_OPTIONAL ON)
endif()
endif()
set(_MAGNUM_MeshTools_DEPENDENCIES )
@ -404,7 +410,9 @@ endif()
set(_MAGNUM_Primitives_DEPENDENCIES Trade)
set(_MAGNUM_SceneGraph_DEPENDENCIES )
set(_MAGNUM_Shaders_DEPENDENCIES GL)
set(_MAGNUM_Shapes_DEPENDENCIES SceneGraph)
if(MAGNUM_BUILD_DEPRECATED)
set(_MAGNUM_Shapes_DEPENDENCIES SceneGraph)
endif()
set(_MAGNUM_Text_DEPENDENCIES TextureTools GL)
set(_MAGNUM_TextureTools_DEPENDENCIES )

4
src/Magnum/DebugTools/CMakeLists.txt

@ -72,6 +72,10 @@ if(TARGET_GL)
endif()
if(WITH_SHAPES)
if(NOT MAGNUM_BUILD_DEPRECATED)
message(FATAL_ERROR "Shapes are scheduled for removal and not available if BUILD_DEPRECATED is disabled. See the docs for alternatives.")
endif()
list(APPEND MagnumDebugTools_SRCS
ShapeRenderer.cpp

12
src/Magnum/DebugTools/DebugTools.h

@ -49,10 +49,14 @@ class ObjectRendererOptions;
class ResourceManager;
template<UnsignedInt> class ShapeRenderer;
typedef ShapeRenderer<2> ShapeRenderer2D;
typedef ShapeRenderer<3> ShapeRenderer3D;
class ShapeRendererOptions;
#ifdef MAGNUM_BUILD_DEPRECATED
CORRADE_IGNORE_DEPRECATED_PUSH
template<UnsignedInt> class CORRADE_DEPRECATED("scheduled for removal, see the docs for alternatives") ShapeRenderer;
typedef CORRADE_DEPRECATED("scheduled for removal, see the docs for alternatives") ShapeRenderer<2> ShapeRenderer2D;
typedef CORRADE_DEPRECATED("scheduled for removal, see the docs for alternatives") ShapeRenderer<3> ShapeRenderer3D;
class CORRADE_DEPRECATED("scheduled for removal, see the docs for alternatives") ShapeRendererOptions;
CORRADE_IGNORE_DEPRECATED_POP
#endif
#endif
#endif

4
src/Magnum/DebugTools/Implementation/AbstractBoxRenderer.cpp

@ -23,6 +23,8 @@
DEALINGS IN THE SOFTWARE.
*/
#define _MAGNUM_DO_NOT_WARN_DEPRECATED_SHAPES
#include "AbstractBoxRenderer.h"
#include "Magnum/GL/Mesh.h"
@ -33,6 +35,7 @@
namespace Magnum { namespace DebugTools { namespace Implementation {
CORRADE_IGNORE_DEPRECATED_PUSH
AbstractBoxRenderer<2>::AbstractBoxRenderer(): AbstractShapeRenderer<2>("box2d", "box2d-vertices", {}) {
if(!wireframeMesh) AbstractShapeRenderer<2>::createResources(Primitives::squareWireframe());
}
@ -40,5 +43,6 @@ AbstractBoxRenderer<2>::AbstractBoxRenderer(): AbstractShapeRenderer<2>("box2d",
AbstractBoxRenderer<3>::AbstractBoxRenderer(): AbstractShapeRenderer<3>("box3d", "box3d-vertices", "box3d-indices") {
if(!wireframeMesh) AbstractShapeRenderer<3>::createResources(Primitives::cubeWireframe());
}
CORRADE_IGNORE_DEPRECATED_POP
}}}

2
src/Magnum/DebugTools/Implementation/AbstractBoxRenderer.h

@ -32,6 +32,7 @@
namespace Magnum { namespace DebugTools { namespace Implementation {
CORRADE_IGNORE_DEPRECATED_PUSH
template<UnsignedInt dimensions> class AbstractBoxRenderer;
template<> class AbstractBoxRenderer<2>: public AbstractShapeRenderer<2> {
@ -43,6 +44,7 @@ template<> class AbstractBoxRenderer<3>: public AbstractShapeRenderer<3> {
public:
AbstractBoxRenderer();
};
CORRADE_IGNORE_DEPRECATED_POP
}}}

4
src/Magnum/DebugTools/Implementation/AbstractShapeRenderer.cpp

@ -23,6 +23,8 @@
DEALINGS IN THE SOFTWARE.
*/
#define _MAGNUM_DO_NOT_WARN_DEPRECATED_SHAPES
#include "AbstractShapeRenderer.h"
#include <Corrade/Containers/Array.h>
@ -38,6 +40,7 @@
namespace Magnum { namespace DebugTools { namespace Implementation {
CORRADE_IGNORE_DEPRECATED_PUSH
namespace {
template<UnsignedInt dimensions> ResourceKey shaderKey();
@ -130,5 +133,6 @@ template<UnsignedInt dimensions> void AbstractShapeRenderer<dimensions>::createR
template class AbstractShapeRenderer<2>;
template class AbstractShapeRenderer<3>;
CORRADE_IGNORE_DEPRECATED_POP
}}}

6
src/Magnum/DebugTools/Implementation/AbstractShapeRenderer.h

@ -35,6 +35,7 @@
namespace Magnum {
CORRADE_IGNORE_DEPRECATED_PUSH
namespace Shapes { namespace Implementation {
template<UnsignedInt> struct AbstractShape;
}}
@ -64,6 +65,9 @@ template<UnsignedInt dimensions> class AbstractShapeRenderer {
Resource<GL::Buffer> indexBuffer, vertexBuffer;
};
}}}
}}
CORRADE_IGNORE_DEPRECATED_POP
}
#endif

4
src/Magnum/DebugTools/Implementation/AxisAlignedBoxRenderer.cpp

@ -23,6 +23,8 @@
DEALINGS IN THE SOFTWARE.
*/
#define _MAGNUM_DO_NOT_WARN_DEPRECATED_SHAPES
#include "AxisAlignedBoxRenderer.h"
#include "Magnum/GL/Mesh.h"
@ -32,6 +34,7 @@
namespace Magnum { namespace DebugTools { namespace Implementation {
CORRADE_IGNORE_DEPRECATED_PUSH
template<UnsignedInt dimensions> AxisAlignedBoxRenderer<dimensions>::AxisAlignedBoxRenderer(const Shapes::Implementation::AbstractShape<dimensions>& axisAlignedBox): axisAlignedBox(static_cast<const Shapes::Implementation::Shape<Shapes::AxisAlignedBox<dimensions>>&>(axisAlignedBox).shape) {}
template<UnsignedInt dimensions> void AxisAlignedBoxRenderer<dimensions>::draw(Resource<ShapeRendererOptions>& options, const MatrixTypeFor<dimensions, Float>& projectionMatrix) {
@ -44,5 +47,6 @@ template<UnsignedInt dimensions> void AxisAlignedBoxRenderer<dimensions>::draw(R
template class AxisAlignedBoxRenderer<2>;
template class AxisAlignedBoxRenderer<3>;
CORRADE_IGNORE_DEPRECATED_POP
}}}

2
src/Magnum/DebugTools/Implementation/AxisAlignedBoxRenderer.h

@ -31,6 +31,7 @@
namespace Magnum { namespace DebugTools { namespace Implementation {
CORRADE_IGNORE_DEPRECATED_PUSH
template<UnsignedInt dimensions> class AxisAlignedBoxRenderer: public AbstractBoxRenderer<dimensions> {
public:
explicit AxisAlignedBoxRenderer(const Shapes::Implementation::AbstractShape<dimensions>& axisAlignedBox);
@ -41,6 +42,7 @@ template<UnsignedInt dimensions> class AxisAlignedBoxRenderer: public AbstractBo
private:
const Shapes::AxisAlignedBox<dimensions>& axisAlignedBox;
};
CORRADE_IGNORE_DEPRECATED_POP
}}}

4
src/Magnum/DebugTools/Implementation/BoxRenderer.cpp

@ -23,6 +23,8 @@
DEALINGS IN THE SOFTWARE.
*/
#define _MAGNUM_DO_NOT_WARN_DEPRECATED_SHAPES
#include "BoxRenderer.h"
#include "Magnum/GL/Mesh.h"
@ -32,6 +34,7 @@
namespace Magnum { namespace DebugTools { namespace Implementation {
CORRADE_IGNORE_DEPRECATED_PUSH
template<UnsignedInt dimensions> BoxRenderer<dimensions>::BoxRenderer(const Shapes::Implementation::AbstractShape<dimensions>& box): box(static_cast<const Shapes::Implementation::Shape<Shapes::Box<dimensions>>&>(box).shape) {}
template<UnsignedInt dimensions> void BoxRenderer<dimensions>::draw(Resource<ShapeRendererOptions>& options, const MatrixTypeFor<dimensions, Float>& projectionMatrix) {
@ -42,5 +45,6 @@ template<UnsignedInt dimensions> void BoxRenderer<dimensions>::draw(Resource<Sha
template class BoxRenderer<2>;
template class BoxRenderer<3>;
CORRADE_IGNORE_DEPRECATED_POP
}}}

2
src/Magnum/DebugTools/Implementation/BoxRenderer.h

@ -31,6 +31,7 @@
namespace Magnum { namespace DebugTools { namespace Implementation {
CORRADE_IGNORE_DEPRECATED_PUSH
template<UnsignedInt dimensions> class BoxRenderer: public AbstractBoxRenderer<dimensions> {
public:
explicit BoxRenderer(const Shapes::Implementation::AbstractShape<dimensions>& box);
@ -41,6 +42,7 @@ template<UnsignedInt dimensions> class BoxRenderer: public AbstractBoxRenderer<d
private:
const Shapes::Box<dimensions>& box;
};
CORRADE_IGNORE_DEPRECATED_POP
}}}

4
src/Magnum/DebugTools/Implementation/CapsuleRenderer.cpp

@ -23,6 +23,8 @@
DEALINGS IN THE SOFTWARE.
*/
#define _MAGNUM_DO_NOT_WARN_DEPRECATED_SHAPES
#include "CapsuleRenderer.h"
#include "Magnum/DebugTools/ResourceManager.h"
@ -39,6 +41,7 @@
namespace Magnum { namespace DebugTools { namespace Implementation {
CORRADE_IGNORE_DEPRECATED_PUSH
AbstractCapsuleRenderer<2>::AbstractCapsuleRenderer(): AbstractShapeRenderer<2>("capsule2d", "capsule2d-vertices", "capsule2d-indices") {
constexpr UnsignedInt rings = 10;
if(!wireframeMesh) createResources(Primitives::capsule2DWireframe(rings, 1, 1.0f));
@ -123,5 +126,6 @@ template<UnsignedInt dimensions> void CapsuleRenderer<dimensions>::draw(Resource
template class CapsuleRenderer<2>;
template class CapsuleRenderer<3>;
CORRADE_IGNORE_DEPRECATED_POP
}}}

2
src/Magnum/DebugTools/Implementation/CapsuleRenderer.h

@ -31,6 +31,7 @@
namespace Magnum { namespace DebugTools { namespace Implementation {
CORRADE_IGNORE_DEPRECATED_PUSH
template<UnsignedInt dimensions> class AbstractCapsuleRenderer;
template<> class AbstractCapsuleRenderer<2>: public AbstractShapeRenderer<2> {
@ -61,6 +62,7 @@ template<UnsignedInt dimensions> class CapsuleRenderer: public AbstractCapsuleRe
private:
const Shapes::Capsule<dimensions>& capsule;
};
CORRADE_IGNORE_DEPRECATED_POP
}}}

2
src/Magnum/DebugTools/Implementation/CapsuleRendererTransformation.h

@ -35,6 +35,7 @@
namespace Magnum { namespace DebugTools { namespace Implementation {
CORRADE_IGNORE_DEPRECATED_PUSH
template<UnsignedInt dimensions> std::array<MatrixTypeFor<dimensions, Float>, 3> capsuleRendererTransformation(const VectorTypeFor<dimensions, Float>& a, const VectorTypeFor<dimensions, Float>& b, Float radius);
template<> std::array<Matrix3, 3> capsuleRendererTransformation<2>(const Vector2& a, const Vector2& b, const Float radius) {
@ -101,6 +102,7 @@ template<> std::array<Matrix4, 3> capsuleRendererTransformation<3>(const Vector3
Matrix4::translation(b-capDistance)*rotationScaling
}};
}
CORRADE_IGNORE_DEPRECATED_POP
}}}

4
src/Magnum/DebugTools/Implementation/CylinderRenderer.cpp

@ -23,6 +23,8 @@
DEALINGS IN THE SOFTWARE.
*/
#define _MAGNUM_DO_NOT_WARN_DEPRECATED_SHAPES
#include "CylinderRenderer.h"
#include "Magnum/DebugTools/ShapeRenderer.h"
@ -38,6 +40,7 @@
namespace Magnum { namespace DebugTools { namespace Implementation {
CORRADE_IGNORE_DEPRECATED_PUSH
AbstractCylinderRenderer<2>::AbstractCylinderRenderer(): AbstractShapeRenderer<2>("cylinder2d", "cylinder2d-vertices", {}) {
if(!wireframeMesh) createResources(Primitives::squareWireframe());
}
@ -57,5 +60,6 @@ template<UnsignedInt dimensions> void CylinderRenderer<dimensions>::draw(Resourc
template class CylinderRenderer<2>;
template class CylinderRenderer<3>;
CORRADE_IGNORE_DEPRECATED_POP
}}}

2
src/Magnum/DebugTools/Implementation/CylinderRenderer.h

@ -31,6 +31,7 @@
namespace Magnum { namespace DebugTools { namespace Implementation {
CORRADE_IGNORE_DEPRECATED_PUSH
template<UnsignedInt dimensions> class AbstractCylinderRenderer;
template<> class AbstractCylinderRenderer<2>: public AbstractShapeRenderer<2> {
@ -53,6 +54,7 @@ template<UnsignedInt dimensions> class CylinderRenderer: public AbstractCylinder
private:
const Shapes::Cylinder<dimensions>& cylinder;
};
CORRADE_IGNORE_DEPRECATED_POP
}}}

2
src/Magnum/DebugTools/Implementation/CylinderRendererTransformation.h

@ -33,6 +33,7 @@
namespace Magnum { namespace DebugTools { namespace Implementation {
CORRADE_IGNORE_DEPRECATED_PUSH
template<UnsignedInt dimensions> MatrixTypeFor<dimensions, Float> cylinderRendererTransformation(const VectorTypeFor<dimensions, Float>& a, const VectorTypeFor<dimensions, Float>& b, Float radius);
template<> Matrix3 cylinderRendererTransformation<2>(const Vector2& a, const Vector2& b, const Float radius) {
@ -83,6 +84,7 @@ template<> Matrix4 cylinderRendererTransformation<3>(const Vector3& a, const Vec
/* Scaling and translation */
return Matrix4::translation(0.5f*(a + b))*rotation*Matrix4::scaling({radius, length, radius});
}
CORRADE_IGNORE_DEPRECATED_POP
}}}

4
src/Magnum/DebugTools/Implementation/LineSegmentRenderer.cpp

@ -23,6 +23,8 @@
DEALINGS IN THE SOFTWARE.
*/
#define _MAGNUM_DO_NOT_WARN_DEPRECATED_SHAPES
#include "LineSegmentRenderer.h"
#include "Magnum/DebugTools/ShapeRenderer.h"
@ -37,6 +39,7 @@
namespace Magnum { namespace DebugTools { namespace Implementation {
CORRADE_IGNORE_DEPRECATED_PUSH
namespace {
template<UnsignedInt dimensions> ResourceKey meshKey();
template<> inline ResourceKey meshKey<2>() { return ResourceKey("line2d"); }
@ -64,5 +67,6 @@ template<UnsignedInt dimensions> void LineSegmentRenderer<dimensions>::draw(Reso
template class LineSegmentRenderer<2>;
template class LineSegmentRenderer<3>;
CORRADE_IGNORE_DEPRECATED_POP
}}}

2
src/Magnum/DebugTools/Implementation/LineSegmentRenderer.h

@ -31,6 +31,7 @@
namespace Magnum { namespace DebugTools { namespace Implementation {
CORRADE_IGNORE_DEPRECATED_PUSH
template<UnsignedInt dimensions> class LineSegmentRenderer: public AbstractShapeRenderer<dimensions> {
public:
explicit LineSegmentRenderer(const Shapes::Implementation::AbstractShape<dimensions>& line);
@ -41,6 +42,7 @@ template<UnsignedInt dimensions> class LineSegmentRenderer: public AbstractShape
private:
const Shapes::LineSegment<dimensions>& line;
};
CORRADE_IGNORE_DEPRECATED_POP
}}}

2
src/Magnum/DebugTools/Implementation/LineSegmentRendererTransformation.h

@ -29,11 +29,13 @@
namespace Magnum { namespace DebugTools { namespace Implementation {
CORRADE_IGNORE_DEPRECATED_PUSH
template<UnsignedInt dimensions> MatrixTypeFor<dimensions, Float> lineSegmentRendererTransformation(const VectorTypeFor<dimensions, Float>& a, const VectorTypeFor<dimensions, Float>& b) {
auto transformation = MatrixTypeFor<dimensions, Float>::translation(a);
transformation.right() = b - a;
return transformation;
}
CORRADE_IGNORE_DEPRECATED_POP
}}}

4
src/Magnum/DebugTools/Implementation/PointRenderer.cpp

@ -23,6 +23,8 @@
DEALINGS IN THE SOFTWARE.
*/
#define _MAGNUM_DO_NOT_WARN_DEPRECATED_SHAPES
#include "PointRenderer.h"
#include "Magnum/DebugTools/ShapeRenderer.h"
@ -35,6 +37,7 @@
namespace Magnum { namespace DebugTools { namespace Implementation {
CORRADE_IGNORE_DEPRECATED_PUSH
namespace {
template<UnsignedInt dimensions> ResourceKey meshKey();
template<> inline ResourceKey meshKey<2>() { return ResourceKey("point2d"); }
@ -64,5 +67,6 @@ template<UnsignedInt dimensions> void PointRenderer<dimensions>::draw(Resource<S
template class PointRenderer<2>;
template class PointRenderer<3>;
CORRADE_IGNORE_DEPRECATED_POP
}}}

2
src/Magnum/DebugTools/Implementation/PointRenderer.h

@ -31,6 +31,7 @@
namespace Magnum { namespace DebugTools { namespace Implementation {
CORRADE_IGNORE_DEPRECATED_PUSH
template<UnsignedInt dimensions> class PointRenderer: public AbstractShapeRenderer<dimensions> {
public:
explicit PointRenderer(const Shapes::Implementation::AbstractShape<dimensions>& point);
@ -41,6 +42,7 @@ template<UnsignedInt dimensions> class PointRenderer: public AbstractShapeRender
private:
const Shapes::Point<dimensions>& point;
};
CORRADE_IGNORE_DEPRECATED_POP
}}}

4
src/Magnum/DebugTools/Implementation/SphereRenderer.cpp

@ -23,6 +23,8 @@
DEALINGS IN THE SOFTWARE.
*/
#define _MAGNUM_DO_NOT_WARN_DEPRECATED_SHAPES
#include "SphereRenderer.h"
#include "Magnum/DebugTools/ShapeRenderer.h"
@ -36,6 +38,7 @@
namespace Magnum { namespace DebugTools { namespace Implementation {
CORRADE_IGNORE_DEPRECATED_PUSH
AbstractSphereRenderer<2>::AbstractSphereRenderer(): AbstractShapeRenderer<2>("sphere2d", "sphere2d-vertices", {}) {
if(!wireframeMesh) createResources(Primitives::circle2DWireframe(40));
}
@ -56,5 +59,6 @@ template<UnsignedInt dimensions> void SphereRenderer<dimensions>::draw(Resource<
template class SphereRenderer<2>;
template class SphereRenderer<3>;
CORRADE_IGNORE_DEPRECATED_POP
}}}

2
src/Magnum/DebugTools/Implementation/SphereRenderer.h

@ -31,6 +31,7 @@
namespace Magnum { namespace DebugTools { namespace Implementation {
CORRADE_IGNORE_DEPRECATED_PUSH
template<UnsignedInt dimensions> class AbstractSphereRenderer;
template<> class AbstractSphereRenderer<2>: public AbstractShapeRenderer<2> {
@ -53,6 +54,7 @@ template<UnsignedInt dimensions> class SphereRenderer: public AbstractSphereRend
private:
const Shapes::Sphere<dimensions>& sphere;
};
CORRADE_IGNORE_DEPRECATED_POP
}}}

23
src/Magnum/DebugTools/ResourceManager.cpp

@ -23,21 +23,36 @@
DEALINGS IN THE SOFTWARE.
*/
#define _MAGNUM_DO_NOT_WARN_DEPRECATED_SHAPES
#include "ResourceManager.h"
#include "Magnum/ResourceManager.hpp"
#include "Magnum/DebugTools/ForceRenderer.h"
#include "Magnum/DebugTools/ObjectRenderer.h"
#include "Magnum/DebugTools/ShapeRenderer.h"
#include "Magnum/GL/AbstractShaderProgram.h"
#include "Magnum/GL/Buffer.h"
#include "Magnum/GL/Mesh.h"
#include "Magnum/GL/MeshView.h"
#ifdef MAGNUM_BUILD_DEPRECATED
#include "Magnum/DebugTools/ShapeRenderer.h"
#endif
namespace Magnum {
namespace Implementation {
template struct MAGNUM_DEBUGTOOLS_EXPORT ResourceManagerLocalInstanceImplementation<ResourceManagerLocalInstance, GL::AbstractShaderProgram, GL::Buffer, GL::Mesh, GL::MeshView, DebugTools::ForceRendererOptions, DebugTools::ObjectRendererOptions, DebugTools::ShapeRendererOptions>;
#ifdef MAGNUM_BUILD_DEPRECATED
CORRADE_IGNORE_DEPRECATED_PUSH
#endif
template struct MAGNUM_DEBUGTOOLS_EXPORT ResourceManagerLocalInstanceImplementation<ResourceManagerLocalInstance, GL::AbstractShaderProgram, GL::Buffer, GL::Mesh, GL::MeshView, DebugTools::ForceRendererOptions, DebugTools::ObjectRendererOptions
#ifdef MAGNUM_BUILD_DEPRECATED
, DebugTools::ShapeRendererOptions
#endif
>;
#ifdef MAGNUM_BUILD_DEPRECATED
CORRADE_IGNORE_DEPRECATED_POP
#endif
}
namespace DebugTools {
@ -45,7 +60,11 @@ namespace DebugTools {
ResourceManager::ResourceManager() {
setFallback(new ForceRendererOptions);
setFallback(new ObjectRendererOptions);
#ifdef MAGNUM_BUILD_DEPRECATED
CORRADE_IGNORE_DEPRECATED_PUSH
setFallback(new ShapeRendererOptions);
CORRADE_IGNORE_DEPRECATED_POP
#endif
}
ResourceManager::~ResourceManager() = default;

27
src/Magnum/DebugTools/ResourceManager.h

@ -38,17 +38,27 @@
#include "Magnum/DebugTools/visibility.h"
#include "Magnum/GL/GL.h"
#include "Magnum/SceneGraph/SceneGraph.h"
#include "Magnum/Shapes/Shapes.h"
/** @todo fix this better */
#ifdef CORRADE_MSVC2017_COMPATIBILITY
#include "Magnum/DebugTools/ForceRenderer.h"
#include "Magnum/DebugTools/ObjectRenderer.h"
#include "Magnum/DebugTools/ShapeRenderer.h"
#include "Magnum/GL/AbstractShaderProgram.h"
#include "Magnum/GL/Buffer.h"
#include "Magnum/GL/Mesh.h"
#include "Magnum/GL/MeshView.h"
#ifdef MAGNUM_BUILD_DEPRECATED
#if !defined(Magnum_DebugTools_ShapeRenderer_h) && !defined(_MAGNUM_DO_NOT_WARN_DEPRECATED_SHAPES)
#define Magnum_DebugTools_ShapeRenderer_h_not_included
#define _MAGNUM_DO_NOT_WARN_DEPRECATED_SHAPES
#endif
#include "Magnum/DebugTools/ShapeRenderer.h"
#ifdef Magnum_DebugTools_ShapeRenderer_h_not_included
#undef Magnum_DebugTools_ShapeRenderer_h_not_included
#undef _MAGNUM_DO_NOT_WARN_DEPRECATED_SHAPES
#endif
#endif
#endif
#ifdef MAGNUM_TARGET_GL
@ -64,11 +74,22 @@ information.
@ref MAGNUM_TARGET_GL enabled (done by default). See @ref building-features
for more information.
*/
class MAGNUM_DEBUGTOOLS_EXPORT ResourceManager: public Magnum::ResourceManager<Magnum::Implementation::ResourceManagerLocalInstance, GL::AbstractShaderProgram, GL::Buffer, GL::Mesh, GL::MeshView, DebugTools::ForceRendererOptions, DebugTools::ObjectRendererOptions, DebugTools::ShapeRendererOptions> {
#ifdef MAGNUM_BUILD_DEPRECATED
CORRADE_IGNORE_DEPRECATED_PUSH
#endif
class MAGNUM_DEBUGTOOLS_EXPORT ResourceManager: public Magnum::ResourceManager<Magnum::Implementation::ResourceManagerLocalInstance, GL::AbstractShaderProgram, GL::Buffer, GL::Mesh, GL::MeshView, DebugTools::ForceRendererOptions, DebugTools::ObjectRendererOptions
#ifdef MAGNUM_BUILD_DEPRECATED
, DebugTools::ShapeRendererOptions
#endif
>
{
public:
explicit ResourceManager();
~ResourceManager();
};
#ifdef MAGNUM_BUILD_DEPRECATED
CORRADE_IGNORE_DEPRECATED_POP
#endif
#else
#error this header is available only in the OpenGL build
#endif

4
src/Magnum/DebugTools/ShapeRenderer.cpp

@ -23,6 +23,8 @@
DEALINGS IN THE SOFTWARE.
*/
#define _MAGNUM_DO_NOT_WARN_DEPRECATED_SHAPES
#include "ShapeRenderer.h"
#include "Magnum/DebugTools/ResourceManager.h"
@ -40,6 +42,7 @@
namespace Magnum { namespace DebugTools {
CORRADE_IGNORE_DEPRECATED_PUSH
namespace Implementation {
template<> void createDebugMesh(ShapeRenderer<2>& renderer, const Shapes::Implementation::AbstractShape<2>& shape) {
@ -129,5 +132,6 @@ template<UnsignedInt dimensions> void ShapeRenderer<dimensions>::draw(const Matr
template class ShapeRenderer<2>;
template class ShapeRenderer<3>;
CORRADE_IGNORE_DEPRECATED_POP
}}

72
src/Magnum/DebugTools/ShapeRenderer.h

@ -27,8 +27,16 @@
#ifdef MAGNUM_TARGET_GL
/** @file
* @brief Class @ref Magnum::DebugTools::ShapeRenderer, @ref Magnum::DebugTools::ShapeRendererOptions, typedef @ref Magnum::DebugTools::ShapeRenderer2D, @ref Magnum::DebugTools::ShapeRenderer3D
*/
@brief Class @ref Magnum::DebugTools::ShapeRenderer, @ref Magnum::DebugTools::ShapeRendererOptions, typedef @ref Magnum::DebugTools::ShapeRenderer2D, @ref Magnum::DebugTools::ShapeRenderer3D
@deprecated The @ref Magnum::Shapes library is a failed design experiment and
is scheduled for removal in a future release. Related geometry algorithms
were moved to @ref Magnum::Math::Distance and @ref Magnum::Math::Intersection;
if you need a full-fledged physics library, please have look at
[Bullet](https://bulletphysics.org), which has Magnum integration in
@ref Magnum::BulletIntegration, or at [Box2D](https://box2d.org/), which
has a @ref examples-box2d "Magnum example" as well.
*/
#endif
#include "Magnum/Resource.h"
@ -36,11 +44,22 @@
#include "Magnum/SceneGraph/Drawable.h"
#include "Magnum/Shapes/Shapes.h"
#include "Magnum/Shapes/shapeImplementation.h"
#include "Magnum/DebugTools/DebugTools.h"
#include "Magnum/DebugTools/visibility.h"
#ifndef MAGNUM_BUILD_DEPRECATED
#error the Shapes library is scheduled for removal, see the docs for alternatives
#endif
/* I still have a test for this class and it shouldn't pollute the log there */
#ifndef _MAGNUM_DO_NOT_WARN_DEPRECATED_SHAPES
CORRADE_DEPRECATED_FILE("the Shapes library is scheduled for removal, see the docs for alternatives")
#endif
#ifdef MAGNUM_TARGET_GL
namespace Magnum { namespace DebugTools {
CORRADE_IGNORE_DEPRECATED_PUSH
template<UnsignedInt> class ShapeRenderer;
namespace Implementation {
@ -52,13 +71,21 @@ namespace Implementation {
/**
@brief Shape renderer options
@deprecated The @ref Shapes library is a failed design experiment and is
scheduled for removal in a future release. Related geometry algorithms were
moved to @ref Math::Distance and @ref Math::Intersection; if you need a
full-fledged physics library, please have look at [Bullet](https://bulletphysics.org),
which has Magnum integration in @ref BulletIntegration, or at
[Box2D](https://box2d.org/), which has a @ref examples-box2d "Magnum example"
as well.
See @ref ShapeRenderer documentation for more information.
@note This class is available only if Magnum is compiled with
@ref MAGNUM_TARGET_GL enabled (done by default). See @ref building-features
for more information.
*/
class ShapeRendererOptions {
class CORRADE_DEPRECATED("scheduled for removal, see the docs for alternatives") ShapeRendererOptions {
public:
/**
* @brief Shape rendering mode
@ -124,6 +151,14 @@ class ShapeRendererOptions {
/**
@brief Shape renderer
@deprecated The @ref Shapes library is a failed design experiment and is
scheduled for removal in a future release. Related geometry algorithms were
moved to @ref Math::Distance and @ref Math::Intersection; if you need a
full-fledged physics library, please have look at [Bullet](https://bulletphysics.org),
which has Magnum integration in @ref BulletIntegration, or at
[Box2D](https://box2d.org/), which has a @ref examples-box2d "Magnum example"
as well.
Visualizes collision shapes using wireframe primitives. See
@ref debug-tools-renderers for more information.
@ -149,7 +184,7 @@ new DebugTools::ShapeRenderer2D(shape, "red", debugDrawables);
@todo Different drawing style for inverted shapes? (marking the "inside" somehow)
*/
template<UnsignedInt dimensions> class MAGNUM_DEBUGTOOLS_EXPORT ShapeRenderer: public SceneGraph::Drawable<dimensions, Float> {
template<UnsignedInt dimensions> class CORRADE_DEPRECATED("scheduled for removal, see the docs for alternatives") MAGNUM_DEBUGTOOLS_EXPORT ShapeRenderer: public SceneGraph::Drawable<dimensions, Float> {
#ifndef DOXYGEN_GENERATING_OUTPUT
friend void Implementation::createDebugMesh<>(ShapeRenderer<dimensions>&, const Shapes::Implementation::AbstractShape<dimensions>&);
#endif
@ -178,11 +213,32 @@ template<UnsignedInt dimensions> class MAGNUM_DEBUGTOOLS_EXPORT ShapeRenderer: p
std::vector<Implementation::AbstractShapeRenderer<dimensions>*> _renderers;
};
/** @brief Two-dimensional shape renderer */
typedef ShapeRenderer<2> ShapeRenderer2D;
/**
@brief Two-dimensional shape renderer
@deprecated The @ref Shapes library is a failed design experiment and is
scheduled for removal in a future release. Related geometry algorithms were
moved to @ref Math::Distance and @ref Math::Intersection; if you need a
full-fledged physics library, please have look at [Bullet](https://bulletphysics.org),
which has Magnum integration in @ref BulletIntegration, or at
[Box2D](https://box2d.org/), which has a @ref examples-box2d "Magnum example"
as well.
*/
typedef CORRADE_DEPRECATED("scheduled for removal, see the docs for alternatives") ShapeRenderer<2> ShapeRenderer2D;
/** @brief Three-dimensional shape renderer */
typedef ShapeRenderer<3> ShapeRenderer3D;
/**
@brief Three-dimensional shape renderer
@deprecated The @ref Shapes library is a failed design experiment and is
scheduled for removal in a future release. Related geometry algorithms were
moved to @ref Math::Distance and @ref Math::Intersection; if you need a
full-fledged physics library, please have look at [Bullet](https://bulletphysics.org),
which has Magnum integration in @ref BulletIntegration, or at
[Box2D](https://box2d.org/), which has a @ref examples-box2d "Magnum example"
as well.
*/
typedef CORRADE_DEPRECATED("scheduled for removal, see the docs for alternatives") ShapeRenderer<3> ShapeRenderer3D;
CORRADE_IGNORE_DEPRECATED_POP
}}
#else

2
src/Magnum/DebugTools/Test/CapsuleRendererTest.cpp

@ -51,6 +51,7 @@ CapsuleRendererTest::CapsuleRendererTest() {
&CapsuleRendererTest::common3D});
}
CORRADE_IGNORE_DEPRECATED_PUSH
void CapsuleRendererTest::zeroLength2D() {
const Vector2 a(0.5f, 3.0f);
std::array<Matrix3, 3> transformation = Implementation::capsuleRendererTransformation<2>(a, a, 3.5f);
@ -171,6 +172,7 @@ void CapsuleRendererTest::common3D() {
CORRADE_COMPARE(transformation[1].translation(), 0.5f*(a + b));
CORRADE_COMPARE(transformation[2].translation(), b-capDistance);
}
CORRADE_IGNORE_DEPRECATED_POP
}}}

2
src/Magnum/DebugTools/Test/CylinderRendererTest.cpp

@ -51,6 +51,7 @@ CylinderRendererTest::CylinderRendererTest() {
&CylinderRendererTest::common3D});
}
CORRADE_IGNORE_DEPRECATED_PUSH
void CylinderRendererTest::zeroLength2D() {
const Vector2 a(0.5f, 3.0f);
const Matrix3 transformation = Implementation::cylinderRendererTransformation<2>(a, a, 3.5f);
@ -119,6 +120,7 @@ void CylinderRendererTest::common3D() {
CORRADE_COMPARE(transformation.translation(), 0.5f*(a + b));
}
CORRADE_IGNORE_DEPRECATED_POP
}}}

2
src/Magnum/DebugTools/Test/LineSegmentRendererTest.cpp

@ -45,6 +45,7 @@ LineSegmentRendererTest::LineSegmentRendererTest() {
&LineSegmentRendererTest::line3D});
}
CORRADE_IGNORE_DEPRECATED_PUSH
void LineSegmentRendererTest::line2D() {
const Vector2 a(-2.0f, 3.0f);
const Vector2 b(3.4f, -1.5f);
@ -62,6 +63,7 @@ void LineSegmentRendererTest::line3D() {
CORRADE_COMPARE(matrix.transformPoint({0.0f, 0.0f, 0.0f}), a);
CORRADE_COMPARE(matrix.transformPoint({1.0f, 0.0f, 0.0f}), b);
}
CORRADE_IGNORE_DEPRECATED_POP
}}}

4
src/Magnum/Shapes/AbstractShape.cpp

@ -23,6 +23,8 @@
DEALINGS IN THE SOFTWARE.
*/
#define _MAGNUM_DO_NOT_WARN_DEPRECATED_SHAPES
#include "AbstractShape.h"
#include <Corrade/Utility/Debug.h>
@ -33,6 +35,7 @@
namespace Magnum { namespace Shapes {
CORRADE_IGNORE_DEPRECATED_PUSH
template<UnsignedInt dimensions> AbstractShape<dimensions>::AbstractShape(SceneGraph::AbstractObject<dimensions, Float>& object, ShapeGroup<dimensions>* group): SceneGraph::AbstractGroupedFeature<dimensions, AbstractShape<dimensions>, Float>(object, group) {
SceneGraph::AbstractFeature<dimensions, Float>::setCachedTransformations(SceneGraph::CachedTransformation::Absolute);
}
@ -65,5 +68,6 @@ template<UnsignedInt dimensions> void AbstractShape<dimensions>::markDirty() {
template class MAGNUM_SHAPES_EXPORT AbstractShape<2>;
template class MAGNUM_SHAPES_EXPORT AbstractShape<3>;
#endif
CORRADE_IGNORE_DEPRECATED_POP
}}

55
src/Magnum/Shapes/AbstractShape.h

@ -26,17 +26,29 @@
*/
/** @file
* @brief Class @ref Magnum::Shapes::AbstractShape, typedef @ref Magnum::Shapes::AbstractShape2D, @ref Magnum::Shapes::AbstractShape3D
*/
@brief Class @ref Magnum::Shapes::AbstractShape, typedef @ref Magnum::Shapes::AbstractShape2D, @ref Magnum::Shapes::AbstractShape3D
@deprecated The @ref Magnum::Shapes library is a failed design experiment and
is scheduled for removal in a future release. Related geometry algorithms
were moved to @ref Magnum::Math::Distance and @ref Magnum::Math::Intersection;
if you need a full-fledged physics library, please have look at
[Bullet](https://bulletphysics.org), which has Magnum integration in
@ref Magnum::BulletIntegration, or at [Box2D](https://box2d.org/), which
has a @ref examples-box2d "Magnum example" as well.
*/
#include "Magnum/Magnum.h"
#include "Magnum/DimensionTraits.h"
#include "Magnum/SceneGraph/AbstractGroupedFeature.h"
#include "Magnum/Shapes/shapeImplementation.h"
#include "Magnum/Shapes/Shapes.h"
#include "Magnum/Shapes/visibility.h"
/* File-level deprecation warning issued from Shapes.h */
namespace Magnum { namespace Shapes {
CORRADE_IGNORE_DEPRECATED_PUSH
namespace Implementation {
template<UnsignedInt dimensions> inline const AbstractShape<dimensions>& getAbstractShape(const Shapes::AbstractShape<dimensions>& shape) {
return shape.abstractTransformedShape();
@ -46,11 +58,19 @@ namespace Implementation {
/**
@brief Base class for object shapes
@deprecated The @ref Shapes library is a failed design experiment and is
scheduled for removal in a future release. Related geometry algorithms were
moved to @ref Math::Distance and @ref Math::Intersection; if you need a
full-fledged physics library, please have look at [Bullet](https://bulletphysics.org),
which has Magnum integration in @ref BulletIntegration, or at
[Box2D](https://box2d.org/), which has a @ref examples-box2d "Magnum example"
as well.
This class is not directly instantiable, use @ref Shape instead. See
@ref shapes for brief introduction.
@see @ref AbstractShape2D, @ref AbstractShape3D
*/
template<UnsignedInt dimensions> class MAGNUM_SHAPES_EXPORT AbstractShape: public SceneGraph::AbstractGroupedFeature<dimensions, AbstractShape<dimensions>, Float> {
template<UnsignedInt dimensions> class CORRADE_DEPRECATED("scheduled for removal, see the docs for alternatives") MAGNUM_SHAPES_EXPORT AbstractShape: public SceneGraph::AbstractGroupedFeature<dimensions, AbstractShape<dimensions>, Float> {
#ifndef CORRADE_MSVC2017_COMPATIBILITY
friend const Implementation::AbstractShape<dimensions>& Implementation::getAbstractShape<>(const AbstractShape<dimensions>&);
#else
@ -120,11 +140,32 @@ template<UnsignedInt dimensions> class MAGNUM_SHAPES_EXPORT AbstractShape: publi
virtual const Implementation::AbstractShape<dimensions> MAGNUM_SHAPES_LOCAL & abstractTransformedShape() const = 0;
};
/** @brief Base class for two-dimensional object shapes */
typedef AbstractShape<2> AbstractShape2D;
/**
@brief Base class for two-dimensional object shapes
@deprecated The @ref Shapes library is a failed design experiment and is
scheduled for removal in a future release. Related geometry algorithms were
moved to @ref Math::Distance and @ref Math::Intersection; if you need a
full-fledged physics library, please have look at [Bullet](https://bulletphysics.org),
which has Magnum integration in @ref BulletIntegration, or at
[Box2D](https://box2d.org/), which has a @ref examples-box2d "Magnum example"
as well.
*/
typedef CORRADE_DEPRECATED("scheduled for removal, see the docs for alternatives") AbstractShape<2> AbstractShape2D;
/** @brief Base class for three-dimensional object shapes */
typedef AbstractShape<3> AbstractShape3D;
/**
@brief Base class for three-dimensional object shapes
@deprecated The @ref Shapes library is a failed design experiment and is
scheduled for removal in a future release. Related geometry algorithms were
moved to @ref Math::Distance and @ref Math::Intersection; if you need a
full-fledged physics library, please have look at [Bullet](https://bulletphysics.org),
which has Magnum integration in @ref BulletIntegration, or at
[Box2D](https://box2d.org/), which has a @ref examples-box2d "Magnum example"
as well.
*/
typedef CORRADE_DEPRECATED("scheduled for removal, see the docs for alternatives") AbstractShape<3> AbstractShape3D;
CORRADE_IGNORE_DEPRECATED_POP
}}

4
src/Magnum/Shapes/AxisAlignedBox.cpp

@ -23,6 +23,8 @@
DEALINGS IN THE SOFTWARE.
*/
#define _MAGNUM_DO_NOT_WARN_DEPRECATED_SHAPES
#include "AxisAlignedBox.h"
#include "Magnum/Math/Matrix3.h"
@ -31,6 +33,7 @@
namespace Magnum { namespace Shapes {
CORRADE_IGNORE_DEPRECATED_PUSH
template<UnsignedInt dimensions> AxisAlignedBox<dimensions> AxisAlignedBox<dimensions>::transformed(const MatrixTypeFor<dimensions, Float>& matrix) const {
return AxisAlignedBox<dimensions>(matrix.transformPoint(_min),
matrix.transformPoint(_max));
@ -45,5 +48,6 @@ template<UnsignedInt dimensions> bool AxisAlignedBox<dimensions>::operator%(cons
template class MAGNUM_SHAPES_EXPORT AxisAlignedBox<2>;
template class MAGNUM_SHAPES_EXPORT AxisAlignedBox<3>;
#endif
CORRADE_IGNORE_DEPRECATED_POP
}}

68
src/Magnum/Shapes/AxisAlignedBox.h

@ -26,24 +26,43 @@
*/
/** @file
* @brief Class @ref Magnum::Shapes::AxisAlignedBox, typedef @ref Magnum::Shapes::AxisAlignedBox2D, @ref Magnum::Shapes.:AxisAlignedBox3D
*/
@brief Class @ref Magnum::Shapes::AxisAlignedBox, typedef @ref Magnum::Shapes::AxisAlignedBox2D, @ref Magnum::Shapes.:AxisAlignedBox3D
@deprecated The @ref Magnum::Shapes library is a failed design experiment and
is scheduled for removal in a future release. Related geometry algorithms
were moved to @ref Magnum::Math::Distance and @ref Magnum::Math::Intersection;
if you need a full-fledged physics library, please have look at
[Bullet](https://bulletphysics.org), which has Magnum integration in
@ref Magnum::BulletIntegration, or at [Box2D](https://box2d.org/), which
has a @ref examples-box2d "Magnum example" as well.
*/
#include "Magnum/DimensionTraits.h"
#include "Magnum/Math/Vector3.h"
#include "Magnum/Shapes/Shapes.h"
#include "Magnum/Shapes/visibility.h"
/* File-level deprecation warning issued from Shapes.h */
namespace Magnum { namespace Shapes {
CORRADE_IGNORE_DEPRECATED_PUSH
/**
@brief Axis-aligned box
@deprecated The @ref Shapes library is a failed design experiment and is
scheduled for removal in a future release. Related geometry algorithms were
moved to @ref Math::Distance and @ref Math::Intersection; if you need a
full-fledged physics library, please have look at [Bullet](https://bulletphysics.org),
which has Magnum integration in @ref BulletIntegration, or at
[Box2D](https://box2d.org/), which has a @ref examples-box2d "Magnum example"
as well.
See @ref shapes for brief introduction.
@see @ref AxisAlignedBox2D, @ref AxisAlignedBox3D
@todo Assert for rotation
*/
template<UnsignedInt dimensions> class MAGNUM_SHAPES_EXPORT AxisAlignedBox {
template<UnsignedInt dimensions> class CORRADE_DEPRECATED("scheduled for removal, see the docs for alternatives") MAGNUM_SHAPES_EXPORT AxisAlignedBox {
public:
enum: UnsignedInt {
Dimensions = dimensions /**< Dimension count */
@ -89,14 +108,45 @@ template<UnsignedInt dimensions> class MAGNUM_SHAPES_EXPORT AxisAlignedBox {
VectorTypeFor<dimensions, Float> _min, _max;
};
/** @brief Two-dimensional axis-aligned box */
typedef AxisAlignedBox<2> AxisAlignedBox2D;
/**
@brief Two-dimensional axis-aligned box
@deprecated The @ref Shapes library is a failed design experiment and is
scheduled for removal in a future release. Related geometry algorithms were
moved to @ref Math::Distance and @ref Math::Intersection; if you need a
full-fledged physics library, please have look at [Bullet](https://bulletphysics.org),
which has Magnum integration in @ref BulletIntegration, or at
[Box2D](https://box2d.org/), which has a @ref examples-box2d "Magnum example"
as well.
*/
typedef CORRADE_DEPRECATED("scheduled for removal, see the docs for alternatives") AxisAlignedBox<2> AxisAlignedBox2D;
/** @brief Three-dimensional axis-aligned box */
typedef AxisAlignedBox<3> AxisAlignedBox3D;
/**
@brief Three-dimensional axis-aligned box
@deprecated The @ref Shapes library is a failed design experiment and is
scheduled for removal in a future release. Related geometry algorithms were
moved to @ref Math::Distance and @ref Math::Intersection; if you need a
full-fledged physics library, please have look at [Bullet](https://bulletphysics.org),
which has Magnum integration in @ref BulletIntegration, or at
[Box2D](https://box2d.org/), which has a @ref examples-box2d "Magnum example"
as well.
*/
typedef CORRADE_DEPRECATED("scheduled for removal, see the docs for alternatives") AxisAlignedBox<3> AxisAlignedBox3D;
/** @collisionoccurenceoperator{Point,AxisAlignedBox} */
template<UnsignedInt dimensions> inline bool operator%(const Point<dimensions>& a, const AxisAlignedBox<dimensions>& b) { return b % a; }
/**
@collisionoccurenceoperator{Point,AxisAlignedBox}
@deprecated The @ref Shapes library is a failed design experiment and is
scheduled for removal in a future release. Related geometry algorithms were
moved to @ref Math::Distance and @ref Math::Intersection; if you need a
full-fledged physics library, please have look at [Bullet](https://bulletphysics.org),
which has Magnum integration in @ref BulletIntegration, or at
[Box2D](https://box2d.org/), which has a @ref examples-box2d "Magnum example"
as well.
*/
template<UnsignedInt dimensions> inline CORRADE_DEPRECATED("scheduled for removal, see the docs for alternatives") bool operator%(const Point<dimensions>& a, const AxisAlignedBox<dimensions>& b) { return b % a; }
CORRADE_IGNORE_DEPRECATED_POP
}}

4
src/Magnum/Shapes/Box.cpp

@ -23,10 +23,13 @@
DEALINGS IN THE SOFTWARE.
*/
#define _MAGNUM_DO_NOT_WARN_DEPRECATED_SHAPES
#include "Box.h"
namespace Magnum { namespace Shapes {
CORRADE_IGNORE_DEPRECATED_PUSH
template<UnsignedInt dimensions> Box<dimensions> Box<dimensions>::transformed(const MatrixTypeFor<dimensions, Float>& matrix) const {
return Box<dimensions>(matrix*_transformation);
}
@ -35,5 +38,6 @@ template<UnsignedInt dimensions> Box<dimensions> Box<dimensions>::transformed(co
template class MAGNUM_SHAPES_EXPORT Box<2>;
template class MAGNUM_SHAPES_EXPORT Box<3>;
#endif
CORRADE_IGNORE_DEPRECATED_POP
}}

55
src/Magnum/Shapes/Box.h

@ -26,26 +26,46 @@
*/
/** @file
* @brief Class @ref Magnum::Shapes::Box, typedef @ref Magnum::Shapes::Box2D, @ref Magnum::Shapes::Box3D
*/
@brief Class @ref Magnum::Shapes::Box, typedef @ref Magnum::Shapes::Box2D, @ref Magnum::Shapes::Box3D
@deprecated The @ref Magnum::Shapes library is a failed design experiment and
is scheduled for removal in a future release. Related geometry algorithms
were moved to @ref Magnum::Math::Distance and @ref Magnum::Math::Intersection;
if you need a full-fledged physics library, please have look at
[Bullet](https://bulletphysics.org), which has Magnum integration in
@ref Magnum::BulletIntegration, or at [Box2D](https://box2d.org/), which
has a @ref examples-box2d "Magnum example" as well.
*/
#include "Magnum/DimensionTraits.h"
#include "Magnum/Math/Matrix3.h"
#include "Magnum/Math/Matrix4.h"
#include "Magnum/Shapes/Shapes.h"
#include "Magnum/Shapes/visibility.h"
/* File-level deprecation warning issued from Shapes.h */
namespace Magnum { namespace Shapes {
CORRADE_IGNORE_DEPRECATED_PUSH
/**
@brief Unit-size box with assigned transformation matrix
@deprecated The @ref Shapes library is a failed design experiment and is
scheduled for removal in a future release. Related geometry algorithms were
moved to @ref Math::Distance and @ref Math::Intersection; if you need a
full-fledged physics library, please have look at [Bullet](https://bulletphysics.org),
which has Magnum integration in @ref BulletIntegration, or at
[Box2D](https://box2d.org/), which has a @ref examples-box2d "Magnum example"
as well.
Unit-size means that half extents are equal to 1, equivalent to e.g. sphere
radius. See @ref shapes for brief introduction.
@see @ref Box2D, @ref Box3D
@todo Use quat + position + size instead?
@todo Assert for skew
*/
template<UnsignedInt dimensions> class MAGNUM_SHAPES_EXPORT Box {
template<UnsignedInt dimensions> class CORRADE_DEPRECATED("scheduled for removal, see the docs for alternatives") MAGNUM_SHAPES_EXPORT Box {
public:
enum: UnsignedInt {
Dimensions = dimensions /**< Dimension count */
@ -78,11 +98,32 @@ template<UnsignedInt dimensions> class MAGNUM_SHAPES_EXPORT Box {
MatrixTypeFor<dimensions, Float> _transformation;
};
/** @brief Two-dimensional box */
typedef Box<2> Box2D;
/**
@brief Two-dimensional box
@deprecated The @ref Shapes library is a failed design experiment and is
scheduled for removal in a future release. Related geometry algorithms were
moved to @ref Math::Distance and @ref Math::Intersection; if you need a
full-fledged physics library, please have look at [Bullet](https://bulletphysics.org),
which has Magnum integration in @ref BulletIntegration, or at
[Box2D](https://box2d.org/), which has a @ref examples-box2d "Magnum example"
as well.
*/
typedef CORRADE_DEPRECATED("scheduled for removal, see the docs for alternatives") Box<2> Box2D;
/** @brief Three-dimensional box */
typedef Box<3> Box3D;
/**
@brief Three-dimensional box
@deprecated The @ref Shapes library is a failed design experiment and is
scheduled for removal in a future release. Related geometry algorithms were
moved to @ref Math::Distance and @ref Math::Intersection; if you need a
full-fledged physics library, please have look at [Bullet](https://bulletphysics.org),
which has Magnum integration in @ref BulletIntegration, or at
[Box2D](https://box2d.org/), which has a @ref examples-box2d "Magnum example"
as well.
*/
typedef CORRADE_DEPRECATED("scheduled for removal, see the docs for alternatives") Box<3> Box3D;
CORRADE_IGNORE_DEPRECATED_POP
}}

4
src/Magnum/Shapes/CMakeLists.txt

@ -23,6 +23,10 @@
# DEALINGS IN THE SOFTWARE.
#
if(NOT MAGNUM_BUILD_DEPRECATED)
message(FATAL_ERROR "Shapes are scheduled for removal and not available if BUILD_DEPRECATED is disabled. See the docs for alternatives.")
endif()
set(MagnumShapes_SRCS
AbstractShape.cpp
AxisAlignedBox.cpp

4
src/Magnum/Shapes/Capsule.cpp

@ -23,6 +23,8 @@
DEALINGS IN THE SOFTWARE.
*/
#define _MAGNUM_DO_NOT_WARN_DEPRECATED_SHAPES
#include "Capsule.h"
#include "Magnum/Magnum.h"
@ -35,6 +37,7 @@
namespace Magnum { namespace Shapes {
CORRADE_IGNORE_DEPRECATED_PUSH
template<UnsignedInt dimensions> Capsule<dimensions> Capsule<dimensions>::transformed(const MatrixTypeFor<dimensions, Float>& matrix) const {
return Capsule<dimensions>(matrix.transformPoint(_a), matrix.transformPoint(_b), matrix.uniformScaling()*_radius);
}
@ -53,5 +56,6 @@ template<UnsignedInt dimensions> bool Capsule<dimensions>::operator%(const Spher
template class MAGNUM_SHAPES_EXPORT Capsule<2>;
template class MAGNUM_SHAPES_EXPORT Capsule<3>;
#endif
CORRADE_IGNORE_DEPRECATED_POP
}}

82
src/Magnum/Shapes/Capsule.h

@ -26,26 +26,45 @@
*/
/** @file
* @brief Class @ref Magnum::Shapes::Capsule, typedef @ref Magnum::Shapes::Capsule2D, @ref Magnum::Shapes::Capsule3D
*/
@brief Class @ref Magnum::Shapes::Capsule, typedef @ref Magnum::Shapes::Capsule2D, @ref Magnum::Shapes::Capsule3D
@deprecated The @ref Magnum::Shapes library is a failed design experiment and
is scheduled for removal in a future release. Related geometry algorithms
were moved to @ref Magnum::Math::Distance and @ref Magnum::Math::Intersection;
if you need a full-fledged physics library, please have look at
[Bullet](https://bulletphysics.org), which has Magnum integration in
@ref Magnum::BulletIntegration, or at [Box2D](https://box2d.org/), which
has a @ref examples-box2d "Magnum example" as well.
*/
#include "Magnum/DimensionTraits.h"
#include "Magnum/Math/Vector3.h"
#include "Magnum/Shapes/Shapes.h"
#include "Magnum/Shapes/visibility.h"
/* File-level deprecation warning issued from Shapes.h */
namespace Magnum { namespace Shapes {
CORRADE_IGNORE_DEPRECATED_PUSH
/**
@brief Capsule defined by cylinder start and end point and radius
@deprecated The @ref Shapes library is a failed design experiment and is
scheduled for removal in a future release. Related geometry algorithms were
moved to @ref Math::Distance and @ref Math::Intersection; if you need a
full-fledged physics library, please have look at [Bullet](https://bulletphysics.org),
which has Magnum integration in @ref BulletIntegration, or at
[Box2D](https://box2d.org/), which has a @ref examples-box2d "Magnum example"
as well.
Unlike other elements the capsule expects uniform scaling. See @ref shapes for
brief introduction.
@see @ref Capsule2D, @ref Capsule3D, @ref Cylinder
@todo Store the radius as squared value to avoid sqrt/pow? Will complicate
collision detection with sphere.
*/
template<UnsignedInt dimensions> class MAGNUM_SHAPES_EXPORT Capsule {
template<UnsignedInt dimensions> class CORRADE_DEPRECATED("scheduled for removal, see the docs for alternatives") MAGNUM_SHAPES_EXPORT Capsule {
public:
enum: UnsignedInt {
Dimensions = dimensions /**< Dimension count */
@ -101,17 +120,58 @@ template<UnsignedInt dimensions> class MAGNUM_SHAPES_EXPORT Capsule {
Float _radius;
};
/** @brief Two-dimensional capsule */
typedef Capsule<2> Capsule2D;
/**
@brief Two-dimensional capsule
@deprecated The @ref Shapes library is a failed design experiment and is
scheduled for removal in a future release. Related geometry algorithms were
moved to @ref Math::Distance and @ref Math::Intersection; if you need a
full-fledged physics library, please have look at [Bullet](https://bulletphysics.org),
which has Magnum integration in @ref BulletIntegration, or at
[Box2D](https://box2d.org/), which has a @ref examples-box2d "Magnum example"
as well.
*/
typedef CORRADE_DEPRECATED("scheduled for removal, see the docs for alternatives") Capsule<2> Capsule2D;
/** @brief Three-dimensional capsule */
typedef Capsule<3> Capsule3D;
/**
@brief Three-dimensional capsule
@deprecated The @ref Shapes library is a failed design experiment and is
scheduled for removal in a future release. Related geometry algorithms were
moved to @ref Math::Distance and @ref Math::Intersection; if you need a
full-fledged physics library, please have look at [Bullet](https://bulletphysics.org),
which has Magnum integration in @ref BulletIntegration, or at
[Box2D](https://box2d.org/), which has a @ref examples-box2d "Magnum example"
as well.
*/
typedef CORRADE_DEPRECATED("scheduled for removal, see the docs for alternatives") Capsule<3> Capsule3D;
/** @collisionoccurenceoperator{Point,Capsule} */
template<UnsignedInt dimensions> inline bool operator%(const Point<dimensions>& a, const Capsule<dimensions>& b) { return b % a; }
/**
@collisionoccurenceoperator{Point,Capsule}
@deprecated The @ref Shapes library is a failed design experiment and is
scheduled for removal in a future release. Related geometry algorithms were
moved to @ref Math::Distance and @ref Math::Intersection; if you need a
full-fledged physics library, please have look at [Bullet](https://bulletphysics.org),
which has Magnum integration in @ref BulletIntegration, or at
[Box2D](https://box2d.org/), which has a @ref examples-box2d "Magnum example"
as well.
*/
template<UnsignedInt dimensions> inline CORRADE_DEPRECATED("scheduled for removal, see the docs for alternatives") bool operator%(const Point<dimensions>& a, const Capsule<dimensions>& b) { return b % a; }
/** @collisionoccurenceoperator{Sphere,Capsule} */
template<UnsignedInt dimensions> inline bool operator%(const Sphere<dimensions>& a, const Capsule<dimensions>& b) { return b % a; }
/**
@collisionoccurenceoperator{Sphere,Capsule}
@deprecated The @ref Shapes library is a failed design experiment and is
scheduled for removal in a future release. Related geometry algorithms were
moved to @ref Math::Distance and @ref Math::Intersection; if you need a
full-fledged physics library, please have look at [Bullet](https://bulletphysics.org),
which has Magnum integration in @ref BulletIntegration, or at
[Box2D](https://box2d.org/), which has a @ref examples-box2d "Magnum example"
as well.
*/
template<UnsignedInt dimensions> inline CORRADE_DEPRECATED("scheduled for removal, see the docs for alternatives") bool operator%(const Sphere<dimensions>& a, const Capsule<dimensions>& b) { return b % a; }
CORRADE_IGNORE_DEPRECATED_POP
}}

55
src/Magnum/Shapes/Collision.h

@ -26,18 +26,38 @@
*/
/** @file
* @brief Class @ref Magnum::Shapes::Collision, typedef @ref Magnum::Shapes::Collision2D, @ref Magnum::Shapes::Collision3D
*/
@brief Class @ref Magnum::Shapes::Collision, typedef @ref Magnum::Shapes::Collision2D, @ref Magnum::Shapes::Collision3D
@deprecated The @ref Magnum::Shapes library is a failed design experiment and
is scheduled for removal in a future release. Related geometry algorithms
were moved to @ref Magnum::Math::Distance and @ref Magnum::Math::Intersection;
if you need a full-fledged physics library, please have look at
[Bullet](https://bulletphysics.org), which has Magnum integration in
@ref Magnum::BulletIntegration, or at [Box2D](https://box2d.org/), which
has a @ref examples-box2d "Magnum example" as well.
*/
#include "Magnum/DimensionTraits.h"
#include "Magnum/Math/Vector2.h"
#include "Magnum/Math/Vector3.h"
#include "Magnum/Shapes/Shapes.h"
/* File-level deprecation warning issued from Shapes.h */
namespace Magnum { namespace Shapes {
CORRADE_IGNORE_DEPRECATED_PUSH
/**
@brief Collision data
@deprecated The @ref Shapes library is a failed design experiment and is
scheduled for removal in a future release. Related geometry algorithms were
moved to @ref Math::Distance and @ref Math::Intersection; if you need a
full-fledged physics library, please have look at [Bullet](https://bulletphysics.org),
which has Magnum integration in @ref BulletIntegration, or at
[Box2D](https://box2d.org/), which has a @ref examples-box2d "Magnum example"
as well.
Contains information about collision between objects A and B, described by
contact position, separation normal and separation distance.
@ -51,7 +71,7 @@ If the collision not occured, contact position and separation normal is
undefined (i.e., *not* normalized) and separation distance is negative or zero.
@see @ref Collision2D, @ref Collision3D
*/
template<UnsignedInt dimensions> class Collision {
template<UnsignedInt dimensions> class CORRADE_DEPRECATED("scheduled for removal, see the docs for alternatives") Collision {
public:
/**
* @brief Default constructor
@ -121,11 +141,32 @@ template<UnsignedInt dimensions> class Collision {
Float _separationDistance;
};
/** @brief Two-dimensional collision data */
typedef Collision<2> Collision2D;
/**
@brief Two-dimensional collision data
@deprecated The @ref Shapes library is a failed design experiment and is
scheduled for removal in a future release. Related geometry algorithms were
moved to @ref Math::Distance and @ref Math::Intersection; if you need a
full-fledged physics library, please have look at [Bullet](https://bulletphysics.org),
which has Magnum integration in @ref BulletIntegration, or at
[Box2D](https://box2d.org/), which has a @ref examples-box2d "Magnum example"
as well.
*/
typedef CORRADE_DEPRECATED("scheduled for removal, see the docs for alternatives") Collision<2> Collision2D;
/** @brief Three-dimensional collision data */
typedef Collision<3> Collision3D;
/**
@brief Three-dimensional collision data
@deprecated The @ref Shapes library is a failed design experiment and is
scheduled for removal in a future release. Related geometry algorithms were
moved to @ref Math::Distance and @ref Math::Intersection; if you need a
full-fledged physics library, please have look at [Bullet](https://bulletphysics.org),
which has Magnum integration in @ref BulletIntegration, or at
[Box2D](https://box2d.org/), which has a @ref examples-box2d "Magnum example"
as well.
*/
typedef CORRADE_DEPRECATED("scheduled for removal, see the docs for alternatives") Collision<3> Collision3D;
CORRADE_IGNORE_DEPRECATED_POP
}}

4
src/Magnum/Shapes/Composition.cpp

@ -23,6 +23,8 @@
DEALINGS IN THE SOFTWARE.
*/
#define _MAGNUM_DO_NOT_WARN_DEPRECATED_SHAPES
#include "Composition.h"
#include <algorithm>
@ -32,6 +34,7 @@
namespace Magnum { namespace Shapes {
CORRADE_IGNORE_DEPRECATED_PUSH
/*
Hierarchy implementation notes:
@ -152,5 +155,6 @@ template<UnsignedInt dimensions> bool Composition<dimensions>::collides(const Im
template class MAGNUM_SHAPES_EXPORT Composition<2>;
template class MAGNUM_SHAPES_EXPORT Composition<3>;
#endif
CORRADE_IGNORE_DEPRECATED_POP
}}

130
src/Magnum/Shapes/Composition.h

@ -26,8 +26,16 @@
*/
/** @file
* @brief Class @ref Magnum::Shapes::Composition, typedef @ref Magnum::Shapes::Composition2D, @ref Magnum::Shapes::Composition3D, enum @ref Magnum::Shapes::CompositionOperation
*/
@brief Class @ref Magnum::Shapes::Composition, typedef @ref Magnum::Shapes::Composition2D, @ref Magnum::Shapes::Composition3D, enum @ref Magnum::Shapes::CompositionOperation
@deprecated The @ref Magnum::Shapes library is a failed design experiment and
is scheduled for removal in a future release. Related geometry algorithms
were moved to @ref Magnum::Math::Distance and @ref Magnum::Math::Intersection;
if you need a full-fledged physics library, please have look at
[Bullet](https://bulletphysics.org), which has Magnum integration in
@ref Magnum::BulletIntegration, or at [Box2D](https://box2d.org/), which
has a @ref examples-box2d "Magnum example" as well.
*/
#include <type_traits>
#include <utility>
@ -39,8 +47,11 @@
#include "Magnum/Shapes/shapeImplementation.h"
#include "Magnum/Shapes/visibility.h"
/* File-level deprecation warning issued from Shapes.h */
namespace Magnum { namespace Shapes {
CORRADE_IGNORE_DEPRECATED_PUSH
namespace Implementation {
template<class> struct ShapeHelper;
@ -52,8 +63,18 @@ namespace Implementation {
}
}
/** @brief Shape operation */
enum class CompositionOperation: UnsignedByte {
/**
@brief Shape operation
@deprecated The @ref Shapes library is a failed design experiment and is
scheduled for removal in a future release. Related geometry algorithms were
moved to @ref Math::Distance and @ref Math::Intersection; if you need a
full-fledged physics library, please have look at [Bullet](https://bulletphysics.org),
which has Magnum integration in @ref BulletIntegration, or at
[Box2D](https://box2d.org/), which has a @ref examples-box2d "Magnum example"
as well.
*/
enum class CORRADE_DEPRECATED_ENUM("scheduled for removal, see the docs for alternatives") CompositionOperation: UnsignedByte {
Not, /**< Boolean NOT */
And, /**< Boolean AND */
Or /**< Boolean OR */
@ -62,9 +83,17 @@ enum class CompositionOperation: UnsignedByte {
/**
@brief Composition of shapes
@deprecated The @ref Shapes library is a failed design experiment and is
scheduled for removal in a future release. Related geometry algorithms were
moved to @ref Math::Distance and @ref Math::Intersection; if you need a
full-fledged physics library, please have look at [Bullet](https://bulletphysics.org),
which has Magnum integration in @ref BulletIntegration, or at
[Box2D](https://box2d.org/), which has a @ref examples-box2d "Magnum example"
as well.
Result of logical operations on shapes. See @ref shapes for brief introduction.
*/
template<UnsignedInt dimensions> class MAGNUM_SHAPES_EXPORT Composition {
template<UnsignedInt dimensions> class CORRADE_DEPRECATED("scheduled for removal, see the docs for alternatives") MAGNUM_SHAPES_EXPORT Composition {
friend Implementation::AbstractShape<dimensions>& Implementation::getAbstractShape<>(Composition<dimensions>&, std::size_t);
friend const Implementation::AbstractShape<dimensions>& Implementation::getAbstractShape<>(const Composition<dimensions>&, std::size_t);
friend Implementation::ShapeHelper<Composition<dimensions>>;
@ -187,24 +216,66 @@ template<UnsignedInt dimensions> class MAGNUM_SHAPES_EXPORT Composition {
Containers::Array<Node> _nodes;
};
/** @brief Two-dimensional shape composition */
typedef Composition<2> Composition2D;
/**
@brief Two-dimensional shape composition
@deprecated The @ref Shapes library is a failed design experiment and is
scheduled for removal in a future release. Related geometry algorithms were
moved to @ref Math::Distance and @ref Math::Intersection; if you need a
full-fledged physics library, please have look at [Bullet](https://bulletphysics.org),
which has Magnum integration in @ref BulletIntegration, or at
[Box2D](https://box2d.org/), which has a @ref examples-box2d "Magnum example"
as well.
*/
CORRADE_IGNORE_DEPRECATED_PUSH /* Otherwise GCC warns on the typedef :/ */
typedef CORRADE_DEPRECATED("scheduled for removal, see the docs for alternatives") Composition<2> Composition2D;
CORRADE_IGNORE_DEPRECATED_POP
/** @brief Three-dimensional shape composition */
typedef Composition<3> Composition3D;
/**
@brief Three-dimensional shape composition
@deprecated The @ref Shapes library is a failed design experiment and is
scheduled for removal in a future release. Related geometry algorithms were
moved to @ref Math::Distance and @ref Math::Intersection; if you need a
full-fledged physics library, please have look at [Bullet](https://bulletphysics.org),
which has Magnum integration in @ref BulletIntegration, or at
[Box2D](https://box2d.org/), which has a @ref examples-box2d "Magnum example"
as well.
*/
CORRADE_IGNORE_DEPRECATED_PUSH /* Otherwise GCC warns on the typedef :/ */
typedef CORRADE_DEPRECATED("scheduled for removal, see the docs for alternatives") Composition<3> Composition3D;
CORRADE_IGNORE_DEPRECATED_POP
#ifdef DOXYGEN_GENERATING_OUTPUT
/** @debugoperatorclassenum{Composition,Composition::Type} */
/**
@debugoperatorclassenum{Composition,Composition::Type}
@deprecated The @ref Shapes library is a failed design experiment and is
scheduled for removal in a future release. Related geometry algorithms were
moved to @ref Math::Distance and @ref Math::Intersection; if you need a
full-fledged physics library, please have look at [Bullet](https://bulletphysics.org),
which has Magnum integration in @ref BulletIntegration, or at
[Box2D](https://box2d.org/), which has a @ref examples-box2d "Magnum example"
as well.
*/
template<UnsignedInt dimensions> Debug& operator<<(Debug& debug, typename Composition<dimensions>::Type value);
#endif
/** @relates Composition
@brief Collision occurence of shape with Composition
@deprecated The @ref Shapes library is a failed design experiment and is
scheduled for removal in a future release. Related geometry algorithms were
moved to @ref Math::Distance and @ref Math::Intersection; if you need a
full-fledged physics library, please have look at [Bullet](https://bulletphysics.org),
which has Magnum integration in @ref BulletIntegration or at
[Box2D](https://box2d.org/), which has a @ref examples-box2d "Magnum example"
as well.
*/
#ifdef DOXYGEN_GENERATING_OUTPUT
template<UnsignedInt dimensions, class T> inline bool operator%(const T& a, const Composition<dimensions>& b) {
#else
template<UnsignedInt dimensions, class T> inline auto operator%(const T& a, const Composition<dimensions>& b) -> typename std::enable_if<std::is_same<decltype(Implementation::TypeOf<T>::type()), typename Implementation::ShapeDimensionTraits<dimensions>::Type>::value, bool>::type {
template<UnsignedInt dimensions, class T> inline CORRADE_DEPRECATED("scheduled for removal, see the docs for alternatives") auto operator%(const T& a, const Composition<dimensions>& b) -> typename std::enable_if<std::is_same<decltype(Implementation::TypeOf<T>::type()), typename Implementation::ShapeDimensionTraits<dimensions>::Type>::value, bool>::type {
#endif
return b % a;
}
@ -212,27 +283,51 @@ template<UnsignedInt dimensions, class T> inline auto operator%(const T& a, cons
#ifdef DOXYGEN_GENERATING_OUTPUT
/** @relates Composition
@brief Logical NOT of shape
@deprecated The @ref Shapes library is a failed design experiment and is
scheduled for removal in a future release. Related geometry algorithms were
moved to @ref Math::Distance and @ref Math::Intersection; if you need a
full-fledged physics library, please have look at [Bullet](https://bulletphysics.org),
which has Magnum integration in @ref BulletIntegration or at
[Box2D](https://box2d.org/), which has a @ref examples-box2d "Magnum example"
as well.
*/
template<class T> inline Composition<T::Dimensions> operator!(T a);
template<class T> inline CORRADE_DEPRECATED("scheduled for removal, see the docs for alternatives") Composition<T::Dimensions> operator!(T a);
/** @relates Composition
@brief Logical AND of two shapes
@deprecated The @ref Shapes library is a failed design experiment and is
scheduled for removal in a future release. Related geometry algorithms were
moved to @ref Math::Distance and @ref Math::Intersection; if you need a
full-fledged physics library, please have look at [Bullet](https://bulletphysics.org),
which has Magnum integration in @ref BulletIntegration or at
[Box2D](https://box2d.org/), which has a @ref examples-box2d "Magnum example"
as well.
[Short-circuit evaluation](http://en.wikipedia.org/wiki/Short-circuit_evaluation)
is used here, so this operation can be used for providing simplified shape
version, because collision with @p b is computed only if @p a collides.
See @ref shapes-simplification for an example.
*/
template<class T> inline Composition<T::Dimensions> operator&&(T a, T b);
template<class T> inline CORRADE_DEPRECATED("scheduled for removal, see the docs for alternatives") Composition<T::Dimensions> operator&&(T a, T b);
/** @relates Composition
@brief Logical OR of two shapes
@deprecated The @ref Shapes library is a failed design experiment and is
scheduled for removal in a future release. Related geometry algorithms were
moved to @ref Math::Distance and @ref Math::Intersection; if you need a
full-fledged physics library, please have look at [Bullet](https://bulletphysics.org),
which has Magnum integration in @ref BulletIntegration or at
[Box2D](https://box2d.org/), which has a @ref examples-box2d "Magnum example"
as well.
[Short-circuit evaluation](http://en.wikipedia.org/wiki/Short-circuit_evaluation)
is used, so if collision with @p a is detected, collision with @p b is not
computed.
*/
template<class T> inline Composition<T::Dimensions> operator||(T a, T b);
template<class T> inline CORRADE_DEPRECATED("scheduled for removal, see the docs for alternatives") Composition<T::Dimensions> operator||(T a, T b);
#endif
#ifndef DOXYGEN_GENERATING_OUTPUT
@ -243,13 +338,13 @@ template<class T> inline Composition<T::Dimensions> operator||(T a, T b);
std::is_same<decltype(Implementation::TypeOf<T>::type()), typename Implementation::ShapeDimensionTraits<T::Dimensions>::Type>::value && \
std::is_same<decltype(Implementation::TypeOf<U>::type()), typename Implementation::ShapeDimensionTraits<T::Dimensions>::Type>::value, \
Composition<T::Dimensions>>::type
template<class T> inline auto operator!(T&& a) -> enableIfIsShapeType {
template<class T> inline CORRADE_DEPRECATED("scheduled for removal, see the docs for alternatives") auto operator!(T&& a) -> enableIfIsShapeType {
return Composition<T::Dimensions>(CompositionOperation::Not, std::forward<T>(a));
}
template<class T, class U> inline auto operator&&(T&& a, U&& b) -> enableIfAreShapeType {
template<class T, class U> inline CORRADE_DEPRECATED("scheduled for removal, see the docs for alternatives") auto operator&&(T&& a, U&& b) -> enableIfAreShapeType {
return Composition<T::Dimensions>(CompositionOperation::And, std::forward<T>(a), std::forward<U>(b));
}
template<class T, class U> inline auto operator||(T&& a, U&& b) -> enableIfAreShapeType {
template<class T, class U> inline CORRADE_DEPRECATED("scheduled for removal, see the docs for alternatives") auto operator||(T&& a, U&& b) -> enableIfAreShapeType {
return Composition<T::Dimensions>(CompositionOperation::Or, std::forward<T>(a), std::forward<U>(b));
}
#undef enableIfIsShapeType
@ -293,6 +388,7 @@ template<UnsignedInt dimensions> template<class T> inline const T& Composition<d
"but" << _shapes[i]->type(), *static_cast<T*>(nullptr));
return static_cast<Implementation::Shape<T>*>(_shapes[i])->shape;
}
CORRADE_IGNORE_DEPRECATED_POP
}}

4
src/Magnum/Shapes/Cylinder.cpp

@ -23,6 +23,8 @@
DEALINGS IN THE SOFTWARE.
*/
#define _MAGNUM_DO_NOT_WARN_DEPRECATED_SHAPES
#include "Cylinder.h"
#include "Magnum/Magnum.h"
@ -35,6 +37,7 @@
namespace Magnum { namespace Shapes {
CORRADE_IGNORE_DEPRECATED_PUSH
template<UnsignedInt dimensions> Cylinder<dimensions> Cylinder<dimensions>::transformed(const MatrixTypeFor<dimensions, Float>& matrix) const {
return Cylinder<dimensions>(matrix.transformPoint(_a), matrix.transformPoint(_b), matrix.uniformScaling()*_radius);
}
@ -53,5 +56,6 @@ template<UnsignedInt dimensions> bool Cylinder<dimensions>::operator%(const Sphe
template class MAGNUM_SHAPES_EXPORT Cylinder<2>;
template class MAGNUM_SHAPES_EXPORT Cylinder<3>;
#endif
CORRADE_IGNORE_DEPRECATED_POP
}}

82
src/Magnum/Shapes/Cylinder.h

@ -26,26 +26,45 @@
*/
/** @file
* @brief Class @ref Magnum::Shapes::Cylinder, typedef @ref Magnum::Shapes::Cylinder2D, @ref Magnum::Shapes::Cylinder3D
*/
@brief Class @ref Magnum::Shapes::Cylinder, typedef @ref Magnum::Shapes::Cylinder2D, @ref Magnum::Shapes::Cylinder3D
@deprecated The @ref Magnum::Shapes library is a failed design experiment and
is scheduled for removal in a future release. Related geometry algorithms
were moved to @ref Magnum::Math::Distance and @ref Magnum::Math::Intersection;
if you need a full-fledged physics library, please have look at
[Bullet](https://bulletphysics.org), which has Magnum integration in
@ref Magnum::BulletIntegration, or at [Box2D](https://box2d.org/), which
has a @ref examples-box2d "Magnum example" as well.
*/
#include "Magnum/DimensionTraits.h"
#include "Magnum/Math/Vector3.h"
#include "Magnum/Shapes/Shapes.h"
#include "Magnum/Shapes/visibility.h"
/* File-level deprecation warning issued from Shapes.h */
namespace Magnum { namespace Shapes {
CORRADE_IGNORE_DEPRECATED_PUSH
/**
@brief Infinite cylinder defined by line and radius
@deprecated The @ref Shapes library is a failed design experiment and is
scheduled for removal in a future release. Related geometry algorithms were
moved to @ref Math::Distance and @ref Math::Intersection; if you need a
full-fledged physics library, please have look at [Bullet](https://bulletphysics.org),
which has Magnum integration in @ref BulletIntegration, or at
[Box2D](https://box2d.org/), which has a @ref examples-box2d "Magnum example"
as well.
Unlike other elements the cylinder expects uniform scaling. See @ref shapes for
brief introduction.
@see @ref Cylinder2D, @ref Cylinder3D, @ref Capsule
@todo Store the radius as squared value to avoid sqrt/pow? Will complicate
collision detection with sphere.
*/
template<UnsignedInt dimensions> class MAGNUM_SHAPES_EXPORT Cylinder {
template<UnsignedInt dimensions> class CORRADE_DEPRECATED("scheduled for removal, see the docs for alternatives") MAGNUM_SHAPES_EXPORT Cylinder {
public:
enum: UnsignedInt {
Dimensions = dimensions /**< Dimension count */
@ -101,17 +120,58 @@ template<UnsignedInt dimensions> class MAGNUM_SHAPES_EXPORT Cylinder {
Float _radius;
};
/** @brief Infinite two-dimensional cylinder */
typedef Cylinder<2> Cylinder2D;
/**
@brief Infinite two-dimensional cylinder
@deprecated The @ref Shapes library is a failed design experiment and is
scheduled for removal in a future release. Related geometry algorithms were
moved to @ref Math::Distance and @ref Math::Intersection; if you need a
full-fledged physics library, please have look at [Bullet](https://bulletphysics.org),
which has Magnum integration in @ref BulletIntegration, or at
[Box2D](https://box2d.org/), which has a @ref examples-box2d "Magnum example"
as well.
*/
typedef CORRADE_DEPRECATED("scheduled for removal, see the docs for alternatives") Cylinder<2> Cylinder2D;
/** @brief Infinite three-dimensional cylinder */
typedef Cylinder<3> Cylinder3D;
/**
@brief Infinite three-dimensional cylinder
@deprecated The @ref Shapes library is a failed design experiment and is
scheduled for removal in a future release. Related geometry algorithms were
moved to @ref Math::Distance and @ref Math::Intersection; if you need a
full-fledged physics library, please have look at [Bullet](https://bulletphysics.org),
which has Magnum integration in @ref BulletIntegration, or at
[Box2D](https://box2d.org/), which has a @ref examples-box2d "Magnum example"
as well.
*/
typedef CORRADE_DEPRECATED("scheduled for removal, see the docs for alternatives") Cylinder<3> Cylinder3D;
/** @collisionoccurenceoperator{Point,Cylinder} */
template<UnsignedInt dimensions> inline bool operator%(const Point<dimensions>& a, const Cylinder<dimensions>& b) { return b % a; }
/**
@collisionoccurenceoperator{Point,Cylinder}
@deprecated The @ref Shapes library is a failed design experiment and is
scheduled for removal in a future release. Related geometry algorithms were
moved to @ref Math::Distance and @ref Math::Intersection; if you need a
full-fledged physics library, please have look at [Bullet](https://bulletphysics.org),
which has Magnum integration in @ref BulletIntegration, or at
[Box2D](https://box2d.org/), which has a @ref examples-box2d "Magnum example"
as well.
*/
template<UnsignedInt dimensions> inline CORRADE_DEPRECATED("scheduled for removal, see the docs for alternatives") bool operator%(const Point<dimensions>& a, const Cylinder<dimensions>& b) { return b % a; }
/** @collisionoccurenceoperator{Sphere,Cylinder} */
template<UnsignedInt dimensions> inline bool operator%(const Sphere<dimensions>& a, const Cylinder<dimensions>& b) { return b % a; }
/**
@collisionoccurenceoperator{Sphere,Cylinder}
@deprecated The @ref Shapes library is a failed design experiment and is
scheduled for removal in a future release. Related geometry algorithms were
moved to @ref Math::Distance and @ref Math::Intersection; if you need a
full-fledged physics library, please have look at [Bullet](https://bulletphysics.org),
which has Magnum integration in @ref BulletIntegration, or at
[Box2D](https://box2d.org/), which has a @ref examples-box2d "Magnum example"
as well.
*/
template<UnsignedInt dimensions> inline CORRADE_DEPRECATED("scheduled for removal, see the docs for alternatives") bool operator%(const Sphere<dimensions>& a, const Cylinder<dimensions>& b) { return b % a; }
CORRADE_IGNORE_DEPRECATED_POP
}}

4
src/Magnum/Shapes/Implementation/CollisionDispatch.cpp

@ -23,6 +23,8 @@
DEALINGS IN THE SOFTWARE.
*/
#define _MAGNUM_DO_NOT_WARN_DEPRECATED_SHAPES
#include "CollisionDispatch.h"
#include "Magnum/Shapes/AxisAlignedBox.h"
@ -37,6 +39,7 @@
namespace Magnum { namespace Shapes { namespace Implementation {
CORRADE_IGNORE_DEPRECATED_PUSH
template<> bool collides(const AbstractShape<2>& a, const AbstractShape<2>& b) {
if(a.type() < b.type()) return collides(b, a);
@ -125,5 +128,6 @@ template<> Collision<3> collision(const AbstractShape<3>& a, const AbstractShape
return {};
}
CORRADE_IGNORE_DEPRECATED_POP
}}}

2
src/Magnum/Shapes/Implementation/CollisionDispatch.h

@ -30,6 +30,7 @@
namespace Magnum { namespace Shapes { namespace Implementation {
CORRADE_IGNORE_DEPRECATED_PUSH
template<UnsignedInt> struct AbstractShape;
/*
@ -45,6 +46,7 @@ each combination).
template<UnsignedInt dimensions> bool collides(const AbstractShape<dimensions>& a, const AbstractShape<dimensions>& b);
template<UnsignedInt dimensions> Collision<dimensions> collision(const AbstractShape<dimensions>& a, const AbstractShape<dimensions>& b);
CORRADE_IGNORE_DEPRECATED_POP
}}}

4
src/Magnum/Shapes/Line.cpp

@ -23,6 +23,8 @@
DEALINGS IN THE SOFTWARE.
*/
#define _MAGNUM_DO_NOT_WARN_DEPRECATED_SHAPES
#include "Line.h"
#include "Magnum/Math/Matrix3.h"
@ -30,6 +32,7 @@
namespace Magnum { namespace Shapes {
CORRADE_IGNORE_DEPRECATED_PUSH
template<UnsignedInt dimensions> Line<dimensions> Line<dimensions>::transformed(const MatrixTypeFor<dimensions, Float>& matrix) const {
return Line<dimensions>(matrix.transformPoint(_a),
matrix.transformPoint(_b));
@ -40,5 +43,6 @@ template<UnsignedInt dimensions> Line<dimensions> Line<dimensions>::transformed(
template class MAGNUM_SHAPES_EXPORT Line<2>;
template class MAGNUM_SHAPES_EXPORT Line<3>;
#endif
CORRADE_IGNORE_DEPRECATED_POP
}}

56
src/Magnum/Shapes/Line.h

@ -26,23 +26,43 @@
*/
/** @file
* @brief Class @ref Magnum::Shapes::Line, typedef @ref Magnum::Shapes::Line2D, @ref Magnum::Shapes::Line3D
*/
@brief Class @ref Magnum::Shapes::Line, typedef @ref Magnum::Shapes::Line2D, @ref Magnum::Shapes::Line3D
@deprecated The @ref Magnum::Shapes library is a failed design experiment and
is scheduled for removal in a future release. Related geometry algorithms
were moved to @ref Magnum::Math::Distance and @ref Magnum::Math::Intersection;
if you need a full-fledged physics library, please have look at
[Bullet](https://bulletphysics.org), which has Magnum integration in
@ref Magnum::BulletIntegration, or at [Box2D](https://box2d.org/), which
has a @ref examples-box2d "Magnum example" as well.
*/
#include "Magnum/DimensionTraits.h"
#include "Magnum/Math/Vector3.h"
#include "Magnum/Shapes/Shapes.h"
#include "Magnum/Shapes/visibility.h"
/* File-level deprecation warning issued from Shapes.h */
namespace Magnum { namespace Shapes {
CORRADE_IGNORE_DEPRECATED_PUSH
/**
@brief Infinite line, defined by two points
@deprecated The @ref Shapes library is a failed design experiment and is
scheduled for removal in a future release. Related geometry algorithms were
moved to @ref Math::Distance and @ref Math::Intersection; if you need a
full-fledged physics library, please have look at [Bullet](https://bulletphysics.org),
which has Magnum integration in @ref BulletIntegration, or at
[Box2D](https://box2d.org/), which has a @ref examples-box2d "Magnum example"
as well.
See @ref shapes for brief introduction.
@see @ref Line2D, @ref Line3D
@todo collision detection of two Line2D
*/
template<UnsignedInt dimensions> class MAGNUM_SHAPES_EXPORT Line {
template<UnsignedInt dimensions> class CORRADE_DEPRECATED("scheduled for removal, see the docs for alternatives") MAGNUM_SHAPES_EXPORT Line {
public:
enum: UnsignedInt {
Dimensions = dimensions /**< Dimension count */
@ -85,11 +105,33 @@ template<UnsignedInt dimensions> class MAGNUM_SHAPES_EXPORT Line {
VectorTypeFor<dimensions, Float> _a, _b;
};
/** @brief Infinite two-dimensional line */
typedef Line<2> Line2D;
/**
@brief Infinite two-dimensional line
@deprecated The @ref Shapes library is a failed design experiment and is
scheduled for removal in a future release. Related geometry algorithms were
moved to @ref Math::Distance and @ref Math::Intersection; if you need a
full-fledged physics library, please have look at [Bullet](https://bulletphysics.org),
which has Magnum integration in @ref BulletIntegration, or at
[Box2D](https://box2d.org/), which has a @ref examples-box2d "Magnum example"
as well.
*/
typedef CORRADE_DEPRECATED("scheduled for removal, see the docs for alternatives") Line<2> Line2D;
/**
@brief Infinite three-dimensional line
@deprecated The @ref Shapes library is a failed design experiment and is
scheduled for removal in a future release. Related geometry algorithms were
moved to @ref Math::Distance and @ref Math::Intersection; if you need a
full-fledged physics library, please have look at [Bullet](https://bulletphysics.org),
which has Magnum integration in @ref BulletIntegration, or at
[Box2D](https://box2d.org/), which has a @ref examples-box2d "Magnum example"
as well.
*/
/** @brief Infinite three-dimensional line */
typedef Line<3> Line3D;
typedef CORRADE_DEPRECATED("scheduled for removal, see the docs for alternatives") Line<3> Line3D;
CORRADE_IGNORE_DEPRECATED_POP
}}

54
src/Magnum/Shapes/LineSegment.h

@ -26,20 +26,39 @@
*/
/** @file
* @brief Class @ref Magnum::Shapes::LineSegment, typedef @ref Magnum::Shapes::LineSegment2D, @ref Magnum::Shapes::LineSegment3D
*/
@brief Class @ref Magnum::Shapes::LineSegment, typedef @ref Magnum::Shapes::LineSegment2D, @ref Magnum::Shapes::LineSegment3D
@deprecated The @ref Magnum::Shapes library is a failed design experiment and
is scheduled for removal in a future release. Related geometry algorithms
were moved to @ref Magnum::Math::Distance and @ref Magnum::Math::Intersection;
if you need a full-fledged physics library, please have look at
[Bullet](https://bulletphysics.org), which has Magnum integration in
@ref Magnum::BulletIntegration, or at [Box2D](https://box2d.org/), which
has a @ref examples-box2d "Magnum example" as well.
*/
#include "Magnum/Shapes/Line.h"
/* File-level deprecation warning issued from Shapes.h */
namespace Magnum { namespace Shapes {
CORRADE_IGNORE_DEPRECATED_PUSH
/**
@brief Line segment, defined by starting and ending point
@deprecated The @ref Shapes library is a failed design experiment and is
scheduled for removal in a future release. Related geometry algorithms were
moved to @ref Math::Distance and @ref Math::Intersection; if you need a
full-fledged physics library, please have look at [Bullet](https://bulletphysics.org),
which has Magnum integration in @ref BulletIntegration, or at
[Box2D](https://box2d.org/), which has a @ref examples-box2d "Magnum example"
as well.
See @ref shapes for brief introduction.
@see @ref LineSegment2D, @ref LineSegment3D
*/
template<UnsignedInt dimensions> class LineSegment: public Line<dimensions> {
template<UnsignedInt dimensions> class CORRADE_DEPRECATED("scheduled for removal, see the docs for alternatives") LineSegment: public Line<dimensions> {
public:
/**
* @brief Default constructor
@ -60,11 +79,32 @@ template<UnsignedInt dimensions> class LineSegment: public Line<dimensions> {
constexpr LineSegment(const Line<dimensions>& line): Line<dimensions>(line) {}
};
/** @brief Two-dimensional line segment */
typedef LineSegment<2> LineSegment2D;
/**
@brief Two-dimensional line segment
@deprecated The @ref Shapes library is a failed design experiment and is
scheduled for removal in a future release. Related geometry algorithms were
moved to @ref Math::Distance and @ref Math::Intersection; if you need a
full-fledged physics library, please have look at [Bullet](https://bulletphysics.org),
which has Magnum integration in @ref BulletIntegration, or at
[Box2D](https://box2d.org/), which has a @ref examples-box2d "Magnum example"
as well.
*/
typedef CORRADE_DEPRECATED("scheduled for removal, see the docs for alternatives") LineSegment<2> LineSegment2D;
/** @brief Three-dimensional line segment */
typedef LineSegment<3> LineSegment3D;
/**
@brief Three-dimensional line segment
@deprecated The @ref Shapes library is a failed design experiment and is
scheduled for removal in a future release. Related geometry algorithms were
moved to @ref Math::Distance and @ref Math::Intersection; if you need a
full-fledged physics library, please have look at [Bullet](https://bulletphysics.org),
which has Magnum integration in @ref BulletIntegration, or at
[Box2D](https://box2d.org/), which has a @ref examples-box2d "Magnum example"
as well.
*/
typedef CORRADE_DEPRECATED("scheduled for removal, see the docs for alternatives") LineSegment<3> LineSegment3D;
CORRADE_IGNORE_DEPRECATED_POP
}}

4
src/Magnum/Shapes/Plane.cpp

@ -23,6 +23,8 @@
DEALINGS IN THE SOFTWARE.
*/
#define _MAGNUM_DO_NOT_WARN_DEPRECATED_SHAPES
#include "Plane.h"
#include "Magnum/Math/Intersection.h"
@ -31,6 +33,7 @@
namespace Magnum { namespace Shapes {
CORRADE_IGNORE_DEPRECATED_PUSH
Plane Plane::transformed(const Matrix4& matrix) const {
/* Using matrix.rotation() would result in two more normalizations (slow),
using .normalized() instead of matrix.uniformScaling() would not check
@ -48,5 +51,6 @@ bool Plane::operator%(const LineSegment3D& other) const {
Float t = Math::Intersection::planeLine(Math::planeEquation(_normal, _position), other.a(), other.b()-other.a());
return t > 0.0f && t < 1.0f;
}
CORRADE_IGNORE_DEPRECATED_POP
}}

47
src/Magnum/Shapes/Plane.h

@ -26,23 +26,42 @@
*/
/** @file
* @brief Class @ref Magnum::Shapes::Plane
*/
@brief Class @ref Magnum::Shapes::Plane
@deprecated The @ref Magnum::Shapes library is a failed design experiment and
is scheduled for removal in a future release. Related geometry algorithms
were moved to @ref Magnum::Math::Distance and @ref Magnum::Math::Intersection;
if you need a full-fledged physics library, please have look at
[Bullet](https://bulletphysics.org), which has Magnum integration in
@ref Magnum::BulletIntegration, or at [Box2D](https://box2d.org/), which
has a @ref examples-box2d "Magnum example" as well.
*/
#include "Magnum/Magnum.h"
#include "Magnum/Math/Vector3.h"
#include "Magnum/Shapes/Shapes.h"
#include "Magnum/Shapes/visibility.h"
/* File-level deprecation warning issued from Shapes.h */
namespace Magnum { namespace Shapes {
CORRADE_IGNORE_DEPRECATED_PUSH
/**
@brief Infinite plane, defined by position and normal (3D only)
@deprecated The @ref Shapes library is a failed design experiment and is
scheduled for removal in a future release. Related geometry algorithms were
moved to @ref Math::Distance and @ref Math::Intersection; if you need a
full-fledged physics library, please have look at [Bullet](https://bulletphysics.org),
which has Magnum integration in @ref BulletIntegration, or at
[Box2D](https://box2d.org/), which has a @ref examples-box2d "Magnum example"
as well.
Unlike other elements the plane expects uniform scaling. See @ref shapes for
brief introduction.
*/
class MAGNUM_SHAPES_EXPORT Plane {
class CORRADE_DEPRECATED("scheduled for removal, see the docs for alternatives") MAGNUM_SHAPES_EXPORT Plane {
public:
enum: UnsignedInt {
Dimensions = 3 /**< Dimension count */
@ -90,17 +109,33 @@ class MAGNUM_SHAPES_EXPORT Plane {
/** @relatesalso Line
@brief Collision occurence of @ref Line and @ref Plane
@deprecated The @ref Shapes library is a failed design experiment and is
scheduled for removal in a future release. Related geometry algorithms were
moved to @ref Math::Distance and @ref Math::Intersection; if you need a
full-fledged physics library, please have look at [Bullet](https://bulletphysics.org),
which has Magnum integration in @ref BulletIntegration, or at
[Box2D](https://box2d.org/), which has a @ref examples-box2d "Magnum example"
as well.
@see @ref Plane::operator%(const Line3D&) const
*/
inline bool operator%(const Line3D& a, const Plane& b) { return b % a; }
inline CORRADE_DEPRECATED("scheduled for removal, see the docs for alternatives") bool operator%(const Line3D& a, const Plane& b) { return b % a; }
/** @relatesalso LineSegment
@brief Collision occurence of @ref LineSegment and @ref Plane
@deprecated The @ref Shapes library is a failed design experiment and is
scheduled for removal in a future release. Related geometry algorithms were
moved to @ref Math::Distance and @ref Math::Intersection; if you need a
full-fledged physics library, please have look at [Bullet](https://bulletphysics.org),
which has Magnum integration in @ref BulletIntegration, or at
[Box2D](https://box2d.org/), which has a @ref examples-box2d "Magnum example"
as well.
@see @ref Plane::operator%(const LineSegment3D&) const
*/
inline bool operator%(const LineSegment3D& a, const Plane& b) { return b % a; }
inline CORRADE_DEPRECATED("scheduled for removal, see the docs for alternatives") bool operator%(const LineSegment3D& a, const Plane& b) { return b % a; }
CORRADE_IGNORE_DEPRECATED_POP
}}

4
src/Magnum/Shapes/Point.cpp

@ -23,6 +23,8 @@
DEALINGS IN THE SOFTWARE.
*/
#define _MAGNUM_DO_NOT_WARN_DEPRECATED_SHAPES
#include "Point.h"
#include "Magnum/Math/Matrix3.h"
@ -30,6 +32,7 @@
namespace Magnum { namespace Shapes {
CORRADE_IGNORE_DEPRECATED_PUSH
template<UnsignedInt dimensions> Point<dimensions> Point<dimensions>::transformed(const MatrixTypeFor<dimensions, Float>& matrix) const {
return Point<dimensions>(matrix.transformPoint(_position));
}
@ -38,5 +41,6 @@ template<UnsignedInt dimensions> Point<dimensions> Point<dimensions>::transforme
template class MAGNUM_SHAPES_EXPORT Point<2>;
template class MAGNUM_SHAPES_EXPORT Point<3>;
#endif
CORRADE_IGNORE_DEPRECATED_POP
}}

55
src/Magnum/Shapes/Point.h

@ -26,22 +26,42 @@
*/
/** @file
* @brief Class @ref Magnum::Shapes::Point, typedef @ref Magnum::Shapes::Point2D, @ref Magnum::Shapes::Point3D
*/
@brief Class @ref Magnum::Shapes::Point, typedef @ref Magnum::Shapes::Point2D, @ref Magnum::Shapes::Point3D
@deprecated The @ref Magnum::Shapes library is a failed design experiment and
is scheduled for removal in a future release. Related geometry algorithms
were moved to @ref Magnum::Math::Distance and @ref Magnum::Math::Intersection;
if you need a full-fledged physics library, please have look at
[Bullet](https://bulletphysics.org), which has Magnum integration in
@ref Magnum::BulletIntegration, or at [Box2D](https://box2d.org/), which
has a @ref examples-box2d "Magnum example" as well.
*/
#include "Magnum/DimensionTraits.h"
#include "Magnum/Math/Vector3.h"
#include "Magnum/Shapes/Shapes.h"
#include "Magnum/Shapes/visibility.h"
/* File-level deprecation warning issued from Shapes.h */
namespace Magnum { namespace Shapes {
CORRADE_IGNORE_DEPRECATED_PUSH
/**
@brief Point
@deprecated The @ref Shapes library is a failed design experiment and is
scheduled for removal in a future release. Related geometry algorithms were
moved to @ref Math::Distance and @ref Math::Intersection; if you need a
full-fledged physics library, please have look at [Bullet](https://bulletphysics.org),
which has Magnum integration in @ref BulletIntegration, or at
[Box2D](https://box2d.org/), which has a @ref examples-box2d "Magnum example"
as well.
See @ref shapes for brief introduction.
@see @ref Point2D, @ref Point3D
*/
template<UnsignedInt dimensions> class MAGNUM_SHAPES_EXPORT Point {
template<UnsignedInt dimensions> class CORRADE_DEPRECATED("scheduled for removal, see the docs for alternatives") MAGNUM_SHAPES_EXPORT Point {
public:
enum: UnsignedInt {
Dimensions = dimensions /**< Dimension count */
@ -74,11 +94,32 @@ template<UnsignedInt dimensions> class MAGNUM_SHAPES_EXPORT Point {
VectorTypeFor<dimensions, Float> _position;
};
/** @brief Two-dimensional point */
typedef Point<2> Point2D;
/**
@brief Two-dimensional point
@deprecated The @ref Shapes library is a failed design experiment and is
scheduled for removal in a future release. Related geometry algorithms were
moved to @ref Math::Distance and @ref Math::Intersection; if you need a
full-fledged physics library, please have look at [Bullet](https://bulletphysics.org),
which has Magnum integration in @ref BulletIntegration, or at
[Box2D](https://box2d.org/), which has a @ref examples-box2d "Magnum example"
as well.
*/
typedef CORRADE_DEPRECATED("scheduled for removal, see the docs for alternatives") Point<2> Point2D;
/** @brief Three-dimensional point */
typedef Point<3> Point3D;
/**
@brief Three-dimensional point
@deprecated The @ref Shapes library is a failed design experiment and is
scheduled for removal in a future release. Related geometry algorithms were
moved to @ref Math::Distance and @ref Math::Intersection; if you need a
full-fledged physics library, please have look at [Bullet](https://bulletphysics.org),
which has Magnum integration in @ref BulletIntegration, or at
[Box2D](https://box2d.org/), which has a @ref examples-box2d "Magnum example"
as well.
*/
typedef CORRADE_DEPRECATED("scheduled for removal, see the docs for alternatives") Point<3> Point3D;
CORRADE_IGNORE_DEPRECATED_POP
}}

4
src/Magnum/Shapes/Shape.cpp

@ -23,12 +23,15 @@
DEALINGS IN THE SOFTWARE.
*/
#define _MAGNUM_DO_NOT_WARN_DEPRECATED_SHAPES
#include "Shape.h"
#include "Magnum/Shapes/Composition.h"
namespace Magnum { namespace Shapes { namespace Implementation {
CORRADE_IGNORE_DEPRECATED_PUSH
template<UnsignedInt dimensions> void ShapeHelper<Composition<dimensions>>::set(Shapes::Shape<Composition<dimensions>>& shape, const Composition<dimensions>& composition) {
shape._transformedShape.shape = shape._shape.shape = composition;
}
@ -45,5 +48,6 @@ template<UnsignedInt dimensions> void ShapeHelper<Composition<dimensions>>::tran
template struct MAGNUM_SHAPES_EXPORT ShapeHelper<Composition<2>>;
template struct MAGNUM_SHAPES_EXPORT ShapeHelper<Composition<3>>;
CORRADE_IGNORE_DEPRECATED_POP
}}}

26
src/Magnum/Shapes/Shape.h

@ -26,15 +26,26 @@
*/
/** @file
* @brief Class @ref Magnum::Shapes::Shape
*/
@brief Class @ref Magnum::Shapes::Shape
@deprecated The @ref Magnum::Shapes library is a failed design experiment and
is scheduled for removal in a future release. Related geometry algorithms
were moved to @ref Magnum::Math::Distance and @ref Magnum::Math::Intersection;
if you need a full-fledged physics library, please have look at
[Bullet](https://bulletphysics.org), which has Magnum integration in
@ref Magnum::BulletIntegration, or at [Box2D](https://box2d.org/), which
has a @ref examples-box2d "Magnum example" as well.
*/
#include "Magnum/Shapes/AbstractShape.h"
#include "Magnum/Shapes/Shapes.h"
#include "Magnum/Shapes/visibility.h"
/* File-level deprecation warning issued from Shapes.h */
namespace Magnum { namespace Shapes {
CORRADE_IGNORE_DEPRECATED_PUSH
namespace Implementation {
template<class> struct ShapeHelper;
}
@ -42,6 +53,14 @@ namespace Implementation {
/**
@brief Object shape
@deprecated The @ref Shapes library is a failed design experiment and is
scheduled for removal in a future release. Related geometry algorithms were
moved to @ref Math::Distance and @ref Math::Intersection; if you need a
full-fledged physics library, please have look at [Bullet](https://bulletphysics.org),
which has Magnum integration in @ref BulletIntegration, or at
[Box2D](https://box2d.org/), which has a @ref examples-box2d "Magnum example"
as well.
Adds shape for collision detection to object. Each Shape is part of
some @ref ShapeGroup, which essentially maintains a set of objects which can
collide with each other. See @ref shapes for brief introduction.
@ -67,7 +86,7 @@ Shapes::AbstractShape3D* firstCollision = shapes.firstCollision(shape);
@see @ref scenegraph, @ref ShapeGroup2D, @ref ShapeGroup3D,
@ref DebugTools::ShapeRenderer
*/
template<class T> class Shape: public AbstractShape<T::Dimensions> {
template<class T> class CORRADE_DEPRECATED("scheduled for removal, see the docs for alternatives") Shape: public AbstractShape<T::Dimensions> {
friend Implementation::ShapeHelper<T>;
public:
@ -152,6 +171,7 @@ namespace Implementation {
static void transform(Shapes::Shape<Composition<dimensions>>& shape, const MatrixTypeFor<dimensions, Float>& absoluteTransformationMatrix);
};
}
CORRADE_IGNORE_DEPRECATED_POP
}}

4
src/Magnum/Shapes/ShapeGroup.cpp

@ -23,12 +23,15 @@
DEALINGS IN THE SOFTWARE.
*/
#define _MAGNUM_DO_NOT_WARN_DEPRECATED_SHAPES
#include "ShapeGroup.h"
#include "Magnum/Shapes/AbstractShape.h"
namespace Magnum { namespace Shapes {
CORRADE_IGNORE_DEPRECATED_PUSH
template<UnsignedInt dimensions> void ShapeGroup<dimensions>::setClean() {
/* Clean all objects */
if(!this->isEmpty()) {
@ -56,5 +59,6 @@ template<UnsignedInt dimensions> AbstractShape<dimensions>* ShapeGroup<dimension
template class MAGNUM_SHAPES_EXPORT ShapeGroup<2>;
template class MAGNUM_SHAPES_EXPORT ShapeGroup<3>;
#endif
CORRADE_IGNORE_DEPRECATED_POP
}}

46
src/Magnum/Shapes/ShapeGroup.h

@ -26,8 +26,16 @@
*/
/** @file
* @brief Class @ref Magnum::Shapes::ShapeGroup, typedef @ref Magnum::Shapes::ShapeGroup2D, @ref Magnum::Shapes::ShapeGroup3D
*/
@brief Class @ref Magnum::Shapes::ShapeGroup, typedef @ref Magnum::Shapes::ShapeGroup2D, @ref Magnum::Shapes::ShapeGroup3D
@deprecated The @ref Magnum::Shapes library is a failed design experiment and
is scheduled for removal in a future release. Related geometry algorithms
were moved to @ref Magnum::Math::Distance and @ref Magnum::Math::Intersection;
if you need a full-fledged physics library, please have look at
[Bullet](https://bulletphysics.org), which has Magnum integration in
@ref Magnum::BulletIntegration, or at [Box2D](https://box2d.org/), which
has a @ref examples-box2d "Magnum example" as well.
*/
#include <vector>
@ -35,15 +43,26 @@
#include "Magnum/Shapes/AbstractShape.h"
#include "Magnum/Shapes/visibility.h"
/* File-level deprecation warning issued from Shapes.h */
namespace Magnum { namespace Shapes {
CORRADE_IGNORE_DEPRECATED_PUSH
/**
@brief Group of shapes
@deprecated The @ref Shapes library is a failed design experiment and is
scheduled for removal in a future release. Related geometry algorithms were
moved to @ref Math::Distance and @ref Math::Intersection; if you need a
full-fledged physics library, please have look at [Bullet](https://bulletphysics.org),
which has Magnum integration in @ref BulletIntegration, or at
[Box2D](https://box2d.org/), which has a @ref examples-box2d "Magnum example"
as well.
See @ref Shape for more information. See @ref shapes for brief introduction.
@see @ref scenegraph, @ref ShapeGroup2D, @ref ShapeGroup3D
*/
template<UnsignedInt dimensions> class MAGNUM_SHAPES_EXPORT ShapeGroup: public SceneGraph::FeatureGroup<dimensions, AbstractShape<dimensions>, Float> {
template<UnsignedInt dimensions> class CORRADE_DEPRECATED("scheduled for removal, see the docs for alternatives") MAGNUM_SHAPES_EXPORT ShapeGroup: public SceneGraph::FeatureGroup<dimensions, AbstractShape<dimensions>, Float> {
friend AbstractShape<dimensions>;
public:
@ -94,18 +113,35 @@ template<UnsignedInt dimensions> class MAGNUM_SHAPES_EXPORT ShapeGroup: public S
/**
@brief Group of two-dimensional shapes
@deprecated The @ref Shapes library is a failed design experiment and is
scheduled for removal in a future release. Related geometry algorithms were
moved to @ref Math::Distance and @ref Math::Intersection; if you need a
full-fledged physics library, please have look at [Bullet](https://bulletphysics.org),
which has Magnum integration in @ref BulletIntegration, or at
[Box2D](https://box2d.org/), which has a @ref examples-box2d "Magnum example"
as well.
See @ref Shape for more information.
@see @ref ShapeGroup3D
*/
typedef ShapeGroup<2> ShapeGroup2D;
typedef CORRADE_DEPRECATED("scheduled for removal, see the docs for alternatives") ShapeGroup<2> ShapeGroup2D;
/**
@brief Group of three-dimensional shapes
@deprecated The @ref Shapes library is a failed design experiment and is
scheduled for removal in a future release. Related geometry algorithms were
moved to @ref Math::Distance and @ref Math::Intersection; if you need a
full-fledged physics library, please have look at [Bullet](https://bulletphysics.org),
which has Magnum integration in @ref BulletIntegration, or at
[Box2D](https://box2d.org/), which has a @ref examples-box2d "Magnum example"
as well.
See @ref Shape for more information.
@see @ref ShapeGroup2D
*/
typedef ShapeGroup<3> ShapeGroup3D;
typedef CORRADE_DEPRECATED("scheduled for removal, see the docs for alternatives") ShapeGroup<3> ShapeGroup3D;
CORRADE_IGNORE_DEPRECATED_POP
}}

109
src/Magnum/Shapes/Shapes.h

@ -26,70 +26,91 @@
*/
/** @file
* @brief Forward declarations for the @ref Magnum::Shapes namespace
*/
@brief Forward declarations for the @ref Magnum::Shapes namespace
@deprecated The @ref Magnum::Shapes library is a failed design experiment and
is scheduled for removal in a future release. Related geometry algorithms
were moved to @ref Magnum::Math::Distance and @ref Magnum::Math::Intersection;
if you need a full-fledged physics library, please have look at
[Bullet](https://bulletphysics.org), which has Magnum integration in
@ref Magnum::BulletIntegration, or at [Box2D](https://box2d.org/), which
has a @ref examples-box2d "Magnum example" as well.
*/
#include <Corrade/Utility/Macros.h>
#include "Magnum/Types.h"
namespace Magnum { namespace Shapes {
#ifndef MAGNUM_BUILD_DEPRECATED
#error the Shapes library is scheduled for removal, see the docs for alternatives
#endif
/* I still have a test for this class and it shouldn't pollute the log there */
#ifndef _MAGNUM_DO_NOT_WARN_DEPRECATED_SHAPES
CORRADE_DEPRECATED_FILE("the Shapes library is scheduled for removal, see the docs for alternatives")
#endif
namespace Magnum { namespace CORRADE_DEPRECATED_NAMESPACE("scheduled for removal, see the docs for alternatives") Shapes {
CORRADE_IGNORE_DEPRECATED_PUSH
#ifndef DOXYGEN_GENERATING_OUTPUT
template<UnsignedInt> class AbstractShape;
typedef AbstractShape<2> AbstractShape2D;
typedef AbstractShape<3> AbstractShape3D;
template<UnsignedInt> class CORRADE_DEPRECATED("scheduled for removal, see the docs for alternatives") AbstractShape;
typedef AbstractShape<2> CORRADE_DEPRECATED("scheduled for removal, see the docs for alternatives") AbstractShape2D;
typedef AbstractShape<3> CORRADE_DEPRECATED("scheduled for removal, see the docs for alternatives") AbstractShape3D;
template<UnsignedInt> class AxisAlignedBox;
typedef AxisAlignedBox<2> AxisAlignedBox2D;
typedef AxisAlignedBox<3> AxisAlignedBox3D;
template<UnsignedInt> class CORRADE_DEPRECATED("scheduled for removal, see the docs for alternatives") AxisAlignedBox;
typedef AxisAlignedBox<2> CORRADE_DEPRECATED("scheduled for removal, see the docs for alternatives") AxisAlignedBox2D;
typedef AxisAlignedBox<3> CORRADE_DEPRECATED("scheduled for removal, see the docs for alternatives") AxisAlignedBox3D;
template<UnsignedInt> class Box;
typedef Box<2> Box2D;
typedef Box<3> Box3D;
template<UnsignedInt> class CORRADE_DEPRECATED("scheduled for removal, see the docs for alternatives") Box;
typedef CORRADE_DEPRECATED("scheduled for removal, see the docs for alternatives") Box<2> Box2D;
typedef CORRADE_DEPRECATED("scheduled for removal, see the docs for alternatives") Box<3> Box3D;
template<UnsignedInt> class Capsule;
typedef Capsule<2> Capsule2D;
typedef Capsule<3> Capsule3D;
template<UnsignedInt> class CORRADE_DEPRECATED("scheduled for removal, see the docs for alternatives") Capsule;
typedef CORRADE_DEPRECATED("scheduled for removal, see the docs for alternatives") Capsule<2> Capsule2D;
typedef CORRADE_DEPRECATED("scheduled for removal, see the docs for alternatives") Capsule<3> Capsule3D;
template<UnsignedInt> class Collision;
typedef Collision<2> Collision2D;
typedef Collision<3> Collision3D;
template<UnsignedInt> class CORRADE_DEPRECATED("scheduled for removal, see the docs for alternatives") Collision;
typedef CORRADE_DEPRECATED("scheduled for removal, see the docs for alternatives") Collision<2> Collision2D;
typedef CORRADE_DEPRECATED("scheduled for removal, see the docs for alternatives") Collision<3> Collision3D;
template<UnsignedInt> class Composition;
typedef Composition<2> Composition2D;
typedef Composition<3> Composition3D;
template<UnsignedInt> class CORRADE_DEPRECATED("scheduled for removal, see the docs for alternatives") Composition;
typedef CORRADE_DEPRECATED("scheduled for removal, see the docs for alternatives") Composition<2> Composition2D;
typedef CORRADE_DEPRECATED("scheduled for removal, see the docs for alternatives") Composition<3> Composition3D;
template<UnsignedInt> class Cylinder;
typedef Cylinder<2> Cylinder2D;
typedef Cylinder<3> Cylinder3D;
template<UnsignedInt> class CORRADE_DEPRECATED("scheduled for removal, see the docs for alternatives") Cylinder;
typedef CORRADE_DEPRECATED("scheduled for removal, see the docs for alternatives") Cylinder<2> Cylinder2D;
typedef CORRADE_DEPRECATED("scheduled for removal, see the docs for alternatives") Cylinder<3> Cylinder3D;
template<UnsignedInt> class Line;
typedef Line<2> Line2D;
typedef Line<3> Line3D;
template<UnsignedInt> class CORRADE_DEPRECATED("scheduled for removal, see the docs for alternatives") Line;
typedef CORRADE_DEPRECATED("scheduled for removal, see the docs for alternatives") Line<2> Line2D;
typedef CORRADE_DEPRECATED("scheduled for removal, see the docs for alternatives") Line<3> Line3D;
template<UnsignedInt> class LineSegment;
typedef LineSegment<2> LineSegment2D;
typedef LineSegment<3> LineSegment3D;
template<UnsignedInt> class CORRADE_DEPRECATED("scheduled for removal, see the docs for alternatives") LineSegment;
typedef CORRADE_DEPRECATED("scheduled for removal, see the docs for alternatives") LineSegment<2> LineSegment2D;
typedef CORRADE_DEPRECATED("scheduled for removal, see the docs for alternatives") LineSegment<3> LineSegment3D;
template<class> class Shape;
template<class> class CORRADE_DEPRECATED("scheduled for removal, see the docs for alternatives") Shape;
template<UnsignedInt> class ShapeGroup;
typedef ShapeGroup<2> ShapeGroup2D;
typedef ShapeGroup<3> ShapeGroup3D;
template<UnsignedInt> class CORRADE_DEPRECATED("scheduled for removal, see the docs for alternatives") ShapeGroup;
typedef CORRADE_DEPRECATED("scheduled for removal, see the docs for alternatives") ShapeGroup<2> ShapeGroup2D;
typedef CORRADE_DEPRECATED("scheduled for removal, see the docs for alternatives") ShapeGroup<3> ShapeGroup3D;
template<UnsignedInt> class Sphere;
typedef Sphere<2> Sphere2D;
typedef Sphere<3> Sphere3D;
template<UnsignedInt> class CORRADE_DEPRECATED("scheduled for removal, see the docs for alternatives") Sphere;
typedef CORRADE_DEPRECATED("scheduled for removal, see the docs for alternatives") Sphere<2> Sphere2D;
typedef CORRADE_DEPRECATED("scheduled for removal, see the docs for alternatives") Sphere<3> Sphere3D;
template<UnsignedInt> class InvertedSphere;
typedef InvertedSphere<2> InvertedSphere2D;
typedef InvertedSphere<3> InvertedSphere3D;
template<UnsignedInt> class CORRADE_DEPRECATED("scheduled for removal, see the docs for alternatives") InvertedSphere;
typedef CORRADE_DEPRECATED("scheduled for removal, see the docs for alternatives") InvertedSphere<2> InvertedSphere2D;
typedef CORRADE_DEPRECATED("scheduled for removal, see the docs for alternatives") InvertedSphere<3> InvertedSphere3D;
class Plane;
class CORRADE_DEPRECATED("scheduled for removal, see the docs for alternatives") Plane;
template<UnsignedInt> class Point;
typedef Point<2> Point2D;
typedef Point<3> Point3D;
template<UnsignedInt> class CORRADE_DEPRECATED("scheduled for removal, see the docs for alternatives") Point;
typedef CORRADE_DEPRECATED("scheduled for removal, see the docs for alternatives") Point<2> Point2D;
typedef CORRADE_DEPRECATED("scheduled for removal, see the docs for alternatives") Point<3> Point3D;
#endif
CORRADE_IGNORE_DEPRECATED_POP
}}

4
src/Magnum/Shapes/Sphere.cpp

@ -23,6 +23,8 @@
DEALINGS IN THE SOFTWARE.
*/
#define _MAGNUM_DO_NOT_WARN_DEPRECATED_SHAPES
#include "Sphere.h"
#include "Magnum/Magnum.h"
@ -35,6 +37,7 @@
namespace Magnum { namespace Shapes {
CORRADE_IGNORE_DEPRECATED_PUSH
template<UnsignedInt dimensions> Sphere<dimensions> Sphere<dimensions>::transformed(const MatrixTypeFor<dimensions, Float>& matrix) const {
return Sphere<dimensions>(matrix.transformPoint(_position), matrix.uniformScaling()*_radius);
}
@ -149,5 +152,6 @@ template class MAGNUM_SHAPES_EXPORT Sphere<3>;
template class MAGNUM_SHAPES_EXPORT InvertedSphere<2>;
template class MAGNUM_SHAPES_EXPORT InvertedSphere<3>;
#endif
CORRADE_IGNORE_DEPRECATED_POP
}}

206
src/Magnum/Shapes/Sphere.h

@ -26,27 +26,46 @@
*/
/** @file
* @brief Class @ref Magnum::Shapes::Sphere, typedef @ref Magnum::Shapes::Sphere2D, @ref Magnum::Shapes::Sphere3D
*/
@brief Class @ref Magnum::Shapes::Sphere, typedef @ref Magnum::Shapes::Sphere2D, @ref Magnum::Shapes::Sphere3D
@deprecated The @ref Magnum::Shapes library is a failed design experiment and
is scheduled for removal in a future release. Related geometry algorithms
were moved to @ref Magnum::Math::Distance and @ref Magnum::Math::Intersection;
if you need a full-fledged physics library, please have look at
[Bullet](https://bulletphysics.org), which has Magnum integration in
@ref Magnum::BulletIntegration, or at [Box2D](https://box2d.org/), which
has a @ref examples-box2d "Magnum example" as well.
*/
#include "Magnum/DimensionTraits.h"
#include "Magnum/Math/Vector3.h"
#include "Magnum/Shapes/Collision.h"
#include "Magnum/Shapes/Shapes.h"
#include "Magnum/Shapes/Collision.h"
#include "Magnum/Shapes/visibility.h"
/* File-level deprecation warning issued from Shapes.h */
namespace Magnum { namespace Shapes {
CORRADE_IGNORE_DEPRECATED_PUSH
/**
@brief Sphere defined by position and radius
@deprecated The @ref Shapes library is a failed design experiment and is
scheduled for removal in a future release. Related geometry algorithms were
moved to @ref Math::Distance and @ref Math::Intersection; if you need a
full-fledged physics library, please have look at [Bullet](https://bulletphysics.org),
which has Magnum integration in @ref BulletIntegration, or at
[Box2D](https://box2d.org/), which has a @ref examples-box2d "Magnum example"
as well.
Unlike other elements the sphere expects uniform scaling. See @ref shapes for
brief introduction.
@see @ref Sphere2D, @ref Sphere3D
@todo Store the radius as squared value to avoid sqrt/pow? Will complicate
collision detection with another sphere.
*/
template<UnsignedInt dimensions> class MAGNUM_SHAPES_EXPORT Sphere {
template<UnsignedInt dimensions> class CORRADE_DEPRECATED("scheduled for removal, see the docs for alternatives") MAGNUM_SHAPES_EXPORT Sphere {
public:
enum: UnsignedInt {
Dimensions = dimensions /**< Dimension count */
@ -104,20 +123,48 @@ template<UnsignedInt dimensions> class MAGNUM_SHAPES_EXPORT Sphere {
Float _radius;
};
/** @brief Two-dimensional sphere */
typedef Sphere<2> Sphere2D;
/**
@brief Two-dimensional sphere
@deprecated The @ref Shapes library is a failed design experiment and is
scheduled for removal in a future release. Related geometry algorithms were
moved to @ref Math::Distance and @ref Math::Intersection; if you need a
full-fledged physics library, please have look at [Bullet](https://bulletphysics.org),
which has Magnum integration in @ref BulletIntegration, or at
[Box2D](https://box2d.org/), which has a @ref examples-box2d "Magnum example"
as well.
*/
typedef CORRADE_DEPRECATED("scheduled for removal, see the docs for alternatives") Sphere<2> Sphere2D;
/** @brief Three-dimensional sphere */
typedef Sphere<3> Sphere3D;
/**
@brief Three-dimensional sphere
@deprecated The @ref Shapes library is a failed design experiment and is
scheduled for removal in a future release. Related geometry algorithms were
moved to @ref Math::Distance and @ref Math::Intersection; if you need a
full-fledged physics library, please have look at [Bullet](https://bulletphysics.org),
which has Magnum integration in @ref BulletIntegration, or at
[Box2D](https://box2d.org/), which has a @ref examples-box2d "Magnum example"
as well.
*/
typedef CORRADE_DEPRECATED("scheduled for removal, see the docs for alternatives") Sphere<3> Sphere3D;
/**
@brief Inverted sphere defined by position and radius
@deprecated The @ref Shapes library is a failed design experiment and is
scheduled for removal in a future release. Related geometry algorithms were
moved to @ref Math::Distance and @ref Math::Intersection; if you need a
full-fledged physics library, please have look at [Bullet](https://bulletphysics.org),
which has Magnum integration in @ref BulletIntegration, or at
[Box2D](https://box2d.org/), which has a @ref examples-box2d "Magnum example"
as well.
Inverted version of @ref Sphere, detecting collisions on the outside, not on
the inside. See @ref shapes for brief introduction.
@see @ref InvertedSphere2D, @ref InvertedSphere3D
*/
template<UnsignedInt dimensions> class MAGNUM_SHAPES_EXPORT InvertedSphere:
template<UnsignedInt dimensions> class CORRADE_DEPRECATED("scheduled for removal, see the docs for alternatives") MAGNUM_SHAPES_EXPORT InvertedSphere:
#ifdef DOXYGEN_GENERATING_OUTPUT
public Sphere<dimensions>
#else
@ -163,35 +210,136 @@ template<UnsignedInt dimensions> class MAGNUM_SHAPES_EXPORT InvertedSphere:
constexpr /*implicit*/ InvertedSphere(const Sphere<dimensions>& other): Sphere<dimensions>(other) {}
};
/** @brief Inverted two-dimensional sphere */
typedef InvertedSphere<2> InvertedSphere2D;
/**
@brief Inverted two-dimensional sphere
@deprecated The @ref Shapes library is a failed design experiment and is
scheduled for removal in a future release. Related geometry algorithms were
moved to @ref Math::Distance and @ref Math::Intersection; if you need a
full-fledged physics library, please have look at [Bullet](https://bulletphysics.org),
which has Magnum integration in @ref BulletIntegration, or at
[Box2D](https://box2d.org/), which has a @ref examples-box2d "Magnum example"
as well.
*/
typedef CORRADE_DEPRECATED("scheduled for removal, see the docs for alternatives") InvertedSphere<2> InvertedSphere2D;
/** @brief Inverted three-dimensional sphere */
typedef InvertedSphere<3> InvertedSphere3D;
/**
@brief Inverted three-dimensional sphere
@deprecated The @ref Shapes library is a failed design experiment and is
scheduled for removal in a future release. Related geometry algorithms were
moved to @ref Math::Distance and @ref Math::Intersection; if you need a
full-fledged physics library, please have look at [Bullet](https://bulletphysics.org),
which has Magnum integration in @ref BulletIntegration, or at
[Box2D](https://box2d.org/), which has a @ref examples-box2d "Magnum example"
as well.
*/
typedef CORRADE_DEPRECATED("scheduled for removal, see the docs for alternatives") InvertedSphere<3> InvertedSphere3D;
/** @collisionoccurenceoperator{Point,Sphere} */
template<UnsignedInt dimensions> inline bool operator%(const Point<dimensions>& a, const Sphere<dimensions>& b) { return b % a; }
/**
@collisionoccurenceoperator{Point,Sphere}
@deprecated The @ref Shapes library is a failed design experiment and is
scheduled for removal in a future release. Related geometry algorithms were
moved to @ref Math::Distance and @ref Math::Intersection; if you need a
full-fledged physics library, please have look at [Bullet](https://bulletphysics.org),
which has Magnum integration in @ref BulletIntegration, or at
[Box2D](https://box2d.org/), which has a @ref examples-box2d "Magnum example"
as well.
*/
template<UnsignedInt dimensions> inline CORRADE_DEPRECATED("scheduled for removal, see the docs for alternatives") bool operator%(const Point<dimensions>& a, const Sphere<dimensions>& b) { return b % a; }
/** @collisionoccurenceoperator{Point,InvertedSphere} */
template<UnsignedInt dimensions> inline bool operator%(const Point<dimensions>& a, const InvertedSphere<dimensions>& b) { return b % a; }
/**
@collisionoccurenceoperator{Point,InvertedSphere}
@deprecated The @ref Shapes library is a failed design experiment and is
scheduled for removal in a future release. Related geometry algorithms were
moved to @ref Math::Distance and @ref Math::Intersection; if you need a
full-fledged physics library, please have look at [Bullet](https://bulletphysics.org),
which has Magnum integration in @ref BulletIntegration, or at
[Box2D](https://box2d.org/), which has a @ref examples-box2d "Magnum example"
as well.
*/
template<UnsignedInt dimensions> inline CORRADE_DEPRECATED("scheduled for removal, see the docs for alternatives") bool operator%(const Point<dimensions>& a, const InvertedSphere<dimensions>& b) { return b % a; }
/** @collisionoperator{Point,Sphere} */
template<UnsignedInt dimensions> inline Collision<dimensions> operator/(const Point<dimensions>& a, const Sphere<dimensions>& b) { return (b/a).flipped(); }
/**
@collisionoperator{Point,Sphere}
@deprecated The @ref Shapes library is a failed design experiment and is
scheduled for removal in a future release. Related geometry algorithms were
moved to @ref Math::Distance and @ref Math::Intersection; if you need a
full-fledged physics library, please have look at [Bullet](https://bulletphysics.org),
which has Magnum integration in @ref BulletIntegration, or at
[Box2D](https://box2d.org/), which has a @ref examples-box2d "Magnum example"
as well.
*/
template<UnsignedInt dimensions> inline CORRADE_DEPRECATED("scheduled for removal, see the docs for alternatives") Collision<dimensions> operator/(const Point<dimensions>& a, const Sphere<dimensions>& b) { return (b/a).flipped(); }
/** @collisionoperator{Point,InvertedSphere} */
template<UnsignedInt dimensions> inline Collision<dimensions> operator/(const Point<dimensions>& a, const InvertedSphere<dimensions>& b) { return (b/a).flipped(); }
/**
@collisionoperator{Point,InvertedSphere}
@deprecated The @ref Shapes library is a failed design experiment and is
scheduled for removal in a future release. Related geometry algorithms were
moved to @ref Math::Distance and @ref Math::Intersection; if you need a
full-fledged physics library, please have look at [Bullet](https://bulletphysics.org),
which has Magnum integration in @ref BulletIntegration, or at
[Box2D](https://box2d.org/), which has a @ref examples-box2d "Magnum example"
as well.
*/
template<UnsignedInt dimensions> inline CORRADE_DEPRECATED("scheduled for removal, see the docs for alternatives") Collision<dimensions> operator/(const Point<dimensions>& a, const InvertedSphere<dimensions>& b) { return (b/a).flipped(); }
/** @collisionoccurenceoperator{Line,Sphere} */
template<UnsignedInt dimensions> inline bool operator%(const Line<dimensions>& a, const Sphere<dimensions>& b) { return b % a; }
/**
@collisionoccurenceoperator{Line,Sphere}
@deprecated The @ref Shapes library is a failed design experiment and is
scheduled for removal in a future release. Related geometry algorithms were
moved to @ref Math::Distance and @ref Math::Intersection; if you need a
full-fledged physics library, please have look at [Bullet](https://bulletphysics.org),
which has Magnum integration in @ref BulletIntegration, or at
[Box2D](https://box2d.org/), which has a @ref examples-box2d "Magnum example"
as well.
*/
template<UnsignedInt dimensions> inline CORRADE_DEPRECATED("scheduled for removal, see the docs for alternatives") bool operator%(const Line<dimensions>& a, const Sphere<dimensions>& b) { return b % a; }
/** @collisionoccurenceoperator{LineSegment,Sphere} */
template<UnsignedInt dimensions> inline bool operator%(const LineSegment<dimensions>& a, const Sphere<dimensions>& b) { return b % a; }
/**
@collisionoccurenceoperator{LineSegment,Sphere}
@deprecated The @ref Shapes library is a failed design experiment and is
scheduled for removal in a future release. Related geometry algorithms were
moved to @ref Math::Distance and @ref Math::Intersection; if you need a
full-fledged physics library, please have look at [Bullet](https://bulletphysics.org),
which has Magnum integration in @ref BulletIntegration, or at
[Box2D](https://box2d.org/), which has a @ref examples-box2d "Magnum example"
as well.
*/
template<UnsignedInt dimensions> inline CORRADE_DEPRECATED("scheduled for removal, see the docs for alternatives") bool operator%(const LineSegment<dimensions>& a, const Sphere<dimensions>& b) { return b % a; }
/** @collisionoccurenceoperator{Sphere,InvertedSphere} */
template<UnsignedInt dimensions> inline bool operator%(const Sphere<dimensions>& a, const InvertedSphere<dimensions>& b) { return b % a; }
/**
@collisionoccurenceoperator{Sphere,InvertedSphere}
@deprecated The @ref Shapes library is a failed design experiment and is
scheduled for removal in a future release. Related geometry algorithms were
moved to @ref Math::Distance and @ref Math::Intersection; if you need a
full-fledged physics library, please have look at [Bullet](https://bulletphysics.org),
which has Magnum integration in @ref BulletIntegration, or at
[Box2D](https://box2d.org/), which has a @ref examples-box2d "Magnum example"
as well.
*/
template<UnsignedInt dimensions> inline CORRADE_DEPRECATED("scheduled for removal, see the docs for alternatives") bool operator%(const Sphere<dimensions>& a, const InvertedSphere<dimensions>& b) { return b % a; }
/** @collisionoperator{Sphere,InvertedSphere} */
template<UnsignedInt dimensions> inline Collision<dimensions> operator/(const Sphere<dimensions>& a, const InvertedSphere<dimensions>& b) { return (b/a).flipped(); }
/**
@collisionoperator{Sphere,InvertedSphere}
@deprecated The @ref Shapes library is a failed design experiment and is
scheduled for removal in a future release. Related geometry algorithms were
moved to @ref Math::Distance and @ref Math::Intersection; if you need a
full-fledged physics library, please have look at [Bullet](https://bulletphysics.org),
which has Magnum integration in @ref BulletIntegration, or at
[Box2D](https://box2d.org/), which has a @ref examples-box2d "Magnum example"
as well.
*/
template<UnsignedInt dimensions> inline CORRADE_DEPRECATED("scheduled for removal, see the docs for alternatives") Collision<dimensions> operator/(const Sphere<dimensions>& a, const InvertedSphere<dimensions>& b) { return (b/a).flipped(); }
CORRADE_IGNORE_DEPRECATED_POP
}}

4
src/Magnum/Shapes/Test/AxisAlignedBoxTest.cpp

@ -23,6 +23,8 @@
DEALINGS IN THE SOFTWARE.
*/
#define _MAGNUM_DO_NOT_WARN_DEPRECATED_SHAPES
#include "Magnum/Math/Matrix4.h"
#include "Magnum/Magnum.h"
#include "Magnum/Shapes/AxisAlignedBox.h"
@ -44,6 +46,7 @@ AxisAlignedBoxTest::AxisAlignedBoxTest() {
&AxisAlignedBoxTest::collisionPoint});
}
CORRADE_IGNORE_DEPRECATED_PUSH
void AxisAlignedBoxTest::transformed() {
const auto box = Shapes::AxisAlignedBox3D({-1.0f, -2.0f, -3.0f}, {1.0f, 2.0f, 3.0f})
.transformed(Matrix4::translation(Vector3(1.0f))*Matrix4::scaling({2.0f, -1.0f, 1.5f}));
@ -59,6 +62,7 @@ void AxisAlignedBoxTest::collisionPoint() {
VERIFY_NOT_COLLIDES(box, point1);
VERIFY_COLLIDES(box, point2);
}
CORRADE_IGNORE_DEPRECATED_POP
}}}

4
src/Magnum/Shapes/Test/BoxTest.cpp

@ -25,6 +25,8 @@
#include <Corrade/TestSuite/Tester.h>
#define _MAGNUM_DO_NOT_WARN_DEPRECATED_SHAPES
#include "Magnum/Magnum.h"
#include "Magnum/Math/Matrix4.h"
#include "Magnum/Shapes/Box.h"
@ -41,11 +43,13 @@ BoxTest::BoxTest() {
addTests({&BoxTest::transformed});
}
CORRADE_IGNORE_DEPRECATED_PUSH
void BoxTest::transformed() {
const auto box = Shapes::Box3D(Matrix4::translation({1.0f, 2.0f, -3.0f}))
.transformed(Matrix4::scaling({2.0f, -1.0f, 1.5f}));
CORRADE_COMPARE(box.transformation(), Matrix4::scaling({2.0f, -1.0f, 1.5f})*Matrix4::translation({1.0f, 2.0f, -3.0f}));
}
CORRADE_IGNORE_DEPRECATED_POP
}}}

4
src/Magnum/Shapes/Test/CapsuleTest.cpp

@ -23,6 +23,8 @@
DEALINGS IN THE SOFTWARE.
*/
#define _MAGNUM_DO_NOT_WARN_DEPRECATED_SHAPES
#include "Magnum/Magnum.h"
#include "Magnum/Math/Matrix3.h"
#include "Magnum/Math/Matrix4.h"
@ -49,6 +51,7 @@ CapsuleTest::CapsuleTest() {
&CapsuleTest::collisionSphere});
}
CORRADE_IGNORE_DEPRECATED_PUSH
void CapsuleTest::transformed() {
const Shapes::Capsule3D capsule({1.0f, 2.0f, 3.0f}, {-1.0f, -2.0f, -3.0f}, 7.0f);
@ -79,6 +82,7 @@ void CapsuleTest::collisionSphere() {
VERIFY_COLLIDES(capsule, sphere1);
VERIFY_NOT_COLLIDES(capsule, sphere2);
}
CORRADE_IGNORE_DEPRECATED_POP
}}}

4
src/Magnum/Shapes/Test/CollisionTest.cpp

@ -25,6 +25,8 @@
#include <Corrade/TestSuite/Tester.h>
#define _MAGNUM_DO_NOT_WARN_DEPRECATED_SHAPES
#include "Magnum/Magnum.h"
#include "Magnum/Shapes/Collision.h"
@ -42,6 +44,7 @@ CollisionTest::CollisionTest() {
&CollisionTest::flipped});
}
CORRADE_IGNORE_DEPRECATED_PUSH
void CollisionTest::boolConversion() {
CORRADE_VERIFY(!Collision3D());
CORRADE_VERIFY(!Collision3D({}, {2.0f, 0.0f, 0.0f}, 0.0f));
@ -55,6 +58,7 @@ void CollisionTest::flipped() {
CORRADE_COMPARE(flipped.separationNormal(), Vector3(-1.0f, 0.0f, 0.0f));
CORRADE_COMPARE(flipped.separationDistance(), 0.5f);
}
CORRADE_IGNORE_DEPRECATED_POP
}}}

4
src/Magnum/Shapes/Test/CompositionTest.cpp

@ -23,6 +23,8 @@
DEALINGS IN THE SOFTWARE.
*/
#define _MAGNUM_DO_NOT_WARN_DEPRECATED_SHAPES
#include "Magnum/Math/Matrix3.h"
#include "Magnum/Math/Matrix4.h"
#include "Magnum/Shapes/Point.h"
@ -62,6 +64,7 @@ CompositionTest::CompositionTest() {
&CompositionTest::transformed});
}
CORRADE_IGNORE_DEPRECATED_PUSH
void CompositionTest::negated() {
const Shapes::Composition2D a = !Shapes::Point2D(Vector2::xAxis(0.5f));
@ -182,6 +185,7 @@ void CompositionTest::transformed() {
CORRADE_COMPARE(b.get<Shapes::AxisAlignedBox2D>(2).min(), Vector2(1.5f, -7.0f));
CORRADE_COMPARE(b.get<Shapes::AxisAlignedBox2D>(2).max(), Vector2(2.0f, -6.5f));
}
CORRADE_IGNORE_DEPRECATED_POP
}}}

4
src/Magnum/Shapes/Test/CylinderTest.cpp

@ -23,6 +23,8 @@
DEALINGS IN THE SOFTWARE.
*/
#define _MAGNUM_DO_NOT_WARN_DEPRECATED_SHAPES
#include "Magnum/Magnum.h"
#include "Magnum/Math/Matrix3.h"
#include "Magnum/Math/Matrix4.h"
@ -49,6 +51,7 @@ CylinderTest::CylinderTest() {
&CylinderTest::collisionSphere});
}
CORRADE_IGNORE_DEPRECATED_PUSH
void CylinderTest::transformed() {
const Shapes::Cylinder3D cylinder({1.0f, 2.0f, 3.0f}, {-1.0f, -2.0f, -3.0f}, 7.0f);
@ -79,6 +82,7 @@ void CylinderTest::collisionSphere() {
VERIFY_COLLIDES(cylinder, sphere1);
VERIFY_NOT_COLLIDES(cylinder, sphere2);
}
CORRADE_IGNORE_DEPRECATED_POP
}}}

4
src/Magnum/Shapes/Test/LineTest.cpp

@ -25,6 +25,8 @@
#include <Corrade/TestSuite/Tester.h>
#define _MAGNUM_DO_NOT_WARN_DEPRECATED_SHAPES
#include "Magnum/Magnum.h"
#include "Magnum/Math/Matrix4.h"
#include "Magnum/Shapes/Line.h"
@ -41,12 +43,14 @@ LineTest::LineTest() {
addTests({&LineTest::transformed});
}
CORRADE_IGNORE_DEPRECATED_PUSH
void LineTest::transformed() {
const auto line = Shapes::Line3D({1.0f, 2.0f, 3.0f}, {-1.0f, -2.0f, -3.0f})
.transformed(Matrix4::rotation(Deg(90.0f), Vector3::zAxis()));
CORRADE_COMPARE(line.a(), Vector3(-2.0f, 1.0f, 3.0f));
CORRADE_COMPARE(line.b(), Vector3(2.0f, -1.0f, -3.0f));
}
CORRADE_IGNORE_DEPRECATED_POP
}}}

4
src/Magnum/Shapes/Test/PlaneTest.cpp

@ -23,6 +23,8 @@
DEALINGS IN THE SOFTWARE.
*/
#define _MAGNUM_DO_NOT_WARN_DEPRECATED_SHAPES
#include "Magnum/Math/Matrix4.h"
#include "Magnum/Shapes/LineSegment.h"
#include "Magnum/Shapes/Point.h"
@ -46,6 +48,7 @@ PlaneTest::PlaneTest() {
&PlaneTest::collisionLineSegment});
}
CORRADE_IGNORE_DEPRECATED_PUSH
void PlaneTest::transformed() {
const Shapes::Plane plane({1.0f, 2.0f, 3.0f}, {Constants::sqrt2(), -Constants::sqrt2(), 0});
@ -76,6 +79,7 @@ void PlaneTest::collisionLineSegment() {
VERIFY_NOT_COLLIDES(plane, line2);
VERIFY_NOT_COLLIDES(plane, line3);
}
CORRADE_IGNORE_DEPRECATED_POP
}}}

4
src/Magnum/Shapes/Test/PointTest.cpp

@ -25,6 +25,8 @@
#include <Corrade/TestSuite/Tester.h>
#define _MAGNUM_DO_NOT_WARN_DEPRECATED_SHAPES
#include "Magnum/Magnum.h"
#include "Magnum/Math/Matrix4.h"
#include "Magnum/Shapes/Point.h"
@ -41,11 +43,13 @@ PointTest::PointTest() {
addTests({&PointTest::transformed});
}
CORRADE_IGNORE_DEPRECATED_PUSH
void PointTest::transformed() {
const auto point = Shapes::Point3D({1.0f, 2.0f, 3.0f})
.transformed(Matrix4::translation({5.0f, 6.0f, 7.0f}));
CORRADE_COMPARE(point.position(), Vector3(6.0f, 8.0f, 10.0f));
}
CORRADE_IGNORE_DEPRECATED_POP
}}}

4
src/Magnum/Shapes/Test/ShapeImplementationTest.cpp

@ -26,6 +26,8 @@
#include <sstream>
#include <Corrade/TestSuite/Tester.h>
#define _MAGNUM_DO_NOT_WARN_DEPRECATED_SHAPES
#include "Magnum/Shapes/shapeImplementation.h"
namespace Magnum { namespace Shapes { namespace Test {
@ -40,6 +42,7 @@ ShapeImplementationTest::ShapeImplementationTest() {
addTests({&ShapeImplementationTest::debug});
}
CORRADE_IGNORE_DEPRECATED_PUSH
void ShapeImplementationTest::debug() {
std::ostringstream o;
Debug(&o) << Implementation::ShapeDimensionTraits<2>::Type::Composition << Implementation::ShapeDimensionTraits<2>::Type(0xbe);
@ -49,6 +52,7 @@ void ShapeImplementationTest::debug() {
Debug(&o) << Implementation::ShapeDimensionTraits<3>::Type::Plane << Implementation::ShapeDimensionTraits<3>::Type(0xbe);
CORRADE_COMPARE(o.str(), "Shapes::Shape3D::Type::Plane Shapes::Shape3D::Type(0xbe)\n");
}
CORRADE_IGNORE_DEPRECATED_POP
}}}

4
src/Magnum/Shapes/Test/ShapeTest.cpp

@ -25,6 +25,8 @@
#include <Corrade/TestSuite/Tester.h>
#define _MAGNUM_DO_NOT_WARN_DEPRECATED_SHAPES
#include "Magnum/Shapes/Composition.h"
#include "Magnum/Shapes/Point.h"
#include "Magnum/Shapes/Shape.h"
@ -59,6 +61,7 @@ ShapeTest::ShapeTest() {
&ShapeTest::shapeGroup});
}
CORRADE_IGNORE_DEPRECATED_PUSH
void ShapeTest::clean() {
Scene3D scene;
ShapeGroup3D shapes;
@ -221,6 +224,7 @@ void ShapeTest::shapeGroup() {
a.setClean();
CORRADE_COMPARE(point.position(), Vector2(5.25f, -1.0f));
}
CORRADE_IGNORE_DEPRECATED_POP
}}}

4
src/Magnum/Shapes/Test/SphereTest.cpp

@ -23,6 +23,8 @@
DEALINGS IN THE SOFTWARE.
*/
#define _MAGNUM_DO_NOT_WARN_DEPRECATED_SHAPES
#include "Magnum/Magnum.h"
#include "Magnum/Math/Matrix3.h"
#include "Magnum/Math/Matrix4.h"
@ -56,6 +58,7 @@ SphereTest::SphereTest() {
&SphereTest::collisionSphereInverted});
}
CORRADE_IGNORE_DEPRECATED_PUSH
void SphereTest::transformed() {
const Shapes::Sphere3D sphere({1.0f, 2.0f, 3.0f}, 7.0f);
@ -171,6 +174,7 @@ void SphereTest::collisionSphereInverted() {
const Shapes::Sphere3D sphere3({1.5f, 2.0f, 3.0f}, 1.0f);
CORRADE_VERIFY(!(sphere%sphere3) && !(sphere/sphere3));
}
CORRADE_IGNORE_DEPRECATED_POP
}}}

4
src/Magnum/Shapes/shapeImplementation.cpp

@ -23,12 +23,15 @@
DEALINGS IN THE SOFTWARE.
*/
#define _MAGNUM_DO_NOT_WARN_DEPRECATED_SHAPES
#include "shapeImplementation.h"
#include <Corrade/Utility/Debug.h>
namespace Magnum { namespace Shapes { namespace Implementation {
CORRADE_IGNORE_DEPRECATED_PUSH
Debug& operator<<(Debug& debug, ShapeDimensionTraits<2>::Type value) {
switch(value) {
/* LCOV_EXCL_START */
@ -77,5 +80,6 @@ template<UnsignedInt dimensions> AbstractShape<dimensions>::AbstractShape() = de
template struct AbstractShape<2>;
template struct AbstractShape<3>;
CORRADE_IGNORE_DEPRECATED_POP
}}}

2
src/Magnum/Shapes/shapeImplementation.h

@ -35,6 +35,7 @@
namespace Magnum { namespace Shapes { namespace Implementation {
CORRADE_IGNORE_DEPRECATED_PUSH
/*
Adding new collision type:
@ -181,6 +182,7 @@ template<class T> struct Shape: AbstractShape<T::Dimensions> {
static_cast<Shape<T>*>(result)->shape = shape.transformed(matrix);
}
};
CORRADE_IGNORE_DEPRECATED_POP
}}}

Loading…
Cancel
Save