Browse Source

Split the OpenGL layer out, pt 26: remove dependencies on the GL lib.

Primitives, MeshTools, Trade and TextureTools are not depending on the
GL library anymore.
pull/233/head
Vladimír Vondruš 8 years ago
parent
commit
4e757a3f64
  1. 8
      CMakeLists.txt
  2. 25
      doc/building.dox
  3. 5
      doc/changelog.dox
  4. 8
      doc/namespaces.dox
  5. 19
      modules/FindMagnum.cmake
  6. 16
      src/Magnum/DebugTools/BufferData.h
  7. 159
      src/Magnum/DebugTools/CMakeLists.txt
  8. 5
      src/Magnum/DebugTools/DebugTools.h
  9. 14
      src/Magnum/DebugTools/ForceRenderer.h
  10. 14
      src/Magnum/DebugTools/ObjectRenderer.h
  11. 14
      src/Magnum/DebugTools/ResourceManager.h
  12. 14
      src/Magnum/DebugTools/ShapeRenderer.h
  13. 48
      src/Magnum/DebugTools/Test/CMakeLists.txt
  14. 31
      src/Magnum/MeshTools/CMakeLists.txt
  15. 14
      src/Magnum/MeshTools/Compile.h
  16. 1
      src/Magnum/MeshTools/CompressIndices.h
  17. 19
      src/Magnum/MeshTools/FullScreenTriangle.h
  18. 25
      src/Magnum/TextureTools/CMakeLists.txt
  19. 10
      src/Magnum/TextureTools/DistanceField.h
  20. 3
      src/Magnum/Trade/CMakeLists.txt

8
CMakeLists.txt

@ -106,15 +106,15 @@ cmake_dependent_option(WITH_TGAIMPORTER "Build TgaImporter plugin" OFF "NOT WITH
# Parts of the library
cmake_dependent_option(WITH_AUDIO "Build Audio library" OFF "NOT WITH_AL_INFO;NOT WITH_ANYAUDIOIMPORTER;NOT WITH_WAVAUDIOIMPORTER" ON)
option(WITH_DEBUGTOOLS "Build DebugTools library" ON)
cmake_dependent_option(WITH_MESHTOOLS "Build MeshTools library" ON "( NOT WITH_DEBUGTOOLS OR ( NOT WITH_SHAPES AND NOT WITH_SCENEGRAPH ) ) AND NOT WITH_OBJIMPORTER" ON)
cmake_dependent_option(WITH_PRIMITIVES "Builf Primitives library" ON "NOT WITH_DEBUGTOOLS OR NOT WITH_SHAPES" ON)
cmake_dependent_option(WITH_MESHTOOLS "Build MeshTools library" ON "NOT WITH_OBJIMPORTER" ON)
option(WITH_SHAPES "Build Shapes library" ON)
cmake_dependent_option(WITH_SCENEGRAPH "Build SceneGraph library" ON "NOT WITH_SHAPES" ON)
cmake_dependent_option(WITH_SHADERS "Build Shaders library" ON "NOT WITH_DEBUGTOOLS OR ( NOT WITH_SHAPES AND NOT WITH_SCENEGRAPH )" ON)
option(WITH_SHADERS "Build Shaders library" ON)
cmake_dependent_option(WITH_TEXT "Build Text library" ON "NOT WITH_FONTCONVERTER;NOT WITH_MAGNUMFONT;NOT WITH_MAGNUMFONTCONVERTER" ON)
cmake_dependent_option(WITH_TEXTURETOOLS "Build TextureTools library" ON "NOT WITH_TEXT;NOT WITH_DISTANCEFIELDCONVERTER" ON)
cmake_dependent_option(WITH_TRADE "Build Trade library" ON "NOT WITH_MESHTOOLS;NOT WITH_PRIMITIVES;NOT WITH_IMAGECONVERTER;NOT WITH_ANYIMAGEIMPORTER;NOT WITH_ANYIMAGECONVERTER;NOT WITH_ANYSCENEIMPORTER;NOT WITH_OBJIMPORTER;NOT WITH_TGAIMAGECONVERTER;NOT WITH_TGAIMPORTER" ON)
cmake_dependent_option(WITH_GL "Build GL library" ON "NOT WITH_DEBUGTOOLS;NOT WITH_MESHTOOLS;NOT WITH_PRIMITIVES;NOT WITH_SHADERS;NOT WITH_TEXT;NOT WITH_TEXTURETOOLS;NOT WITH_TRADE;NOT WITH_GL_INFO;NOT WITH_ANDROIDAPPLICATION;NOT WITH_WINDOWLESSIOSAPPLICATION;NOT WITH_CGLCONTEXT;NOT WITH_GLXAPPLICATION;NOT WITH_GLXCONTEXT;NOT WITH_XEGLAPPLICATION;NOT WITH_WINDOWLESSWGLAPPLICATION;NOT WITH_GLXCONTEXT;NOT WITH_XEGLAPPLICATION;NOT WITH_WINDOWLESSWGLAPPLICATION;NOT WITH_WGLCONTEXT;NOT WITH_WINDOWLESSWINDOWSEGLAPPLICATION;NOT WITH_GLFWAPPLICATION;NOT WITH_GLUTAPPLICATION;NOT WITH_SDL2APPLICATION;NOT WITH_DISTANCEFIELDCONVERTER;NOT WITH_FONTCONVERTER;NOT WITH_IMAGECONVERTER" ON)
cmake_dependent_option(WITH_GL "Build GL library" ON "NOT WITH_SHADERS;NOT WITH_TEXT;NOT WITH_GL_INFO;NOT WITH_ANDROIDAPPLICATION;NOT WITH_WINDOWLESSIOSAPPLICATION;NOT WITH_CGLCONTEXT;NOT WITH_GLXAPPLICATION;NOT WITH_GLXCONTEXT;NOT WITH_XEGLAPPLICATION;NOT WITH_WINDOWLESSWGLAPPLICATION;NOT WITH_GLXCONTEXT;NOT WITH_XEGLAPPLICATION;NOT WITH_WINDOWLESSWGLAPPLICATION;NOT WITH_WGLCONTEXT;NOT WITH_WINDOWLESSWINDOWSEGLAPPLICATION;NOT WITH_GLFWAPPLICATION;NOT WITH_GLUTAPPLICATION;NOT WITH_SDL2APPLICATION;NOT WITH_DISTANCEFIELDCONVERTER;NOT WITH_FONTCONVERTER;NOT WITH_IMAGECONVERTER" ON)
option(WITH_PRIMITIVES "Builf Primitives library" ON)
cmake_dependent_option(TARGET_GL "Build libraries with OpenGL interoperability" ON "WITH_GL" OFF)

25
doc/building.dox

@ -385,8 +385,8 @@ available for desktop OpenGL only, see @ref requires-gl.
- `TARGET_GL` --- Build libraries with OpenGL interoperability enabled.
Enabled by default when `WITH_GL` is enabled. Disabling this will cause
libraries to not depend on the @ref GL library, but doesn't affect the
@ref GL library itself.
other libraries to not depend on the @ref GL library, but doesn't affect
the @ref GL library itself.
- `TARGET_GLES` --- Target OpenGL ES. Available only when `WITH_GL` is
enabled.
- `TARGET_GLES2` --- Target OpenGL ES 2.0 instead of 3.0 and later. Available
@ -419,27 +419,24 @@ be built and which not:
- `WITH_AUDIO` --- Build the @ref Audio library. Depends on
[OpenAL](https://www.openal.org/), not built by default.
- `WITH_DEBUGTOOLS` --- Build the @ref DebugTools library. Enables also
building of the GL library.
- `WITH_GL` --- Build the @ref GL library
- `WITH_DEBUGTOOLS` --- Build the @ref DebugTools library.
- `WITH_GL` --- Build the @ref GL library. Enabled automatically if
`WITH_SHADERS` or `WITH_TEXT` is enabled.
- `WITH_MESHTOOLS` --- Build the @ref MeshTools library. Enables also
building of the Trade and GL libraries.
building of the Trade library.
- `WITH_PRIMITIVES` --- Build the @ref Primitives library. Enables also
building of the Trade and GL libraries.
building of the Trade library.
- `WITH_SCENEGRAPH` --- Build the @ref SceneGraph library. Enabled
automatically if `WITH_SHAPES` is enabled.
- `WITH_SHADERS` --- Build the @ref Shaders library. Enables also building of
the GL library.
- `WITH_SHAPES` --- Build the @ref Shapes library. Enables also building of
the SceneGraph library. Enabled automatically if `WITH_DEBUGTOOLS` is
enabled.
the SceneGraph library.
- `WITH_TEXT` --- Build the @ref Text library. Enables also building of
the TextureTools and GL libraries.
- `WITH_TEXTURETOOLS` --- Build the @ref TextureTools library. Enables also
building of the GL library. Enabled automatically if `WITH_TEXT` or
`WITH_DISTANCEFIELDCONVERTER` is enabled.
- `WITH_TRADE` --- Build the @ref Trade library. Enables also building of the
GL library.
- `WITH_TEXTURETOOLS` --- Build the @ref TextureTools library. Enabled
automatically if `WITH_TEXT` or `WITH_DISTANCEFIELDCONVERTER` is enabled.
- `WITH_TRADE` --- Build the @ref Trade library.
There are more involved component dependencies that are not described here (for
example the @ref DebugTools has some functionality that gets built only when

5
doc/changelog.dox

@ -131,6 +131,11 @@ See also:
@subsection changelog-latest-buildsystem Build system
- The core @ref Magnum library is not depending on OpenGL anymore, all
GL-related APIs are now part of a new @ref GL library
- @ref Primitives and @ref Trade libraries do not depend on OpenGL anymore
- @ref DebugTools, @ref MeshTools and @ref TextureTools have only an optional
dependency on the @ref GL library, controlled with `TARGET_GL` CMake option
- All plugin interfaces now implement
@ref Corrade::PluginManager::AbstractPlugin::pluginSearchPaths() "pluginSearchPaths()"
for plugin directory autodetection --- you no longer need to specify the

8
doc/namespaces.dox

@ -280,6 +280,10 @@ find_package(Magnum REQUIRED MeshTools)
target_link_libraries(your-app Magnum::MeshTools)
@endcode
Note that functionality depending on @ref GL APIs is available only if Magnum
is built with both `WITH_GL` and `TARGET_GL` enabled (which is done by
default).
See @ref building and @ref cmake for more information.
*/
@ -417,6 +421,10 @@ find_package(Magnum REQUIRED TextureTools)
target_link_libraries(your-app Magnum::TextureTools)
@endcode
Note that functionality depending on @ref GL APIs is available only if Magnum
is built with both `WITH_GL` and `TARGET_GL` enabled (which is done by
default).
See @ref building and @ref cmake for more information.
*/

19
modules/FindMagnum.cmake

@ -336,9 +336,16 @@ foreach(_component ${Magnum_FIND_COMPONENTS})
if(_component STREQUAL Audio)
# no inter-component dependencies
elseif(_component STREQUAL DebugTools)
set(_MAGNUM_${_COMPONENT}_DEPENDENCIES MeshTools Primitives SceneGraph Shaders Shapes Trade GL)
if(MAGNUM_TARGET_GL)
# MeshTools, Primitives, SceneGraph, Shaders and Shapes are used
# only for GL renderers
set(_MAGNUM_${_COMPONENT}_DEPENDENCIES MeshTools Primitives SceneGraph Shaders Shapes Trade GL)
endif()
elseif(_component STREQUAL MeshTools)
set(_MAGNUM_${_COMPONENT}_DEPENDENCIES Trade GL)
if(MAGNUM_TARGET_GL)
# Trade is used only in compile(), which needs GL as well
set(_MAGNUM_${_COMPONENT}_DEPENDENCIES Trade GL)
endif()
elseif(_component STREQUAL OpenGLTester)
if(MAGNUM_TARGET_HEADLESS OR CORRADE_TARGET_EMSCRIPTEN OR CORRADE_TARGET_ANDROID)
set(_MAGNUM_${_COMPONENT}_DEPENDENCIES WindowlessEglApplication GL)
@ -360,7 +367,7 @@ foreach(_component ${Magnum_FIND_COMPONENTS})
endif()
endif()
elseif(_component STREQUAL Primitives)
set(_MAGNUM_${_COMPONENT}_DEPENDENCIES Trade GL)
set(_MAGNUM_${_COMPONENT}_DEPENDENCIES Trade)
elseif(_component STREQUAL SceneGraph)
# no dependencies except for the main lib
elseif(_component STREQUAL Shaders)
@ -370,9 +377,11 @@ foreach(_component ${Magnum_FIND_COMPONENTS})
elseif(_component STREQUAL Text)
set(_MAGNUM_${_COMPONENT}_DEPENDENCIES TextureTools GL)
elseif(_component STREQUAL TextureTools)
set(_MAGNUM_${_COMPONENT}_DEPENDENCIES GL)
if(MAGNUM_TARGET_GL)
set(_MAGNUM_${_COMPONENT}_DEPENDENCIES GL)
endif()
elseif(_component STREQUAL Trade)
set(_MAGNUM_${_COMPONENT}_DEPENDENCIES GL)
# no dependencies except for the main lib
elseif(_component STREQUAL AndroidApplication)
set(_MAGNUM_${_COMPONENT}_DEPENDENCIES GL)
elseif(_component STREQUAL GlfwApplication)

16
src/Magnum/DebugTools/BufferData.h

@ -25,7 +25,7 @@
DEALINGS IN THE SOFTWARE.
*/
#ifndef MAGNUM_TARGET_WEBGL
#if defined(MAGNUM_TARGET_GL) && !defined(MAGNUM_TARGET_WEBGL)
/** @file
* @brief Function @ref Magnum::DebugTools::bufferData(), @ref Magnum::DebugTools::bufferSubData()
*/
@ -36,7 +36,7 @@
#include "Magnum/GL/Buffer.h"
#include "Magnum/DebugTools/visibility.h"
#ifndef MAGNUM_TARGET_WEBGL
#if defined(MAGNUM_TARGET_GL) && !defined(MAGNUM_TARGET_WEBGL)
namespace Magnum { namespace DebugTools {
namespace Implementation {
@ -48,6 +48,11 @@ namespace Implementation {
Emulates @ref GL::Buffer::subData() call on platforms that don't support it
(such as OpenGL ES) by using @ref GL::Buffer::map().
@note This function is available only if Magnum is compiled with
@ref MAGNUM_TARGET_GL enabled (done by default). See @ref building-features
for more information.
@requires_gles30 Extension @extension{EXT,map_buffer_range} in OpenGL ES
2.0.
@requires_gles Buffer mapping is not available in WebGL.
@ -63,6 +68,11 @@ template<class T> Containers::Array<T> inline bufferSubData(GL::Buffer& buffer,
Emulates @ref GL::Buffer::data() call on platforms that don't support it (such
as OpenGL ES) by using @ref GL::Buffer::map().
@note This function is available only if Magnum is compiled with
@ref MAGNUM_TARGET_GL enabled (done by default). See @ref building-features
for more information.
@requires_gles30 Extension @extension{EXT,map_buffer_range} in OpenGL ES
2.0.
@requires_gles Buffer mapping is not available in WebGL.
@ -75,7 +85,7 @@ template<class T = char> Containers::Array<T> inline bufferData(GL::Buffer& buff
}}
#else
#error this header is not available in WebGL build
#error this header is available only in the OpenGL (ES) build and not available in the WebGL build
#endif
#endif

159
src/Magnum/DebugTools/CMakeLists.txt

@ -24,23 +24,82 @@
#
set(MagnumDebugTools_SRCS
Profiler.cpp
ResourceManager.cpp
TextureImage.cpp)
Profiler.cpp)
set(MagnumDebugTools_HEADERS
DebugTools.h
Profiler.h
ResourceManager.h
TextureImage.h
visibility.h)
Profiler.h)
# Header files to display in project view of IDEs only
set(MagnumDebugTools_PRIVATE_HEADERS )
if(MAGNUM_TARGET_GLES AND NOT MAGNUM_TARGET_GLES2)
corrade_add_resource(MagnumDebugTools_RESOURCES resources.conf)
list(APPEND MagnumDebugTools_SRCS ${MagnumDebugTools_RESOURCES})
if(TARGET_GL)
list(APPEND MagnumDebugTools_SRCS
ResourceManager.cpp
TextureImage.cpp)
list(APPEND MagnumDebugTools_HEADERS
ResourceManager.h
TextureImage.h
visibility.h)
if(MAGNUM_TARGET_GLES AND NOT MAGNUM_TARGET_GLES2)
corrade_add_resource(MagnumDebugTools_RESOURCES resources.conf)
list(APPEND MagnumDebugTools_SRCS ${MagnumDebugTools_RESOURCES})
endif()
if(NOT MAGNUM_TARGET_WEBGL)
list(APPEND MagnumDebugTools_SRCS
BufferData.cpp)
list(APPEND MagnumDebugTools_HEADERS
BufferData.h)
endif()
if(WITH_SCENEGRAPH)
list(APPEND MagnumDebugTools_SRCS
ForceRenderer.cpp
ObjectRenderer.cpp)
list(APPEND MagnumDebugTools_HEADERS
ForceRenderer.h
ObjectRenderer.h)
list(APPEND MagnumDebugTools_PRIVATE_HEADERS
Implementation/ForceRendererTransformation.h)
endif()
if(WITH_SHAPES)
list(APPEND MagnumDebugTools_SRCS
ShapeRenderer.cpp
Implementation/AbstractBoxRenderer.cpp
Implementation/AbstractShapeRenderer.cpp
Implementation/AxisAlignedBoxRenderer.cpp
Implementation/BoxRenderer.cpp
Implementation/CapsuleRenderer.cpp
Implementation/CylinderRenderer.cpp
Implementation/LineSegmentRenderer.cpp
Implementation/PointRenderer.cpp
Implementation/SphereRenderer.cpp)
list(APPEND MagnumDebugTools_HEADERS
ShapeRenderer.h)
list(APPEND MagnumDebugTools_PRIVATE_HEADERS
Implementation/AbstractBoxRenderer.h
Implementation/AbstractShapeRenderer.h
Implementation/AxisAlignedBoxRenderer.h
Implementation/BoxRenderer.h
Implementation/CapsuleRenderer.h
Implementation/CapsuleRendererTransformation.h
Implementation/CylinderRenderer.h
Implementation/CylinderRendererTransformation.h
Implementation/LineSegmentRenderer.h
Implementation/LineSegmentRendererTransformation.h
Implementation/PointRenderer.h
Implementation/SphereRenderer.h)
endif()
endif()
# Build the TestSuite-related functionality only if it is present
@ -53,59 +112,6 @@ if(Corrade_TestSuite_FOUND)
CompareImage.h)
endif()
if(NOT MAGNUM_TARGET_WEBGL)
list(APPEND MagnumDebugTools_SRCS
BufferData.cpp)
list(APPEND MagnumDebugTools_HEADERS
BufferData.h)
endif()
if(WITH_SCENEGRAPH)
list(APPEND MagnumDebugTools_SRCS
ForceRenderer.cpp
ObjectRenderer.cpp)
list(APPEND MagnumDebugTools_HEADERS
ForceRenderer.h
ObjectRenderer.h)
list(APPEND MagnumDebugTools_PRIVATE_HEADERS
Implementation/ForceRendererTransformation.h)
endif()
if(WITH_SHAPES)
list(APPEND MagnumDebugTools_SRCS
ShapeRenderer.cpp
Implementation/AbstractBoxRenderer.cpp
Implementation/AbstractShapeRenderer.cpp
Implementation/AxisAlignedBoxRenderer.cpp
Implementation/BoxRenderer.cpp
Implementation/CapsuleRenderer.cpp
Implementation/CylinderRenderer.cpp
Implementation/LineSegmentRenderer.cpp
Implementation/PointRenderer.cpp
Implementation/SphereRenderer.cpp)
list(APPEND MagnumDebugTools_HEADERS
ShapeRenderer.h)
list(APPEND MagnumDebugTools_PRIVATE_HEADERS
Implementation/AbstractBoxRenderer.h
Implementation/AbstractShapeRenderer.h
Implementation/AxisAlignedBoxRenderer.h
Implementation/BoxRenderer.h
Implementation/CapsuleRenderer.h
Implementation/CapsuleRendererTransformation.h
Implementation/CylinderRenderer.h
Implementation/CylinderRendererTransformation.h
Implementation/LineSegmentRenderer.h
Implementation/LineSegmentRendererTransformation.h
Implementation/PointRenderer.h
Implementation/SphereRenderer.h)
endif()
# DebugTools library
add_library(MagnumDebugTools ${SHARED_OR_STATIC}
${MagnumDebugTools_SRCS}
@ -119,22 +125,23 @@ if(NOT BUILD_STATIC)
elseif(BUILD_STATIC_PIC)
set_target_properties(MagnumDebugTools PROPERTIES POSITION_INDEPENDENT_CODE ON)
endif()
target_link_libraries(MagnumDebugTools PUBLIC
Magnum
MagnumGL)
target_link_libraries(MagnumDebugTools PUBLIC Magnum)
if(Corrade_TestSuite_FOUND)
target_link_libraries(MagnumDebugTools PUBLIC Corrade::TestSuite)
endif()
if(WITH_SCENEGRAPH)
target_link_libraries(MagnumDebugTools PUBLIC MagnumSceneGraph)
endif()
if(WITH_SHAPES)
target_link_libraries(MagnumDebugTools PUBLIC MagnumShapes MagnumPrimitives)
endif()
if(WITH_SCENEGRAPH OR WITH_SHAPES)
target_link_libraries(MagnumDebugTools PUBLIC
MagnumMeshTools
MagnumShaders)
if(TARGET_GL)
target_link_libraries(MagnumDebugTools PUBLIC MagnumGL)
if(WITH_SCENEGRAPH)
target_link_libraries(MagnumDebugTools PUBLIC MagnumSceneGraph)
endif()
if(WITH_SHAPES)
target_link_libraries(MagnumDebugTools PUBLIC MagnumShapes MagnumPrimitives)
endif()
if(WITH_SCENEGRAPH OR WITH_SHAPES)
target_link_libraries(MagnumDebugTools PUBLIC
MagnumMeshTools
MagnumShaders)
endif()
endif()
install(TARGETS MagnumDebugTools

5
src/Magnum/DebugTools/DebugTools.h

@ -34,6 +34,9 @@
namespace Magnum { namespace DebugTools {
#ifndef DOXYGEN_GENERATING_OUTPUT
class Profiler;
#ifdef MAGNUM_TARGET_GL
template<UnsignedInt> class ForceRenderer;
typedef ForceRenderer<2> ForceRenderer2D;
typedef ForceRenderer<3> ForceRenderer3D;
@ -44,7 +47,6 @@ typedef ObjectRenderer<2> ObjectRenderer2D;
typedef ObjectRenderer<3> ObjectRenderer3D;
class ObjectRendererOptions;
class Profiler;
class ResourceManager;
template<UnsignedInt> class ShapeRenderer;
@ -52,6 +54,7 @@ typedef ShapeRenderer<2> ShapeRenderer2D;
typedef ShapeRenderer<3> ShapeRenderer3D;
class ShapeRendererOptions;
#endif
#endif
}}

14
src/Magnum/DebugTools/ForceRenderer.h

@ -25,9 +25,11 @@
DEALINGS IN THE SOFTWARE.
*/
#ifdef MAGNUM_TARGET_GL
/** @file
* @brief Class @ref Magnum::DebugTools::ForceRenderer, @ref Magnum::DebugTools::ForceRendererOptions, typedef @ref Magnum::DebugTools::ForceRenderer2D, @ref Magnum::DebugTools::ForceRenderer3D
*/
#endif
#include "Magnum/Resource.h"
#include "Magnum/GL/GL.h"
@ -36,12 +38,17 @@
#include "Magnum/Shaders/Shaders.h"
#include "Magnum/DebugTools/visibility.h"
#ifdef MAGNUM_TARGET_GL
namespace Magnum { namespace DebugTools {
/**
@brief Force renderer options
See @ref ForceRenderer documentation for more information.
@note This class is available only if Magnum is compiled with
@ref MAGNUM_TARGET_GL enabled (done by default). See @ref building-features
for more information.
*/
class ForceRendererOptions {
public:
@ -101,6 +108,10 @@ Vector3 force;
new DebugTools::ForceRenderer2D(object, {0.3f, 1.5f, -0.7f}, &force, "my", debugDrawables);
@endcode
@note This class is available only if Magnum is compiled with
@ref MAGNUM_TARGET_GL enabled (done by default). See @ref building-features
for more information.
@see @ref ForceRenderer2D, @ref ForceRenderer3D, @ref ForceRendererOptions
*/
template<UnsignedInt dimensions> class MAGNUM_DEBUGTOOLS_EXPORT ForceRenderer: public SceneGraph::Drawable<dimensions, Float> {
@ -148,5 +159,8 @@ typedef ForceRenderer<2> ForceRenderer2D;
typedef ForceRenderer<3> ForceRenderer3D;
}}
#else
#error this header is available only in the OpenGL build
#endif
#endif

14
src/Magnum/DebugTools/ObjectRenderer.h

@ -25,9 +25,11 @@
DEALINGS IN THE SOFTWARE.
*/
#ifdef MAGNUM_TARGET_GL
/** @file
* @brief Class @ref Magnum::DebugTools::ObjectRenderer, @ref Magnum::DebugTools::ObjectRendererOptions, typedef @ref Magnum::DebugTools::ObjectRenderer2D, @ref Magnum::DebugTools::ObjectRenderer3D
*/
#endif
#include "Magnum/Resource.h"
#include "Magnum/DebugTools/visibility.h"
@ -35,12 +37,17 @@
#include "Magnum/SceneGraph/Drawable.h"
#include "Magnum/Shaders/Shaders.h"
#ifdef MAGNUM_TARGET_GL
namespace Magnum { namespace DebugTools {
/**
@brief Object renderer options
See @ref ObjectRenderer documentation for more information.
@note This class is available only if Magnum is compiled with
@ref MAGNUM_TARGET_GL enabled (done by default). See @ref building-features
for more information.
*/
class ObjectRendererOptions {
public:
@ -83,6 +90,10 @@ Object3D* object;
new DebugTools::ObjectRenderer2D(object, "my", debugDrawables);
@endcode
@note This class is available only if Magnum is compiled with
@ref MAGNUM_TARGET_GL enabled (done by default). See @ref building-features
for more information.
@see @ref ObjectRenderer2D, @ref ObjectRenderer3D, @ref ObjectRendererOptions
*/
template<UnsignedInt dimensions> class MAGNUM_DEBUGTOOLS_EXPORT ObjectRenderer: public SceneGraph::Drawable<dimensions, Float> {
@ -117,5 +128,8 @@ typedef ObjectRenderer<2> ObjectRenderer2D;
typedef ObjectRenderer<3> ObjectRenderer3D;
}}
#else
#error this header is available only in the OpenGL build
#endif
#endif

14
src/Magnum/DebugTools/ResourceManager.h

@ -25,9 +25,11 @@
DEALINGS IN THE SOFTWARE.
*/
#ifdef MAGNUM_TARGET_GL
/** @file
* @brief Class @ref Magnum::DebugTools::ResourceManager
*/
#endif
#include "Magnum/ResourceManager.h"
@ -49,21 +51,27 @@
#include "Magnum/GL/MeshView.h"
#endif
namespace Magnum {
namespace DebugTools {
#ifdef MAGNUM_TARGET_GL
namespace Magnum { namespace DebugTools {
/**
@brief Resource manager for debug tools
Stores various data used by debug renderers. See @ref debug-tools for more
information.
@note This class is available only if Magnum is compiled with
@ref MAGNUM_TARGET_GL enabled (done by default). See @ref building-features
for more information.
*/
class MAGNUM_DEBUGTOOLS_EXPORT ResourceManager: public Magnum::ResourceManager<Magnum::Implementation::ResourceManagerLocalInstance, GL::AbstractShaderProgram, GL::Buffer, GL::Mesh, GL::MeshView, DebugTools::ForceRendererOptions, DebugTools::ObjectRendererOptions, DebugTools::ShapeRendererOptions> {
public:
explicit ResourceManager();
~ResourceManager();
};
#else
#error this header is available only in the OpenGL build
#endif
}}

14
src/Magnum/DebugTools/ShapeRenderer.h

@ -25,9 +25,11 @@
DEALINGS IN THE SOFTWARE.
*/
#ifdef MAGNUM_TARGET_GL
/** @file
* @brief Class @ref Magnum::DebugTools::ShapeRenderer, @ref Magnum::DebugTools::ShapeRendererOptions, typedef @ref Magnum::DebugTools::ShapeRenderer2D, @ref Magnum::DebugTools::ShapeRenderer3D
*/
#endif
#include "Magnum/Resource.h"
#include "Magnum/Math/Color.h"
@ -36,6 +38,7 @@
#include "Magnum/Shapes/shapeImplementation.h"
#include "Magnum/DebugTools/visibility.h"
#ifdef MAGNUM_TARGET_GL
namespace Magnum { namespace DebugTools {
template<UnsignedInt> class ShapeRenderer;
@ -50,6 +53,10 @@ namespace Implementation {
@brief Shape renderer options
See @ref ShapeRenderer documentation for more information.
@note This class is available only if Magnum is compiled with
@ref MAGNUM_TARGET_GL enabled (done by default). See @ref building-features
for more information.
*/
class ShapeRendererOptions {
public:
@ -134,6 +141,10 @@ Shapes::AbstractShape2D* shape;
new DebugTools::ShapeRenderer2D(shape, "red", debugDrawables);
@endcode
@note This class is available only if Magnum is compiled with
@ref MAGNUM_TARGET_GL enabled (done by default). See @ref building-features
for more information.
@see @ref ShapeRenderer2D, @ref ShapeRenderer3D, @ref ShapeRendererOptions
@todo Different drawing style for inverted shapes? (marking the "inside" somehow)
@ -174,5 +185,8 @@ typedef ShapeRenderer<2> ShapeRenderer2D;
typedef ShapeRenderer<3> ShapeRenderer3D;
}}
#else
#error this header is available only in the OpenGL build
#endif
#endif

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

@ -23,35 +23,37 @@
# DEALINGS IN THE SOFTWARE.
#
if(WITH_SHAPES)
corrade_add_test(DebugToolsCapsuleRendererTest CapsuleRendererTest.cpp LIBRARIES MagnumMathTestLib)
corrade_add_test(DebugToolsCylinderRendererTest CylinderRendererTest.cpp LIBRARIES MagnumMathTestLib)
corrade_add_test(DebugToolsLineSegmentRendererTest LineSegmentRendererTest.cpp LIBRARIES MagnumMathTestLib)
set_target_properties(
DebugToolsCapsuleRendererTest
DebugToolsCylinderRendererTest
DebugToolsLineSegmentRendererTest
PROPERTIES FOLDER "Magnum/DebugTools/Test")
endif()
if(WITH_SCENEGRAPH)
corrade_add_test(DebugToolsForceRendererTest ForceRendererTest.cpp LIBRARIES MagnumMathTestLib)
set_target_properties(DebugToolsForceRendererTest PROPERTIES FOLDER "Magnum/DebugTools/Test")
endif()
if(Corrade_TestSuite_FOUND)
corrade_add_test(DebugToolsCompareImageTest CompareImageTest.cpp LIBRARIES MagnumDebugTools)
set_target_properties(DebugToolsCompareImageTest PROPERTIES FOLDER "Magnum/DebugTools/Test")
endif()
if(BUILD_GL_TESTS)
corrade_add_test(DebugToolsTextureImageGLTest TextureImageGLTest.cpp LIBRARIES MagnumDebugTools MagnumOpenGLTester)
set_target_properties(DebugToolsTextureImageGLTest PROPERTIES FOLDER "Magnum/DebugTools/Test")
if(TARGET_GL)
if(WITH_SHAPES)
corrade_add_test(DebugToolsCapsuleRendererTest CapsuleRendererTest.cpp LIBRARIES MagnumMathTestLib)
corrade_add_test(DebugToolsCylinderRendererTest CylinderRendererTest.cpp LIBRARIES MagnumMathTestLib)
corrade_add_test(DebugToolsLineSegmentRendererTest LineSegmentRendererTest.cpp LIBRARIES MagnumMathTestLib)
set_target_properties(
DebugToolsCapsuleRendererTest
DebugToolsCylinderRendererTest
DebugToolsLineSegmentRendererTest
PROPERTIES FOLDER "Magnum/DebugTools/Test")
endif()
if(WITH_SCENEGRAPH)
corrade_add_test(DebugToolsForceRendererTest ForceRendererTest.cpp LIBRARIES MagnumMathTestLib)
set_target_properties(DebugToolsForceRendererTest PROPERTIES FOLDER "Magnum/DebugTools/Test")
endif()
if(BUILD_GL_TESTS)
corrade_add_test(DebugToolsTextureImageGLTest TextureImageGLTest.cpp LIBRARIES MagnumDebugTools MagnumOpenGLTester)
set_target_properties(DebugToolsTextureImageGLTest PROPERTIES FOLDER "Magnum/DebugTools/Test")
if(NOT (MAGNUM_TARGET_GLES2 AND MAGNUM_TARGET_WEBGL))
corrade_add_test(DebugToolsBufferDataGLTest BufferDataGLTest.cpp LIBRARIES MagnumDebugTools MagnumOpenGLTester)
if(NOT (MAGNUM_TARGET_GLES2 AND MAGNUM_TARGET_WEBGL))
corrade_add_test(DebugToolsBufferDataGLTest BufferDataGLTest.cpp LIBRARIES MagnumDebugTools MagnumOpenGLTester)
set_target_properties(DebugToolsBufferDataGLTest PROPERTIES FOLDER "Magnum/DebugTools/Test")
set_target_properties(DebugToolsBufferDataGLTest PROPERTIES FOLDER "Magnum/DebugTools/Test")
endif()
endif()
endif()

31
src/Magnum/MeshTools/CMakeLists.txt

@ -25,8 +25,6 @@
# Files shared between main library and unit test library
set(MagnumMeshTools_SRCS
Compile.cpp
FullScreenTriangle.cpp
Tipsify.cpp)
# Files compiled with different flags for main library and unit test library
@ -38,11 +36,9 @@ set(MagnumMeshTools_GracefulAssert_SRCS
set(MagnumMeshTools_HEADERS
CombineIndexedArrays.h
Compile.h
CompressIndices.h
Duplicate.h
FlipNormals.h
FullScreenTriangle.h
GenerateFlatNormals.h
Interleave.h
RemoveDuplicates.h
@ -52,11 +48,21 @@ set(MagnumMeshTools_HEADERS
visibility.h)
if(TARGET_GL)
list(APPEND MagnumMeshTools_SRCS
Compile.cpp
FullScreenTriangle.cpp)
list(APPEND MagnumMeshTools_HEADERS
Compile.h
FullScreenTriangle.h)
endif()
# Objects shared between main and test library
add_library(MagnumMeshToolsObjects OBJECT
${MagnumMeshTools_SRCS}
${MagnumMeshTools_HEADERS})
target_include_directories(MagnumMeshToolsObjects PUBLIC $<TARGET_PROPERTY:MagnumGL,INTERFACE_INCLUDE_DIRECTORIES>)
target_include_directories(MagnumMeshToolsObjects PUBLIC $<TARGET_PROPERTY:Magnum,INTERFACE_INCLUDE_DIRECTORIES>)
if(NOT BUILD_STATIC)
target_compile_definitions(MagnumMeshToolsObjects PRIVATE "MagnumMeshToolsObjects_EXPORTS")
endif()
@ -64,6 +70,9 @@ if(NOT BUILD_STATIC OR BUILD_STATIC_PIC)
set_target_properties(MagnumMeshToolsObjects PROPERTIES POSITION_INDEPENDENT_CODE ON)
endif()
set_target_properties(MagnumMeshToolsObjects PROPERTIES FOLDER "Magnum/MeshTools")
if(TARGET_GL)
target_include_directories(MagnumMeshToolsObjects PUBLIC $<TARGET_PROPERTY:MagnumGL,INTERFACE_INCLUDE_DIRECTORIES>)
endif()
# Main MeshTools library
add_library(MagnumMeshTools ${SHARED_OR_STATIC}
@ -78,8 +87,10 @@ elseif(BUILD_STATIC_PIC)
set_target_properties(MagnumMeshTools PROPERTIES POSITION_INDEPENDENT_CODE ON)
endif()
target_link_libraries(MagnumMeshTools PUBLIC
Magnum
MagnumTrade)
Magnum)
if(TARGET_GL)
target_link_libraries(MagnumMeshTools PUBLIC MagnumGL MagnumTrade)
endif()
install(TARGETS MagnumMeshTools
RUNTIME DESTINATION ${MAGNUM_BINARY_INSTALL_DIR}
@ -101,8 +112,10 @@ if(BUILD_TESTS)
set_target_properties(MagnumMeshToolsTestLib PROPERTIES POSITION_INDEPENDENT_CODE ON)
endif()
target_link_libraries(MagnumMeshToolsTestLib PUBLIC
Magnum
MagnumTrade)
Magnum)
if(TARGET_GL)
target_link_libraries(MagnumMeshToolsTestLib PUBLIC MagnumGL MagnumTrade)
endif()
# On Windows we need to install first and then run the tests to avoid "DLL
# not found" hell, thus we need to install this too

14
src/Magnum/MeshTools/Compile.h

@ -29,6 +29,9 @@
* @brief Function @ref Magnum::MeshTools::compile()
*/
#include "Magnum/configure.h"
#ifdef MAGNUM_TARGET_GL
#include <tuple>
#include <memory>
@ -55,6 +58,10 @@ This is just a convenience function for creating generic meshes, you might want
to use @ref interleave() and @ref compressIndices() functions instead for
greater flexibility.
@note This function is available only if Magnum is compiled with
@ref MAGNUM_TARGET_GL enabled (done by default). See @ref building-features
for more information.
@see @ref shaders-generic
*/
MAGNUM_MESHTOOLS_EXPORT std::tuple<GL::Mesh, std::unique_ptr<GL::Buffer>, std::unique_ptr<GL::Buffer>> compile(const Trade::MeshData2D& meshData, GL::BufferUsage usage);
@ -76,10 +83,17 @@ This is just a convenience function for creating generic meshes, you might want
to use @ref interleave() and @ref compressIndices() functions instead for
greater flexibility.
@note This function is available only if Magnum is compiled with
@ref MAGNUM_TARGET_GL enabled (done by default). See @ref building-features
for more information.
@see @ref shaders-generic
*/
MAGNUM_MESHTOOLS_EXPORT std::tuple<GL::Mesh, std::unique_ptr<GL::Buffer>, std::unique_ptr<GL::Buffer>> compile(const Trade::MeshData3D& meshData, GL::BufferUsage usage);
}}
#else
#error this header is available only in the OpenGL build
#endif
#endif

1
src/Magnum/MeshTools/CompressIndices.h

@ -30,6 +30,7 @@
*/
#include <tuple>
#include <vector>
#include "Magnum/Mesh.h"
#include "Magnum/MeshTools/visibility.h"

19
src/Magnum/MeshTools/FullScreenTriangle.h

@ -25,10 +25,15 @@
DEALINGS IN THE SOFTWARE.
*/
#ifdef MAGNUM_TARGET_GL
/** @file
* @brief Function @ref Magnum::MeshTools::fullScreenTriangle()
*/
#endif
#include "Magnum/configure.h"
#ifdef MAGNUM_TARGET_GL
#include <memory>
#include <utility>
@ -79,15 +84,25 @@ void main() {
#endif
}
@endcode
@note This function is available only if Magnum is compiled with
@ref MAGNUM_TARGET_GL enabled (done by default). See @ref building-features
for more information.
*/
std::pair<std::unique_ptr<GL::Buffer>, GL::Mesh> MAGNUM_MESHTOOLS_EXPORT fullScreenTriangle(GL::Version version);
/**
@overload
/** @overload
This function implicitly uses current context version.
@note This function is available only if Magnum is compiled with
@ref MAGNUM_TARGET_GL enabled (done by default). See @ref building-features
for more information.
*/
std::pair<std::unique_ptr<GL::Buffer>, GL::Mesh> MAGNUM_MESHTOOLS_EXPORT fullScreenTriangle();
#else
#error this header is available only in the OpenGL build
#endif
}}

25
src/Magnum/TextureTools/CMakeLists.txt

@ -23,20 +23,25 @@
# DEALINGS IN THE SOFTWARE.
#
corrade_add_resource(MagnumTextureTools_RCS resources.conf)
set_target_properties(MagnumTextureTools_RCS-dependencies PROPERTIES FOLDER "Magnum/TextureTools")
set(MagnumTextureTools_SRCS
Atlas.cpp
DistanceField.cpp
${MagnumTextureTools_RCS})
Atlas.cpp)
set(MagnumTextureTools_HEADERS
Atlas.h
DistanceField.h
visibility.h)
if(TARGET_GL)
corrade_add_resource(MagnumTextureTools_RCS resources.conf)
set_target_properties(MagnumTextureTools_RCS-dependencies PROPERTIES FOLDER "Magnum/TextureTools")
list(APPEND MagnumTextureTools_SRCS
DistanceField.cpp
${MagnumTextureTools_RCS})
list(APPEND MagnumTextureTools_HEADERS DistanceField.h)
endif()
# TextureTools library
add_library(MagnumTextureTools ${SHARED_OR_STATIC}
${MagnumTextureTools_SRCS}
@ -50,8 +55,10 @@ elseif(BUILD_STATIC_PIC)
set_target_properties(MagnumTextureTools PROPERTIES POSITION_INDEPENDENT_CODE ON)
endif()
target_link_libraries(MagnumTextureTools PUBLIC
Magnum
MagnumGL)
Magnum)
if(WITH_GL)
target_link_libraries(MagnumTextureTools PUBLIC MagnumGL)
endif()
install(TARGETS MagnumTextureTools
RUNTIME DESTINATION ${MAGNUM_BINARY_INSTALL_DIR}

10
src/Magnum/TextureTools/DistanceField.h

@ -29,6 +29,9 @@
* @brief Function @ref Magnum::TextureTools::distanceField()
*/
#include "Magnum/configure.h"
#ifdef MAGNUM_TARGET_GL
#include "Magnum/Magnum.h"
#include "Magnum/GL/GL.h"
#ifndef MAGNUM_TARGET_GLES
@ -92,6 +95,10 @@ http://www.valvesoftware.com/publications/2007/SIGGRAPH2007_AlphaTestedMagnifica
rendering to @ref GL::TextureFormat::Luminance is not supported in most
cases.
@note This function is available only if Magnum is compiled with
@ref MAGNUM_TARGET_GL enabled (done by default). See @ref building-features
for more information.
@bug ES (and maybe GL < 3.20) implementation behaves slightly different
(jaggies, visible e.g. when rendering outlined fonts)
*/
@ -102,5 +109,8 @@ void MAGNUM_TEXTURETOOLS_EXPORT distanceField(GL::Texture2D& input, GL::Texture2
#endif
}}
#else
#error this header is available only in the OpenGL build
#endif
#endif

3
src/Magnum/Trade/CMakeLists.txt

@ -74,7 +74,6 @@ add_library(MagnumTradeObjects OBJECT
${MagnumTrade_HEADERS})
target_include_directories(MagnumTradeObjects PUBLIC
$<TARGET_PROPERTY:Magnum,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:MagnumGL,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:Corrade::PluginManager,INTERFACE_INCLUDE_DIRECTORIES>)
if(NOT BUILD_STATIC)
target_compile_definitions(MagnumTradeObjects PRIVATE "MagnumTradeObjects_EXPORTS")
@ -98,7 +97,6 @@ elseif(BUILD_STATIC_PIC)
endif()
target_link_libraries(MagnumTrade PUBLIC
Magnum
MagnumGL
Corrade::PluginManager)
install(TARGETS MagnumTrade
@ -138,7 +136,6 @@ if(BUILD_TESTS)
endif()
target_link_libraries(MagnumTradeTestLib
Magnum
MagnumGL
Corrade::PluginManager)
# On Windows we need to install first and then run the tests to avoid "DLL

Loading…
Cancel
Save