diff --git a/doc/cmake.dox b/doc/cmake.dox index b6ab4f3a9..73732b990 100644 --- a/doc/cmake.dox +++ b/doc/cmake.dox @@ -156,17 +156,18 @@ variable along with `MAGNUM_PLUGINS_*_DEBUG_DIR` / `MAGNUM_PLUGINS_*_RELEASE_DIR variables to decide in preprocessing step. Features of found %Magnum library are exposed in these CMake variables, they -are also available as preprocessor variables if including Magnum.h: +are also available as preprocessor variables if including @ref Magnum/Magnum.h: - `MAGNUM_BUILD_DEPRECATED` -- Defined if compiled with deprecated APIs included -- `MAGNUM_BUILD_STATIC` -- Defined if built as static libraries. Default are - shared libraries. +- `MAGNUM_BUILD_STATIC` -- Defined if compiled as static libraries. Default + are shared libraries. - `MAGNUM_TARGET_GLES` -- Defined if compiled for OpenGL ES - `MAGNUM_TARGET_GLES2` -- Defined if compiled for OpenGL ES 2.0 - `MAGNUM_TARGET_GLES3` -- Defined if compiled for OpenGL ES 3.0 - `MAGNUM_TARGET_DESKTOP_GLES` -- Defined if compiled with OpenGL ES emulation on desktop OpenGL +- `MAGNUM_TARGET_WEBGL` --- Defined if compiled for WebGL If `MAGNUM_BUILD_DEPRECATED` is defined, the `MAGNUM_INCLUDE_DIR` variable also contains path directly to Magnum directory (i.e. for includes without `Magnum/` diff --git a/doc/getting-started.dox b/doc/getting-started.dox index 35b90f9ad..e8d0ff721 100644 --- a/doc/getting-started.dox +++ b/doc/getting-started.dox @@ -61,6 +61,10 @@ The code will be slightly different from what is presented below, but the changes are only minor (two modified lines and one additional file) and the main principles are the same. +If you are using `compatibility` branch of Magnum and Corrade, replace +`modules/FindCorrade.cmake` with [the one from `compatibility` branch](https://github.com/mosra/corrade/blob/compatibility/modules/FindCorrade.cmake) +so the compatibility mode gets properly detected and used. + @section getting-started-review Review project structure The base project consists of just six files in two subfolders. %Magnum uses diff --git a/doc/platform.dox b/doc/platform.dox index 633f38057..ef1cd319f 100644 --- a/doc/platform.dox +++ b/doc/platform.dox @@ -125,15 +125,19 @@ void MyApplication::viewportEvent(const Vector2i& size) { Windowless applications provide just a context for ofscreen rendering or performing tasks on GPU. There is not yet any platform-independent toolkit which could handle this in portable way, thus you have to use platform-specific -ones. As example we use @ref Platform::WindowlessGlxApplication, you need to -implement just @ref WindowlessGlxApplication::exec() "exec()" function. The -class can be then used directly in `main()`, but again, for convenience and -portability it's better to use @ref MAGNUM_WINDOWLESSGLXAPPLICATION_MAIN() -macro. +ones. %Magnum provides windowless applications for X11-based Unix, OS X and +Windows. To make things simple, as an example we will use only +@ref Platform::WindowlessGlxApplication, see link for bootstrap application +below for fully portable example. + +You need to implement just @ref WindowlessGlxApplication::exec() "exec()" +function. The class can be then used directly in `main()`, but again, for +convenience and portability it's better to use +@ref MAGNUM_WINDOWLESSGLXAPPLICATION_MAIN() macro. Similarly as with windowed applications, to simplify the porting, the library provides `Platform::WindowlessApplication` typedef and `MAGNUM_WINDOWLESSAPPLICATION_MAIN()` -macro, but only if only one windowless application header is included. Changing +macro, but only if just one windowless application header is included. Changing the code to use different toolkit is then matter of replacing only the #`include` statement. Aliases for windowless applications are separated from aliases for windowed applications, because projects commonly @@ -143,8 +147,10 @@ etc.). Barebone application which will just print out current OpenGL version and renderer string and exits is in the following code listing. -@note Fully contained windowless application along with CMake setup is - available in `windowless` branch of [Magnum Bootstrap](https://github.com/mosra/magnum-bootstrap) +@note Fully contained windowless application using @ref Platform::WindowlessCglApplication + on OS X, @ref Platform::WindowlessGlxApplication on Unix and + @ref Platform::WindowlessWglApplication on Windows along with CMake setup + is available in `windowless` branch of [Magnum Bootstrap](https://github.com/mosra/magnum-bootstrap) repository. @code diff --git a/modules/FindMagnum.cmake b/modules/FindMagnum.cmake index 22b5d029e..55addc7aa 100644 --- a/modules/FindMagnum.cmake +++ b/modules/FindMagnum.cmake @@ -92,6 +92,7 @@ # MAGNUM_TARGET_GLES3 - Defined if compiled for OpenGL ES 3.0 # MAGNUM_TARGET_DESKTOP_GLES - Defined if compiled with OpenGL ES # emulation on desktop OpenGL +# MAGNUM_TARGET_WEBGL - Defined if compiled for WebGL # # If `MAGNUM_BUILD_DEPRECATED` is defined, the `MAGNUM_INCLUDE_DIR` variable # also contains path directly to Magnum directory (i.e. for includes without @@ -207,6 +208,10 @@ string(FIND "${_magnumConfigure}" "#define MAGNUM_TARGET_DESKTOP_GLES" _TARGET_D if(NOT _TARGET_DESKTOP_GLES EQUAL -1) set(MAGNUM_TARGET_DESKTOP_GLES 1) endif() +string(FIND "${_magnumConfigure}" "#define MAGNUM_TARGET_WEBGL" _TARGET_WEBGL) +if(NOT _TARGET_WEBGL EQUAL -1) + set(MAGNUM_TARGET_WEBGL 1) +endif() # Dependent libraries and includes set(MAGNUM_INCLUDE_DIRS ${MAGNUM_INCLUDE_DIR} diff --git a/src/Magnum/Context.h b/src/Magnum/Context.h index f7e3d9f9b..8acc9042e 100644 --- a/src/Magnum/Context.h +++ b/src/Magnum/Context.h @@ -134,6 +134,13 @@ class MAGNUM_EXPORT Context { #endif }; + /** + * @brief %Context flags + * + * @see @ref flags() + */ + typedef Containers::EnumSet Flags; + /** * @brief State to reset * @@ -166,13 +173,6 @@ class MAGNUM_EXPORT Context { */ typedef Containers::EnumSet States; - /** - * @brief %Context flags - * - * @see @ref flags() - */ - typedef Containers::EnumSet Flags; - /** * @brief Constructor * @@ -385,6 +385,7 @@ class MAGNUM_EXPORT Context { * as it does most operations in compile time. * @see @ref supportedExtensions(), @ref Extension::extensions(), * @ref MAGNUM_ASSERT_EXTENSION_SUPPORTED() + * @todoc Explicit reference when Doxygen can handle const */ bool isExtensionSupported(const Extension& extension) const { return isVersionSupported(_extensionRequiredVersion[extension._index]) && extensionStatus[extension._index]; @@ -418,6 +419,7 @@ class MAGNUM_EXPORT Context { * Can be used e.g. for listing extensions available on current * hardware, but for general usage prefer isExtensionDisabled() const, * as it does most operations in compile time. + * @todoc Explicit reference when Doxygen can handle const */ bool isExtensionDisabled(const Extension& extension) const { return isVersionSupported(extension._requiredVersion) && extensionStatus[extension._index] && !isVersionSupported(_extensionRequiredVersion[extension._index]); diff --git a/src/Magnum/DebugTools/ForceRenderer.cpp b/src/Magnum/DebugTools/ForceRenderer.cpp index dd785c12f..6c020cb12 100644 --- a/src/Magnum/DebugTools/ForceRenderer.cpp +++ b/src/Magnum/DebugTools/ForceRenderer.cpp @@ -95,6 +95,9 @@ template ForceRenderer::ForceRenderer(SceneG ResourceManager::instance().set(this->mesh.key(), mesh, ResourceDataState::Final, ResourcePolicy::Manual); } +/* To avoid deleting pointers to incomplete type on destruction of Resource members */ +template ForceRenderer::~ForceRenderer() = default; + template void ForceRenderer::draw(const typename DimensionTraits::MatrixType& transformationMatrix, SceneGraph::AbstractCamera& camera) { shader->setTransformationProjectionMatrix(camera.projectionMatrix()*Implementation::forceRendererTransformation(transformationMatrix.transformPoint(forcePosition), force)*DimensionTraits::MatrixType::scaling(typename DimensionTraits::VectorType(options->scale()))) .setColor(options->color()); diff --git a/src/Magnum/DebugTools/ForceRenderer.h b/src/Magnum/DebugTools/ForceRenderer.h index 045f0f2b8..134a758db 100644 --- a/src/Magnum/DebugTools/ForceRenderer.h +++ b/src/Magnum/DebugTools/ForceRenderer.h @@ -125,6 +125,8 @@ template class MAGNUM_DEBUGTOOLS_EXPORT ForceRenderer: p */ ForceRenderer(SceneGraph::AbstractObject&, const typename DimensionTraits::VectorType&, typename DimensionTraits::VectorType&&, ResourceKey = ResourceKey(), SceneGraph::DrawableGroup* = nullptr) = delete; + ~ForceRenderer(); + private: void draw(const typename DimensionTraits::MatrixType& transformationMatrix, SceneGraph::AbstractCamera& camera) override; diff --git a/src/Magnum/DebugTools/ObjectRenderer.cpp b/src/Magnum/DebugTools/ObjectRenderer.cpp index ee3da5fce..eacfa6d2b 100644 --- a/src/Magnum/DebugTools/ObjectRenderer.cpp +++ b/src/Magnum/DebugTools/ObjectRenderer.cpp @@ -175,6 +175,9 @@ template ObjectRenderer::ObjectRenderer(Scen ResourceManager::instance().set(this->mesh.key(), mesh, ResourceDataState::Final, ResourcePolicy::Manual); } +/* To avoid deleting pointers to incomplete type on destruction of Resource members */ +template ObjectRenderer::~ObjectRenderer() = default; + template void ObjectRenderer::draw(const typename DimensionTraits::MatrixType& transformationMatrix, SceneGraph::AbstractCamera& camera) { shader->setTransformationProjectionMatrix(camera.projectionMatrix()*transformationMatrix*DimensionTraits::MatrixType::scaling(typename DimensionTraits::VectorType(options->size()))); mesh->draw(*shader); diff --git a/src/Magnum/DebugTools/ObjectRenderer.h b/src/Magnum/DebugTools/ObjectRenderer.h index 70371d95f..e5df920d1 100644 --- a/src/Magnum/DebugTools/ObjectRenderer.h +++ b/src/Magnum/DebugTools/ObjectRenderer.h @@ -97,6 +97,8 @@ template class MAGNUM_DEBUGTOOLS_EXPORT ObjectRenderer: */ explicit ObjectRenderer(SceneGraph::AbstractObject& object, ResourceKey options = ResourceKey(), SceneGraph::DrawableGroup* drawables = nullptr); + ~ObjectRenderer(); + private: void draw(const typename DimensionTraits::MatrixType& transformationMatrix, SceneGraph::AbstractCamera& camera) override; diff --git a/src/Magnum/Magnum.h b/src/Magnum/Magnum.h index 46ed5f9a2..4d16d875c 100644 --- a/src/Magnum/Magnum.h +++ b/src/Magnum/Magnum.h @@ -75,7 +75,7 @@ using Corrade::Utility::Error; Defined if the library contains deprecated API (which will be removed in the future). To preserve backward compatibility, %Magnum is by default built with deprecated API included. -@see @ref building +@see @ref building, @ref cmake */ #define MAGNUM_BUILD_DEPRECATED /* (enabled by default) */ @@ -84,7 +84,7 @@ deprecated API included. @brief Static library build Defined if built as static libraries. Default are shared libraries. -@see @ref building +@see @ref building, @ref cmake */ #define MAGNUM_BUILD_STATIC #undef MAGNUM_BUILD_STATIC @@ -94,7 +94,7 @@ Defined if built as static libraries. Default are shared libraries. Defined if the engine is built for OpenGL ES 3.0 or OpenGL ES 2.0. @see @ref MAGNUM_TARGET_GLES2, @ref MAGNUM_TARGET_GLES3, - @ref MAGNUM_TARGET_DESKTOP_GLES, @ref building + @ref MAGNUM_TARGET_DESKTOP_GLES, @ref building, @ref cmake */ #define MAGNUM_TARGET_GLES #undef MAGNUM_TARGET_GLES @@ -104,7 +104,8 @@ Defined if the engine is built for OpenGL ES 3.0 or OpenGL ES 2.0. Defined if the engine is built for OpenGL ES 2.0. Implies also @ref MAGNUM_TARGET_GLES. -@see @ref MAGNUM_TARGET_GLES3, @ref MAGNUM_TARGET_DESKTOP_GLES, @ref building +@see @ref MAGNUM_TARGET_GLES3, @ref MAGNUM_TARGET_DESKTOP_GLES, @ref building, + @ref cmake */ #define MAGNUM_TARGET_GLES2 #undef MAGNUM_TARGET_GLES2 @@ -114,7 +115,8 @@ Defined if the engine is built for OpenGL ES 2.0. Implies also Defined if the engine is built for OpenGL ES 3.0. Implies also @ref MAGNUM_TARGET_GLES. -@see @ref MAGNUM_TARGET_GLES2, @ref MAGNUM_TARGET_DESKTOP_GLES, @ref building +@see @ref MAGNUM_TARGET_GLES2, @ref MAGNUM_TARGET_DESKTOP_GLES, @ref building, + @ref cmake */ #define MAGNUM_TARGET_GLES3 #undef MAGNUM_TARGET_GLES3 @@ -124,7 +126,8 @@ Defined if the engine is built for OpenGL ES 3.0. Implies also Defined if the engine is built for OpenGL ES 3.0 or OpenGL ES 2.0 emulated within standard desktop OpenGL. Implies also @ref MAGNUM_TARGET_GLES. -@see @ref MAGNUM_TARGET_GLES2, @ref MAGNUM_TARGET_GLES3, @ref building +@see @ref MAGNUM_TARGET_GLES2, @ref MAGNUM_TARGET_GLES3, @ref building, + @ref cmake */ #define MAGNUM_TARGET_DESKTOP_GLES #undef MAGNUM_TARGET_DESKTOP_GLES @@ -138,7 +141,7 @@ differently, but there are some [specific restrictions and features](http://www.khronos.org/registry/webgl/specs/latest/1.0/#6) which you might want to be aware of. Implies also @ref MAGNUM_TARGET_GLES and @ref MAGNUM_TARGET_GLES2. -@see @ref CORRADE_TARGET_EMSCRIPTEN, @ref building +@see @ref CORRADE_TARGET_EMSCRIPTEN, @ref building, @ref cmake */ #define MAGNUM_TARGET_WEBGL #undef MAGNUM_TARGET_WEBGL