From 7dc0f9c3f49beb92246e107f655b97abd640ef22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Tue, 16 Jun 2026 23:27:00 +0200 Subject: [PATCH] DebugTools: deprecate ForceRenderer and ObjectRenderer. "These seemed like a good idea at the time." But that was in 2013 and while that might have been acceptable back then, it's not anymore, it's all just a complex abstraction that prevents any reasonable resource reuse and forces a dedicated draw call for each use. Just do this directly from the corresponding Primitives instead. Deprecating those allows me to eventually deprecate the (also overengineered) ResourceManager class, at which point Magnum should be finally free from the worst design decisions from 15 years ago. Unfortunately several examples still rely on it (while it only makes them more complex, not better), have to wait until those are cleaned up first. --- doc/changelog-old.dox | 2 +- doc/changelog.dox | 21 ++++++--- doc/custom-buildsystems-order.dot | 8 ++-- doc/custom-buildsystems.dox | 5 +- doc/debug-tools.dox | 34 -------------- doc/scenegraph.dox | 9 ++-- doc/snippets/DebugTools-gl.cpp | 39 ++++++++-------- modules/FindMagnum.cmake | 19 ++++---- src/Magnum/DebugTools/CMakeLists.txt | 13 ++++-- src/Magnum/DebugTools/DebugTools.h | 24 ++++++---- src/Magnum/DebugTools/ForceRenderer.cpp | 5 ++ src/Magnum/DebugTools/ForceRenderer.h | 46 +++++++++++++++---- .../ForceRendererTransformation.h | 6 +++ src/Magnum/DebugTools/ObjectRenderer.cpp | 5 ++ src/Magnum/DebugTools/ObjectRenderer.h | 38 +++++++++++---- src/Magnum/DebugTools/Profiler.h | 7 ++- src/Magnum/DebugTools/ResourceManager.cpp | 6 +++ src/Magnum/DebugTools/ResourceManager.h | 26 ++++++++--- src/Magnum/DebugTools/Test/CMakeLists.txt | 6 +-- .../DebugTools/Test/ForceRendererGLTest.cpp | 11 +++++ .../DebugTools/Test/ForceRendererTest.cpp | 1 - .../DebugTools/Test/ObjectRendererGLTest.cpp | 11 +++++ src/MagnumPlugins/MagnumFont/MagnumFont.cpp | 4 ++ 23 files changed, 222 insertions(+), 124 deletions(-) diff --git a/doc/changelog-old.dox b/doc/changelog-old.dox index ec9b66259..da2293e6c 100644 --- a/doc/changelog-old.dox +++ b/doc/changelog-old.dox @@ -1021,7 +1021,7 @@ a high-level overview. - @ref Text::AbstractLayouter has now a virtual destructor to avoid leaking its subclasses - Fixed @ref Trade::ObjImporter on Android -- Fixed assertion when using @ref DebugTools::ObjectRenderer +- Fixed assertion when using @cpp DebugTools::ObjectRenderer @ce - Fixed appearance of `Primitives::Cylinder::solid()` and `Primitives::Circle::solid()` (see [mosra/magnum#197](https://github.com/mosra/magnum/pull/197), [mosra/magnum#220](https://github.com/mosra/magnum/pull/220)) diff --git a/doc/changelog.dox b/doc/changelog.dox index f576b62fb..1de75c114 100644 --- a/doc/changelog.dox +++ b/doc/changelog.dox @@ -1533,6 +1533,13 @@ See also: @ref DebugTools::FrameProfilerGL. The new name plays better with IDE autocompletion and makes the GL-specific class appear next to the API-independent base in alphabetically sorted lists. +- @cpp DebugTools::ForceRenderer @ce, @cpp DebugTools::ObjectRenderer @ce as + well as their @cpp DebugTools::ResourceManager @ce dependency are + deprecated in favor of directly using the @ref Primitives::arrow2D() / + @relativeref{Primitives,axis2D()} or @ref Primitives::arrow3D() / + @relativeref{Primitives,axis3D()} primitives in a custom drawable, which + allows for more flexibility, better resource reuse and improved performance + such as with GPU instancing - List-taking @cpp GL::Shader::compile() @ce and @cpp GL::AbstractShaderProgram::link() @ce functions are deprecated in favor of new @ref GL::Shader::submitCompile(), @@ -1917,7 +1924,7 @@ See also: @cpp Trade::ImporterFileCallbackPolicy::LoadPernament @ce containing a typo, use @ref InputFileCallbackPolicy::LoadPermanent instead - @cpp DebugTools::ForceRendererOptions::scale() @ce, use - @ref DebugTools::ForceRendererOptions::size() instead + @cpp DebugTools::ForceRendererOptions::size() @ce instead - @cpp Math::Color3::Hsv @ce and @cpp Math::Color4::Hsv @ce @ref std::tuple typedefs and @ref Math::Color3::fromHsv() / @ref Math::Color4::fromHsv() overloads taking separate hue, saturation @@ -3685,8 +3692,8 @@ Released 2019-10-24, tagged as @cpp InputFileCallbackPolicy::LoadPernament @ce is deprecated due to a typo, use @ref InputFileCallbackPolicy::LoadPermanent instead. - @cpp DebugTools::ForceRendererOptions::scale() @ce is deprecated in favor - of @ref DebugTools::ForceRendererOptions::size(), as that's more consistent - with the documentation and the corresponding setter. + of @cpp DebugTools::ForceRendererOptions::size() @ce, as that's more + consistent with the documentation and the corresponding setter. - @cpp Text::AbstractFont::openSingleData() @ce and @cpp Text::AbstractFont::openData() @ce taking a list of files are deprecated in favor of @@ -3721,10 +3728,10 @@ Released 2019-10-24, tagged as will print a warning at runtime. Use a constructor without the @p data parameter instead. - The @cpp ResourceManager::instance() @ce singleton (and its implicit use in - @ref DebugTools::ForceRenderer and @ref DebugTools::ObjectRenderer) is - deprecated as it makes some use cases harder than they should be. Make your - own singleton or explicitly pass a @ref ResourceManager reference around - instead. + @cpp DebugTools::ForceRenderer @ce and @cpp DebugTools::ObjectRenderer @ce) + is deprecated as it makes some use cases harder than they should be. Make + your own singleton or explicitly pass a @ref ResourceManager reference + around instead. - @ref Platform::BasicScreen::application() now returns a reference instead of a pointer and together with @ref Platform::BasicScreen::redraw() checks that the screen is actually added to the application instead of returning diff --git a/doc/custom-buildsystems-order.dot b/doc/custom-buildsystems-order.dot index 8bfd02a53..e0d6964b9 100644 --- a/doc/custom-buildsystems-order.dot +++ b/doc/custom-buildsystems-order.dot @@ -71,10 +71,10 @@ digraph "Magnum library dependency order" { MagnumDebugTools -> CorradeTestSuite [style=dotted] MagnumDebugTools -> Magnum MagnumDebugTools -> MagnumGL [style=dotted] - MagnumDebugTools -> MagnumMeshTools [style=dotted] - MagnumDebugTools -> MagnumPrimitives [style=dotted] - MagnumDebugTools -> MagnumShaders [style=dotted] - MagnumDebugTools -> MagnumSceneGraph [style=dotted] + MagnumDebugTools -> MagnumMeshTools [style=dotted class="m-dim"] + MagnumDebugTools -> MagnumPrimitives [style=dotted class="m-dim"] + MagnumDebugTools -> MagnumShaders [style=dotted class="m-dim"] + MagnumDebugTools -> MagnumSceneGraph [style=dotted class="m-dim"] MagnumGL -> Magnum diff --git a/doc/custom-buildsystems.dox b/doc/custom-buildsystems.dox index 001df6785..d5a9d4b9f 100644 --- a/doc/custom-buildsystems.dox +++ b/doc/custom-buildsystems.dox @@ -62,8 +62,9 @@ cyclic dependency marked with a dotted rectangle. Deprecated libraries that are scheduled for removal are marked with a @m_span{m-text m-dim} dim @m_endspan color. In some cases a dependency is optional (marked with a dotted line) and you can remove the dependency by disabling parts or configuration options that -require given dependency. See documentation of each library for more -information. +require given dependency. A dim dotted line is then for an optional dependency +that's only required by deprecated functionality. See documentation of each +library for more information. @todo make this diagram clickable once [the dumpster fire](https://github.com/mosra/m.css/pull/69) is fixed diff --git a/doc/debug-tools.dox b/doc/debug-tools.dox index dae9ff183..f5f7b8e19 100644 --- a/doc/debug-tools.dox +++ b/doc/debug-tools.dox @@ -30,39 +30,5 @@ namespace Magnum { @tableofcontents @m_footernavigation - -@ref DebugTools library provides various helper classes to help you with -prototyping and debugging applications without the need to write too much -common code. They probably have no usage in production code, but can be useful -in development. See documentation of @ref DebugTools namespace for more -information about building and usage with CMake. - -@section debug-tools-renderers Debug renderers - -Debug renderers provide a way to visualize objects and object features in -@ref scenegraph "scene graph" without the need to mess around with meshes and -shaders. They are implemented as object features, so you can attach any number -of them to any object. - -Basic usage involves instancing @ref DebugTools::ResourceManager and keeping it -for the whole lifetime of debug renderers. Next you need some -@ref SceneGraph::DrawableGroup instance. You can use the same group as for the -rest of your scene, but preferably use dedicated one for debug renderers, so -you can easily enable or disable debug rendering. - -Next step is to create configuration for your debug renderers and create -particular debug renderer. The configuration is managed using the resource -manager - you create configuration instance, add it to the manager and then -reference it using particular resource key. This way you can easily share the -same options with more renderers. If no options are specified or resource with -given key doesn't exist, default fallback is used. - -Example usage: visualizing object position, rotation and scaling using -@ref DebugTools::ObjectRenderer : - -@snippet DebugTools-gl.cpp debug-tools-renderers - -See @ref DebugTools::ObjectRenderer and @ref DebugTools::ForceRenderer for more -information. */ } diff --git a/doc/scenegraph.dox b/doc/scenegraph.dox index a88e270d7..df6d8cd03 100644 --- a/doc/scenegraph.dox +++ b/doc/scenegraph.dox @@ -212,10 +212,11 @@ for more detailed information and usage examples: - @ref SceneGraph::Animable "SceneGraph::Animable*D" --- Adds animation functionality to given object. Group of animables can be then controlled using @ref SceneGraph::AnimableGroup "SceneGraph::AnimableGroup*D". -- @ref DebugTools::ObjectRenderer "DebugTools::ObjectRenderer*D", - @ref DebugTools::ForceRenderer "DebugTools::ForceRenderer*D" --- Visualize - object properties, object shape or force vector for debugging purposes. See - @ref debug-tools for more information. +- @ref DebugTools::ObjectRenderer "DebugTools::ObjectRenderer*D" + @m_class{m-label m-danger} **deprecated**, + @ref DebugTools::ForceRenderer "DebugTools::ForceRenderer*D" + @m_class{m-label m-danger} **deprecated** --- Visualize object properties, + object shape or force vector for debugging purposes. Each feature takes a reference to *holder object* in its constructor, so adding a feature to an object might look just like the following, as in some cases you diff --git a/doc/snippets/DebugTools-gl.cpp b/doc/snippets/DebugTools-gl.cpp index 3ef6aca95..3911f7d1c 100644 --- a/doc/snippets/DebugTools-gl.cpp +++ b/doc/snippets/DebugTools-gl.cpp @@ -33,10 +33,7 @@ #include "Magnum/PixelFormat.h" #include "Magnum/DebugTools/ColorMap.h" #include "Magnum/DebugTools/CompareImage.h" -#include "Magnum/DebugTools/ForceRenderer.h" #include "Magnum/DebugTools/FrameProfiler.h" -#include "Magnum/DebugTools/ResourceManager.h" -#include "Magnum/DebugTools/ObjectRenderer.h" #include "Magnum/DebugTools/TextureImage.h" #include "Magnum/GL/Framebuffer.h" #include "Magnum/GL/CubeMapTexture.h" @@ -45,6 +42,7 @@ #include "Magnum/GL/TextureArray.h" #endif #include "Magnum/GL/TextureFormat.h" +#include "Magnum/Math/Color.h" #include "Magnum/Math/Range.h" #include "Magnum/SceneGraph/Drawable.h" #include "Magnum/SceneGraph/Object.h" @@ -57,6 +55,16 @@ #include "Magnum/GL/BufferImage.h" #endif +#ifdef MAGNUM_BUILD_DEPRECATED +#define _MAGNUM_NO_DEPRECATED_FORCERENDERER +#define _MAGNUM_NO_DEPRECATED_OBJECTRENDERER +#define _MAGNUM_NO_DEPRECATED_RESOURCEMANAGER + +#include "Magnum/DebugTools/ForceRenderer.h" +#include "Magnum/DebugTools/ObjectRenderer.h" +#include "Magnum/DebugTools/ResourceManager.h" +#endif + using namespace Magnum; using namespace Magnum::Math::Literals; @@ -65,23 +73,6 @@ using namespace Magnum::Math::Literals; avoid -Wmisssing-prototypes */ void mainDebugTools(); void mainDebugTools() { -{ -SceneGraph::Object* object{}; -/* [debug-tools-renderers] */ -// Global instance of debug resource manager, drawable group for the renderers -DebugTools::ResourceManager manager; -SceneGraph::DrawableGroup3D debugDrawables; - -// Create renderer options which will be referenced later by "my" resource key -manager.set("my", DebugTools::ObjectRendererOptions{}.setSize(0.3f)); - -// Create debug renderer for given object, use "my" options for it. The -// renderer is automatically added to the object features and also to -// specified drawable group. -new DebugTools::ObjectRenderer3D{manager, *object, "my", &debugDrawables}; -/* [debug-tools-renderers] */ -} - #if !(defined(MAGNUM_TARGET_GLES2) && defined(MAGNUM_TARGET_WEBGL)) { /* [ColorMap] */ @@ -99,7 +90,9 @@ colorMapTexture } #endif +#ifdef MAGNUM_BUILD_DEPRECATED { +CORRADE_IGNORE_DEPRECATED_PUSH DebugTools::ResourceManager manager; SceneGraph::Object* object{}; SceneGraph::DrawableGroup3D debugDrawables; @@ -114,7 +107,9 @@ Vector3 force; // taken as a reference, has to be kept in scope new DebugTools::ForceRenderer3D(manager, *object, {0.3f, 1.5f, -0.7f}, force, "my", &debugDrawables); /* [ForceRenderer] */ +CORRADE_IGNORE_DEPRECATED_POP } +#endif #ifndef MAGNUM_TARGET_GLES { @@ -143,8 +138,10 @@ DebugTools::FrameProfiler _profiler{{ } #endif +#ifdef MAGNUM_BUILD_DEPRECATED { SceneGraph::Object* object{}; +CORRADE_IGNORE_DEPRECATED_PUSH /* [ObjectRenderer] */ DebugTools::ResourceManager manager; SceneGraph::DrawableGroup3D debugDrawables; @@ -155,7 +152,9 @@ manager.set("my", DebugTools::ObjectRendererOptions{}.setSize(0.3f)); // Create debug renderer for given object, use "my" options for it new DebugTools::ObjectRenderer3D{manager, *object, "my", &debugDrawables}; /* [ObjectRenderer] */ +CORRADE_IGNORE_DEPRECATED_POP } +#endif { /* [FrameProfilerGL-usage] */ diff --git a/modules/FindMagnum.cmake b/modules/FindMagnum.cmake index 5c7f7a017..02b64016d 100644 --- a/modules/FindMagnum.cmake +++ b/modules/FindMagnum.cmake @@ -455,16 +455,19 @@ set(_MAGNUM_Audio_DEPENDENCIES ) # compiled at all. set(_MAGNUM_DebugTools_DEPENDENCIES Trade) set(_MAGNUM_DebugTools_Trade_DEPENDENCY_IS_OPTIONAL ON) -# MeshTools, Primitives, SceneGraph and Shaders are used only for GL renderers -# in DebugTools. All of this is optional, compiled in only if the base library -# was selected. if(MAGNUM_TARGET_GL) - list(APPEND _MAGNUM_DebugTools_DEPENDENCIES MeshTools Primitives SceneGraph Shaders 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) + list(APPEND _MAGNUM_DebugTools_DEPENDENCIES GL) set(_MAGNUM_DebugTools_GL_DEPENDENCY_IS_OPTIONAL ON) + # MeshTools, Primitives, SceneGraph and Shaders are used only for + # (deprecated) GL renderers in DebugTools. All of this is optional, + # compiled in only if the base library was selected. + if(MAGNUM_BUILD_DEPRECATED) + list(APPEND _MAGNUM_DebugTools_DEPENDENCIES MeshTools Primitives SceneGraph Shaders) + 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) + endif() endif() set(_MAGNUM_MaterialTools_DEPENDENCIES Trade) diff --git a/src/Magnum/DebugTools/CMakeLists.txt b/src/Magnum/DebugTools/CMakeLists.txt index 280af12a2..cf5313198 100644 --- a/src/Magnum/DebugTools/CMakeLists.txt +++ b/src/Magnum/DebugTools/CMakeLists.txt @@ -51,17 +51,20 @@ endif() if(MAGNUM_TARGET_GL) list(APPEND MagnumDebugTools_SRCS - ResourceManager.cpp Screenshot.cpp) list(APPEND MagnumDebugTools_GracefulAssert_SRCS TextureImage.cpp) list(APPEND MagnumDebugTools_HEADERS - ResourceManager.h Screenshot.h TextureImage.h) + if(MAGNUM_BUILD_DEPRECATED) + list(APPEND MagnumDebugTools_SRCS ResourceManager.cpp) + list(APPEND MagnumDebugTools_HEADERS ResourceManager.h) + endif() + if(MAGNUM_TARGET_GLES AND NOT MAGNUM_TARGET_GLES2) corrade_add_resource(MagnumDebugTools_RESOURCES resources.conf) list(APPEND MagnumDebugTools_SRCS ${MagnumDebugTools_RESOURCES}) @@ -83,7 +86,7 @@ if(MAGNUM_TARGET_GL) BufferData.h) endif() - if(MAGNUM_WITH_SCENEGRAPH) + if(MAGNUM_BUILD_DEPRECATED AND MAGNUM_WITH_SCENEGRAPH) list(APPEND MagnumDebugTools_SRCS ForceRenderer.cpp ObjectRenderer.cpp) @@ -145,7 +148,7 @@ if(Corrade_TestSuite_FOUND AND MAGNUM_WITH_TRADE) endif() if(MAGNUM_TARGET_GL) target_link_libraries(MagnumDebugTools PUBLIC MagnumGL) - if(MAGNUM_WITH_SCENEGRAPH) + if(MAGNUM_BUILD_DEPRECATED AND MAGNUM_WITH_SCENEGRAPH) target_link_libraries(MagnumDebugTools PUBLIC MagnumMeshTools MagnumPrimitives @@ -179,7 +182,7 @@ if(MAGNUM_BUILD_TESTS) endif() if(MAGNUM_TARGET_GL) target_link_libraries(MagnumDebugToolsTestLib PUBLIC MagnumGL) - if(MAGNUM_WITH_SCENEGRAPH) + if(MAGNUM_BUILD_DEPRECATED AND MAGNUM_WITH_SCENEGRAPH) target_link_libraries(MagnumDebugToolsTestLib PUBLIC MagnumMeshTools MagnumPrimitives diff --git a/src/Magnum/DebugTools/DebugTools.h b/src/Magnum/DebugTools/DebugTools.h index 3146b573d..dd4f86a98 100644 --- a/src/Magnum/DebugTools/DebugTools.h +++ b/src/Magnum/DebugTools/DebugTools.h @@ -50,17 +50,23 @@ class FrameProfilerGL; typedef CORRADE_DEPRECATED("use FrameProfilerGL instead") FrameProfilerGL GLFrameProfiler; #endif -template class ForceRenderer; -typedef ForceRenderer<2> ForceRenderer2D; -typedef ForceRenderer<3> ForceRenderer3D; -class ForceRendererOptions; +#ifdef MAGNUM_BUILD_DEPRECATED +template class CORRADE_DEPRECATED("use Primitives::arrow2D() or arrow3D() in a custom drawable instead") ForceRenderer; +CORRADE_IGNORE_DEPRECATED_PUSH /* MSVC warns here */ +typedef CORRADE_DEPRECATED("use Primitives::arrow2D() in a custom drawable instead") ForceRenderer<2> ForceRenderer2D; +typedef CORRADE_DEPRECATED("use Primitives::arrow3D() in a custom drawable instead") ForceRenderer<3> ForceRenderer3D; +CORRADE_IGNORE_DEPRECATED_POP +class CORRADE_DEPRECATED("use Primitives::arrow2D() or arrow3D() in a custom drawable instead") ForceRendererOptions; -template class ObjectRenderer; -typedef ObjectRenderer<2> ObjectRenderer2D; -typedef ObjectRenderer<3> ObjectRenderer3D; -class ObjectRendererOptions; +template class CORRADE_DEPRECATED("use Primitives::axis2D() or axis3D() in a custom drawable instead") ObjectRenderer; +CORRADE_IGNORE_DEPRECATED_PUSH /* MSVC warns here */ +typedef CORRADE_DEPRECATED("use Primitives::axis2D() in a custom drawable instead") ObjectRenderer<2> ObjectRenderer2D; +typedef CORRADE_DEPRECATED("use Primitives::axis3D() in a custom drawable instead") ObjectRenderer<3> ObjectRenderer3D; +CORRADE_IGNORE_DEPRECATED_POP +class CORRADE_DEPRECATED("use Primitives::axis2D() or axis3D() in a custom drawable instead") ObjectRendererOptions; -class ResourceManager; +class CORRADE_DEPRECATED("use Primitives::arrow2D() / axis2D or arrow3D() / axis3D() in a custom drawable instead") ResourceManager; +#endif #endif }} diff --git a/src/Magnum/DebugTools/ForceRenderer.cpp b/src/Magnum/DebugTools/ForceRenderer.cpp index 54ad808aa..87410efda 100644 --- a/src/Magnum/DebugTools/ForceRenderer.cpp +++ b/src/Magnum/DebugTools/ForceRenderer.cpp @@ -24,6 +24,9 @@ DEALINGS IN THE SOFTWARE. */ +#define _MAGNUM_NO_DEPRECATED_FORCERENDERER +#define _MAGNUM_NO_DEPRECATED_RESOURCEMANAGER + #include "ForceRenderer.h" #include "Magnum/GL/Mesh.h" @@ -35,6 +38,7 @@ namespace Magnum { namespace DebugTools { +CORRADE_IGNORE_DEPRECATED_PUSH namespace { template ResourceKey shaderKey(); @@ -89,5 +93,6 @@ template void ForceRenderer::draw(const Matr template class MAGNUM_DEBUGTOOLS_EXPORT ForceRenderer<2>; template class MAGNUM_DEBUGTOOLS_EXPORT ForceRenderer<3>; +CORRADE_IGNORE_DEPRECATED_POP }} diff --git a/src/Magnum/DebugTools/ForceRenderer.h b/src/Magnum/DebugTools/ForceRenderer.h index 6e5158c99..5e70ab0a8 100644 --- a/src/Magnum/DebugTools/ForceRenderer.h +++ b/src/Magnum/DebugTools/ForceRenderer.h @@ -26,15 +26,18 @@ DEALINGS IN THE SOFTWARE. */ -#ifdef MAGNUM_TARGET_GL +#if defined(MAGNUM_BUILD_DEPRECATED) && defined(MAGNUM_TARGET_GL) /** @file * @brief Class @ref Magnum::DebugTools::ForceRenderer, @ref Magnum::DebugTools::ForceRendererOptions, typedef @ref Magnum::DebugTools::ForceRenderer2D, @ref Magnum::DebugTools::ForceRenderer3D + * @m_deprecated_since_latest Use @ref Magnum/Primitives/Arrow.h and + * @ref Primitives::arrow2D() or @relativeref{Primitives,arrow3D()} in a + * custom drawable instead */ #endif #include "Magnum/configure.h" -#ifdef MAGNUM_TARGET_GL +#if defined(MAGNUM_BUILD_DEPRECATED) && defined(MAGNUM_TARGET_GL) #include "Magnum/Resource.h" #include "Magnum/DebugTools/DebugTools.h" #include "Magnum/DebugTools/visibility.h" @@ -43,10 +46,16 @@ #include "Magnum/SceneGraph/Drawable.h" #include "Magnum/Shaders/Shaders.h" +#ifndef _MAGNUM_NO_DEPRECATED_FORCERENDERER +CORRADE_DEPRECATED_FILE("use Magnum/Primitives/Arrow.h and Primitives::arrow2D() or arrow3D() in a custom drawable instead") +#endif + namespace Magnum { namespace DebugTools { /** @brief Force renderer options +@m_deprecated_since_latest Use @ref Primitives::arrow2D() or + @relativeref{Primitives,arrow3D()} in a custom drawable instead See @ref ForceRenderer documentation for more information. @@ -54,7 +63,7 @@ See @ref ForceRenderer documentation for more information. @ref MAGNUM_TARGET_GL "TARGET_GL" and `MAGNUM_WITH_SCENEGRAPH` enabled (done by default). See @ref building-features for more information. */ -class ForceRendererOptions { +class CORRADE_DEPRECATED("use Primitives::arrow2D() or arrow3D() in a custom drawable instead") ForceRendererOptions { public: constexpr ForceRendererOptions(): _color(1.0f), _size(1.0f) {} @@ -67,10 +76,12 @@ class ForceRendererOptions { * * Default is @cpp 0xffffffff_rgbaf @ce. */ + CORRADE_IGNORE_DEPRECATED_PUSH /* GCC 4.8 warns due to the return type */ ForceRendererOptions& setColor(const Color4& color) { _color = color; return *this; } + CORRADE_IGNORE_DEPRECATED_POP /** @brief Size of rendered arrow */ constexpr Float size() const { return _size; } @@ -81,10 +92,12 @@ class ForceRendererOptions { * * Default is @cpp 1.0f @ce. */ + CORRADE_IGNORE_DEPRECATED_PUSH /* GCC 4.8 warns due to the return type */ ForceRendererOptions& setSize(Float size) { _size = size; return *this; } + CORRADE_IGNORE_DEPRECATED_POP private: Color4 _color; @@ -93,9 +106,10 @@ class ForceRendererOptions { /** @brief Force renderer +@m_deprecated_since_latest Use @ref Primitives::arrow2D() or + @relativeref{Primitives,arrow3D()} in a custom drawable instead Visualizes force pushing on object by an arrow of the same direction and size. -See @ref debug-tools-renderers for more information. @section DebugTools-ForceRenderer-usage Basic usage @@ -113,7 +127,7 @@ to it. @see @ref ForceRenderer2D, @ref ForceRenderer3D, @ref ForceRendererOptions */ -template class ForceRenderer: public SceneGraph::Drawable { +template class CORRADE_DEPRECATED("use Primitives::arrow2D() or arrow3D() in a custom drawable instead") ForceRenderer: public SceneGraph::Drawable { public: /** * @brief Constructor @@ -126,13 +140,17 @@ template class ForceRenderer: public SceneGraph::Drawabl * more information. * @param drawables Drawable group */ + CORRADE_IGNORE_DEPRECATED_PUSH /* GCC 4.8 warns due to the argument */ explicit ForceRenderer(ResourceManager& manager, SceneGraph::AbstractObject& object, const VectorTypeFor& forcePosition, const VectorTypeFor& force, ResourceKey options = ResourceKey(), SceneGraph::DrawableGroup* drawables = nullptr); + CORRADE_IGNORE_DEPRECATED_POP /** * You have to pass a reference to an external force vector --- the * renderer doesn't store a copy. */ + CORRADE_IGNORE_DEPRECATED_PUSH /* GCC 4.8 warns due to the argument */ explicit ForceRenderer(ResourceManager&, SceneGraph::AbstractObject&, const VectorTypeFor&, VectorTypeFor&&, ResourceKey = ResourceKey(), SceneGraph::DrawableGroup* = nullptr) = delete; + CORRADE_IGNORE_DEPRECATED_POP ~ForceRenderer(); @@ -142,31 +160,43 @@ template class ForceRenderer: public SceneGraph::Drawabl const VectorTypeFor _forcePosition; const VectorTypeFor& _force; + CORRADE_IGNORE_DEPRECATED_PUSH /* GCC 4.8 warns due to the type */ Resource _options; + CORRADE_IGNORE_DEPRECATED_POP Resource> _shader; Resource _mesh; }; /** @brief Two-dimensional force renderer +@m_deprecated_since_latest Use @ref Primitives::arrow2D() or + @relativeref{Primitives,arrow3D()} in a custom drawable instead @note This typedef is available only if Magnum is compiled with @ref MAGNUM_TARGET_GL enabled (done by default). See @ref building-features for more information. */ -typedef ForceRenderer<2> ForceRenderer2D; +CORRADE_IGNORE_DEPRECATED_PUSH /* MSVC warns here */ +typedef CORRADE_DEPRECATED("use Primitives::arrow2D() in a custom drawable instead") ForceRenderer<2> ForceRenderer2D; +CORRADE_IGNORE_DEPRECATED_POP /** @brief Three-dimensional force renderer +@m_deprecated_since_latest Use @ref Primitives::arrow2D() or + @relativeref{Primitives,arrow3D()} in a custom drawable instead @note This typedef is available only if Magnum is compiled with @ref MAGNUM_TARGET_GL enabled (done by default). See @ref building-features for more information. */ -typedef ForceRenderer<3> ForceRenderer3D; +CORRADE_IGNORE_DEPRECATED_PUSH /* MSVC warns here */ +typedef CORRADE_DEPRECATED("use Primitives::arrow3D() in a custom drawable instead") ForceRenderer<3> ForceRenderer3D; +CORRADE_IGNORE_DEPRECATED_POP }} -#else +#elif !defined(MAGNUM_BUILD_DEPRECATED) +#error use Magnum/Primitives/Arrow.h and Primitives::arrow2D() or arrow3D() in a custom drawable instead +#elif !defined(MAGNUM_TARGET_GL) #error this header is available only in the OpenGL build #endif diff --git a/src/Magnum/DebugTools/Implementation/ForceRendererTransformation.h b/src/Magnum/DebugTools/Implementation/ForceRendererTransformation.h index 69d6d06d2..42ca1c6e3 100644 --- a/src/Magnum/DebugTools/Implementation/ForceRendererTransformation.h +++ b/src/Magnum/DebugTools/Implementation/ForceRendererTransformation.h @@ -26,6 +26,9 @@ DEALINGS IN THE SOFTWARE. */ +#include "Magnum/configure.h" + +#ifdef MAGNUM_BUILD_DEPRECATED #include "Magnum/DimensionTraits.h" #include "Magnum/Magnum.h" #include "Magnum/Math/Functions.h" @@ -66,5 +69,8 @@ template<> Matrix4 forceRendererTransformation<3>(const Vector3& forcePosition, } }}} +#else +#error this header is only meant to be used by deprecated functionality +#endif #endif diff --git a/src/Magnum/DebugTools/ObjectRenderer.cpp b/src/Magnum/DebugTools/ObjectRenderer.cpp index aea922896..57b5d7bb5 100644 --- a/src/Magnum/DebugTools/ObjectRenderer.cpp +++ b/src/Magnum/DebugTools/ObjectRenderer.cpp @@ -24,6 +24,9 @@ DEALINGS IN THE SOFTWARE. */ +#define _MAGNUM_NO_DEPRECATED_OBJECTRENDERER +#define _MAGNUM_NO_DEPRECATED_RESOURCEMANAGER + #include "ObjectRenderer.h" #include "Magnum/DebugTools/ResourceManager.h" @@ -36,6 +39,7 @@ namespace Magnum { namespace DebugTools { +CORRADE_IGNORE_DEPRECATED_PUSH namespace { template struct Renderer; @@ -74,5 +78,6 @@ template void ObjectRenderer::draw(const Mat template class MAGNUM_DEBUGTOOLS_EXPORT ObjectRenderer<2>; template class MAGNUM_DEBUGTOOLS_EXPORT ObjectRenderer<3>; +CORRADE_IGNORE_DEPRECATED_POP }} diff --git a/src/Magnum/DebugTools/ObjectRenderer.h b/src/Magnum/DebugTools/ObjectRenderer.h index 9120812d3..608e93dfd 100644 --- a/src/Magnum/DebugTools/ObjectRenderer.h +++ b/src/Magnum/DebugTools/ObjectRenderer.h @@ -26,9 +26,12 @@ DEALINGS IN THE SOFTWARE. */ -#ifdef MAGNUM_TARGET_GL +#if defined(MAGNUM_BUILD_DEPRECATED) && defined(MAGNUM_TARGET_GL) /** @file * @brief Class @ref Magnum::DebugTools::ObjectRenderer, @ref Magnum::DebugTools::ObjectRendererOptions, typedef @ref Magnum::DebugTools::ObjectRenderer2D, @ref Magnum::DebugTools::ObjectRenderer3D + * @m_deprecated_since_latest Use @ref Magnum/Primitives/Axis.h and + * @ref Primitives::axis2D() or @relativeref{Primitives,axis3D()} in a + * custom drawable instead */ #endif @@ -42,10 +45,16 @@ #include "Magnum/SceneGraph/Drawable.h" #include "Magnum/Shaders/Shaders.h" +#ifndef _MAGNUM_NO_DEPRECATED_OBJECTRENDERER +CORRADE_DEPRECATED_FILE("use Magnum/Primitives/Axis.h and Primitives::axis2D() or axis3D() in a custom drawable instead") +#endif + namespace Magnum { namespace DebugTools { /** @brief Object renderer options +@m_deprecated_since_latest Use @ref Primitives::axis2D() or + @relativeref{Primitives,axis3D()} in a custom drawable instead See @ref ObjectRenderer documentation for more information. @@ -53,7 +62,7 @@ See @ref ObjectRenderer documentation for more information. @ref MAGNUM_TARGET_GL "TARGET_GL" and `MAGNUM_WITH_SCENEGRAPH` enabled (done by default). See @ref building-features for more information. */ -class ObjectRendererOptions { +class CORRADE_DEPRECATED("use Primitives::axis2D() or axis3D() in a custom drawable instead") ObjectRendererOptions { public: constexpr ObjectRendererOptions(): _size(1.0f) {} @@ -66,10 +75,12 @@ class ObjectRendererOptions { * * Default is @cpp 1.0f @ce. */ + CORRADE_IGNORE_DEPRECATED_PUSH /* GCC 4.8 warns due to the return type */ ObjectRendererOptions& setSize(Float size) { _size = size; return *this; } + CORRADE_IGNORE_DEPRECATED_POP private: Float _size; @@ -77,9 +88,10 @@ class ObjectRendererOptions { /** @brief Object renderer +@m_deprecated_since_latest Use @ref Primitives::axis2D() or + @relativeref{Primitives,axis3D()} in a custom drawable instead -Visualizes object position, rotation and scale using colored axes. See -@ref debug-tools-renderers for more information. +Visualizes object position, rotation and scale using colored axes. @section DebugTools-ObjectRenderer-usage Basic usage @@ -93,7 +105,7 @@ Example code: @see @ref ObjectRenderer2D, @ref ObjectRenderer3D, @ref ObjectRendererOptions */ -template class ObjectRenderer: public SceneGraph::Drawable { +template class CORRADE_DEPRECATED("use Primitives::axis2D() or axis3D() in a custom drawable instead") ObjectRenderer: public SceneGraph::Drawable { public: /** * @brief Constructor @@ -106,14 +118,18 @@ template class ObjectRenderer: public SceneGraph::Drawab * * The renderer is automatically added to object's features. */ + CORRADE_IGNORE_DEPRECATED_PUSH /* GCC 4.8 warns due to the argument */ explicit ObjectRenderer(ResourceManager& manager, SceneGraph::AbstractObject& object, ResourceKey options = ResourceKey(), SceneGraph::DrawableGroup* drawables = nullptr); + CORRADE_IGNORE_DEPRECATED_POP ~ObjectRenderer(); private: void draw(const MatrixTypeFor& transformationMatrix, SceneGraph::Camera& camera) override; + CORRADE_IGNORE_DEPRECATED_PUSH /* GCC 4.8 warns due to the type */ Resource _options; + CORRADE_IGNORE_DEPRECATED_POP Resource> _shader; Resource _mesh; }; @@ -125,7 +141,9 @@ template class ObjectRenderer: public SceneGraph::Drawab @ref MAGNUM_TARGET_GL enabled (done by default). See @ref building-features for more information. */ -typedef ObjectRenderer<2> ObjectRenderer2D; +CORRADE_IGNORE_DEPRECATED_PUSH /* MSVC warns here */ +typedef CORRADE_DEPRECATED("use Primitives::axis2D() in a custom drawable instead") ObjectRenderer<2> ObjectRenderer2D; +CORRADE_IGNORE_DEPRECATED_POP /** @brief Three-dimensional object renderer @@ -134,10 +152,14 @@ typedef ObjectRenderer<2> ObjectRenderer2D; @ref MAGNUM_TARGET_GL enabled (done by default). See @ref building-features for more information. */ -typedef ObjectRenderer<3> ObjectRenderer3D; +CORRADE_IGNORE_DEPRECATED_PUSH /* MSVC warns here */ +typedef CORRADE_DEPRECATED("use Primitives::axis3D() in a custom drawable instead") ObjectRenderer<3> ObjectRenderer3D; +CORRADE_IGNORE_DEPRECATED_POP }} -#else +#elif !defined(MAGNUM_BUILD_DEPRECATED) +#error use Magnum/Primitives/Axis.h and Primitives::axis2D() or axis3D() in a custom drawable instead +#elif !defined(MAGNUM_TARGET_GL) #error this header is available only in the OpenGL build #endif diff --git a/src/Magnum/DebugTools/Profiler.h b/src/Magnum/DebugTools/Profiler.h index 28ab1733a..28ca5020e 100644 --- a/src/Magnum/DebugTools/Profiler.h +++ b/src/Magnum/DebugTools/Profiler.h @@ -29,9 +29,8 @@ #ifdef MAGNUM_BUILD_DEPRECATED /** @file * @brief Class @ref Magnum::DebugTools::Profiler - * @m_deprecated_since{2020,06} Obsolete, use - * @ref Magnum/DebugTools/FrameProfiler.h and the - * @ref Magnum::DebugTools::FrameProfiler class instead. + * @m_deprecated_since{2020,06} Use @ref Magnum/DebugTools/FrameProfiler.h and + * the @ref Magnum::DebugTools::FrameProfiler class instead. */ #endif @@ -55,7 +54,7 @@ namespace Magnum { namespace DebugTools { /** @brief Profiler -@m_deprecated_since{2020,06} Obsolete, use @ref FrameProfiler instead. +@m_deprecated_since{2020,06} Use @ref FrameProfiler instead. Measures time passed during specified sections of each frame. It's meant to be used in rendering and event loops (e.g. @ref Platform::Sdl2Application::drawEvent()), diff --git a/src/Magnum/DebugTools/ResourceManager.cpp b/src/Magnum/DebugTools/ResourceManager.cpp index 1c49683ff..c38d47006 100644 --- a/src/Magnum/DebugTools/ResourceManager.cpp +++ b/src/Magnum/DebugTools/ResourceManager.cpp @@ -24,6 +24,10 @@ DEALINGS IN THE SOFTWARE. */ +#define _MAGNUM_NO_DEPRECATED_FORCERENDERER +#define _MAGNUM_NO_DEPRECATED_OBJECTRENDERER +#define _MAGNUM_NO_DEPRECATED_RESOURCEMANAGER + #include "ResourceManager.h" #include "Magnum/DebugTools/ForceRenderer.h" @@ -36,8 +40,10 @@ namespace Magnum { namespace DebugTools { ResourceManager::ResourceManager() { + CORRADE_IGNORE_DEPRECATED_PUSH /* GCC 4.8 warns here */ setFallback(new ForceRendererOptions); setFallback(new ObjectRendererOptions); + CORRADE_IGNORE_DEPRECATED_POP } ResourceManager::~ResourceManager() = default; diff --git a/src/Magnum/DebugTools/ResourceManager.h b/src/Magnum/DebugTools/ResourceManager.h index 63cbf2015..f7060a403 100644 --- a/src/Magnum/DebugTools/ResourceManager.h +++ b/src/Magnum/DebugTools/ResourceManager.h @@ -26,15 +26,19 @@ DEALINGS IN THE SOFTWARE. */ -#ifdef MAGNUM_TARGET_GL +#if defined(MAGNUM_BUILD_DEPRECATED) && defined(MAGNUM_TARGET_GL) /** @file * @brief Class @ref Magnum::DebugTools::ResourceManager + * @m_deprecated_since_latest Use @ref Magnum/Primitives/Arrow.h / + * @ref Magnum/Primitives/Axis.h and @ref Primitives::arrow2D() / + * @relativeref{Primitives,axis2D()} or @relativeref{Primitives,arrow3D()} + * / @relativeref{Primitives,axis3D()} in a custom drawable instead */ #endif #include "Magnum/configure.h" -#ifdef MAGNUM_TARGET_GL +#if defined(MAGNUM_BUILD_DEPRECATED) && defined(MAGNUM_TARGET_GL) #include "Magnum/ResourceManager.h" #include "Magnum/Magnum.h" @@ -43,8 +47,7 @@ #include "Magnum/GL/GL.h" #include "Magnum/SceneGraph/SceneGraph.h" -/** @todo fix this better */ -#ifdef CORRADE_TARGET_MSVC /* This is not a bug, this is a feature :( Not even /permissive- helps. */ +#ifdef CORRADE_TARGET_MSVC #include "Magnum/DebugTools/ForceRenderer.h" #include "Magnum/DebugTools/ObjectRenderer.h" #include "Magnum/GL/AbstractShaderProgram.h" @@ -53,10 +56,17 @@ #include "Magnum/GL/MeshView.h" #endif +#ifndef _MAGNUM_NO_DEPRECATED_RESOURCEMANAGER +CORRADE_DEPRECATED_FILE("use Magnum/Primitives/Arrow.h / Magnum/Primitives/Axis.h and Primitives::arrow2D() / axis2D() or arrow3D() / axis3D() in a custom drawable instead") +#endif + namespace Magnum { namespace DebugTools { /** @brief Resource manager for debug tools +@m_deprecated_since_latest Use @ref Primitives::arrow2D() / + @relativeref{Primitives,axis2D()} or @relativeref{Primitives,arrow3D()} / + @relativeref{Primitives,axis3D()} in a custom drawable instead Stores various data used by debug renderers. See @ref debug-tools for more information. @@ -65,13 +75,17 @@ information. @ref MAGNUM_TARGET_GL "TARGET_GL" enabled (done by default). See @ref building-features for more information. */ -class MAGNUM_DEBUGTOOLS_EXPORT ResourceManager: public Magnum::ResourceManager +CORRADE_IGNORE_DEPRECATED_PUSH /* GCC 4.8 warns due to the base types */ +class CORRADE_DEPRECATED("use Primitives::arrow2D() / axis2D or arrow3D() / axis3D() in a custom drawable instead") MAGNUM_DEBUGTOOLS_EXPORT ResourceManager: public Magnum::ResourceManager { public: explicit ResourceManager(); ~ResourceManager(); }; -#else +CORRADE_IGNORE_DEPRECATED_POP +#elif !defined(MAGNUM_BUILD_DEPRECATED) +#error use Magnum/Primitives/Arrow.h / Magnum/Primitives/Axis.h and Primitives::arrow2D() / axis2D() or arrow3D() / axis3D() in a custom drawable instead +#elif !defined(MAGNUM_TARGET_GL) #error this header is available only in the OpenGL build #endif diff --git a/src/Magnum/DebugTools/Test/CMakeLists.txt b/src/Magnum/DebugTools/Test/CMakeLists.txt index 227e1d5bd..4880203cd 100644 --- a/src/Magnum/DebugTools/Test/CMakeLists.txt +++ b/src/Magnum/DebugTools/Test/CMakeLists.txt @@ -106,13 +106,13 @@ if(MAGNUM_WITH_TRADE) endif() if(MAGNUM_TARGET_GL) - if(MAGNUM_WITH_SCENEGRAPH) + if(MAGNUM_BUILD_DEPRECATED AND MAGNUM_WITH_SCENEGRAPH) corrade_add_test(DebugToolsForceRendererTest ForceRendererTest.cpp LIBRARIES MagnumMathTestLib) endif() if(MAGNUM_BUILD_GL_TESTS) corrade_add_test(DebugToolsFrameProfilerGLTest FrameProfilerGLTest.cpp - LIBRARIES MagnumDebugTools MagnumOpenGLTester) + LIBRARIES MagnumDebugTools MagnumOpenGLTester MagnumPrimitives MagnumMeshTools MagnumShaders) corrade_add_test(DebugToolsTextureImageGLTest TextureImageGLTest.cpp LIBRARIES MagnumDebugToolsTestLib MagnumOpenGLTester) @@ -165,7 +165,7 @@ if(MAGNUM_TARGET_GL) endif() endif() - if(MAGNUM_WITH_SCENEGRAPH AND MAGNUM_WITH_TRADE) + if(MAGNUM_BUILD_DEPRECATED AND MAGNUM_WITH_SCENEGRAPH AND MAGNUM_WITH_TRADE) corrade_add_test(DebugToolsForceRendererGLTest ForceRendererGLTest.cpp LIBRARIES MagnumDebugTools MagnumOpenGLTester FILES ForceRenderer2D.tga ForceRenderer3D.tga) diff --git a/src/Magnum/DebugTools/Test/ForceRendererGLTest.cpp b/src/Magnum/DebugTools/Test/ForceRendererGLTest.cpp index d637ef620..71ec42216 100644 --- a/src/Magnum/DebugTools/Test/ForceRendererGLTest.cpp +++ b/src/Magnum/DebugTools/Test/ForceRendererGLTest.cpp @@ -24,6 +24,9 @@ DEALINGS IN THE SOFTWARE. */ +#define _MAGNUM_NO_DEPRECATED_FORCERENDERER +#define _MAGNUM_NO_DEPRECATED_RESOURCEMANAGER + #include #include #include @@ -86,13 +89,17 @@ void ForceRendererGLTest::render2D() { SceneGraph::Camera2D camera{scene}; camera.setProjectionMatrix(Matrix3::projection({4.0f, 4.0f})); + CORRADE_IGNORE_DEPRECATED_PUSH ResourceManager manager; manager.set("my", ForceRendererOptions{}.setColor(0xff3366_rgbf)); + CORRADE_IGNORE_DEPRECATED_POP SceneGraph::Object object{&scene}; object.translate({-1.0f, -1.0f}); Vector2 force{2.0f, 2.0f}; + CORRADE_IGNORE_DEPRECATED_PUSH ForceRenderer2D renderer{manager, object, {}, force, "my", &drawables}; + CORRADE_IGNORE_DEPRECATED_POP GL::Renderbuffer color; color.setStorage( @@ -143,15 +150,19 @@ void ForceRendererGLTest::render3D() { SceneGraph::Camera3D camera{cameraObject}; camera.setProjectionMatrix(Matrix4::orthographicProjection({4.0f, 4.0f}, 0.1f, 1.0f)); + CORRADE_IGNORE_DEPRECATED_PUSH ResourceManager manager; manager.set("my", ForceRendererOptions{}.setColor(0xff3366_rgbf)); + CORRADE_IGNORE_DEPRECATED_POP SceneGraph::Object object{&scene}; object .rotateY(-90.0_degf) .translate({-0.5f, -1.0f, 1.0f}); Vector3 force{2.0f, 2.0f, 0.0f}; + CORRADE_IGNORE_DEPRECATED_PUSH ForceRenderer3D renderer{manager, object, {}, force, "my", &drawables}; + CORRADE_IGNORE_DEPRECATED_POP GL::Renderbuffer color; color.setStorage( diff --git a/src/Magnum/DebugTools/Test/ForceRendererTest.cpp b/src/Magnum/DebugTools/Test/ForceRendererTest.cpp index aad735c6e..9e8422a6b 100644 --- a/src/Magnum/DebugTools/Test/ForceRendererTest.cpp +++ b/src/Magnum/DebugTools/Test/ForceRendererTest.cpp @@ -110,7 +110,6 @@ void ForceRendererTest::arbitrary3D() { Math::TypeTraits::epsilon(), TestSuite::Compare::Less); #endif - /** @todo This shouldn't be too different */ CORRADE_COMPARE_AS(Math::abs(Math::dot(m.up(), m.backward())), Math::TypeTraits::epsilon(), TestSuite::Compare::Less); diff --git a/src/Magnum/DebugTools/Test/ObjectRendererGLTest.cpp b/src/Magnum/DebugTools/Test/ObjectRendererGLTest.cpp index 9f302c0a2..ae95c3cc4 100644 --- a/src/Magnum/DebugTools/Test/ObjectRendererGLTest.cpp +++ b/src/Magnum/DebugTools/Test/ObjectRendererGLTest.cpp @@ -24,6 +24,9 @@ DEALINGS IN THE SOFTWARE. */ +#define _MAGNUM_NO_DEPRECATED_OBJECTRENDERER +#define _MAGNUM_NO_DEPRECATED_RESOURCEMANAGER + #include #include #include @@ -86,14 +89,18 @@ void ObjectRendererGLTest::render2D() { SceneGraph::Camera2D camera{scene}; camera.setProjectionMatrix(Matrix3::projection({4.0f, 4.0f})); + CORRADE_IGNORE_DEPRECATED_PUSH ResourceManager manager; manager.set("my", ObjectRendererOptions{}.setSize(2.2f)); + CORRADE_IGNORE_DEPRECATED_POP SceneGraph::Object object{&scene}; object .rotate(-17.3_degf) .translate({-1.0f, -1.0f}); + CORRADE_IGNORE_DEPRECATED_PUSH ObjectRenderer2D renderer{manager, object, "my", &drawables}; + CORRADE_IGNORE_DEPRECATED_POP GL::Renderbuffer color; color.setStorage( @@ -130,15 +137,19 @@ void ObjectRendererGLTest::render3D() { SceneGraph::Camera3D camera{scene}; camera.setProjectionMatrix(Matrix4::orthographicProjection({4.0f, 4.0f}, 0.1f, 2.0f)); + CORRADE_IGNORE_DEPRECATED_PUSH ResourceManager manager; manager.set("my", ObjectRendererOptions{}.setSize(2.2f)); + CORRADE_IGNORE_DEPRECATED_POP SceneGraph::Object object{&scene}; object .rotateZ(17.3_degf) .rotateY(45.0_degf) .translate({-1.0f, -1.0f, -1.0f}); + CORRADE_IGNORE_DEPRECATED_PUSH ObjectRenderer3D renderer{manager, object, "my", &drawables}; + CORRADE_IGNORE_DEPRECATED_POP GL::Renderbuffer color; color.setStorage( diff --git a/src/MagnumPlugins/MagnumFont/MagnumFont.cpp b/src/MagnumPlugins/MagnumFont/MagnumFont.cpp index b88e812e3..7664f91ed 100644 --- a/src/MagnumPlugins/MagnumFont/MagnumFont.cpp +++ b/src/MagnumPlugins/MagnumFont/MagnumFont.cpp @@ -213,7 +213,9 @@ Containers::Pointer MagnumFont::doCreateShaper() { using AbstractShaper::AbstractShaper; UnsignedInt doShape(const Containers::StringView textFull, const UnsignedInt begin, const UnsignedInt end, Containers::ArrayView) override { + CORRADE_IGNORE_DEPRECATED_PUSH /* GCC 4.8 warns here */ const Data& fontData = *static_cast(font())._opened; + CORRADE_IGNORE_DEPRECATED_POP const Containers::StringView text = textFull.slice(begin, end == ~UnsignedInt{} ? textFull.size() : end); /* Get glyph codes from characters */ @@ -235,7 +237,9 @@ Containers::Pointer MagnumFont::doCreateShaper() { Utility::copy(stridedArrayView(_glyphs).slice(&Containers::Pair::first), ids); } void doGlyphOffsetsAdvancesInto(const Containers::StridedArrayView1D& offsets, const Containers::StridedArrayView1D& advances) const override { + CORRADE_IGNORE_DEPRECATED_PUSH /* GCC 4.8 warns here */ const Data& fontData = *static_cast(font())._opened; + CORRADE_IGNORE_DEPRECATED_POP for(std::size_t i = 0; i != _glyphs.size(); ++i) { /* There's no glyph offsets in addition to advances */ offsets[i] = {};