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 # Parts of the library
cmake_dependent_option(WITH_AUDIO "Build Audio library" OFF "NOT WITH_AL_INFO;NOT WITH_ANYAUDIOIMPORTER;NOT WITH_WAVAUDIOIMPORTER" ON) 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) 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_MESHTOOLS "Build MeshTools library" ON "NOT WITH_OBJIMPORTER" ON)
cmake_dependent_option(WITH_PRIMITIVES "Builf Primitives library" ON "NOT WITH_DEBUGTOOLS OR NOT WITH_SHAPES" ON)
option(WITH_SHAPES "Build Shapes library" 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_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_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_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_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) 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. - `TARGET_GL` --- Build libraries with OpenGL interoperability enabled.
Enabled by default when `WITH_GL` is enabled. Disabling this will cause 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 other libraries to not depend on the @ref GL library, but doesn't affect
@ref GL library itself. the @ref GL library itself.
- `TARGET_GLES` --- Target OpenGL ES. Available only when `WITH_GL` is - `TARGET_GLES` --- Target OpenGL ES. Available only when `WITH_GL` is
enabled. enabled.
- `TARGET_GLES2` --- Target OpenGL ES 2.0 instead of 3.0 and later. Available - `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 - `WITH_AUDIO` --- Build the @ref Audio library. Depends on
[OpenAL](https://www.openal.org/), not built by default. [OpenAL](https://www.openal.org/), not built by default.
- `WITH_DEBUGTOOLS` --- Build the @ref DebugTools library. Enables also - `WITH_DEBUGTOOLS` --- Build the @ref DebugTools library.
building of the GL library. - `WITH_GL` --- Build the @ref GL library. Enabled automatically if
- `WITH_GL` --- Build the @ref GL library `WITH_SHADERS` or `WITH_TEXT` is enabled.
- `WITH_MESHTOOLS` --- Build the @ref MeshTools library. Enables also - `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 - `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 - `WITH_SCENEGRAPH` --- Build the @ref SceneGraph library. Enabled
automatically if `WITH_SHAPES` is enabled. automatically if `WITH_SHAPES` is enabled.
- `WITH_SHADERS` --- Build the @ref Shaders library. Enables also building of - `WITH_SHADERS` --- Build the @ref Shaders library. Enables also building of
the GL library. the GL library.
- `WITH_SHAPES` --- Build the @ref Shapes library. Enables also building of - `WITH_SHAPES` --- Build the @ref Shapes library. Enables also building of
the SceneGraph library. Enabled automatically if `WITH_DEBUGTOOLS` is the SceneGraph library.
enabled.
- `WITH_TEXT` --- Build the @ref Text library. Enables also building of - `WITH_TEXT` --- Build the @ref Text library. Enables also building of
the TextureTools and GL libraries. the TextureTools and GL libraries.
- `WITH_TEXTURETOOLS` --- Build the @ref TextureTools library. Enables also - `WITH_TEXTURETOOLS` --- Build the @ref TextureTools library. Enabled
building of the GL library. Enabled automatically if `WITH_TEXT` or automatically if `WITH_TEXT` or `WITH_DISTANCEFIELDCONVERTER` is enabled.
`WITH_DISTANCEFIELDCONVERTER` is enabled. - `WITH_TRADE` --- Build the @ref Trade library.
- `WITH_TRADE` --- Build the @ref Trade library. Enables also building of the
GL library.
There are more involved component dependencies that are not described here (for There are more involved component dependencies that are not described here (for
example the @ref DebugTools has some functionality that gets built only when 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 @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 - All plugin interfaces now implement
@ref Corrade::PluginManager::AbstractPlugin::pluginSearchPaths() "pluginSearchPaths()" @ref Corrade::PluginManager::AbstractPlugin::pluginSearchPaths() "pluginSearchPaths()"
for plugin directory autodetection --- you no longer need to specify the 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) target_link_libraries(your-app Magnum::MeshTools)
@endcode @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. 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) target_link_libraries(your-app Magnum::TextureTools)
@endcode @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. 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) if(_component STREQUAL Audio)
# no inter-component dependencies # no inter-component dependencies
elseif(_component STREQUAL DebugTools) 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) 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) elseif(_component STREQUAL OpenGLTester)
if(MAGNUM_TARGET_HEADLESS OR CORRADE_TARGET_EMSCRIPTEN OR CORRADE_TARGET_ANDROID) if(MAGNUM_TARGET_HEADLESS OR CORRADE_TARGET_EMSCRIPTEN OR CORRADE_TARGET_ANDROID)
set(_MAGNUM_${_COMPONENT}_DEPENDENCIES WindowlessEglApplication GL) set(_MAGNUM_${_COMPONENT}_DEPENDENCIES WindowlessEglApplication GL)
@ -360,7 +367,7 @@ foreach(_component ${Magnum_FIND_COMPONENTS})
endif() endif()
endif() endif()
elseif(_component STREQUAL Primitives) elseif(_component STREQUAL Primitives)
set(_MAGNUM_${_COMPONENT}_DEPENDENCIES Trade GL) set(_MAGNUM_${_COMPONENT}_DEPENDENCIES Trade)
elseif(_component STREQUAL SceneGraph) elseif(_component STREQUAL SceneGraph)
# no dependencies except for the main lib # no dependencies except for the main lib
elseif(_component STREQUAL Shaders) elseif(_component STREQUAL Shaders)
@ -370,9 +377,11 @@ foreach(_component ${Magnum_FIND_COMPONENTS})
elseif(_component STREQUAL Text) elseif(_component STREQUAL Text)
set(_MAGNUM_${_COMPONENT}_DEPENDENCIES TextureTools GL) set(_MAGNUM_${_COMPONENT}_DEPENDENCIES TextureTools GL)
elseif(_component STREQUAL TextureTools) elseif(_component STREQUAL TextureTools)
set(_MAGNUM_${_COMPONENT}_DEPENDENCIES GL) if(MAGNUM_TARGET_GL)
set(_MAGNUM_${_COMPONENT}_DEPENDENCIES GL)
endif()
elseif(_component STREQUAL Trade) elseif(_component STREQUAL Trade)
set(_MAGNUM_${_COMPONENT}_DEPENDENCIES GL) # no dependencies except for the main lib
elseif(_component STREQUAL AndroidApplication) elseif(_component STREQUAL AndroidApplication)
set(_MAGNUM_${_COMPONENT}_DEPENDENCIES GL) set(_MAGNUM_${_COMPONENT}_DEPENDENCIES GL)
elseif(_component STREQUAL GlfwApplication) elseif(_component STREQUAL GlfwApplication)

16
src/Magnum/DebugTools/BufferData.h

@ -25,7 +25,7 @@
DEALINGS IN THE SOFTWARE. DEALINGS IN THE SOFTWARE.
*/ */
#ifndef MAGNUM_TARGET_WEBGL #if defined(MAGNUM_TARGET_GL) && !defined(MAGNUM_TARGET_WEBGL)
/** @file /** @file
* @brief Function @ref Magnum::DebugTools::bufferData(), @ref Magnum::DebugTools::bufferSubData() * @brief Function @ref Magnum::DebugTools::bufferData(), @ref Magnum::DebugTools::bufferSubData()
*/ */
@ -36,7 +36,7 @@
#include "Magnum/GL/Buffer.h" #include "Magnum/GL/Buffer.h"
#include "Magnum/DebugTools/visibility.h" #include "Magnum/DebugTools/visibility.h"
#ifndef MAGNUM_TARGET_WEBGL #if defined(MAGNUM_TARGET_GL) && !defined(MAGNUM_TARGET_WEBGL)
namespace Magnum { namespace DebugTools { namespace Magnum { namespace DebugTools {
namespace Implementation { namespace Implementation {
@ -48,6 +48,11 @@ namespace Implementation {
Emulates @ref GL::Buffer::subData() call on platforms that don't support it Emulates @ref GL::Buffer::subData() call on platforms that don't support it
(such as OpenGL ES) by using @ref GL::Buffer::map(). (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 @requires_gles30 Extension @extension{EXT,map_buffer_range} in OpenGL ES
2.0. 2.0.
@requires_gles Buffer mapping is not available in WebGL. @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 Emulates @ref GL::Buffer::data() call on platforms that don't support it (such
as OpenGL ES) by using @ref GL::Buffer::map(). 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 @requires_gles30 Extension @extension{EXT,map_buffer_range} in OpenGL ES
2.0. 2.0.
@requires_gles Buffer mapping is not available in WebGL. @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 #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
#endif #endif

159
src/Magnum/DebugTools/CMakeLists.txt

@ -24,23 +24,82 @@
# #
set(MagnumDebugTools_SRCS set(MagnumDebugTools_SRCS
Profiler.cpp Profiler.cpp)
ResourceManager.cpp
TextureImage.cpp)
set(MagnumDebugTools_HEADERS set(MagnumDebugTools_HEADERS
DebugTools.h DebugTools.h
Profiler.h Profiler.h)
ResourceManager.h
TextureImage.h
visibility.h)
# Header files to display in project view of IDEs only # Header files to display in project view of IDEs only
set(MagnumDebugTools_PRIVATE_HEADERS ) set(MagnumDebugTools_PRIVATE_HEADERS )
if(MAGNUM_TARGET_GLES AND NOT MAGNUM_TARGET_GLES2) if(TARGET_GL)
corrade_add_resource(MagnumDebugTools_RESOURCES resources.conf) list(APPEND MagnumDebugTools_SRCS
list(APPEND MagnumDebugTools_SRCS ${MagnumDebugTools_RESOURCES}) 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() endif()
# Build the TestSuite-related functionality only if it is present # Build the TestSuite-related functionality only if it is present
@ -53,59 +112,6 @@ if(Corrade_TestSuite_FOUND)
CompareImage.h) CompareImage.h)
endif() 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 # DebugTools library
add_library(MagnumDebugTools ${SHARED_OR_STATIC} add_library(MagnumDebugTools ${SHARED_OR_STATIC}
${MagnumDebugTools_SRCS} ${MagnumDebugTools_SRCS}
@ -119,22 +125,23 @@ if(NOT BUILD_STATIC)
elseif(BUILD_STATIC_PIC) elseif(BUILD_STATIC_PIC)
set_target_properties(MagnumDebugTools PROPERTIES POSITION_INDEPENDENT_CODE ON) set_target_properties(MagnumDebugTools PROPERTIES POSITION_INDEPENDENT_CODE ON)
endif() endif()
target_link_libraries(MagnumDebugTools PUBLIC target_link_libraries(MagnumDebugTools PUBLIC Magnum)
Magnum
MagnumGL)
if(Corrade_TestSuite_FOUND) if(Corrade_TestSuite_FOUND)
target_link_libraries(MagnumDebugTools PUBLIC Corrade::TestSuite) target_link_libraries(MagnumDebugTools PUBLIC Corrade::TestSuite)
endif() endif()
if(WITH_SCENEGRAPH) if(TARGET_GL)
target_link_libraries(MagnumDebugTools PUBLIC MagnumSceneGraph) target_link_libraries(MagnumDebugTools PUBLIC MagnumGL)
endif() if(WITH_SCENEGRAPH)
if(WITH_SHAPES) target_link_libraries(MagnumDebugTools PUBLIC MagnumSceneGraph)
target_link_libraries(MagnumDebugTools PUBLIC MagnumShapes MagnumPrimitives) endif()
endif() if(WITH_SHAPES)
if(WITH_SCENEGRAPH OR WITH_SHAPES) target_link_libraries(MagnumDebugTools PUBLIC MagnumShapes MagnumPrimitives)
target_link_libraries(MagnumDebugTools PUBLIC endif()
MagnumMeshTools if(WITH_SCENEGRAPH OR WITH_SHAPES)
MagnumShaders) target_link_libraries(MagnumDebugTools PUBLIC
MagnumMeshTools
MagnumShaders)
endif()
endif() endif()
install(TARGETS MagnumDebugTools install(TARGETS MagnumDebugTools

5
src/Magnum/DebugTools/DebugTools.h

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

14
src/Magnum/DebugTools/ForceRenderer.h

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

14
src/Magnum/DebugTools/ObjectRenderer.h

@ -25,9 +25,11 @@
DEALINGS IN THE SOFTWARE. DEALINGS IN THE SOFTWARE.
*/ */
#ifdef 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
*/ */
#endif
#include "Magnum/Resource.h" #include "Magnum/Resource.h"
#include "Magnum/DebugTools/visibility.h" #include "Magnum/DebugTools/visibility.h"
@ -35,12 +37,17 @@
#include "Magnum/SceneGraph/Drawable.h" #include "Magnum/SceneGraph/Drawable.h"
#include "Magnum/Shaders/Shaders.h" #include "Magnum/Shaders/Shaders.h"
#ifdef MAGNUM_TARGET_GL
namespace Magnum { namespace DebugTools { namespace Magnum { namespace DebugTools {
/** /**
@brief Object renderer options @brief Object renderer options
See @ref ObjectRenderer documentation for more information. 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 { class ObjectRendererOptions {
public: public:
@ -83,6 +90,10 @@ Object3D* object;
new DebugTools::ObjectRenderer2D(object, "my", debugDrawables); new DebugTools::ObjectRenderer2D(object, "my", debugDrawables);
@endcode @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 @see @ref ObjectRenderer2D, @ref ObjectRenderer3D, @ref ObjectRendererOptions
*/ */
template<UnsignedInt dimensions> class MAGNUM_DEBUGTOOLS_EXPORT ObjectRenderer: public SceneGraph::Drawable<dimensions, Float> { 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; typedef ObjectRenderer<3> ObjectRenderer3D;
}} }}
#else
#error this header is available only in the OpenGL build
#endif
#endif #endif

14
src/Magnum/DebugTools/ResourceManager.h

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

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

@ -23,35 +23,37 @@
# DEALINGS IN THE SOFTWARE. # 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) if(Corrade_TestSuite_FOUND)
corrade_add_test(DebugToolsCompareImageTest CompareImageTest.cpp LIBRARIES MagnumDebugTools) corrade_add_test(DebugToolsCompareImageTest CompareImageTest.cpp LIBRARIES MagnumDebugTools)
set_target_properties(DebugToolsCompareImageTest PROPERTIES FOLDER "Magnum/DebugTools/Test") set_target_properties(DebugToolsCompareImageTest PROPERTIES FOLDER "Magnum/DebugTools/Test")
endif() endif()
if(BUILD_GL_TESTS) if(TARGET_GL)
corrade_add_test(DebugToolsTextureImageGLTest TextureImageGLTest.cpp LIBRARIES MagnumDebugTools MagnumOpenGLTester) if(WITH_SHAPES)
set_target_properties(DebugToolsTextureImageGLTest PROPERTIES FOLDER "Magnum/DebugTools/Test") 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)) if(NOT (MAGNUM_TARGET_GLES2 AND MAGNUM_TARGET_WEBGL))
corrade_add_test(DebugToolsBufferDataGLTest BufferDataGLTest.cpp LIBRARIES MagnumDebugTools MagnumOpenGLTester) 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()
endif() endif()

31
src/Magnum/MeshTools/CMakeLists.txt

@ -25,8 +25,6 @@
# Files shared between main library and unit test library # Files shared between main library and unit test library
set(MagnumMeshTools_SRCS set(MagnumMeshTools_SRCS
Compile.cpp
FullScreenTriangle.cpp
Tipsify.cpp) Tipsify.cpp)
# Files compiled with different flags for main library and unit test library # Files compiled with different flags for main library and unit test library
@ -38,11 +36,9 @@ set(MagnumMeshTools_GracefulAssert_SRCS
set(MagnumMeshTools_HEADERS set(MagnumMeshTools_HEADERS
CombineIndexedArrays.h CombineIndexedArrays.h
Compile.h
CompressIndices.h CompressIndices.h
Duplicate.h Duplicate.h
FlipNormals.h FlipNormals.h
FullScreenTriangle.h
GenerateFlatNormals.h GenerateFlatNormals.h
Interleave.h Interleave.h
RemoveDuplicates.h RemoveDuplicates.h
@ -52,11 +48,21 @@ set(MagnumMeshTools_HEADERS
visibility.h) 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 # Objects shared between main and test library
add_library(MagnumMeshToolsObjects OBJECT add_library(MagnumMeshToolsObjects OBJECT
${MagnumMeshTools_SRCS} ${MagnumMeshTools_SRCS}
${MagnumMeshTools_HEADERS}) ${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) if(NOT BUILD_STATIC)
target_compile_definitions(MagnumMeshToolsObjects PRIVATE "MagnumMeshToolsObjects_EXPORTS") target_compile_definitions(MagnumMeshToolsObjects PRIVATE "MagnumMeshToolsObjects_EXPORTS")
endif() endif()
@ -64,6 +70,9 @@ if(NOT BUILD_STATIC OR BUILD_STATIC_PIC)
set_target_properties(MagnumMeshToolsObjects PROPERTIES POSITION_INDEPENDENT_CODE ON) set_target_properties(MagnumMeshToolsObjects PROPERTIES POSITION_INDEPENDENT_CODE ON)
endif() endif()
set_target_properties(MagnumMeshToolsObjects PROPERTIES FOLDER "Magnum/MeshTools") 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 # Main MeshTools library
add_library(MagnumMeshTools ${SHARED_OR_STATIC} add_library(MagnumMeshTools ${SHARED_OR_STATIC}
@ -78,8 +87,10 @@ elseif(BUILD_STATIC_PIC)
set_target_properties(MagnumMeshTools PROPERTIES POSITION_INDEPENDENT_CODE ON) set_target_properties(MagnumMeshTools PROPERTIES POSITION_INDEPENDENT_CODE ON)
endif() endif()
target_link_libraries(MagnumMeshTools PUBLIC target_link_libraries(MagnumMeshTools PUBLIC
Magnum Magnum)
MagnumTrade) if(TARGET_GL)
target_link_libraries(MagnumMeshTools PUBLIC MagnumGL MagnumTrade)
endif()
install(TARGETS MagnumMeshTools install(TARGETS MagnumMeshTools
RUNTIME DESTINATION ${MAGNUM_BINARY_INSTALL_DIR} RUNTIME DESTINATION ${MAGNUM_BINARY_INSTALL_DIR}
@ -101,8 +112,10 @@ if(BUILD_TESTS)
set_target_properties(MagnumMeshToolsTestLib PROPERTIES POSITION_INDEPENDENT_CODE ON) set_target_properties(MagnumMeshToolsTestLib PROPERTIES POSITION_INDEPENDENT_CODE ON)
endif() endif()
target_link_libraries(MagnumMeshToolsTestLib PUBLIC target_link_libraries(MagnumMeshToolsTestLib PUBLIC
Magnum Magnum)
MagnumTrade) 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 # 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 # 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() * @brief Function @ref Magnum::MeshTools::compile()
*/ */
#include "Magnum/configure.h"
#ifdef MAGNUM_TARGET_GL
#include <tuple> #include <tuple>
#include <memory> #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 to use @ref interleave() and @ref compressIndices() functions instead for
greater flexibility. 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 @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); 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 to use @ref interleave() and @ref compressIndices() functions instead for
greater flexibility. 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 @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); 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 #endif

1
src/Magnum/MeshTools/CompressIndices.h

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

19
src/Magnum/MeshTools/FullScreenTriangle.h

@ -25,10 +25,15 @@
DEALINGS IN THE SOFTWARE. DEALINGS IN THE SOFTWARE.
*/ */
#ifdef MAGNUM_TARGET_GL
/** @file /** @file
* @brief Function @ref Magnum::MeshTools::fullScreenTriangle() * @brief Function @ref Magnum::MeshTools::fullScreenTriangle()
*/ */
#endif
#include "Magnum/configure.h"
#ifdef MAGNUM_TARGET_GL
#include <memory> #include <memory>
#include <utility> #include <utility>
@ -79,15 +84,25 @@ void main() {
#endif #endif
} }
@endcode @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); 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. 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(); 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. # DEALINGS IN THE SOFTWARE.
# #
corrade_add_resource(MagnumTextureTools_RCS resources.conf)
set_target_properties(MagnumTextureTools_RCS-dependencies PROPERTIES FOLDER "Magnum/TextureTools")
set(MagnumTextureTools_SRCS set(MagnumTextureTools_SRCS
Atlas.cpp Atlas.cpp)
DistanceField.cpp
${MagnumTextureTools_RCS})
set(MagnumTextureTools_HEADERS set(MagnumTextureTools_HEADERS
Atlas.h Atlas.h
DistanceField.h
visibility.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 # TextureTools library
add_library(MagnumTextureTools ${SHARED_OR_STATIC} add_library(MagnumTextureTools ${SHARED_OR_STATIC}
${MagnumTextureTools_SRCS} ${MagnumTextureTools_SRCS}
@ -50,8 +55,10 @@ elseif(BUILD_STATIC_PIC)
set_target_properties(MagnumTextureTools PROPERTIES POSITION_INDEPENDENT_CODE ON) set_target_properties(MagnumTextureTools PROPERTIES POSITION_INDEPENDENT_CODE ON)
endif() endif()
target_link_libraries(MagnumTextureTools PUBLIC target_link_libraries(MagnumTextureTools PUBLIC
Magnum Magnum)
MagnumGL) if(WITH_GL)
target_link_libraries(MagnumTextureTools PUBLIC MagnumGL)
endif()
install(TARGETS MagnumTextureTools install(TARGETS MagnumTextureTools
RUNTIME DESTINATION ${MAGNUM_BINARY_INSTALL_DIR} RUNTIME DESTINATION ${MAGNUM_BINARY_INSTALL_DIR}

10
src/Magnum/TextureTools/DistanceField.h

@ -29,6 +29,9 @@
* @brief Function @ref Magnum::TextureTools::distanceField() * @brief Function @ref Magnum::TextureTools::distanceField()
*/ */
#include "Magnum/configure.h"
#ifdef MAGNUM_TARGET_GL
#include "Magnum/Magnum.h" #include "Magnum/Magnum.h"
#include "Magnum/GL/GL.h" #include "Magnum/GL/GL.h"
#ifndef MAGNUM_TARGET_GLES #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 rendering to @ref GL::TextureFormat::Luminance is not supported in most
cases. 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 @bug ES (and maybe GL < 3.20) implementation behaves slightly different
(jaggies, visible e.g. when rendering outlined fonts) (jaggies, visible e.g. when rendering outlined fonts)
*/ */
@ -102,5 +109,8 @@ void MAGNUM_TEXTURETOOLS_EXPORT distanceField(GL::Texture2D& input, GL::Texture2
#endif #endif
}} }}
#else
#error this header is available only in the OpenGL build
#endif
#endif #endif

3
src/Magnum/Trade/CMakeLists.txt

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

Loading…
Cancel
Save