Browse Source

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.
master
Vladimír Vondruš 4 days ago
parent
commit
7dc0f9c3f4
  1. 2
      doc/changelog-old.dox
  2. 21
      doc/changelog.dox
  3. 8
      doc/custom-buildsystems-order.dot
  4. 5
      doc/custom-buildsystems.dox
  5. 34
      doc/debug-tools.dox
  6. 9
      doc/scenegraph.dox
  7. 39
      doc/snippets/DebugTools-gl.cpp
  8. 19
      modules/FindMagnum.cmake
  9. 13
      src/Magnum/DebugTools/CMakeLists.txt
  10. 24
      src/Magnum/DebugTools/DebugTools.h
  11. 5
      src/Magnum/DebugTools/ForceRenderer.cpp
  12. 46
      src/Magnum/DebugTools/ForceRenderer.h
  13. 6
      src/Magnum/DebugTools/Implementation/ForceRendererTransformation.h
  14. 5
      src/Magnum/DebugTools/ObjectRenderer.cpp
  15. 38
      src/Magnum/DebugTools/ObjectRenderer.h
  16. 7
      src/Magnum/DebugTools/Profiler.h
  17. 6
      src/Magnum/DebugTools/ResourceManager.cpp
  18. 26
      src/Magnum/DebugTools/ResourceManager.h
  19. 6
      src/Magnum/DebugTools/Test/CMakeLists.txt
  20. 11
      src/Magnum/DebugTools/Test/ForceRendererGLTest.cpp
  21. 1
      src/Magnum/DebugTools/Test/ForceRendererTest.cpp
  22. 11
      src/Magnum/DebugTools/Test/ObjectRendererGLTest.cpp
  23. 4
      src/MagnumPlugins/MagnumFont/MagnumFont.cpp

2
doc/changelog-old.dox

@ -1021,7 +1021,7 @@ a high-level overview.
- @ref Text::AbstractLayouter has now a virtual destructor to avoid leaking - @ref Text::AbstractLayouter has now a virtual destructor to avoid leaking
its subclasses its subclasses
- Fixed @ref Trade::ObjImporter on Android - 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 - Fixed appearance of `Primitives::Cylinder::solid()` and
`Primitives::Circle::solid()` (see [mosra/magnum#197](https://github.com/mosra/magnum/pull/197), `Primitives::Circle::solid()` (see [mosra/magnum#197](https://github.com/mosra/magnum/pull/197),
[mosra/magnum#220](https://github.com/mosra/magnum/pull/220)) [mosra/magnum#220](https://github.com/mosra/magnum/pull/220))

21
doc/changelog.dox

@ -1533,6 +1533,13 @@ See also:
@ref DebugTools::FrameProfilerGL. The new name plays better with IDE @ref DebugTools::FrameProfilerGL. The new name plays better with IDE
autocompletion and makes the GL-specific class appear next to the autocompletion and makes the GL-specific class appear next to the
API-independent base in alphabetically sorted lists. 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 - List-taking @cpp GL::Shader::compile() @ce and
@cpp GL::AbstractShaderProgram::link() @ce functions are deprecated in @cpp GL::AbstractShaderProgram::link() @ce functions are deprecated in
favor of new @ref GL::Shader::submitCompile(), favor of new @ref GL::Shader::submitCompile(),
@ -1917,7 +1924,7 @@ See also:
@cpp Trade::ImporterFileCallbackPolicy::LoadPernament @ce containing a @cpp Trade::ImporterFileCallbackPolicy::LoadPernament @ce containing a
typo, use @ref InputFileCallbackPolicy::LoadPermanent instead typo, use @ref InputFileCallbackPolicy::LoadPermanent instead
- @cpp DebugTools::ForceRendererOptions::scale() @ce, use - @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 - @cpp Math::Color3::Hsv @ce and @cpp Math::Color4::Hsv @ce
@ref std::tuple typedefs and @ref Math::Color3::fromHsv() / @ref std::tuple typedefs and @ref Math::Color3::fromHsv() /
@ref Math::Color4::fromHsv() overloads taking separate hue, saturation @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 @cpp InputFileCallbackPolicy::LoadPernament @ce is deprecated due to a
typo, use @ref InputFileCallbackPolicy::LoadPermanent instead. typo, use @ref InputFileCallbackPolicy::LoadPermanent instead.
- @cpp DebugTools::ForceRendererOptions::scale() @ce is deprecated in favor - @cpp DebugTools::ForceRendererOptions::scale() @ce is deprecated in favor
of @ref DebugTools::ForceRendererOptions::size(), as that's more consistent of @cpp DebugTools::ForceRendererOptions::size() @ce, as that's more
with the documentation and the corresponding setter. consistent with the documentation and the corresponding setter.
- @cpp Text::AbstractFont::openSingleData() @ce and - @cpp Text::AbstractFont::openSingleData() @ce and
@cpp Text::AbstractFont::openData() @ce taking a list of files are @cpp Text::AbstractFont::openData() @ce taking a list of files are
deprecated in favor of 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 will print a warning at runtime. Use a constructor without the @p data
parameter instead. parameter instead.
- The @cpp ResourceManager::instance() @ce singleton (and its implicit use in - The @cpp ResourceManager::instance() @ce singleton (and its implicit use in
@ref DebugTools::ForceRenderer and @ref DebugTools::ObjectRenderer) is @cpp DebugTools::ForceRenderer @ce and @cpp DebugTools::ObjectRenderer @ce)
deprecated as it makes some use cases harder than they should be. Make your is deprecated as it makes some use cases harder than they should be. Make
own singleton or explicitly pass a @ref ResourceManager reference around your own singleton or explicitly pass a @ref ResourceManager reference
instead. around instead.
- @ref Platform::BasicScreen::application() now returns a reference instead - @ref Platform::BasicScreen::application() now returns a reference instead
of a pointer and together with @ref Platform::BasicScreen::redraw() checks of a pointer and together with @ref Platform::BasicScreen::redraw() checks
that the screen is actually added to the application instead of returning that the screen is actually added to the application instead of returning

8
doc/custom-buildsystems-order.dot

@ -71,10 +71,10 @@ digraph "Magnum library dependency order" {
MagnumDebugTools -> CorradeTestSuite [style=dotted] MagnumDebugTools -> CorradeTestSuite [style=dotted]
MagnumDebugTools -> Magnum MagnumDebugTools -> Magnum
MagnumDebugTools -> MagnumGL [style=dotted] MagnumDebugTools -> MagnumGL [style=dotted]
MagnumDebugTools -> MagnumMeshTools [style=dotted] MagnumDebugTools -> MagnumMeshTools [style=dotted class="m-dim"]
MagnumDebugTools -> MagnumPrimitives [style=dotted] MagnumDebugTools -> MagnumPrimitives [style=dotted class="m-dim"]
MagnumDebugTools -> MagnumShaders [style=dotted] MagnumDebugTools -> MagnumShaders [style=dotted class="m-dim"]
MagnumDebugTools -> MagnumSceneGraph [style=dotted] MagnumDebugTools -> MagnumSceneGraph [style=dotted class="m-dim"]
MagnumGL -> Magnum MagnumGL -> Magnum

5
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 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 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 you can remove the dependency by disabling parts or configuration options that
require given dependency. See documentation of each library for more require given dependency. A dim dotted line is then for an optional dependency
information. 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 @todo make this diagram clickable once [the dumpster fire](https://github.com/mosra/m.css/pull/69) is fixed

34
doc/debug-tools.dox

@ -30,39 +30,5 @@ namespace Magnum {
@tableofcontents @tableofcontents
@m_footernavigation @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.
*/ */
} }

9
doc/scenegraph.dox

@ -212,10 +212,11 @@ for more detailed information and usage examples:
- @ref SceneGraph::Animable "SceneGraph::Animable*D" --- Adds animation - @ref SceneGraph::Animable "SceneGraph::Animable*D" --- Adds animation
functionality to given object. Group of animables can be then controlled functionality to given object. Group of animables can be then controlled
using @ref SceneGraph::AnimableGroup "SceneGraph::AnimableGroup*D". using @ref SceneGraph::AnimableGroup "SceneGraph::AnimableGroup*D".
- @ref DebugTools::ObjectRenderer "DebugTools::ObjectRenderer*D", - @ref DebugTools::ObjectRenderer "DebugTools::ObjectRenderer*D"
@ref DebugTools::ForceRenderer "DebugTools::ForceRenderer*D" --- Visualize @m_class{m-label m-danger} **deprecated**,
object properties, object shape or force vector for debugging purposes. See @ref DebugTools::ForceRenderer "DebugTools::ForceRenderer*D"
@ref debug-tools for more information. @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 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 a feature to an object might look just like the following, as in some cases you

39
doc/snippets/DebugTools-gl.cpp

@ -33,10 +33,7 @@
#include "Magnum/PixelFormat.h" #include "Magnum/PixelFormat.h"
#include "Magnum/DebugTools/ColorMap.h" #include "Magnum/DebugTools/ColorMap.h"
#include "Magnum/DebugTools/CompareImage.h" #include "Magnum/DebugTools/CompareImage.h"
#include "Magnum/DebugTools/ForceRenderer.h"
#include "Magnum/DebugTools/FrameProfiler.h" #include "Magnum/DebugTools/FrameProfiler.h"
#include "Magnum/DebugTools/ResourceManager.h"
#include "Magnum/DebugTools/ObjectRenderer.h"
#include "Magnum/DebugTools/TextureImage.h" #include "Magnum/DebugTools/TextureImage.h"
#include "Magnum/GL/Framebuffer.h" #include "Magnum/GL/Framebuffer.h"
#include "Magnum/GL/CubeMapTexture.h" #include "Magnum/GL/CubeMapTexture.h"
@ -45,6 +42,7 @@
#include "Magnum/GL/TextureArray.h" #include "Magnum/GL/TextureArray.h"
#endif #endif
#include "Magnum/GL/TextureFormat.h" #include "Magnum/GL/TextureFormat.h"
#include "Magnum/Math/Color.h"
#include "Magnum/Math/Range.h" #include "Magnum/Math/Range.h"
#include "Magnum/SceneGraph/Drawable.h" #include "Magnum/SceneGraph/Drawable.h"
#include "Magnum/SceneGraph/Object.h" #include "Magnum/SceneGraph/Object.h"
@ -57,6 +55,16 @@
#include "Magnum/GL/BufferImage.h" #include "Magnum/GL/BufferImage.h"
#endif #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;
using namespace Magnum::Math::Literals; using namespace Magnum::Math::Literals;
@ -65,23 +73,6 @@ using namespace Magnum::Math::Literals;
avoid -Wmisssing-prototypes */ avoid -Wmisssing-prototypes */
void mainDebugTools(); void mainDebugTools();
void mainDebugTools() { void mainDebugTools() {
{
SceneGraph::Object<SceneGraph::MatrixTransformation3D>* 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)) #if !(defined(MAGNUM_TARGET_GLES2) && defined(MAGNUM_TARGET_WEBGL))
{ {
/* [ColorMap] */ /* [ColorMap] */
@ -99,7 +90,9 @@ colorMapTexture
} }
#endif #endif
#ifdef MAGNUM_BUILD_DEPRECATED
{ {
CORRADE_IGNORE_DEPRECATED_PUSH
DebugTools::ResourceManager manager; DebugTools::ResourceManager manager;
SceneGraph::Object<SceneGraph::MatrixTransformation3D>* object{}; SceneGraph::Object<SceneGraph::MatrixTransformation3D>* object{};
SceneGraph::DrawableGroup3D debugDrawables; 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, new DebugTools::ForceRenderer3D(manager, *object, {0.3f, 1.5f, -0.7f}, force,
"my", &debugDrawables); "my", &debugDrawables);
/* [ForceRenderer] */ /* [ForceRenderer] */
CORRADE_IGNORE_DEPRECATED_POP
} }
#endif
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
{ {
@ -143,8 +138,10 @@ DebugTools::FrameProfiler _profiler{{
} }
#endif #endif
#ifdef MAGNUM_BUILD_DEPRECATED
{ {
SceneGraph::Object<SceneGraph::MatrixTransformation3D>* object{}; SceneGraph::Object<SceneGraph::MatrixTransformation3D>* object{};
CORRADE_IGNORE_DEPRECATED_PUSH
/* [ObjectRenderer] */ /* [ObjectRenderer] */
DebugTools::ResourceManager manager; DebugTools::ResourceManager manager;
SceneGraph::DrawableGroup3D debugDrawables; 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 // Create debug renderer for given object, use "my" options for it
new DebugTools::ObjectRenderer3D{manager, *object, "my", &debugDrawables}; new DebugTools::ObjectRenderer3D{manager, *object, "my", &debugDrawables};
/* [ObjectRenderer] */ /* [ObjectRenderer] */
CORRADE_IGNORE_DEPRECATED_POP
} }
#endif
{ {
/* [FrameProfilerGL-usage] */ /* [FrameProfilerGL-usage] */

19
modules/FindMagnum.cmake

@ -455,16 +455,19 @@ set(_MAGNUM_Audio_DEPENDENCIES )
# compiled at all. # compiled at all.
set(_MAGNUM_DebugTools_DEPENDENCIES Trade) set(_MAGNUM_DebugTools_DEPENDENCIES Trade)
set(_MAGNUM_DebugTools_Trade_DEPENDENCY_IS_OPTIONAL ON) 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) if(MAGNUM_TARGET_GL)
list(APPEND _MAGNUM_DebugTools_DEPENDENCIES MeshTools Primitives SceneGraph Shaders GL) list(APPEND _MAGNUM_DebugTools_DEPENDENCIES 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_GL_DEPENDENCY_IS_OPTIONAL ON) 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() endif()
set(_MAGNUM_MaterialTools_DEPENDENCIES Trade) set(_MAGNUM_MaterialTools_DEPENDENCIES Trade)

13
src/Magnum/DebugTools/CMakeLists.txt

@ -51,17 +51,20 @@ endif()
if(MAGNUM_TARGET_GL) if(MAGNUM_TARGET_GL)
list(APPEND MagnumDebugTools_SRCS list(APPEND MagnumDebugTools_SRCS
ResourceManager.cpp
Screenshot.cpp) Screenshot.cpp)
list(APPEND MagnumDebugTools_GracefulAssert_SRCS list(APPEND MagnumDebugTools_GracefulAssert_SRCS
TextureImage.cpp) TextureImage.cpp)
list(APPEND MagnumDebugTools_HEADERS list(APPEND MagnumDebugTools_HEADERS
ResourceManager.h
Screenshot.h Screenshot.h
TextureImage.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) if(MAGNUM_TARGET_GLES AND NOT MAGNUM_TARGET_GLES2)
corrade_add_resource(MagnumDebugTools_RESOURCES resources.conf) corrade_add_resource(MagnumDebugTools_RESOURCES resources.conf)
list(APPEND MagnumDebugTools_SRCS ${MagnumDebugTools_RESOURCES}) list(APPEND MagnumDebugTools_SRCS ${MagnumDebugTools_RESOURCES})
@ -83,7 +86,7 @@ if(MAGNUM_TARGET_GL)
BufferData.h) BufferData.h)
endif() endif()
if(MAGNUM_WITH_SCENEGRAPH) if(MAGNUM_BUILD_DEPRECATED AND MAGNUM_WITH_SCENEGRAPH)
list(APPEND MagnumDebugTools_SRCS list(APPEND MagnumDebugTools_SRCS
ForceRenderer.cpp ForceRenderer.cpp
ObjectRenderer.cpp) ObjectRenderer.cpp)
@ -145,7 +148,7 @@ if(Corrade_TestSuite_FOUND AND MAGNUM_WITH_TRADE)
endif() endif()
if(MAGNUM_TARGET_GL) if(MAGNUM_TARGET_GL)
target_link_libraries(MagnumDebugTools PUBLIC MagnumGL) target_link_libraries(MagnumDebugTools PUBLIC MagnumGL)
if(MAGNUM_WITH_SCENEGRAPH) if(MAGNUM_BUILD_DEPRECATED AND MAGNUM_WITH_SCENEGRAPH)
target_link_libraries(MagnumDebugTools PUBLIC target_link_libraries(MagnumDebugTools PUBLIC
MagnumMeshTools MagnumMeshTools
MagnumPrimitives MagnumPrimitives
@ -179,7 +182,7 @@ if(MAGNUM_BUILD_TESTS)
endif() endif()
if(MAGNUM_TARGET_GL) if(MAGNUM_TARGET_GL)
target_link_libraries(MagnumDebugToolsTestLib PUBLIC MagnumGL) target_link_libraries(MagnumDebugToolsTestLib PUBLIC MagnumGL)
if(MAGNUM_WITH_SCENEGRAPH) if(MAGNUM_BUILD_DEPRECATED AND MAGNUM_WITH_SCENEGRAPH)
target_link_libraries(MagnumDebugToolsTestLib PUBLIC target_link_libraries(MagnumDebugToolsTestLib PUBLIC
MagnumMeshTools MagnumMeshTools
MagnumPrimitives MagnumPrimitives

24
src/Magnum/DebugTools/DebugTools.h

@ -50,17 +50,23 @@ class FrameProfilerGL;
typedef CORRADE_DEPRECATED("use FrameProfilerGL instead") FrameProfilerGL GLFrameProfiler; typedef CORRADE_DEPRECATED("use FrameProfilerGL instead") FrameProfilerGL GLFrameProfiler;
#endif #endif
template<UnsignedInt> class ForceRenderer; #ifdef MAGNUM_BUILD_DEPRECATED
typedef ForceRenderer<2> ForceRenderer2D; template<UnsignedInt> class CORRADE_DEPRECATED("use Primitives::arrow2D() or arrow3D() in a custom drawable instead") ForceRenderer;
typedef ForceRenderer<3> ForceRenderer3D; CORRADE_IGNORE_DEPRECATED_PUSH /* MSVC warns here */
class ForceRendererOptions; 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<UnsignedInt> class ObjectRenderer; template<UnsignedInt> class CORRADE_DEPRECATED("use Primitives::axis2D() or axis3D() in a custom drawable instead") ObjectRenderer;
typedef ObjectRenderer<2> ObjectRenderer2D; CORRADE_IGNORE_DEPRECATED_PUSH /* MSVC warns here */
typedef ObjectRenderer<3> ObjectRenderer3D; typedef CORRADE_DEPRECATED("use Primitives::axis2D() in a custom drawable instead") ObjectRenderer<2> ObjectRenderer2D;
class ObjectRendererOptions; 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 #endif
}} }}

5
src/Magnum/DebugTools/ForceRenderer.cpp

@ -24,6 +24,9 @@
DEALINGS IN THE SOFTWARE. DEALINGS IN THE SOFTWARE.
*/ */
#define _MAGNUM_NO_DEPRECATED_FORCERENDERER
#define _MAGNUM_NO_DEPRECATED_RESOURCEMANAGER
#include "ForceRenderer.h" #include "ForceRenderer.h"
#include "Magnum/GL/Mesh.h" #include "Magnum/GL/Mesh.h"
@ -35,6 +38,7 @@
namespace Magnum { namespace DebugTools { namespace Magnum { namespace DebugTools {
CORRADE_IGNORE_DEPRECATED_PUSH
namespace { namespace {
template<UnsignedInt dimensions> ResourceKey shaderKey(); template<UnsignedInt dimensions> ResourceKey shaderKey();
@ -89,5 +93,6 @@ template<UnsignedInt dimensions> void ForceRenderer<dimensions>::draw(const Matr
template class MAGNUM_DEBUGTOOLS_EXPORT ForceRenderer<2>; template class MAGNUM_DEBUGTOOLS_EXPORT ForceRenderer<2>;
template class MAGNUM_DEBUGTOOLS_EXPORT ForceRenderer<3>; template class MAGNUM_DEBUGTOOLS_EXPORT ForceRenderer<3>;
CORRADE_IGNORE_DEPRECATED_POP
}} }}

46
src/Magnum/DebugTools/ForceRenderer.h

@ -26,15 +26,18 @@
DEALINGS IN THE SOFTWARE. DEALINGS IN THE SOFTWARE.
*/ */
#ifdef MAGNUM_TARGET_GL #if defined(MAGNUM_BUILD_DEPRECATED) && defined(MAGNUM_TARGET_GL)
/** @file /** @file
* @brief Class @ref Magnum::DebugTools::ForceRenderer, @ref Magnum::DebugTools::ForceRendererOptions, typedef @ref Magnum::DebugTools::ForceRenderer2D, @ref Magnum::DebugTools::ForceRenderer3D * @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 #endif
#include "Magnum/configure.h" #include "Magnum/configure.h"
#ifdef MAGNUM_TARGET_GL #if defined(MAGNUM_BUILD_DEPRECATED) && defined(MAGNUM_TARGET_GL)
#include "Magnum/Resource.h" #include "Magnum/Resource.h"
#include "Magnum/DebugTools/DebugTools.h" #include "Magnum/DebugTools/DebugTools.h"
#include "Magnum/DebugTools/visibility.h" #include "Magnum/DebugTools/visibility.h"
@ -43,10 +46,16 @@
#include "Magnum/SceneGraph/Drawable.h" #include "Magnum/SceneGraph/Drawable.h"
#include "Magnum/Shaders/Shaders.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 { namespace Magnum { namespace DebugTools {
/** /**
@brief Force renderer options @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. 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 @ref MAGNUM_TARGET_GL "TARGET_GL" and `MAGNUM_WITH_SCENEGRAPH` enabled
(done by default). See @ref building-features for more information. (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: public:
constexpr ForceRendererOptions(): _color(1.0f), _size(1.0f) {} constexpr ForceRendererOptions(): _color(1.0f), _size(1.0f) {}
@ -67,10 +76,12 @@ class ForceRendererOptions {
* *
* Default is @cpp 0xffffffff_rgbaf @ce. * Default is @cpp 0xffffffff_rgbaf @ce.
*/ */
CORRADE_IGNORE_DEPRECATED_PUSH /* GCC 4.8 warns due to the return type */
ForceRendererOptions& setColor(const Color4& color) { ForceRendererOptions& setColor(const Color4& color) {
_color = color; _color = color;
return *this; return *this;
} }
CORRADE_IGNORE_DEPRECATED_POP
/** @brief Size of rendered arrow */ /** @brief Size of rendered arrow */
constexpr Float size() const { return _size; } constexpr Float size() const { return _size; }
@ -81,10 +92,12 @@ class ForceRendererOptions {
* *
* Default is @cpp 1.0f @ce. * Default is @cpp 1.0f @ce.
*/ */
CORRADE_IGNORE_DEPRECATED_PUSH /* GCC 4.8 warns due to the return type */
ForceRendererOptions& setSize(Float size) { ForceRendererOptions& setSize(Float size) {
_size = size; _size = size;
return *this; return *this;
} }
CORRADE_IGNORE_DEPRECATED_POP
private: private:
Color4 _color; Color4 _color;
@ -93,9 +106,10 @@ class ForceRendererOptions {
/** /**
@brief Force renderer @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. 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 @section DebugTools-ForceRenderer-usage Basic usage
@ -113,7 +127,7 @@ to it.
@see @ref ForceRenderer2D, @ref ForceRenderer3D, @ref ForceRendererOptions @see @ref ForceRenderer2D, @ref ForceRenderer3D, @ref ForceRendererOptions
*/ */
template<UnsignedInt dimensions> class ForceRenderer: public SceneGraph::Drawable<dimensions, Float> { template<UnsignedInt dimensions> class CORRADE_DEPRECATED("use Primitives::arrow2D() or arrow3D() in a custom drawable instead") ForceRenderer: public SceneGraph::Drawable<dimensions, Float> {
public: public:
/** /**
* @brief Constructor * @brief Constructor
@ -126,13 +140,17 @@ template<UnsignedInt dimensions> class ForceRenderer: public SceneGraph::Drawabl
* more information. * more information.
* @param drawables Drawable group * @param drawables Drawable group
*/ */
CORRADE_IGNORE_DEPRECATED_PUSH /* GCC 4.8 warns due to the argument */
explicit ForceRenderer(ResourceManager& manager, SceneGraph::AbstractObject<dimensions, Float>& object, const VectorTypeFor<dimensions, Float>& forcePosition, const VectorTypeFor<dimensions, Float>& force, ResourceKey options = ResourceKey(), SceneGraph::DrawableGroup<dimensions, Float>* drawables = nullptr); explicit ForceRenderer(ResourceManager& manager, SceneGraph::AbstractObject<dimensions, Float>& object, const VectorTypeFor<dimensions, Float>& forcePosition, const VectorTypeFor<dimensions, Float>& force, ResourceKey options = ResourceKey(), SceneGraph::DrawableGroup<dimensions, Float>* drawables = nullptr);
CORRADE_IGNORE_DEPRECATED_POP
/** /**
* You have to pass a reference to an external force vector --- the * You have to pass a reference to an external force vector --- the
* renderer doesn't store a copy. * renderer doesn't store a copy.
*/ */
CORRADE_IGNORE_DEPRECATED_PUSH /* GCC 4.8 warns due to the argument */
explicit ForceRenderer(ResourceManager&, SceneGraph::AbstractObject<dimensions, Float>&, const VectorTypeFor<dimensions, Float>&, VectorTypeFor<dimensions, Float>&&, ResourceKey = ResourceKey(), SceneGraph::DrawableGroup<dimensions, Float>* = nullptr) = delete; explicit ForceRenderer(ResourceManager&, SceneGraph::AbstractObject<dimensions, Float>&, const VectorTypeFor<dimensions, Float>&, VectorTypeFor<dimensions, Float>&&, ResourceKey = ResourceKey(), SceneGraph::DrawableGroup<dimensions, Float>* = nullptr) = delete;
CORRADE_IGNORE_DEPRECATED_POP
~ForceRenderer(); ~ForceRenderer();
@ -142,31 +160,43 @@ template<UnsignedInt dimensions> class ForceRenderer: public SceneGraph::Drawabl
const VectorTypeFor<dimensions, Float> _forcePosition; const VectorTypeFor<dimensions, Float> _forcePosition;
const VectorTypeFor<dimensions, Float>& _force; const VectorTypeFor<dimensions, Float>& _force;
CORRADE_IGNORE_DEPRECATED_PUSH /* GCC 4.8 warns due to the type */
Resource<ForceRendererOptions> _options; Resource<ForceRendererOptions> _options;
CORRADE_IGNORE_DEPRECATED_POP
Resource<GL::AbstractShaderProgram, Shaders::FlatGL<dimensions>> _shader; Resource<GL::AbstractShaderProgram, Shaders::FlatGL<dimensions>> _shader;
Resource<GL::Mesh> _mesh; Resource<GL::Mesh> _mesh;
}; };
/** /**
@brief Two-dimensional force renderer @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 @note This typedef is available only if Magnum is compiled with
@ref MAGNUM_TARGET_GL enabled (done by default). See @ref building-features @ref MAGNUM_TARGET_GL enabled (done by default). See @ref building-features
for more information. 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 @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 @note This typedef is available only if Magnum is compiled with
@ref MAGNUM_TARGET_GL enabled (done by default). See @ref building-features @ref MAGNUM_TARGET_GL enabled (done by default). See @ref building-features
for more information. 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 #error this header is available only in the OpenGL build
#endif #endif

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

@ -26,6 +26,9 @@
DEALINGS IN THE SOFTWARE. DEALINGS IN THE SOFTWARE.
*/ */
#include "Magnum/configure.h"
#ifdef MAGNUM_BUILD_DEPRECATED
#include "Magnum/DimensionTraits.h" #include "Magnum/DimensionTraits.h"
#include "Magnum/Magnum.h" #include "Magnum/Magnum.h"
#include "Magnum/Math/Functions.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 #endif

5
src/Magnum/DebugTools/ObjectRenderer.cpp

@ -24,6 +24,9 @@
DEALINGS IN THE SOFTWARE. DEALINGS IN THE SOFTWARE.
*/ */
#define _MAGNUM_NO_DEPRECATED_OBJECTRENDERER
#define _MAGNUM_NO_DEPRECATED_RESOURCEMANAGER
#include "ObjectRenderer.h" #include "ObjectRenderer.h"
#include "Magnum/DebugTools/ResourceManager.h" #include "Magnum/DebugTools/ResourceManager.h"
@ -36,6 +39,7 @@
namespace Magnum { namespace DebugTools { namespace Magnum { namespace DebugTools {
CORRADE_IGNORE_DEPRECATED_PUSH
namespace { namespace {
template<UnsignedInt> struct Renderer; template<UnsignedInt> struct Renderer;
@ -74,5 +78,6 @@ template<UnsignedInt dimensions> void ObjectRenderer<dimensions>::draw(const Mat
template class MAGNUM_DEBUGTOOLS_EXPORT ObjectRenderer<2>; template class MAGNUM_DEBUGTOOLS_EXPORT ObjectRenderer<2>;
template class MAGNUM_DEBUGTOOLS_EXPORT ObjectRenderer<3>; template class MAGNUM_DEBUGTOOLS_EXPORT ObjectRenderer<3>;
CORRADE_IGNORE_DEPRECATED_POP
}} }}

38
src/Magnum/DebugTools/ObjectRenderer.h

@ -26,9 +26,12 @@
DEALINGS IN THE SOFTWARE. DEALINGS IN THE SOFTWARE.
*/ */
#ifdef MAGNUM_TARGET_GL #if defined(MAGNUM_BUILD_DEPRECATED) && defined(MAGNUM_TARGET_GL)
/** @file /** @file
* @brief Class @ref Magnum::DebugTools::ObjectRenderer, @ref Magnum::DebugTools::ObjectRendererOptions, typedef @ref Magnum::DebugTools::ObjectRenderer2D, @ref Magnum::DebugTools::ObjectRenderer3D * @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 #endif
@ -42,10 +45,16 @@
#include "Magnum/SceneGraph/Drawable.h" #include "Magnum/SceneGraph/Drawable.h"
#include "Magnum/Shaders/Shaders.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 { namespace Magnum { namespace DebugTools {
/** /**
@brief Object renderer options @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. 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 @ref MAGNUM_TARGET_GL "TARGET_GL" and `MAGNUM_WITH_SCENEGRAPH` enabled
(done by default). See @ref building-features for more information. (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: public:
constexpr ObjectRendererOptions(): _size(1.0f) {} constexpr ObjectRendererOptions(): _size(1.0f) {}
@ -66,10 +75,12 @@ class ObjectRendererOptions {
* *
* Default is @cpp 1.0f @ce. * Default is @cpp 1.0f @ce.
*/ */
CORRADE_IGNORE_DEPRECATED_PUSH /* GCC 4.8 warns due to the return type */
ObjectRendererOptions& setSize(Float size) { ObjectRendererOptions& setSize(Float size) {
_size = size; _size = size;
return *this; return *this;
} }
CORRADE_IGNORE_DEPRECATED_POP
private: private:
Float _size; Float _size;
@ -77,9 +88,10 @@ class ObjectRendererOptions {
/** /**
@brief Object renderer @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 Visualizes object position, rotation and scale using colored axes.
@ref debug-tools-renderers for more information.
@section DebugTools-ObjectRenderer-usage Basic usage @section DebugTools-ObjectRenderer-usage Basic usage
@ -93,7 +105,7 @@ Example code:
@see @ref ObjectRenderer2D, @ref ObjectRenderer3D, @ref ObjectRendererOptions @see @ref ObjectRenderer2D, @ref ObjectRenderer3D, @ref ObjectRendererOptions
*/ */
template<UnsignedInt dimensions> class ObjectRenderer: public SceneGraph::Drawable<dimensions, Float> { template<UnsignedInt dimensions> class CORRADE_DEPRECATED("use Primitives::axis2D() or axis3D() in a custom drawable instead") ObjectRenderer: public SceneGraph::Drawable<dimensions, Float> {
public: public:
/** /**
* @brief Constructor * @brief Constructor
@ -106,14 +118,18 @@ template<UnsignedInt dimensions> class ObjectRenderer: public SceneGraph::Drawab
* *
* The renderer is automatically added to object's features. * 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<dimensions, Float>& object, ResourceKey options = ResourceKey(), SceneGraph::DrawableGroup<dimensions, Float>* drawables = nullptr); explicit ObjectRenderer(ResourceManager& manager, SceneGraph::AbstractObject<dimensions, Float>& object, ResourceKey options = ResourceKey(), SceneGraph::DrawableGroup<dimensions, Float>* drawables = nullptr);
CORRADE_IGNORE_DEPRECATED_POP
~ObjectRenderer(); ~ObjectRenderer();
private: private:
void draw(const MatrixTypeFor<dimensions, Float>& transformationMatrix, SceneGraph::Camera<dimensions, Float>& camera) override; void draw(const MatrixTypeFor<dimensions, Float>& transformationMatrix, SceneGraph::Camera<dimensions, Float>& camera) override;
CORRADE_IGNORE_DEPRECATED_PUSH /* GCC 4.8 warns due to the type */
Resource<ObjectRendererOptions> _options; Resource<ObjectRendererOptions> _options;
CORRADE_IGNORE_DEPRECATED_POP
Resource<GL::AbstractShaderProgram, Shaders::VertexColorGL<dimensions>> _shader; Resource<GL::AbstractShaderProgram, Shaders::VertexColorGL<dimensions>> _shader;
Resource<GL::Mesh> _mesh; Resource<GL::Mesh> _mesh;
}; };
@ -125,7 +141,9 @@ template<UnsignedInt dimensions> class ObjectRenderer: public SceneGraph::Drawab
@ref MAGNUM_TARGET_GL enabled (done by default). See @ref building-features @ref MAGNUM_TARGET_GL enabled (done by default). See @ref building-features
for more information. 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 @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 @ref MAGNUM_TARGET_GL enabled (done by default). See @ref building-features
for more information. 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 #error this header is available only in the OpenGL build
#endif #endif

7
src/Magnum/DebugTools/Profiler.h

@ -29,9 +29,8 @@
#ifdef MAGNUM_BUILD_DEPRECATED #ifdef MAGNUM_BUILD_DEPRECATED
/** @file /** @file
* @brief Class @ref Magnum::DebugTools::Profiler * @brief Class @ref Magnum::DebugTools::Profiler
* @m_deprecated_since{2020,06} Obsolete, use * @m_deprecated_since{2020,06} Use @ref Magnum/DebugTools/FrameProfiler.h and
* @ref Magnum/DebugTools/FrameProfiler.h and the * the @ref Magnum::DebugTools::FrameProfiler class instead.
* @ref Magnum::DebugTools::FrameProfiler class instead.
*/ */
#endif #endif
@ -55,7 +54,7 @@ namespace Magnum { namespace DebugTools {
/** /**
@brief Profiler @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 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()), used in rendering and event loops (e.g. @ref Platform::Sdl2Application::drawEvent()),

6
src/Magnum/DebugTools/ResourceManager.cpp

@ -24,6 +24,10 @@
DEALINGS IN THE SOFTWARE. DEALINGS IN THE SOFTWARE.
*/ */
#define _MAGNUM_NO_DEPRECATED_FORCERENDERER
#define _MAGNUM_NO_DEPRECATED_OBJECTRENDERER
#define _MAGNUM_NO_DEPRECATED_RESOURCEMANAGER
#include "ResourceManager.h" #include "ResourceManager.h"
#include "Magnum/DebugTools/ForceRenderer.h" #include "Magnum/DebugTools/ForceRenderer.h"
@ -36,8 +40,10 @@
namespace Magnum { namespace DebugTools { namespace Magnum { namespace DebugTools {
ResourceManager::ResourceManager() { ResourceManager::ResourceManager() {
CORRADE_IGNORE_DEPRECATED_PUSH /* GCC 4.8 warns here */
setFallback(new ForceRendererOptions); setFallback(new ForceRendererOptions);
setFallback(new ObjectRendererOptions); setFallback(new ObjectRendererOptions);
CORRADE_IGNORE_DEPRECATED_POP
} }
ResourceManager::~ResourceManager() = default; ResourceManager::~ResourceManager() = default;

26
src/Magnum/DebugTools/ResourceManager.h

@ -26,15 +26,19 @@
DEALINGS IN THE SOFTWARE. DEALINGS IN THE SOFTWARE.
*/ */
#ifdef MAGNUM_TARGET_GL #if defined(MAGNUM_BUILD_DEPRECATED) && defined(MAGNUM_TARGET_GL)
/** @file /** @file
* @brief Class @ref Magnum::DebugTools::ResourceManager * @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 #endif
#include "Magnum/configure.h" #include "Magnum/configure.h"
#ifdef MAGNUM_TARGET_GL #if defined(MAGNUM_BUILD_DEPRECATED) && defined(MAGNUM_TARGET_GL)
#include "Magnum/ResourceManager.h" #include "Magnum/ResourceManager.h"
#include "Magnum/Magnum.h" #include "Magnum/Magnum.h"
@ -43,8 +47,7 @@
#include "Magnum/GL/GL.h" #include "Magnum/GL/GL.h"
#include "Magnum/SceneGraph/SceneGraph.h" #include "Magnum/SceneGraph/SceneGraph.h"
/** @todo fix this better */ #ifdef CORRADE_TARGET_MSVC
#ifdef CORRADE_TARGET_MSVC /* This is not a bug, this is a feature :( Not even /permissive- helps. */
#include "Magnum/DebugTools/ForceRenderer.h" #include "Magnum/DebugTools/ForceRenderer.h"
#include "Magnum/DebugTools/ObjectRenderer.h" #include "Magnum/DebugTools/ObjectRenderer.h"
#include "Magnum/GL/AbstractShaderProgram.h" #include "Magnum/GL/AbstractShaderProgram.h"
@ -53,10 +56,17 @@
#include "Magnum/GL/MeshView.h" #include "Magnum/GL/MeshView.h"
#endif #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 { namespace Magnum { namespace DebugTools {
/** /**
@brief Resource manager for debug tools @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 Stores various data used by debug renderers. See @ref debug-tools for more
information. information.
@ -65,13 +75,17 @@ information.
@ref MAGNUM_TARGET_GL "TARGET_GL" enabled (done by default). See @ref MAGNUM_TARGET_GL "TARGET_GL" enabled (done by default). See
@ref building-features for more information. @ref building-features for more information.
*/ */
class MAGNUM_DEBUGTOOLS_EXPORT ResourceManager: public Magnum::ResourceManager<GL::AbstractShaderProgram, GL::Buffer, GL::Mesh, GL::MeshView, DebugTools::ForceRendererOptions, DebugTools::ObjectRendererOptions> 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<GL::AbstractShaderProgram, GL::Buffer, GL::Mesh, GL::MeshView, DebugTools::ForceRendererOptions, DebugTools::ObjectRendererOptions>
{ {
public: public:
explicit ResourceManager(); explicit ResourceManager();
~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 #error this header is available only in the OpenGL build
#endif #endif

6
src/Magnum/DebugTools/Test/CMakeLists.txt

@ -106,13 +106,13 @@ if(MAGNUM_WITH_TRADE)
endif() endif()
if(MAGNUM_TARGET_GL) if(MAGNUM_TARGET_GL)
if(MAGNUM_WITH_SCENEGRAPH) if(MAGNUM_BUILD_DEPRECATED AND MAGNUM_WITH_SCENEGRAPH)
corrade_add_test(DebugToolsForceRendererTest ForceRendererTest.cpp LIBRARIES MagnumMathTestLib) corrade_add_test(DebugToolsForceRendererTest ForceRendererTest.cpp LIBRARIES MagnumMathTestLib)
endif() endif()
if(MAGNUM_BUILD_GL_TESTS) if(MAGNUM_BUILD_GL_TESTS)
corrade_add_test(DebugToolsFrameProfilerGLTest FrameProfilerGLTest.cpp corrade_add_test(DebugToolsFrameProfilerGLTest FrameProfilerGLTest.cpp
LIBRARIES MagnumDebugTools MagnumOpenGLTester) LIBRARIES MagnumDebugTools MagnumOpenGLTester MagnumPrimitives MagnumMeshTools MagnumShaders)
corrade_add_test(DebugToolsTextureImageGLTest TextureImageGLTest.cpp corrade_add_test(DebugToolsTextureImageGLTest TextureImageGLTest.cpp
LIBRARIES MagnumDebugToolsTestLib MagnumOpenGLTester) LIBRARIES MagnumDebugToolsTestLib MagnumOpenGLTester)
@ -165,7 +165,7 @@ if(MAGNUM_TARGET_GL)
endif() endif()
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 corrade_add_test(DebugToolsForceRendererGLTest ForceRendererGLTest.cpp
LIBRARIES MagnumDebugTools MagnumOpenGLTester LIBRARIES MagnumDebugTools MagnumOpenGLTester
FILES ForceRenderer2D.tga ForceRenderer3D.tga) FILES ForceRenderer2D.tga ForceRenderer3D.tga)

11
src/Magnum/DebugTools/Test/ForceRendererGLTest.cpp

@ -24,6 +24,9 @@
DEALINGS IN THE SOFTWARE. DEALINGS IN THE SOFTWARE.
*/ */
#define _MAGNUM_NO_DEPRECATED_FORCERENDERER
#define _MAGNUM_NO_DEPRECATED_RESOURCEMANAGER
#include <Corrade/Containers/Optional.h> #include <Corrade/Containers/Optional.h>
#include <Corrade/Containers/String.h> #include <Corrade/Containers/String.h>
#include <Corrade/PluginManager/Manager.h> #include <Corrade/PluginManager/Manager.h>
@ -86,13 +89,17 @@ void ForceRendererGLTest::render2D() {
SceneGraph::Camera2D camera{scene}; SceneGraph::Camera2D camera{scene};
camera.setProjectionMatrix(Matrix3::projection({4.0f, 4.0f})); camera.setProjectionMatrix(Matrix3::projection({4.0f, 4.0f}));
CORRADE_IGNORE_DEPRECATED_PUSH
ResourceManager manager; ResourceManager manager;
manager.set("my", ForceRendererOptions{}.setColor(0xff3366_rgbf)); manager.set("my", ForceRendererOptions{}.setColor(0xff3366_rgbf));
CORRADE_IGNORE_DEPRECATED_POP
SceneGraph::Object<SceneGraph::MatrixTransformation2D> object{&scene}; SceneGraph::Object<SceneGraph::MatrixTransformation2D> object{&scene};
object.translate({-1.0f, -1.0f}); object.translate({-1.0f, -1.0f});
Vector2 force{2.0f, 2.0f}; Vector2 force{2.0f, 2.0f};
CORRADE_IGNORE_DEPRECATED_PUSH
ForceRenderer2D renderer{manager, object, {}, force, "my", &drawables}; ForceRenderer2D renderer{manager, object, {}, force, "my", &drawables};
CORRADE_IGNORE_DEPRECATED_POP
GL::Renderbuffer color; GL::Renderbuffer color;
color.setStorage( color.setStorage(
@ -143,15 +150,19 @@ void ForceRendererGLTest::render3D() {
SceneGraph::Camera3D camera{cameraObject}; SceneGraph::Camera3D camera{cameraObject};
camera.setProjectionMatrix(Matrix4::orthographicProjection({4.0f, 4.0f}, 0.1f, 1.0f)); camera.setProjectionMatrix(Matrix4::orthographicProjection({4.0f, 4.0f}, 0.1f, 1.0f));
CORRADE_IGNORE_DEPRECATED_PUSH
ResourceManager manager; ResourceManager manager;
manager.set("my", ForceRendererOptions{}.setColor(0xff3366_rgbf)); manager.set("my", ForceRendererOptions{}.setColor(0xff3366_rgbf));
CORRADE_IGNORE_DEPRECATED_POP
SceneGraph::Object<SceneGraph::MatrixTransformation3D> object{&scene}; SceneGraph::Object<SceneGraph::MatrixTransformation3D> object{&scene};
object object
.rotateY(-90.0_degf) .rotateY(-90.0_degf)
.translate({-0.5f, -1.0f, 1.0f}); .translate({-0.5f, -1.0f, 1.0f});
Vector3 force{2.0f, 2.0f, 0.0f}; Vector3 force{2.0f, 2.0f, 0.0f};
CORRADE_IGNORE_DEPRECATED_PUSH
ForceRenderer3D renderer{manager, object, {}, force, "my", &drawables}; ForceRenderer3D renderer{manager, object, {}, force, "my", &drawables};
CORRADE_IGNORE_DEPRECATED_POP
GL::Renderbuffer color; GL::Renderbuffer color;
color.setStorage( color.setStorage(

1
src/Magnum/DebugTools/Test/ForceRendererTest.cpp

@ -110,7 +110,6 @@ void ForceRendererTest::arbitrary3D() {
Math::TypeTraits<Float>::epsilon(), Math::TypeTraits<Float>::epsilon(),
TestSuite::Compare::Less); TestSuite::Compare::Less);
#endif #endif
/** @todo This shouldn't be too different */
CORRADE_COMPARE_AS(Math::abs(Math::dot(m.up(), m.backward())), CORRADE_COMPARE_AS(Math::abs(Math::dot(m.up(), m.backward())),
Math::TypeTraits<Float>::epsilon(), Math::TypeTraits<Float>::epsilon(),
TestSuite::Compare::Less); TestSuite::Compare::Less);

11
src/Magnum/DebugTools/Test/ObjectRendererGLTest.cpp

@ -24,6 +24,9 @@
DEALINGS IN THE SOFTWARE. DEALINGS IN THE SOFTWARE.
*/ */
#define _MAGNUM_NO_DEPRECATED_OBJECTRENDERER
#define _MAGNUM_NO_DEPRECATED_RESOURCEMANAGER
#include <Corrade/Containers/Optional.h> #include <Corrade/Containers/Optional.h>
#include <Corrade/Containers/String.h> #include <Corrade/Containers/String.h>
#include <Corrade/PluginManager/Manager.h> #include <Corrade/PluginManager/Manager.h>
@ -86,14 +89,18 @@ void ObjectRendererGLTest::render2D() {
SceneGraph::Camera2D camera{scene}; SceneGraph::Camera2D camera{scene};
camera.setProjectionMatrix(Matrix3::projection({4.0f, 4.0f})); camera.setProjectionMatrix(Matrix3::projection({4.0f, 4.0f}));
CORRADE_IGNORE_DEPRECATED_PUSH
ResourceManager manager; ResourceManager manager;
manager.set("my", ObjectRendererOptions{}.setSize(2.2f)); manager.set("my", ObjectRendererOptions{}.setSize(2.2f));
CORRADE_IGNORE_DEPRECATED_POP
SceneGraph::Object<SceneGraph::MatrixTransformation2D> object{&scene}; SceneGraph::Object<SceneGraph::MatrixTransformation2D> object{&scene};
object object
.rotate(-17.3_degf) .rotate(-17.3_degf)
.translate({-1.0f, -1.0f}); .translate({-1.0f, -1.0f});
CORRADE_IGNORE_DEPRECATED_PUSH
ObjectRenderer2D renderer{manager, object, "my", &drawables}; ObjectRenderer2D renderer{manager, object, "my", &drawables};
CORRADE_IGNORE_DEPRECATED_POP
GL::Renderbuffer color; GL::Renderbuffer color;
color.setStorage( color.setStorage(
@ -130,15 +137,19 @@ void ObjectRendererGLTest::render3D() {
SceneGraph::Camera3D camera{scene}; SceneGraph::Camera3D camera{scene};
camera.setProjectionMatrix(Matrix4::orthographicProjection({4.0f, 4.0f}, 0.1f, 2.0f)); camera.setProjectionMatrix(Matrix4::orthographicProjection({4.0f, 4.0f}, 0.1f, 2.0f));
CORRADE_IGNORE_DEPRECATED_PUSH
ResourceManager manager; ResourceManager manager;
manager.set("my", ObjectRendererOptions{}.setSize(2.2f)); manager.set("my", ObjectRendererOptions{}.setSize(2.2f));
CORRADE_IGNORE_DEPRECATED_POP
SceneGraph::Object<SceneGraph::MatrixTransformation3D> object{&scene}; SceneGraph::Object<SceneGraph::MatrixTransformation3D> object{&scene};
object object
.rotateZ(17.3_degf) .rotateZ(17.3_degf)
.rotateY(45.0_degf) .rotateY(45.0_degf)
.translate({-1.0f, -1.0f, -1.0f}); .translate({-1.0f, -1.0f, -1.0f});
CORRADE_IGNORE_DEPRECATED_PUSH
ObjectRenderer3D renderer{manager, object, "my", &drawables}; ObjectRenderer3D renderer{manager, object, "my", &drawables};
CORRADE_IGNORE_DEPRECATED_POP
GL::Renderbuffer color; GL::Renderbuffer color;
color.setStorage( color.setStorage(

4
src/MagnumPlugins/MagnumFont/MagnumFont.cpp

@ -213,7 +213,9 @@ Containers::Pointer<AbstractShaper> MagnumFont::doCreateShaper() {
using AbstractShaper::AbstractShaper; using AbstractShaper::AbstractShaper;
UnsignedInt doShape(const Containers::StringView textFull, const UnsignedInt begin, const UnsignedInt end, Containers::ArrayView<const FeatureRange>) override { UnsignedInt doShape(const Containers::StringView textFull, const UnsignedInt begin, const UnsignedInt end, Containers::ArrayView<const FeatureRange>) override {
CORRADE_IGNORE_DEPRECATED_PUSH /* GCC 4.8 warns here */
const Data& fontData = *static_cast<const MagnumFont&>(font())._opened; const Data& fontData = *static_cast<const MagnumFont&>(font())._opened;
CORRADE_IGNORE_DEPRECATED_POP
const Containers::StringView text = textFull.slice(begin, end == ~UnsignedInt{} ? textFull.size() : end); const Containers::StringView text = textFull.slice(begin, end == ~UnsignedInt{} ? textFull.size() : end);
/* Get glyph codes from characters */ /* Get glyph codes from characters */
@ -235,7 +237,9 @@ Containers::Pointer<AbstractShaper> MagnumFont::doCreateShaper() {
Utility::copy(stridedArrayView(_glyphs).slice(&Containers::Pair<UnsignedInt, UnsignedInt>::first), ids); Utility::copy(stridedArrayView(_glyphs).slice(&Containers::Pair<UnsignedInt, UnsignedInt>::first), ids);
} }
void doGlyphOffsetsAdvancesInto(const Containers::StridedArrayView1D<Vector2>& offsets, const Containers::StridedArrayView1D<Vector2>& advances) const override { void doGlyphOffsetsAdvancesInto(const Containers::StridedArrayView1D<Vector2>& offsets, const Containers::StridedArrayView1D<Vector2>& advances) const override {
CORRADE_IGNORE_DEPRECATED_PUSH /* GCC 4.8 warns here */
const Data& fontData = *static_cast<const MagnumFont&>(font())._opened; const Data& fontData = *static_cast<const MagnumFont&>(font())._opened;
CORRADE_IGNORE_DEPRECATED_POP
for(std::size_t i = 0; i != _glyphs.size(); ++i) { for(std::size_t i = 0; i != _glyphs.size(); ++i) {
/* There's no glyph offsets in addition to advances */ /* There's no glyph offsets in addition to advances */
offsets[i] = {}; offsets[i] = {};

Loading…
Cancel
Save