Browse Source

Merge branch 'master' into compatibility

Vladimír Vondruš 12 years ago
parent
commit
a486b17d3b
  1. 21
      CMakeLists.txt
  2. 50
      doc/building.dox
  3. 3
      doc/cmake.dox
  4. 2
      doc/scenegraph.dox
  5. 2
      doc/troubleshooting.dox
  6. 35
      doc/utilities.dox
  7. 4
      package/archlinux/PKGBUILD-emscripten
  8. 3
      src/Magnum/AbstractFramebuffer.h
  9. 2
      src/Magnum/AbstractResourceLoader.h
  10. 21
      src/Magnum/AbstractShaderProgram.h
  11. 5
      src/Magnum/AbstractTexture.h
  12. 2
      src/Magnum/Audio/AbstractImporter.h
  13. 9
      src/Magnum/Buffer.h
  14. 4
      src/Magnum/BufferTexture.h
  15. 1
      src/Magnum/CMakeLists.txt
  16. 41
      src/Magnum/Context.h
  17. 2
      src/Magnum/CubeMapTexture.h
  18. 2
      src/Magnum/CubeMapTextureArray.h
  19. 2
      src/Magnum/DebugMessage.h
  20. 7
      src/Magnum/DebugTools/ForceRenderer.h
  21. 7
      src/Magnum/DebugTools/ObjectRenderer.h
  22. 7
      src/Magnum/DebugTools/ShapeRenderer.h
  23. 5
      src/Magnum/DefaultFramebuffer.h
  24. 5
      src/Magnum/Framebuffer.h
  25. 57
      src/Magnum/Implementation/detectedDriver.cpp
  26. 3
      src/Magnum/Implementation/setupDriverWorkarounds.cpp
  27. 4
      src/Magnum/Math/Angle.h
  28. 7
      src/Magnum/Math/Range.h
  29. 20
      src/Magnum/Mesh.h
  30. 2
      src/Magnum/MultisampleTexture.h
  31. 2
      src/Magnum/Platform/Screen.h
  32. 2
      src/Magnum/Platform/ScreenedApplication.h
  33. 55
      src/Magnum/Platform/magnum-info.cpp
  34. 2
      src/Magnum/RectangleTexture.h
  35. 2
      src/Magnum/Renderbuffer.h
  36. 2
      src/Magnum/ResourceManager.h
  37. 9
      src/Magnum/SceneGraph/AbstractCamera.h
  38. 11
      src/Magnum/SceneGraph/AbstractFeature.h
  39. 6
      src/Magnum/SceneGraph/AbstractGroupedFeature.h
  40. 9
      src/Magnum/SceneGraph/AbstractObject.h
  41. 5
      src/Magnum/SceneGraph/AbstractTransformation.h
  42. 6
      src/Magnum/SceneGraph/Animable.h
  43. 7
      src/Magnum/SceneGraph/Camera2D.h
  44. 7
      src/Magnum/SceneGraph/Camera3D.h
  45. 6
      src/Magnum/SceneGraph/Drawable.h
  46. 9
      src/Magnum/SceneGraph/Object.h
  47. 6
      src/Magnum/Shader.h
  48. 6
      src/Magnum/Shaders/MeshVisualizer.cpp
  49. 2
      src/Magnum/Shaders/MeshVisualizer.h
  50. 9
      src/Magnum/Shaders/MeshVisualizer.vert
  51. 6
      src/Magnum/Text/AbstractFont.h
  52. 5
      src/Magnum/Text/AbstractFontConverter.h
  53. 6
      src/Magnum/Text/CMakeLists.txt
  54. 2
      src/Magnum/Text/DistanceFieldGlyphCache.h
  55. 2
      src/Magnum/Text/GlyphCache.h
  56. 4
      src/Magnum/Text/Renderer.h
  57. 63
      src/Magnum/Text/fontconverter.cpp
  58. 4
      src/Magnum/Text/fontconverterConfigure.h.cmake
  59. 2
      src/Magnum/Texture.h
  60. 2
      src/Magnum/TextureArray.h
  61. 9
      src/Magnum/TextureTools/DistanceField.h
  62. 49
      src/Magnum/TextureTools/distancefieldconverter.cpp
  63. 7
      src/Magnum/TextureTools/distancefieldconverterConfigure.h.cmake
  64. 2
      src/Magnum/Timeline.h
  65. 2
      src/Magnum/Trade/AbstractImageConverter.h
  66. 2
      src/Magnum/Trade/AbstractImporter.h
  67. 2
      toolchains

21
CMakeLists.txt

@ -178,8 +178,24 @@ endif()
include(CorradeLibSuffix) include(CorradeLibSuffix)
set(MAGNUM_BINARY_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/bin) set(MAGNUM_BINARY_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/bin)
set(MAGNUM_LIBRARY_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}) set(MAGNUM_LIBRARY_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX})
set(MAGNUM_DATA_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/share/magnum)
set(MAGNUM_CMAKE_FIND_MODULE_INSTALL_DIR ${CMAKE_ROOT}/Modules)
set(MAGNUM_INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/include/Magnum)
set(MAGNUM_EXTERNAL_INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/include/MagnumExternal)
set(MAGNUM_PLUGINS_INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/include/MagnumPlugins)
# Separate install dirs for debug and release plugins
set(MAGNUM_PLUGINS_DEBUG_INSTALL_DIR ${MAGNUM_LIBRARY_INSTALL_DIR}/magnum-d) set(MAGNUM_PLUGINS_DEBUG_INSTALL_DIR ${MAGNUM_LIBRARY_INSTALL_DIR}/magnum-d)
set(MAGNUM_PLUGINS_RELEASE_INSTALL_DIR ${MAGNUM_LIBRARY_INSTALL_DIR}/magnum) set(MAGNUM_PLUGINS_RELEASE_INSTALL_DIR ${MAGNUM_LIBRARY_INSTALL_DIR}/magnum)
# Plugin installation dirs based on wheter we are in debug or release build,
# needed by some command-line tools
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
set(MAGNUM_PLUGINS_INSTALL_DIR ${MAGNUM_PLUGINS_DEBUG_INSTALL_DIR})
else()
set(MAGNUM_PLUGINS_INSTALL_DIR ${MAGNUM_PLUGINS_RELEASE_INSTALL_DIR})
endif()
set(MAGNUM_PLUGINS_FONT_DEBUG_INSTALL_DIR ${MAGNUM_PLUGINS_DEBUG_INSTALL_DIR}/fonts) set(MAGNUM_PLUGINS_FONT_DEBUG_INSTALL_DIR ${MAGNUM_PLUGINS_DEBUG_INSTALL_DIR}/fonts)
set(MAGNUM_PLUGINS_FONT_RELEASE_INSTALL_DIR ${MAGNUM_PLUGINS_RELEASE_INSTALL_DIR}/fonts) set(MAGNUM_PLUGINS_FONT_RELEASE_INSTALL_DIR ${MAGNUM_PLUGINS_RELEASE_INSTALL_DIR}/fonts)
set(MAGNUM_PLUGINS_FONTCONVERTER_DEBUG_INSTALL_DIR ${MAGNUM_PLUGINS_DEBUG_INSTALL_DIR}/fontconverters) set(MAGNUM_PLUGINS_FONTCONVERTER_DEBUG_INSTALL_DIR ${MAGNUM_PLUGINS_DEBUG_INSTALL_DIR}/fontconverters)
@ -190,11 +206,6 @@ set(MAGNUM_PLUGINS_IMPORTER_DEBUG_INSTALL_DIR ${MAGNUM_PLUGINS_DEBUG_INSTALL_DIR
set(MAGNUM_PLUGINS_IMPORTER_RELEASE_INSTALL_DIR ${MAGNUM_PLUGINS_RELEASE_INSTALL_DIR}/importers) set(MAGNUM_PLUGINS_IMPORTER_RELEASE_INSTALL_DIR ${MAGNUM_PLUGINS_RELEASE_INSTALL_DIR}/importers)
set(MAGNUM_PLUGINS_AUDIOIMPORTER_DEBUG_INSTALL_DIR ${MAGNUM_PLUGINS_DEBUG_INSTALL_DIR}/audioimporters) set(MAGNUM_PLUGINS_AUDIOIMPORTER_DEBUG_INSTALL_DIR ${MAGNUM_PLUGINS_DEBUG_INSTALL_DIR}/audioimporters)
set(MAGNUM_PLUGINS_AUDIOIMPORTER_RELEASE_INSTALL_DIR ${MAGNUM_PLUGINS_RELEASE_INSTALL_DIR}/audioimporters) set(MAGNUM_PLUGINS_AUDIOIMPORTER_RELEASE_INSTALL_DIR ${MAGNUM_PLUGINS_RELEASE_INSTALL_DIR}/audioimporters)
set(MAGNUM_DATA_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/share/magnum)
set(MAGNUM_CMAKE_FIND_MODULE_INSTALL_DIR ${CMAKE_ROOT}/Modules)
set(MAGNUM_INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/include/Magnum)
set(MAGNUM_EXTERNAL_INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/include/MagnumExternal)
set(MAGNUM_PLUGINS_INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/include/MagnumPlugins)
add_subdirectory(modules) add_subdirectory(modules)
add_subdirectory(src) add_subdirectory(src)

50
doc/building.dox

@ -167,26 +167,27 @@ CMake and C++ sources, see @ref cmake and @ref Magnum/Magnum.h for more
information. See also @ref corrade-cmake and @ref Corrade/Corrade.h for information. See also @ref corrade-cmake and @ref Corrade/Corrade.h for
additional information. additional information.
By default the engine is built with nearly everything except Audio library, By default the engine is built with nearly everything except @ref Audio
plugins and application libraries (see below). Using `WITH_*` CMake parameters library, plugins and application libraries (see below). Using `WITH_*` CMake
you can specify which parts will be built and which not: parameters you can specify which parts will be built and which not:
- `WITH_AUDIO` - Audio library. Depends on **OpenAL** library, not built by - `WITH_AUDIO` - @ref Audio library. Depends on **OpenAL** library, not built
default. by default.
- `WITH_DEBUGTOOLS` - DebugTools library. Enables also building of MeshTools, - `WITH_DEBUGTOOLS` - @ref DebugTools library. Enables also building of
Primitives, SceneGraph, Shaders and Shapes libraries. %MeshTools, %Primitives, %SceneGraph, %Shaders and %Shapes libraries.
- `WITH_MESHTOOLS` - MeshTools library. Enabled automatically if - `WITH_MESHTOOLS` - @ref MeshTools library. Enabled automatically if
`WITH_DEBUGTOOLS` is enabled. `WITH_DEBUGTOOLS` is enabled.
- `WITH_PRIMITIVES` - Primitives library. Enabled automatically if - `WITH_PRIMITIVES` - @ref Primitives library. Enabled automatically if
`WITH_DEBUGTOOLS` is enabled. `WITH_DEBUGTOOLS` is enabled.
- `WITH_SCENEGRAPH` - SceneGraph library. Enabled automatically if - `WITH_SCENEGRAPH` - @ref SceneGraph library. Enabled automatically if
`WITH_DEBUGTOOLS` or `WITH_SHAPES` is enabled. `WITH_DEBUGTOOLS` or `WITH_SHAPES` is enabled.
- `WITH_SHADERS` - Shaders library. Enabled automatically if `WITH_DEBUGTOOLS` - `WITH_SHADERS` - @ref Shaders library. Enabled automatically if
is enabled. `WITH_DEBUGTOOLS` is enabled.
- `WITH_SHAPES` - Shapes library. Enables also building of SceneGraph - `WITH_SHAPES` - @ref Shapes library. Enables also building of %SceneGraph
library. Enabled automatically if `WITH_DEBUGTOOLS` is enabled. library. Enabled automatically if `WITH_DEBUGTOOLS` is enabled.
- `WITH_TEXT` - Text library. Enables also building of TextureTools library. - `WITH_TEXT` - @ref Text library. Enables also building of %TextureTools
- `WITH_TEXTURETOOLS` - TextureTools library. Enabled automatically if library.
- `WITH_TEXTURETOOLS` - @ref TextureTools library. Enabled automatically if
`WITH_TEXT` or `WITH_DISTANCEFIELDCONVERTER` is enabled. `WITH_TEXT` or `WITH_DISTANCEFIELDCONVERTER` is enabled.
None of the @ref Platform "application libraries" is built by default (and you None of the @ref Platform "application libraries" is built by default (and you
@ -207,15 +208,16 @@ platform best:
There are also a few command-line utilities. They are currently available only There are also a few command-line utilities. They are currently available only
on Linux, Mac OS X and Windows, also disabled by default: on Linux, Mac OS X and Windows, also disabled by default:
- `WITH_MAGNUMINFO` - `magnum-info` executable, provides information about - `WITH_MAGNUMINFO` - @ref magnum-info "magnum-info" executable, provides
the engine and OpenGL capabilities. information about the engine and OpenGL capabilities.
- `WITH_FONTCONVERTER` - `magnum-fontconverter` executable for converting - `WITH_DISTANCEFIELDCONVERTER` - @ref magnum-distancefieldconverter "magnum-distancefieldconverter"
fonts to raster ones. Enables also building of Text library. executable for converting black&white images to distance field textures.
- `WITH_DISTANCEFIELDCONVERTER` - `magnum-distancefieldconverter` executable Enables also building of %TextureTools library.
for converting black&white images to distance field textures. Enables also - `WITH_FONTCONVERTER` - @ref magnum-fontconverter "magnum-fontconverter"
building of TextureTools library. executable for converting fonts to raster ones. Enables also building of
%Text library.
Magnum also contains a set of dependency-less plugins for importing essential %Magnum also contains a set of dependency-less plugins for importing essential
file formats. Additional plugins are provided in separate plugin repository, file formats. Additional plugins are provided in separate plugin repository,
see @ref building-plugins for more information. None of the plugins is built by see @ref building-plugins for more information. None of the plugins is built by
default. default.

3
doc/cmake.dox

@ -156,7 +156,8 @@ variable along with `MAGNUM_PLUGINS_*_DEBUG_DIR` / `MAGNUM_PLUGINS_*_RELEASE_DIR
variables to decide in preprocessing step. variables to decide in preprocessing step.
Features of found %Magnum library are exposed in these CMake variables, they Features of found %Magnum library are exposed in these CMake variables, they
are also available as preprocessor variables if including @ref Magnum/Magnum.h: are also available as preprocessor variables if including
@ref Magnum/Magnum.h "Magnum/Magnum.h":
- `MAGNUM_BUILD_DEPRECATED` -- Defined if compiled with deprecated APIs - `MAGNUM_BUILD_DEPRECATED` -- Defined if compiled with deprecated APIs
included included

2
doc/scenegraph.dox

@ -227,7 +227,7 @@ by calling @ref Object::setClean(). @ref Camera3D "Camera", for example, calls
it automatically before it starts rendering, as it needs its own inverse it automatically before it starts rendering, as it needs its own inverse
transformation to properly draw the objects. transformation to properly draw the objects.
See @ref AbstractFeature-subclassing-caching for more information. See @ref SceneGraph-AbstractFeature-subclassing-caching for more information.
@section scenegraph-construction-order Construction and destruction order @section scenegraph-construction-order Construction and destruction order

2
doc/troubleshooting.dox

@ -55,7 +55,7 @@ try these things:
- Check that you use only extensions that are - Check that you use only extensions that are
@ref Context::isExtensionSupported() "available on your system". @ref Context::isExtensionSupported() "available on your system".
- Check that you didn't exceed any implementation-defined limit (see - Check that you didn't exceed any implementation-defined limit (see
`magnum-info` output for list of all of them). @ref magnum-info output for list of all of them).
- Enable @ref DebugMessage "debug output" to see more detailed errors, - Enable @ref DebugMessage "debug output" to see more detailed errors,
warnings and performance hints. warnings and performance hints.
- If using framebuffer objects, @ref Framebuffer::checkStatus() "check that they are complete". - If using framebuffer objects, @ref Framebuffer::checkStatus() "check that they are complete".

35
doc/utilities.dox

@ -0,0 +1,35 @@
/*
This file is part of Magnum.
Copyright © 2010, 2011, 2012, 2013, 2014
Vladimír Vondruš <mosra@centrum.cz>
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*/
namespace Magnum {
/** @page utilities Utilities
@brief Command-line utilities for system information and data conversion
- @subpage magnum-info -- @copybrief magnum-info
- @subpage magnum-distancefieldconverter -- @copybrief magnum-distancefieldconverter
- @subpage magnum-fontconverter -- @copybrief magnum-fontconverter
*/
}

4
package/archlinux/PKGBUILD-emscripten

@ -7,7 +7,7 @@ arch=('any')
url="http://mosra.cz/blog/magnum.php" url="http://mosra.cz/blog/magnum.php"
license=('MIT') license=('MIT')
depends=('emscripten-corrade') depends=('emscripten-corrade')
makedepends=('cmake' 'ninja') makedepends=('cmake' 'ninja' 'emscripten-git')
options=('!strip' '!buildflags' 'staticlibs') options=('!strip' '!buildflags' 'staticlibs')
build() { build() {
@ -25,7 +25,7 @@ build() {
cmake .. \ cmake .. \
-DCMAKE_BUILD_TYPE=Release \ -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr/emscripten/system \ -DCMAKE_INSTALL_PREFIX=/usr/lib/emscripten/system \
-DWITH_SDL2APPLICATION=ON \ -DWITH_SDL2APPLICATION=ON \
-DWITH_MAGNUMFONT=ON \ -DWITH_MAGNUMFONT=ON \
-DWITH_OBJIMPORTER=ON \ -DWITH_OBJIMPORTER=ON \

3
src/Magnum/AbstractFramebuffer.h

@ -157,7 +157,8 @@ namespace Implementation { struct FramebufferState; }
See @ref DefaultFramebuffer and @ref Framebuffer for more information. See @ref DefaultFramebuffer and @ref Framebuffer for more information.
@section AbstractFramebuffer-performance-optimization Performance optimizations and security @anchor AbstractFramebuffer-performance-optimization
## Performance optimizations and security
The engine tracks currently bound framebuffer and current viewport to avoid The engine tracks currently bound framebuffer and current viewport to avoid
unnecessary calls to @fn_gl{BindFramebuffer} and @fn_gl{Viewport} when unnecessary calls to @fn_gl{BindFramebuffer} and @fn_gl{Viewport} when

2
src/Magnum/AbstractResourceLoader.h

@ -40,7 +40,7 @@ namespace Magnum {
Provides (a)synchronous resource loading for @ref ResourceManager. Provides (a)synchronous resource loading for @ref ResourceManager.
@section AbstractResourceLoader-usage Usage and subclassing ## Usage and subclassing
Usage is done by subclassing. Subclass instances can be added to Usage is done by subclassing. Subclass instances can be added to
@ref ResourceManager using @ref ResourceManager::setLoader(). After adding the @ref ResourceManager using @ref ResourceManager::setLoader(). After adding the

21
src/Magnum/AbstractShaderProgram.h

@ -46,7 +46,8 @@ namespace Implementation {
/** /**
@brief Base for shader program implementations @brief Base for shader program implementations
@section AbstractShaderProgram-subclassing Subclassing workflow @anchor AbstractShaderProgram-subclassing
## Subclassing workflow
This class is designed to be used via subclassing. Subclasses define these This class is designed to be used via subclassing. Subclasses define these
functions and properties: functions and properties:
@ -116,7 +117,8 @@ MyShader& setSpecularTexture(Texture2D& texture) {
} }
@endcode @endcode
@subsection AbstractShaderProgram-attribute-location Binding attribute location @anchor AbstractShaderProgram-attribute-location
### Binding attribute location
The preferred workflow is to specify attribute location for vertex shader input The preferred workflow is to specify attribute location for vertex shader input
attributes and fragment shader output attributes explicitly in the shader code, attributes and fragment shader output attributes explicitly in the shader code,
@ -184,7 +186,8 @@ bindFragmentDataLocationIndexed(NormalOutput, 1, "normal");
@todo @es_extension{EXT,separate_shader_objects} supports explicit attrib @todo @es_extension{EXT,separate_shader_objects} supports explicit attrib
location location
@subsection AbstractShaderProgram-uniform-location Uniform locations @anchor AbstractShaderProgram-uniform-location
### Uniform locations
The preferred workflow is to specify uniform locations directly in the shader The preferred workflow is to specify uniform locations directly in the shader
code, e.g.: code, e.g.:
@ -219,7 +222,8 @@ Int normalMatrixUniform = uniformLocation("normalMatrix");
@ref Magnum::AbstractShaderProgram::uniformLocation() "uniformLocation()" @ref Magnum::AbstractShaderProgram::uniformLocation() "uniformLocation()"
instead. instead.
@subsection AbstractShaderProgram-texture-units Specifying texture binding units @anchor AbstractShaderProgram-texture-units
### Specifying texture binding units
The preferred workflow is to specify texture binding unit directly in the The preferred workflow is to specify texture binding unit directly in the
shader code, e.g.: shader code, e.g.:
@ -251,7 +255,8 @@ setUniform(uniformLocation("specularTexture"), 1);
@ref Magnum::AbstractShaderProgram::setUniform(Int, const T&) "setUniform(Int, Int)" @ref Magnum::AbstractShaderProgram::setUniform(Int, const T&) "setUniform(Int, Int)"
instead. instead.
@section AbstractShaderProgram-rendering-workflow Rendering workflow @anchor AbstractShaderProgram-rendering-workflow
## Rendering workflow
Basic workflow with %AbstractShaderProgram subclasses is: instance shader Basic workflow with %AbstractShaderProgram subclasses is: instance shader
class, configure attribute binding in meshes (see @ref Mesh-configuration "Mesh documentation" class, configure attribute binding in meshes (see @ref Mesh-configuration "Mesh documentation"
@ -268,7 +273,8 @@ shader.setTransformation(transformation)
mesh.draw(shader); mesh.draw(shader);
@endcode @endcode
@section AbstractShaderProgram-types Mapping between GLSL and Magnum types @anchor AbstractShaderProgram-types
## Mapping between GLSL and %Magnum types
See @ref types for more information, only types with GLSL equivalent can be used See @ref types for more information, only types with GLSL equivalent can be used
(and their super- or subclasses with the same size and underlying type). See (and their super- or subclasses with the same size and underlying type). See
@ -306,7 +312,8 @@ also @ref Attribute::DataType enum for additional type options.
@ref Magnum::Matrix4x3 "Matrix4x3") are not available in OpenGL ES 2.0. @ref Magnum::Matrix4x3 "Matrix4x3") are not available in OpenGL ES 2.0.
@requires_gl Double attributes and uniforms are not available in OpenGL ES. @requires_gl Double attributes and uniforms are not available in OpenGL ES.
@section AbstractShaderProgram-performance-optimization Performance optimizations @anchor AbstractShaderProgram-performance-optimization
## Performance optimizations
%Shader limits (such as @ref maxVertexAttributes()) are cached, so repeated %Shader limits (such as @ref maxVertexAttributes()) are cached, so repeated
queries don't result in repeated @fn_gl{Get} calls. queries don't result in repeated @fn_gl{Get} calls.

5
src/Magnum/AbstractTexture.h

@ -62,13 +62,14 @@ Encapsulates one OpenGL texture object. See @ref Texture, @ref TextureArray,
@ref BufferTexture and @ref MultisampleTexture documentation for more @ref BufferTexture and @ref MultisampleTexture documentation for more
information and usage examples. information and usage examples.
@section AbstractTexture-webgl-restrictions WebGL restrictions ## WebGL restrictions
@ref MAGNUM_TARGET_WEBGL "WebGL" puts some restrictions on type of data @ref MAGNUM_TARGET_WEBGL "WebGL" puts some restrictions on type of data
submitted to @ref Texture::setSubImage() "*Texture::setSubImage()", see its submitted to @ref Texture::setSubImage() "*Texture::setSubImage()", see its
documentation for details. documentation for details.
@section AbstractTexture-performance-optimization Performance optimizations and security @anchor AbstractTexture-performance-optimization
## Performance optimizations and security
The engine tracks currently bound textures in all available texture units to The engine tracks currently bound textures in all available texture units to
avoid unnecessary calls to @fn_gl{ActiveTexture} and @fn_gl{BindTexture}. avoid unnecessary calls to @fn_gl{ActiveTexture} and @fn_gl{BindTexture}.

2
src/Magnum/Audio/AbstractImporter.h

@ -43,7 +43,7 @@ Provides interface for importing various audio formats. See @ref plugins for
more information and `*Importer` classes in @ref Audio namespace for available more information and `*Importer` classes in @ref Audio namespace for available
importer plugins. importer plugins.
@section Audio-AbstractImporter-subclassing Subclassing ## Subclassing
Plugin implements function @ref doFeatures(), @ref doIsOpened(), one of or both Plugin implements function @ref doFeatures(), @ref doIsOpened(), one of or both
@ref doOpenData() and @ref doOpenFile() functions, function @ref doClose() and @ref doOpenData() and @ref doOpenFile() functions, function @ref doClose() and

9
src/Magnum/Buffer.h

@ -122,7 +122,7 @@ namespace Implementation { struct BufferState; }
Encapsulates one OpenGL buffer object and provides functions for convenient Encapsulates one OpenGL buffer object and provides functions for convenient
data updates. data updates.
@section Buffer-data Data updating ## Data updating
Default way to set or update buffer data with @ref setData() or @ref setSubData() Default way to set or update buffer data with @ref setData() or @ref setSubData()
is to use @ref Corrade::Containers::ArrayReference. See its documentation for is to use @ref Corrade::Containers::ArrayReference. See its documentation for
@ -138,7 +138,8 @@ std::vector<Vector3> data;
buffer.setData(data, BufferUsage::StaticDraw); buffer.setData(data, BufferUsage::StaticDraw);
@endcode @endcode
@subsection Buffer-data-mapping Memory mapping @anchor Buffer-data-mapping
## Memory mapping
%Buffer data can be also updated asynchronously. First you need to allocate %Buffer data can be also updated asynchronously. First you need to allocate
the buffer to desired size by passing `nullptr` to @ref setData(), e.g.: the buffer to desired size by passing `nullptr` to @ref setData(), e.g.:
@ -166,7 +167,7 @@ for(std::size_t i: {7, 27, 56, 128}) {
CORRADE_INTERNAL_ASSERT_OUTPUT(buffer.unmap()); CORRADE_INTERNAL_ASSERT_OUTPUT(buffer.unmap());
@endcode @endcode
@section Buffer-webgl-restrictions WebGL and NaCl restrictions ## WebGL and NaCl restrictions
Buffers in @ref MAGNUM_TARGET_WEBGL "WebGL" and @ref CORRADE_TARGET_NACL "NaCl" Buffers in @ref MAGNUM_TARGET_WEBGL "WebGL" and @ref CORRADE_TARGET_NACL "NaCl"
need to be bound only to one unique target, i.e., @ref Buffer bound to need to be bound only to one unique target, i.e., @ref Buffer bound to
@ -183,7 +184,7 @@ Buffer indices{Buffer::Target::ElementArray};
To ease up the development, @ref Mesh checks proper target hint when adding To ease up the development, @ref Mesh checks proper target hint when adding
vertex and index buffers in both WebGL and NaCl. vertex and index buffers in both WebGL and NaCl.
@section Buffer-performance-optimization Performance optimizations ## Performance optimizations
The engine tracks currently bound buffers to avoid unnecessary calls to The engine tracks currently bound buffers to avoid unnecessary calls to
@fn_gl{BindBuffer}. If the buffer is already bound to some target, functions @fn_gl{BindBuffer}. If the buffer is already bound to some target, functions

4
src/Magnum/BufferTexture.h

@ -157,7 +157,7 @@ enum class BufferTextureFormat: GLenum {
This texture is, unlike classic textures such as @ref Texture used as simple This texture is, unlike classic textures such as @ref Texture used as simple
data source, without any unnecessary interpolation and wrapping methods. data source, without any unnecessary interpolation and wrapping methods.
@section BufferTexture-usage Usage ## Usage
%Texture data are stored in buffer and after binding the buffer to the texture %Texture data are stored in buffer and after binding the buffer to the texture
using @ref setBuffer(), you can fill the buffer at any time using data setting using @ref setBuffer(), you can fill the buffer at any time using data setting
@ -185,7 +185,7 @@ In shader, the texture is used via `samplerBuffer`, `isamplerBuffer` or
are integer coordinates passed to `texelFetch()`. See @ref AbstractShaderProgram are integer coordinates passed to `texelFetch()`. See @ref AbstractShaderProgram
documentation for more information about usage in shaders. documentation for more information about usage in shaders.
@section BufferTexture-performance-optimization Performance optimizations ## Performance optimizations
If extension @extension{EXT,direct_state_access} is available, @ref setBuffer() If extension @extension{EXT,direct_state_access} is available, @ref setBuffer()
functions use DSA to avoid unnecessary calls to @fn_gl{ActiveTexture} and functions use DSA to avoid unnecessary calls to @fn_gl{ActiveTexture} and

1
src/Magnum/CMakeLists.txt

@ -62,6 +62,7 @@ set(Magnum_SRCS
Implementation/ShaderProgramState.cpp Implementation/ShaderProgramState.cpp
Implementation/State.cpp Implementation/State.cpp
Implementation/TextureState.cpp Implementation/TextureState.cpp
Implementation/detectedDriver.cpp
Implementation/maxTextureSize.cpp Implementation/maxTextureSize.cpp
Implementation/setupDriverWorkarounds.cpp Implementation/setupDriverWorkarounds.cpp

41
src/Magnum/Context.h

@ -38,6 +38,7 @@
#include "Magnum/Magnum.h" #include "Magnum/Magnum.h"
#include "Magnum/OpenGL.h" #include "Magnum/OpenGL.h"
#include "Magnum/visibility.h" #include "Magnum/visibility.h"
#include "MagnumExternal/Optional/optional.hpp"
#ifdef CORRADE_GCC45_COMPATIBILITY #ifdef CORRADE_GCC45_COMPATIBILITY
#include "Version.h" #include "Version.h"
@ -173,6 +174,35 @@ class MAGNUM_EXPORT Context {
*/ */
typedef Containers::EnumSet<State, UnsignedInt> States; typedef Containers::EnumSet<State, UnsignedInt> States;
/**
* @brief Detected driver
*
* @see @ref DetectedDriver, @ref detectedDriver()
*/
enum class DetectedDriver: UnsignedShort {
#ifndef MAGNUM_TARGET_GLES
/** Binary AMD desktop drivers on Windows and Linux */
AMD = 1 << 0,
#endif
#ifdef MAGNUM_TARGET_GLES2
/**
* OpenGL ES 2.0 implementation by ANGLE (translated to D3D9), used
* by browsers on Windows for Native Client and WebGL. As the WebGL
* specification explicitly disallows exposing driver information
* to the application, this check cannot be done reliably.
*/
ProbablyAngle = 1 << 1
#endif
};
/**
* @brief Detected drivers
*
* @see @ref detectedDriver()
*/
typedef Containers::EnumSet<DetectedDriver> DetectedDrivers;
/** /**
* @brief Constructor * @brief Constructor
* *
@ -436,6 +466,15 @@ class MAGNUM_EXPORT Context {
*/ */
void resetState(States states = ~States{}); void resetState(States states = ~States{});
/**
* @brief Detect driver
*
* Tries to detect driver using various OpenGL state queries. Once the
* detection is done, the result is cached, repeated queries don't
* result in repeated GL calls.
*/
DetectedDrivers detectedDriver();
#ifndef DOXYGEN_GENERATING_OUTPUT #ifndef DOXYGEN_GENERATING_OUTPUT
Implementation::State& state() { return *_state; } Implementation::State& state() { return *_state; }
#endif #endif
@ -455,6 +494,8 @@ class MAGNUM_EXPORT Context {
std::vector<Extension> _supportedExtensions; std::vector<Extension> _supportedExtensions;
Implementation::State* _state; Implementation::State* _state;
std::optional<DetectedDrivers> _detectedDrivers;
}; };
/** @debugoperatorclassenum{Magnum::Context,Magnum::Context::Flag} */ /** @debugoperatorclassenum{Magnum::Context,Magnum::Context::Flag} */

2
src/Magnum/CubeMapTexture.h

@ -50,7 +50,7 @@ turned upside down (+Y is top):
| +Y | | +Y |
+----+ +----+
@section CubeMapTexture-usage Basic usage ## Basic usage
See @ref Texture documentation for introduction. See @ref Texture documentation for introduction.

2
src/Magnum/CubeMapTextureArray.h

@ -43,7 +43,7 @@ namespace Magnum {
See @ref CubeMapTexture documentation for introduction. See @ref CubeMapTexture documentation for introduction.
@section CubeMapTextureArray-usage Usage ## Usage
See @ref Texture documentation for introduction. See @ref Texture documentation for introduction.

2
src/Magnum/DebugMessage.h

@ -46,7 +46,7 @@ Allows retrieving and inserting debug messages from and to OpenGL command
stream, for example with conjunction with various debuggers, such as Apitrace stream, for example with conjunction with various debuggers, such as Apitrace
or gDEBugger. or gDEBugger.
@section DebugMessage-usage Basic usage ## Basic usage
To retrieve debug messages from either the GL or your application you need to To retrieve debug messages from either the GL or your application you need to
have OpenGL 4.3 or @extension{KHR,debug} desktop/ES extension. You need to have OpenGL 4.3 or @extension{KHR,debug} desktop/ES extension. You need to

7
src/Magnum/DebugTools/ForceRenderer.h

@ -85,7 +85,8 @@ class ForceRendererOptions {
Visualizes force pushing on object by an arrow of the same direction and size. Visualizes force pushing on object by an arrow of the same direction and size.
See @ref debug-tools-renderers for more information. See @ref debug-tools-renderers for more information.
@section ForceRenderer-usage Basic usage @anchor DebugTools-ForceRenderer-usage
## Basic usage
Example code: Example code:
@code @code
@ -109,8 +110,8 @@ template<UnsignedInt dimensions> class MAGNUM_DEBUGTOOLS_EXPORT ForceRenderer: p
* @param forcePosition Where to render the force, relative to object * @param forcePosition Where to render the force, relative to object
* @param force Force vector * @param force Force vector
* @param options Options resource key. See * @param options Options resource key. See
* @ref ForceRenderer-usage "class documentation" for more * @ref DebugTools-ForceRenderer-usage "class documentation" for
* information. * more information.
* @param drawables Drawable group * @param drawables Drawable group
* *
* The renderer is automatically added to object's features, @p force is * The renderer is automatically added to object's features, @p force is

7
src/Magnum/DebugTools/ObjectRenderer.h

@ -69,7 +69,8 @@ class ObjectRendererOptions {
Visualizes object position, rotation and scale using colored axes. See Visualizes object position, rotation and scale using colored axes. See
@ref debug-tools-renderers for more information. @ref debug-tools-renderers for more information.
@section ObjectRenderer-usage Basic usage @anchor DebugTools-ObjectRenderer-usage
## Basic usage
Example code: Example code:
@code @code
@ -89,8 +90,8 @@ template<UnsignedInt dimensions> class MAGNUM_DEBUGTOOLS_EXPORT ObjectRenderer:
* @brief Constructor * @brief Constructor
* @param object Object for which to create debug renderer * @param object Object for which to create debug renderer
* @param options Options resource key. See * @param options Options resource key. See
* @ref ObjectRenderer-usage "class documentation" for more * @ref DebugTools-ObjectRenderer-usage "class documentation" for
* information. * more information.
* @param drawables Drawable group * @param drawables Drawable group
* *
* The renderer is automatically added to object's features. * The renderer is automatically added to object's features.

7
src/Magnum/DebugTools/ShapeRenderer.h

@ -120,7 +120,8 @@ class ShapeRendererOptions {
Visualizes collision shapes using wireframe primitives. See Visualizes collision shapes using wireframe primitives. See
@ref debug-tools-renderers for more information. @ref debug-tools-renderers for more information.
@section ShapeRenderer-usage Basic usage @anchor DebugTools-ShapeRenderer-usage
## Basic usage
Example code: Example code:
@code @code
@ -152,8 +153,8 @@ template<UnsignedInt dimensions> class MAGNUM_DEBUGTOOLS_EXPORT ShapeRenderer: p
* @brief Constructor * @brief Constructor
* @param shape Shape for which to create debug renderer * @param shape Shape for which to create debug renderer
* @param options Options resource key. See * @param options Options resource key. See
* @ref ShapeRenderer-usage "class documentation" for more * @ref DebugTools-ShapeRenderer-usage "class documentation" for
* information. * more information.
* @param drawables Drawable group * @param drawables Drawable group
* *
* The renderer is automatically added to shape's object features, * The renderer is automatically added to shape's object features,

5
src/Magnum/DefaultFramebuffer.h

@ -41,7 +41,8 @@ created when @ref Context is created and it is available through global
variable @ref defaultFramebuffer. It is by default mapped to whole screen variable @ref defaultFramebuffer. It is by default mapped to whole screen
surface. surface.
@section DefaultFramebuffer-usage Usage @anchor DefaultFramebuffer-usage
## Usage
When you are using only the default framebuffer, the usage is simple. You When you are using only the default framebuffer, the usage is simple. You
must ensure that it is properly resized when application surface is resized, must ensure that it is properly resized when application surface is resized,
@ -69,7 +70,7 @@ void drawEvent() {
See Framebuffer documentation for more involved usage, usage of non-default or See Framebuffer documentation for more involved usage, usage of non-default or
multiple framebuffers. multiple framebuffers.
@section DefaultFramebuffer-performance-optimization Performance optimizations ## Performance optimizations
See also @ref AbstractFramebuffer-performance-optimization "relevant section in AbstractFramebuffer". See also @ref AbstractFramebuffer-performance-optimization "relevant section in AbstractFramebuffer".

5
src/Magnum/Framebuffer.h

@ -45,7 +45,8 @@ Unlike @ref DefaultFramebuffer, which is used for on-screen rendering, this
class is used for off-screen rendering, usable either in windowless class is used for off-screen rendering, usable either in windowless
applications, texture generation or for various post-processing effects. applications, texture generation or for various post-processing effects.
@section Framebuffer-usage Example usage @anchor Framebuffer-usage
## Example usage
See @ref DefaultFramebuffer-usage "DefaultFramebuffer documentation" for See @ref DefaultFramebuffer-usage "DefaultFramebuffer documentation" for
introduction. Imagine you have shader with multiple outputs (e.g. for deferred introduction. Imagine you have shader with multiple outputs (e.g. for deferred
@ -88,7 +89,7 @@ void drawEvent() {
} }
@endcode @endcode
@section Framebuffer-performance-optimization Performance optimizations ## Performance optimizations
See also @ref AbstractFramebuffer-performance-optimization "relevant section in AbstractFramebuffer". See also @ref AbstractFramebuffer-performance-optimization "relevant section in AbstractFramebuffer".

57
src/Magnum/Implementation/detectedDriver.cpp

@ -0,0 +1,57 @@
/*
This file is part of Magnum.
Copyright © 2010, 2011, 2012, 2013, 2014
Vladimír Vondruš <mosra@centrum.cz>
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*/
#include "Magnum/Context.h"
#include "Magnum/Math/Range.h"
namespace Magnum {
auto Context::detectedDriver() -> Context::DetectedDrivers {
if(_detectedDrivers) return *_detectedDrivers;
_detectedDrivers = DetectedDrivers{};
/* AMD binary desktop drivers */
#ifndef MAGNUM_TARGET_GLES
const std::string vendor = vendorString();
if(vendor.find("ATI Technologies Inc.") != std::string::npos)
return *_detectedDrivers |= DetectedDriver::AMD;
#endif
/* OpenGL ES 2.0 implementation using ANGLE. Taken from
http://stackoverflow.com/a/20149090 */
#ifdef MAGNUM_TARGET_GLES2
{
Range1Di range;
glGetIntegerv(GL_ALIASED_LINE_WIDTH_RANGE, range.data());
if(range.min() == 1 && range.max() == 1)
return *_detectedDrivers |= DetectedDriver::ProbablyAngle;
}
#endif
return *_detectedDrivers;
}
}

3
src/Magnum/Implementation/setupDriverWorkarounds.cpp

@ -35,8 +35,7 @@ void Context::setupDriverWorkarounds() {
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
/* This extension causes crash in GLSL compiler on AMD linux drivers 13.251 */ /* This extension causes crash in GLSL compiler on AMD linux drivers 13.251 */
const std::string vendor = vendorString(); if(detectedDriver() & DetectedDriver::AMD)
if(vendor.find("ATI Technologies Inc.") != std::string::npos)
_setRequiredVersion(GL::ARB::explicit_uniform_location, None); _setRequiredVersion(GL::ARB::explicit_uniform_location, None);
#endif #endif

4
src/Magnum/Math/Angle.h

@ -45,7 +45,7 @@ namespace Magnum { namespace Math {
Along with Rad provides convenience classes to make angle specification and Along with Rad provides convenience classes to make angle specification and
conversion less error-prone. conversion less error-prone.
@section Rad-usage Usage ## Usage
You can enter the value either by using literal: You can enter the value either by using literal:
@code @code
@ -92,7 +92,7 @@ Float d = Double(b); // 60.0
//Float e = b; // error, no implicit conversion //Float e = b; // error, no implicit conversion
@endcode @endcode
@section Rad-conversions Requirement of explicit conversion ## Requirement of explicit conversion
The requirement of explicit conversions from and to unitless types helps to The requirement of explicit conversions from and to unitless types helps to
reduce unit-based errors. Consider following example with implicit conversions reduce unit-based errors. Consider following example with implicit conversions

7
src/Magnum/Math/Range.h

@ -103,6 +103,13 @@ template<UnsignedInt dimensions, class T> class Range {
return !operator==(other); return !operator==(other);
} }
/**
* @brief Raw data
* @return One-dimensional array of `dimensions`*2 length.
*/
T* data() { return _min.data(); }
constexpr const T* data() const { return _min.data(); } /**< @overload */
/** /**
* @brief Minimal coordinates (inclusive) * @brief Minimal coordinates (inclusive)
* *

20
src/Magnum/Mesh.h

@ -120,7 +120,8 @@ namespace Implementation { struct MeshState; }
/** /**
@brief %Mesh @brief %Mesh
@section Mesh-configuration Mesh configuration @anchor Mesh-configuration
## %Mesh configuration
You have to specify at least primitive and vertex/index count using You have to specify at least primitive and vertex/index count using
@ref setPrimitive() and @ref setCount(). Then fill your vertex buffers with @ref setPrimitive() and @ref setCount(). Then fill your vertex buffers with
@ -146,9 +147,9 @@ different usage) or store data for more meshes in one buffer.
If vertex/index count or instance count is zero, the mesh is empty and no draw If vertex/index count or instance count is zero, the mesh is empty and no draw
commands are issued when calling @ref draw(). commands are issued when calling @ref draw().
@subsection Mesh-configuration-examples Example mesh configuration ### Example mesh configuration
@subsubsection Mesh-configuration-examples-nonindexed Basic non-indexed mesh #### Basic non-indexed mesh
@code @code
// Custom shader, needing only position data // Custom shader, needing only position data
@ -173,7 +174,7 @@ mesh.setPrimitive(MeshPrimitive::Triangles)
.addVertexBuffer(vertexBuffer, 0, MyShader::Position{}); .addVertexBuffer(vertexBuffer, 0, MyShader::Position{});
@endcode @endcode
@subsubsection Mesh-configuration-examples-nonindexed-phong Interleaved vertex data #### Interleaved vertex data
@code @code
// Non-indexed primitive with positions and normals // Non-indexed primitive with positions and normals
@ -190,7 +191,7 @@ mesh.setPrimitive(plane.primitive())
.addVertexBuffer(buffer, 0, Shaders::Phong::Position{}, Shaders::Phong::Normal{}); .addVertexBuffer(buffer, 0, Shaders::Phong::Position{}, Shaders::Phong::Normal{});
@endcode @endcode
@subsubsection Mesh-configuration-examples-indexed-phong Indexed mesh #### Indexed mesh
@code @code
// Custom shader // Custom shader
@ -254,7 +255,7 @@ mesh.setPrimitive(plane.primitive())
Or, if you plan to use the mesh with stock shaders, you can just use Or, if you plan to use the mesh with stock shaders, you can just use
@ref MeshTools::compile(). @ref MeshTools::compile().
@subsubsection Mesh-configuration-examples-data-options Specific formats of vertex data #### Specific formats of vertex data
@code @code
// Custom shader with colors specified as four floating-point values // Custom shader with colors specified as four floating-point values
@ -300,19 +301,20 @@ mesh.addVertexBuffer(colorBuffer, 0, MyShader::Color{
MyShader::Color::DataOption::Normalized}); MyShader::Color::DataOption::Normalized});
@endcode @endcode
@section Mesh-drawing Rendering meshes ## Rendering meshes
Basic workflow is: bind specific framebuffer for drawing (if needed), set up Basic workflow is: bind specific framebuffer for drawing (if needed), set up
respective shader (see respective shader (see
@ref AbstractShaderProgram-rendering-workflow "AbstractShaderProgram documentation" @ref AbstractShaderProgram-rendering-workflow "AbstractShaderProgram documentation"
for more infromation) and call @ref Mesh::draw(). for more infromation) and call @ref Mesh::draw().
@section Mesh-webgl-restrictions WebGL restrictions ## WebGL restrictions
@ref MAGNUM_TARGET_WEBGL "WebGL" puts some restrictions on vertex buffer @ref MAGNUM_TARGET_WEBGL "WebGL" puts some restrictions on vertex buffer
layout, see @ref addVertexBuffer() documentation for details. layout, see @ref addVertexBuffer() documentation for details.
@section Mesh-performance-optimization Performance optimizations @anchor Mesh-performance-optimization
## Performance optimizations
If @extension{APPLE,vertex_array_object} (part of OpenGL 3.0), OpenGL ES 3.0 or If @extension{APPLE,vertex_array_object} (part of OpenGL 3.0), OpenGL ES 3.0 or
@es_extension{OES,vertex_array_object} on OpenGL ES 2.0 is supported, VAOs are @es_extension{OES,vertex_array_object} on OpenGL ES 2.0 is supported, VAOs are

2
src/Magnum/MultisampleTexture.h

@ -65,7 +65,7 @@ Template class for 2D mulitsample texture and 2D multisample texture array.
Used only from shaders for manual multisample resolve and other operations. See Used only from shaders for manual multisample resolve and other operations. See
also @ref AbstractTexture documentation for more information. also @ref AbstractTexture documentation for more information.
@section MultisampleTexture-usage Usage ## Usage
As multisample textures have no sampler state, the only thing you need is to As multisample textures have no sampler state, the only thing you need is to
set storage: set storage:

2
src/Magnum/Platform/Screen.h

@ -53,7 +53,7 @@ See @ref BasicScreenedApplication for more information.
If exactly one application header is included, this class is also aliased to If exactly one application header is included, this class is also aliased to
`Platform::Screen`. `Platform::Screen`.
@section Screen-explicit-specializations Explicit template specializations ## Explicit template specializations
The following specialization are explicitly compiled into each particular The following specialization are explicitly compiled into each particular
`*Application` library. For other specializations you have to use `*Application` library. For other specializations you have to use

2
src/Magnum/Platform/ScreenedApplication.h

@ -75,7 +75,7 @@ for(Screen* s = app.backScreen(); s; s = s->nextNearerScreen()) {
} }
@endcode @endcode
@section ScreenedApplication-explicit-specializations Explicit template specializations ## Explicit template specializations
The following specialization are explicitly compiled into each particular The following specialization are explicitly compiled into each particular
`*Application` library. For other specializations you have to use `*Application` library. For other specializations you have to use

55
src/Magnum/Platform/magnum-info.cpp

@ -65,6 +65,61 @@
namespace Magnum { namespace Magnum {
/** @page magnum-info Magnum Info
@brief Displays information about %Magnum engine and OpenGL capabilities
@section magnum-info-usage Usage
magnum-info [-h|--help] [--all-extensions] [--limits]
Arguments:
- ` -h`, `--help` -- display this help message and exit
- `--all-extensions` -- show extensions also for fully supported versions
- `--limits` -- display also limits and implementation-defined values
@section magnum-info-example Example output
+---------------------------------------------------------+
| Information about Magnum engine and OpenGL capabilities |
+---------------------------------------------------------+
Used application: Platform::WindowlessGlxApplication
Compilation flags:
CORRADE_BUILD_DEPRECATED
MAGNUM_BUILD_DEPRECATED
Vendor: NVIDIA Corporation
Renderer: GeForce GT 740M/PCIe/SSE2
OpenGL version: OpenGL 4.4 (4.4.0 NVIDIA 337.25)
Context flags:
Supported GLSL versions:
440 core
430 core
420 core
410 core
400 core
330 core
310 es
300 es
100
Vendor extension support:
GL_AMD_vertex_shader_layer -
GL_AMD_shader_trinary_minmax -
GL_ARB_robustness SUPPORTED
GL_ATI_texture_mirror_once SUPPORTED
GL_EXT_texture_filter_anisotropic SUPPORTED
GL_EXT_texture_mirror_clamp SUPPORTED
GL_EXT_direct_state_access SUPPORTED
GL_EXT_texture_sRGB_decode SUPPORTED
GL_EXT_shader_integer_mix SUPPORTED
GL_EXT_debug_label -
GL_EXT_debug_marker -
GL_GREMEDY_string_marker -
*/
class MagnumInfo: public Platform::WindowlessApplication { class MagnumInfo: public Platform::WindowlessApplication {
public: public:
explicit MagnumInfo(const Arguments& arguments); explicit MagnumInfo(const Arguments& arguments);

2
src/Magnum/RectangleTexture.h

@ -43,7 +43,7 @@ namespace Magnum {
See also @ref AbstractTexture documentation for more information. See also @ref AbstractTexture documentation for more information.
@section RectangleTexture-usage Usage ## Usage
Common usage is to fully configure all texture parameters and then set the Common usage is to fully configure all texture parameters and then set the
data from e.g. @ref Image2D. Example configuration: data from e.g. @ref Image2D. Example configuration:

2
src/Magnum/Renderbuffer.h

@ -46,7 +46,7 @@ namespace Implementation { struct FramebufferState; }
Attachable to framebuffer as render target, see @ref Framebuffer documentation Attachable to framebuffer as render target, see @ref Framebuffer documentation
for more information. for more information.
@section Renderbuffer-performance-optimization Performance optimizations ## Performance optimizations
The engine tracks currently bound renderbuffer to avoid unnecessary calls to The engine tracks currently bound renderbuffer to avoid unnecessary calls to
@fn_gl{BindRenderbuffer} in @ref setStorage(). %Renderbuffer limits and @fn_gl{BindRenderbuffer} in @ref setStorage(). %Renderbuffer limits and

2
src/Magnum/ResourceManager.h

@ -163,7 +163,7 @@ template<class T> class ResourceManagerData {
Provides storage for arbitrary set of types, accessible globally using Provides storage for arbitrary set of types, accessible globally using
@ref instance(). @ref instance().
@section ResourceManager-usage Usage ## Usage
Each resource is referenced from @ref Resource class. For optimizing Each resource is referenced from @ref Resource class. For optimizing
performance, each resource can be set as mutable or final. Mutable resources performance, each resource can be set as mutable or final. Mutable resources

9
src/Magnum/SceneGraph/AbstractCamera.h

@ -58,13 +58,14 @@ See Drawable documentation for more information. This class is not directly
instantiatable, use @ref BasicCamera2D or @ref BasicCamera3D subclasses instantiatable, use @ref BasicCamera2D or @ref BasicCamera3D subclasses
instead. instead.
@section AbstractCamera-explicit-specializations Explicit template specializations @anchor SceneGraph-AbstractCamera-explicit-specializations
## Explicit template specializations
The following specialization are explicitly compiled into @ref SceneGraph The following specializations are explicitly compiled into @ref SceneGraph
library. For other specializations (e.g. using @ref Double type) you have to library. For other specializations (e.g. using @ref Double type) you have to
use @ref AbstractCamera.hpp implementation file to avoid linker errors. See use @ref AbstractCamera.hpp implementation file to avoid linker errors. See
also relevant sections in @ref Camera2D-explicit-specializations "Camera2D" also relevant sections in @ref SceneGraph-Camera2D-explicit-specializations "Camera2D"
and @ref Camera3D-explicit-specializations "Camera3D" class documentation or and @ref SceneGraph-Camera3D-explicit-specializations "Camera3D" class documentation or
@ref compilation-speedup-hpp for more information. @ref compilation-speedup-hpp for more information.
- @ref AbstractCamera2D - @ref AbstractCamera2D

11
src/Magnum/SceneGraph/AbstractFeature.h

@ -84,13 +84,14 @@ Contained in @ref Object, takes care of transformation caching. See
Uses @ref Corrade::Containers::LinkedList for accessing holder object and Uses @ref Corrade::Containers::LinkedList for accessing holder object and
sibling features. sibling features.
@section AbstractFeature-subclassing Subclassing ## Subclassing
Feature is templated on dimension count and underlying transformation type, so Feature is templated on dimension count and underlying transformation type, so
it can be used only on object having transformation with the same dimension it can be used only on object having transformation with the same dimension
count and type. count and type.
@subsection AbstractFeature-subclassing-caching Caching transformations in features @anchor SceneGraph-AbstractFeature-subclassing-caching
### Caching transformations in features
Features can cache absolute transformation of the object instead of computing Features can cache absolute transformation of the object instead of computing
it from scratch every time to achieve better performance. See it from scratch every time to achieve better performance. See
@ -120,7 +121,7 @@ class CachingFeature: public SceneGraph::AbstractFeature3D {
Before using the cached value explicitly request object cleaning by calling Before using the cached value explicitly request object cleaning by calling
`object()->setClean()`. `object()->setClean()`.
@subsection AbstractFeature-subclassing-transformation Accessing object transformation ### Accessing object transformation
Features has by default access only to @ref AbstractObject, which is base of Features has by default access only to @ref AbstractObject, which is base of
@ref Object not depending on any particular transformation implementation. This @ref Object not depending on any particular transformation implementation. This
@ -150,9 +151,9 @@ from @ref AbstractBasicTranslationRotationScaling3D "AbstractTranslationRotation
which is derived from @ref AbstractBasicTranslationRotation3D "AbstractTranslationRotation3D", which is derived from @ref AbstractBasicTranslationRotation3D "AbstractTranslationRotation3D",
which is automatically extracted from the reference in our constructor. which is automatically extracted from the reference in our constructor.
@section AbstractFeature-explicit-specializations Explicit template specializations ## Explicit template specializations
The following specialization are explicitly compiled into @ref SceneGraph The following specializations are explicitly compiled into @ref SceneGraph
library. For other specializations (e.g. using @ref Double type) you have to library. For other specializations (e.g. using @ref Double type) you have to
use @ref AbstractFeature.hpp implementation file to avoid linker errors. See use @ref AbstractFeature.hpp implementation file to avoid linker errors. See
also @ref compilation-speedup-hpp for more information. also @ref compilation-speedup-hpp for more information.

6
src/Magnum/SceneGraph/AbstractGroupedFeature.h

@ -41,7 +41,7 @@ namespace Magnum { namespace SceneGraph {
Used together with @ref FeatureGroup. Used together with @ref FeatureGroup.
@section AbstractGroupedFeature-subclassing Subclassing ## Subclassing
Usage is via subclassing the feature using [CRTP](http://en.wikipedia.org/wiki/Curiously_recurring_template_pattern) Usage is via subclassing the feature using [CRTP](http://en.wikipedia.org/wiki/Curiously_recurring_template_pattern)
and typedef'ing @ref FeatureGroup to accept only given type, e.g.: and typedef'ing @ref FeatureGroup to accept only given type, e.g.:
@ -53,9 +53,9 @@ class Drawable: public SceneGraph::AbstractGroupedFeature3D<Drawable> {
typedef SceneGraph::FeatureGroup3D<Drawable> DrawableGroup; typedef SceneGraph::FeatureGroup3D<Drawable> DrawableGroup;
@endcode @endcode
@section AbstractGroupedFeature-explicit-specializations Explicit template specializations ## Explicit template specializations
The following specialization are explicitly compiled into @ref SceneGraph The following specializations are explicitly compiled into @ref SceneGraph
library. For other specializations (e.g. using @ref Double type) you have to library. For other specializations (e.g. using @ref Double type) you have to
use @ref FeatureGroup.hpp implementation file to avoid linker errors. See also use @ref FeatureGroup.hpp implementation file to avoid linker errors. See also
@ref compilation-speedup-hpp for more information. @ref compilation-speedup-hpp for more information.

9
src/Magnum/SceneGraph/AbstractObject.h

@ -55,13 +55,14 @@ for(AbstractFeature* feature = o->firstFeature(); feature; feature = feature->ne
} }
@endcode @endcode
@section AbstractObject-explicit-specializations Explicit template specializations @anchor SceneGraph-AbstractObject-explicit-specializations
## Explicit template specializations
The following specialization are explicitly compiled into @ref SceneGraph The following specializations are explicitly compiled into @ref SceneGraph
library. For other specializations (e.g. using @ref Double type) you have to library. For other specializations (e.g. using @ref Double type) you have to
use @ref Object.hpp implementation file to avoid linker errors. See also use @ref Object.hpp implementation file to avoid linker errors. See also
relevant sections in @ref Object-explicit-specializations "Object" and relevant sections in @ref SceneGraph-Object-explicit-specializations "Object" and
@ref AbstractTransformation-explicit-specializations "AbstractTransformation" @ref SceneGraph-AbstractTransformation-explicit-specializations "AbstractTransformation"
class documentation or @ref compilation-speedup-hpp for more information. class documentation or @ref compilation-speedup-hpp for more information.
- @ref AbstractObject2D - @ref AbstractObject2D

5
src/Magnum/SceneGraph/AbstractTransformation.h

@ -39,9 +39,10 @@ namespace Magnum { namespace SceneGraph {
Provides transformation implementation for @ref Object instances. Provides transformation implementation for @ref Object instances.
@section AbstractTransformation-explicit-specializations Explicit template specializations @anchor SceneGraph-AbstractTransformation-explicit-specializations
## Explicit template specializations
The following specialization are explicitly compiled into @ref SceneGraph The following specializations are explicitly compiled into @ref SceneGraph
library. For other specializations (e.g. using @ref Double type) you have to library. For other specializations (e.g. using @ref Double type) you have to
use @ref Object.hpp implementation file to avoid linker errors. See use @ref Object.hpp implementation file to avoid linker errors. See
@ref compilation-speedup-hpp for more information. @ref compilation-speedup-hpp for more information.

6
src/Magnum/SceneGraph/Animable.h

@ -65,7 +65,7 @@ Debug MAGNUM_SCENEGRAPH_EXPORT operator<<(Debug debug, AnimationState value);
Adds animation feature to object. Each %Animable is part of some Adds animation feature to object. Each %Animable is part of some
@ref AnimableGroup, which takes care of running the animations. @ref AnimableGroup, which takes care of running the animations.
@section Animable-usage Usage ## Usage
First thing is to add @ref Animable feature to some object and implement First thing is to add @ref Animable feature to some object and implement
@ref animationStep(). You can do it conveniently using multiple inheritance @ref animationStep(). You can do it conveniently using multiple inheritance
@ -120,7 +120,7 @@ void MyApplication::drawEvent() {
} }
@endcode @endcode
@section Animable-performance Using animable groups to improve performance ## Using animable groups to improve performance
@ref AnimableGroup is optimized for case when no animation is running -- it @ref AnimableGroup is optimized for case when no animation is running -- it
just puts itself to rest and waits until some animation changes its state to just puts itself to rest and waits until some animation changes its state to
@ -128,7 +128,7 @@ just puts itself to rest and waits until some animation changes its state to
pernamently running to separate group, they will not be always traversed when pernamently running to separate group, they will not be always traversed when
calling @ref AnimableGroup::step(), saving precious frame time. calling @ref AnimableGroup::step(), saving precious frame time.
@section Animable-explicit-specializations Explicit template specializations ## Explicit template specializations
The following specializations are explicitly compiled into @ref SceneGraph The following specializations are explicitly compiled into @ref SceneGraph
library. For other specializations (e.g. using @ref Double type) you have to library. For other specializations (e.g. using @ref Double type) you have to

7
src/Magnum/SceneGraph/Camera2D.h

@ -45,12 +45,13 @@ camera.setProjection({4.0f/3.0f, 1.0f})
.setAspectRatioPolicy(SceneGraph::AspectRatioPolicy::Extend); .setAspectRatioPolicy(SceneGraph::AspectRatioPolicy::Extend);
@endcode @endcode
@section Camera2D-explicit-specializations Explicit template specializations @anchor SceneGraph-Camera2D-explicit-specializations
## Explicit template specializations
The following specialization are explicitly compiled into @ref SceneGraph The following specialization is explicitly compiled into @ref SceneGraph
library. For other specializations (e.g. using @ref Double type) you have to library. For other specializations (e.g. using @ref Double type) you have to
use @ref Camera2D.hpp implementation file to avoid linker errors. See also use @ref Camera2D.hpp implementation file to avoid linker errors. See also
relevant section in @ref AbstractCamera-explicit-specializations "AbstractCamera" relevant section in @ref SceneGraph-AbstractCamera-explicit-specializations "AbstractCamera"
class documentation or @ref compilation-speedup-hpp for more information. class documentation or @ref compilation-speedup-hpp for more information.
- @ref Camera2D - @ref Camera2D

7
src/Magnum/SceneGraph/Camera3D.h

@ -50,12 +50,13 @@ camera.setPerspective({}, 0.001f, 100.0f)
.setAspectRatioPolicy(SceneGraph::AspectRatioPolicy::Extend); .setAspectRatioPolicy(SceneGraph::AspectRatioPolicy::Extend);
@endcode @endcode
@section Camera3D-explicit-specializations Explicit template specializations @anchor SceneGraph-Camera3D-explicit-specializations
## Explicit template specializations
The following specialization are explicitly compiled into @ref SceneGraph The following specialization is explicitly compiled into @ref SceneGraph
library. For other specializations (e.g. using @ref Double type) you have to library. For other specializations (e.g. using @ref Double type) you have to
use @ref Camera3D.hpp implementation file to avoid linker errors. See also use @ref Camera3D.hpp implementation file to avoid linker errors. See also
relevant section in @ref AbstractCamera-explicit-specializations "AbstractCamera" relevant section in @ref SceneGraph-AbstractCamera-explicit-specializations "AbstractCamera"
class documentation or @ref compilation-speedup-hpp for more information. class documentation or @ref compilation-speedup-hpp for more information.
- @ref Camera3D - @ref Camera3D

6
src/Magnum/SceneGraph/Drawable.h

@ -40,7 +40,7 @@ Adds drawing function to the object. Each %Drawable is part of some
@ref DrawableGroup and the whole group is drawn with particular camera using @ref DrawableGroup and the whole group is drawn with particular camera using
@ref AbstractCamera::draw(). @ref AbstractCamera::draw().
@section Drawable-usage Usage ## Usage
First thing is to add @ref Drawable feature to some object and implement First thing is to add @ref Drawable feature to some object and implement
@ref draw(). You can do it conveniently using multiple inheritance (see @ref draw(). You can do it conveniently using multiple inheritance (see
@ -91,7 +91,7 @@ void MyApplication::drawEvent() {
} }
@endcode @endcode
@section Drawable-performance Using drawable groups to improve performance ## Using drawable groups to improve performance
You can organize your drawables to multiple groups to minimize OpenGL state You can organize your drawables to multiple groups to minimize OpenGL state
changes -- for example put all objects using the same shader, the same light changes -- for example put all objects using the same shader, the same light
@ -117,7 +117,7 @@ void MyApplication::drawEvent() {
} }
@endcode @endcode
@section Drawable-explicit-specializations Explicit template specializations ## Explicit template specializations
The following specializations are explicitly compiled into @ref SceneGraph The following specializations are explicitly compiled into @ref SceneGraph
library. For other specializations (e.g. using @ref Double type) you have to library. For other specializations (e.g. using @ref Double type) you have to

9
src/Magnum/SceneGraph/Object.h

@ -72,14 +72,15 @@ for(Object* child = o->firstChild(); child; child = child->nextSibling()) {
} }
@endcode @endcode
@section Object-explicit-specializations Explicit template specializations @anchor SceneGraph-Object-explicit-specializations
## Explicit template specializations
The following specialization are explicitly compiled into @ref SceneGraph The following specializations are explicitly compiled into @ref SceneGraph
library. For other specializations (e.g. using @ref Double type or special library. For other specializations (e.g. using @ref Double type or special
transformation class) you have to use @ref Object.hpp implementation file to transformation class) you have to use @ref Object.hpp implementation file to
avoid linker errors. See also relevant sections in avoid linker errors. See also relevant sections in
@ref AbstractObject-explicit-specializations "AbstractObject" and @ref SceneGraph-AbstractObject-explicit-specializations "AbstractObject" and
@ref AbstractTransformation-explicit-specializations "AbstractTransformation" @ref SceneGraph-AbstractTransformation-explicit-specializations "AbstractTransformation"
class documentation or @ref compilation-speedup-hpp for more information. class documentation or @ref compilation-speedup-hpp for more information.
- @ref DualComplexTransformation "Object<DualComplexTransformation>" - @ref DualComplexTransformation "Object<DualComplexTransformation>"

6
src/Magnum/Shader.h

@ -45,11 +45,9 @@ namespace Magnum {
/** /**
@brief %Shader @brief %Shader
See @ref AbstractShaderProgram for more information. See @ref AbstractShaderProgram for usage information.
@todoc Usage... ## Performance optimizations
@section Shader-performance-optimization Performance optimizations
%Shader limits and implementation-defined values (such as @ref maxUniformComponents()) %Shader limits and implementation-defined values (such as @ref maxUniformComponents())
are cached, so repeated queries don't result in repeated @fn_gl{Get} calls. are cached, so repeated queries don't result in repeated @fn_gl{Get} calls.

6
src/Magnum/Shaders/MeshVisualizer.cpp

@ -61,6 +61,12 @@ MeshVisualizer::MeshVisualizer(const Flags flags): flags(flags), transformationP
vert.addSource(flags & Flag::Wireframe ? "#define WIREFRAME_RENDERING\n" : "") vert.addSource(flags & Flag::Wireframe ? "#define WIREFRAME_RENDERING\n" : "")
.addSource(flags & Flag::NoGeometryShader ? "#define NO_GEOMETRY_SHADER\n" : "") .addSource(flags & Flag::NoGeometryShader ? "#define NO_GEOMETRY_SHADER\n" : "")
#ifdef MAGNUM_TARGET_WEBGL
.addSource("#define SUBSCRIPTING_WORKAROUND\n")
#elif defined(MAGNUM_TARGET_GLES)
.addSource(Context::current()->detectedDriver() & Context::DetectedDriver::ProbablyAngle ?
"#define SUBSCRIPTING_WORKAROUND\n" : "")
#endif
.addSource(rs.get("generic.glsl")) .addSource(rs.get("generic.glsl"))
.addSource(rs.get("MeshVisualizer.vert")); .addSource(rs.get("MeshVisualizer.vert"));
frag.addSource(flags & Flag::Wireframe ? "#define WIREFRAME_RENDERING\n" : "") frag.addSource(flags & Flag::Wireframe ? "#define WIREFRAME_RENDERING\n" : "")

2
src/Magnum/Shaders/MeshVisualizer.h

@ -44,7 +44,7 @@ Uses geometry shader to visualize wireframe. You need to provide @ref Position
attribute in your triangle mesh and call at least @ref setTransformationProjectionMatrix() attribute in your triangle mesh and call at least @ref setTransformationProjectionMatrix()
to be able to render. to be able to render.
@section ShadersMeshVisualizer-wireframe Wireframe visualization ## Wireframe visualization
Wireframe visualization is done by enabling @ref Flag::Wireframe. It is done Wireframe visualization is done by enabling @ref Flag::Wireframe. It is done
either using geometry shaders or with help of additional vertex information. either using geometry shaders or with help of additional vertex information.

9
src/Magnum/Shaders/MeshVisualizer.vert

@ -58,10 +58,17 @@ void main() {
#if defined(WIREFRAME_RENDERING) && defined(NO_GEOMETRY_SHADER) #if defined(WIREFRAME_RENDERING) && defined(NO_GEOMETRY_SHADER)
barycentric = vec3(0.0); barycentric = vec3(0.0);
#ifndef NEW_GLSL
#ifdef SUBSCRIPTING_WORKAROUND
int i = int(mod(vertexIndex, 3.0));
if(i == 0) barycentric.x = 1.0;
else if(i == 1) barycentric.y = 1.0;
else barycentric.z = 1.0;
#elif !defined(NEW_GLSL)
barycentric[int(mod(vertexIndex, 3.0))] = 1.0; barycentric[int(mod(vertexIndex, 3.0))] = 1.0;
#else #else
barycentric[gl_VertexID % 3] = 1.0; barycentric[gl_VertexID % 3] = 1.0;
#endif #endif
#endif #endif
} }

6
src/Magnum/Text/AbstractFont.h

@ -48,14 +48,14 @@ Provides interface for opening fonts, filling glyph cache and layouting the
glyphs. See @ref plugins for more information and `*Font` classes in @ref Text glyphs. See @ref plugins for more information and `*Font` classes in @ref Text
namespace for available font plugins. namespace for available font plugins.
@section AbstractFont-usage Usage ## Usage
First step is to open the font using @ref openData(), @ref openSingleData() or First step is to open the font using @ref openData(), @ref openSingleData() or
@ref openFile(). Next step is to prerender all the glyphs which will be used in @ref openFile(). Next step is to prerender all the glyphs which will be used in
text rendering later, see @ref GlyphCache for more information. See text rendering later, see @ref GlyphCache for more information. See
@ref Renderer for information about text rendering. @ref Renderer for information about text rendering.
@section AbstractFont-subclassing Subclassing ## Subclassing
Plugin implements @ref doFeatures(), @ref doClose(), @ref doLayout(), either Plugin implements @ref doFeatures(), @ref doClose(), @ref doLayout(), either
@ref doCreateGlyphCache() or @ref doFillGlyphCache() and one or more of @ref doCreateGlyphCache() or @ref doFillGlyphCache() and one or more of
@ -304,7 +304,7 @@ CORRADE_ENUMSET_OPERATORS(AbstractFont::Features)
Returned by @ref AbstractFont::layout(). Returned by @ref AbstractFont::layout().
@section TextAbstractLayouter-subclassing Subclassing ## Subclassing
Plugin creates private subclass (no need to expose it to end users) and Plugin creates private subclass (no need to expose it to end users) and
implements @ref doRenderGlyph(). Bounds checking on @p i is done automatically implements @ref doRenderGlyph(). Bounds checking on @p i is done automatically

5
src/Magnum/Text/AbstractFontConverter.h

@ -45,7 +45,10 @@ Provides functionality for converting arbitrary font to different format. See
@ref plugins for more information and `*FontConverter` classes in @ref Text @ref plugins for more information and `*FontConverter` classes in @ref Text
namespace for available font converter plugins. namespace for available font converter plugins.
@section AbstractFontConverter-subclassing Subclassing You can use the @ref magnum-fontconverter "magnum-fontconverter" utility to do
font conversion on command-line.
## Subclassing
Plugin implements @ref doFeatures() and one or more of `exportTo*()` / Plugin implements @ref doFeatures() and one or more of `exportTo*()` /
`importFrom*()` functions based on what features are supported. Characters `importFrom*()` functions based on what features are supported. Characters

6
src/Magnum/Text/CMakeLists.txt

@ -60,10 +60,10 @@ install(TARGETS MagnumText
install(FILES ${MagnumText_HEADERS} DESTINATION ${MAGNUM_INCLUDE_INSTALL_DIR}/Text) install(FILES ${MagnumText_HEADERS} DESTINATION ${MAGNUM_INCLUDE_INSTALL_DIR}/Text)
if(WITH_FONTCONVERTER) if(WITH_FONTCONVERTER)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/configure.h.cmake configure_file(${CMAKE_CURRENT_SOURCE_DIR}/fontconverterConfigure.h.cmake
${CMAKE_CURRENT_BINARY_DIR}/configure.h) ${CMAKE_CURRENT_BINARY_DIR}/fontconverterConfigure.h)
include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR}) include_directories(${CMAKE_CURRENT_BINARY_DIR})
add_executable(magnum-fontconverter fontconverter.cpp) add_executable(magnum-fontconverter fontconverter.cpp)

2
src/Magnum/Text/DistanceFieldGlyphCache.h

@ -40,7 +40,7 @@ Unlike original @ref GlyphCache converts each binary image to distance field.
It is not possible to use non-binary colors with this cache, internal texture It is not possible to use non-binary colors with this cache, internal texture
format is red channel only. format is red channel only.
@section DistanceFieldGlyphCache-usage Usage ## Usage
Usage is similar to @ref GlyphCache, additionally you need to specify size of Usage is similar to @ref GlyphCache, additionally you need to specify size of
resulting distance field texture. resulting distance field texture.

2
src/Magnum/Text/GlyphCache.h

@ -43,7 +43,7 @@ namespace Magnum { namespace Text {
Contains font glyphs prerendered into texture atlas. Contains font glyphs prerendered into texture atlas.
@section GlyphCache-usage Usage ## Usage
Create %GlyphCache object with sufficient size and then call Create %GlyphCache object with sufficient size and then call
@ref AbstractFont::createGlyphCache() to fill it with glyphs. @ref AbstractFont::createGlyphCache() to fill it with glyphs.

4
src/Magnum/Text/Renderer.h

@ -169,7 +169,7 @@ class MAGNUM_TEXT_EXPORT AbstractRenderer {
Lays out the text into mesh using given font. Use of ligatures, kerning etc. Lays out the text into mesh using given font. Use of ligatures, kerning etc.
depends on features supported by particular font and its layouter. depends on features supported by particular font and its layouter.
@section Renderer-usage Usage ## Usage
Immutable text (e.g. menu items, credits) can be simply rendered using static Immutable text (e.g. menu items, credits) can be simply rendered using static
methods, returning result either as data arrays or as fully configured mesh. methods, returning result either as data arrays or as fully configured mesh.
@ -220,7 +220,7 @@ shader.setTransformationProjectionMatrix(projection*Matrix3::translation(-render
renderer.mesh().draw(shader); renderer.mesh().draw(shader);
@endcode @endcode
@section Renderer-extensions Required OpenGL functionality ## Required OpenGL functionality
Mutable text rendering requires @extension{ARB,map_buffer_range} on desktop Mutable text rendering requires @extension{ARB,map_buffer_range} on desktop
OpenGL (also part of OpenGL ES 3.0). If neither @es_extension{EXT,map_buffer_range} OpenGL (also part of OpenGL ES 3.0). If neither @es_extension{EXT,map_buffer_range}

63
src/Magnum/Text/fontconverter.cpp

@ -42,9 +42,52 @@
#error No windowless application available on this platform #error No windowless application available on this platform
#endif #endif
#include "configure.h" #include "fontconverterConfigure.h"
namespace Magnum { namespace Text { namespace Magnum {
/**
@page magnum-fontconverter Font conversion utility
@brief Converts font to raster one of given atlas size
@section magnum-fontconverter-usage Usage
magnum-fontconverter [-h|--help] --font FONT --converter CONVERTER [--plugin-dir DIR] [--characters CHARACTERS] [--font-size N] [--atlas-size "X Y"] [--output-size "X Y"] [--radius N] [--] input output
Arguments:
- `input` -- input font
- `output` -- output filename prefix
- `-h`, `--help` -- display help message and exit
- `--font FONT` -- font plugin
- `--converter CONVERTER` -- font converter plugin
- `--plugin-dir DIR` -- base plugin dir (defaults to plugin directory in
%Magnum install location)
- `--characters CHARACTERS` -- characters to include in the output (default:
`abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789?!:,.&nbsp;`)
- `--font-size N` -- input font size (default: `128`)
- `--atlas-size "X Y"` -- glyph atlas size (default: `"2048 2048"`)
- `--output-size "X Y"` -- output atlas size. If set to zero size, distance
field computation will not be used. (default: `"256 256"`)
- `--radius N` -- distance field computation radius (default: `24`)
The resulting font files can be then used as specified in the documentation of
`converter` plugin.
@section magnum-fontconverter-example Example usage
Making raster font from TTF file with default set of characters using
@ref Text::FreeTypeFont "FreeTypeFont" font plugin and
@ref Text::MagnumFontConverter "MagnumFontConverter" converter plugin:
magnum-fontconverter --font FreeTypeFont --converter MagnumFontConverter DejaVuSans.ttf myfont
According to `MagnumFontConverter` plugin documentation, this will generate
files `myfont.conf` and `myfont.tga` in current directory. You can then load
and use them with the @ref Text::MagnumFont "MagnumFont" plugin.
*/
namespace Text {
class FontConverter: public Platform::WindowlessApplication { class FontConverter: public Platform::WindowlessApplication {
public: public:
@ -59,13 +102,13 @@ class FontConverter: public Platform::WindowlessApplication {
FontConverter::FontConverter(const Arguments& arguments): Platform::WindowlessApplication(arguments, nullptr) { FontConverter::FontConverter(const Arguments& arguments): Platform::WindowlessApplication(arguments, nullptr) {
args.addArgument("input").setHelp("input", "input font") args.addArgument("input").setHelp("input", "input font")
.addArgument("output").setHelp("output", "output filename prefix") .addArgument("output").setHelp("output", "output filename prefix")
.addNamedArgument("font").setHelp("font", "plugin for opening the font") .addNamedArgument("font").setHelp("font", "font plugin")
.addNamedArgument("converter").setHelp("converter", "plugin for converting the font") .addNamedArgument("converter").setHelp("converter", "font converter plugin")
.addOption("plugin-dir", MAGNUM_PLUGINS_DIR).setHelpKey("plugin-dir", "DIR").setHelp("plugin-dir", "base plugin dir") .addOption("plugin-dir", MAGNUM_PLUGINS_DIR).setHelpKey("plugin-dir", "DIR").setHelp("plugin-dir", "base plugin dir")
.addOption("characters", "abcdefghijklmnopqrstuvwxyz" .addOption("characters", "abcdefghijklmnopqrstuvwxyz"
"ABCDEFGHIJKLMNOPQRSTUVWXYZ" "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"0123456789?!:,. ").setHelp("characters", "characters to include in the output") "0123456789?!:,. ").setHelp("characters", "characters to include in the output")
.addOption("font-size", "128").setHelpKey("font-size", "N").setHelp("font-size", "TTF font size") .addOption("font-size", "128").setHelpKey("font-size", "N").setHelp("font-size", "input font size")
.addOption("atlas-size", "2048 2048").setHelpKey("atlas-size", "\"X Y\"").setHelp("atlas-size", "glyph atlas size") .addOption("atlas-size", "2048 2048").setHelpKey("atlas-size", "\"X Y\"").setHelp("atlas-size", "glyph atlas size")
.addOption("output-size", "256 256").setHelpKey("output-size", "\"X Y\"").setHelp("output-size", "output atlas size. If set to zero size, distance field computation will not be used.") .addOption("output-size", "256 256").setHelpKey("output-size", "\"X Y\"").setHelp("output-size", "output atlas size. If set to zero size, distance field computation will not be used.")
.addOption("radius", "24").setHelpKey("radius", "N").setHelp("radius", "distance field computation radius") .addOption("radius", "24").setHelpKey("radius", "N").setHelp("radius", "distance field computation radius")
@ -77,16 +120,16 @@ FontConverter::FontConverter(const Arguments& arguments): Platform::WindowlessAp
int FontConverter::exec() { int FontConverter::exec() {
/* Font converter dependencies */ /* Font converter dependencies */
PluginManager::Manager<Trade::AbstractImageConverter> imageConverterManager(Utility::Directory::join(MAGNUM_PLUGINS_DIR, "imageconverters/")); PluginManager::Manager<Trade::AbstractImageConverter> imageConverterManager(Utility::Directory::join(args.value("plugin-dir"), "imageconverters/"));
/* Load font */ /* Load font */
PluginManager::Manager<Text::AbstractFont> fontManager(Utility::Directory::join(MAGNUM_PLUGINS_DIR, "fonts/")); PluginManager::Manager<Text::AbstractFont> fontManager(Utility::Directory::join(args.value("plugin-dir"), "fonts/"));
if(!(fontManager.load(args.value("font")) & PluginManager::LoadState::Loaded)) if(!(fontManager.load(args.value("font")) & PluginManager::LoadState::Loaded))
std::exit(1); std::exit(1);
std::unique_ptr<Text::AbstractFont> font = fontManager.instance(args.value("font")); std::unique_ptr<Text::AbstractFont> font = fontManager.instance(args.value("font"));
/* Load font converter */ /* Load font converter */
PluginManager::Manager<Text::AbstractFontConverter> converterManager(Utility::Directory::join(MAGNUM_PLUGINS_DIR, "fontconverters/")); PluginManager::Manager<Text::AbstractFontConverter> converterManager(Utility::Directory::join(args.value("plugin-dir"), "fontconverters/"));
if(!(converterManager.load(args.value("converter")) & PluginManager::LoadState::Loaded)) if(!(converterManager.load(args.value("converter")) & PluginManager::LoadState::Loaded))
std::exit(1); std::exit(1);
std::unique_ptr<Text::AbstractFontConverter> converter = converterManager.instance(args.value("converter")); std::unique_ptr<Text::AbstractFontConverter> converter = converterManager.instance(args.value("converter"));
@ -130,6 +173,8 @@ int FontConverter::exec() {
return 0; return 0;
} }
}} }
}
MAGNUM_WINDOWLESSAPPLICATION_MAIN(Magnum::Text::FontConverter) MAGNUM_WINDOWLESSAPPLICATION_MAIN(Magnum::Text::FontConverter)

4
src/Magnum/Text/configure.h.cmake → src/Magnum/Text/fontconverterConfigure.h.cmake

@ -23,4 +23,8 @@
DEALINGS IN THE SOFTWARE. DEALINGS IN THE SOFTWARE.
*/ */
#ifdef CORRADE_IS_DEBUG_BUILD
#define MAGNUM_PLUGINS_DIR "${MAGNUM_PLUGINS_DEBUG_INSTALL_DIR}"
#else
#define MAGNUM_PLUGINS_DIR "${MAGNUM_PLUGINS_INSTALL_DIR}" #define MAGNUM_PLUGINS_DIR "${MAGNUM_PLUGINS_INSTALL_DIR}"
#endif

2
src/Magnum/Texture.h

@ -62,7 +62,7 @@ namespace Implementation {
Template class for one- to three-dimensional textures. See also Template class for one- to three-dimensional textures. See also
@ref AbstractTexture documentation for more information. @ref AbstractTexture documentation for more information.
@section Texture-usage Usage ## Usage
Common usage is to fully configure all texture parameters and then set the Common usage is to fully configure all texture parameters and then set the
data from e.g. @ref Image. Example configuration of high quality texture with data from e.g. @ref Image. Example configuration of high quality texture with

2
src/Magnum/TextureArray.h

@ -53,7 +53,7 @@ namespace Implementation {
Template class for one- and two-dimensional texture arrays. See also Template class for one- and two-dimensional texture arrays. See also
@ref AbstractTexture documentation for more information. @ref AbstractTexture documentation for more information.
@section TextureArray-usage Usage ## Usage
See @ref Texture documentation for introduction. See @ref Texture documentation for introduction.

9
src/Magnum/TextureTools/DistanceField.h

@ -56,6 +56,13 @@ less memory and can be scaled without aliasing issues. Additionally it provides
foundation for features like outlining, glow or drop shadow essentially for foundation for features like outlining, glow or drop shadow essentially for
free. free.
You can also use the @ref magnum-distancefieldconverter "magnum-distancefieldconverter"
utility to do distance field conversion on command-line. By extension, this
functionality is also provided through @ref magnum-fontconverter "magnum-fontconverter"
utility.
### The algorithm
For each pixel inside @p rectangle the algorithm looks at corresponding pixel in For each pixel inside @p rectangle the algorithm looks at corresponding pixel in
@p input and tries to find nearest pixel of opposite color in area given by @p input and tries to find nearest pixel of opposite color in area given by
@p radius. Signed distance between the points is then saved as value of given @p radius. Signed distance between the points is then saved as value of given
@ -67,7 +74,7 @@ that the pixel was originally black and nearest white pixel is farther than
The resulting texture can be used with bilinear filtering. It can be converted The resulting texture can be used with bilinear filtering. It can be converted
back to binary form in shader using e.g. GLSL `smoothstep()` function with step back to binary form in shader using e.g. GLSL `smoothstep()` function with step
around `0.5` to create antialiased edges. Or you can exploit the distance field around `0.5` to create antialiased edges. Or you can exploit the distance field
features to create many other effects. See also Shaders::DistanceFieldVectorShader. features to create many other effects. See also @ref Shaders::DistanceFieldVector.
Based on: *Chris Green - Improved Alpha-Tested Magnification for Vector Textures Based on: *Chris Green - Improved Alpha-Tested Magnification for Vector Textures
and Special Effects, SIGGRAPH 2007, and Special Effects, SIGGRAPH 2007,

49
src/Magnum/TextureTools/distancefieldconverter.cpp

@ -24,6 +24,7 @@
*/ */
#include <Corrade/Utility/Arguments.h> #include <Corrade/Utility/Arguments.h>
#include <Corrade/Utility/Directory.h>
#include <Corrade/PluginManager/Manager.h> #include <Corrade/PluginManager/Manager.h>
#include "Magnum/Math/Range.h" #include "Magnum/Math/Range.h"
@ -49,7 +50,42 @@
#include "distancefieldconverterConfigure.h" #include "distancefieldconverterConfigure.h"
namespace Magnum { namespace TextureTools { namespace Magnum {
/** @page magnum-distancefieldconverter Distance Field conversion utility
@brief Converts black&white image to distance field representation
@section magnum-distancefieldconverter-usage Usage
magnum-distancefieldconverter [-h|--help] [--importer IMPORTER] [--converter CONVERTER] [--plugin-dir DIR] --output-size "X Y" --radius N [--] input output
Arguments:
- `input` -- input image
- `output` -- output image
- `-h`, `--help` -- display help message and exit
- `--importer IMPORTER` -- image importer plugin (default: @ref Trade::TgaImporter "TgaImporter")
- `--converter CONVERTER` -- image converter plugin (default: @ref Trade::TgaImageConverter "TgaImageConverter")
- `--plugin-dir DIR` -- base plugin dir (defaults to plugin directory in
%Magnum install location)
- `--output-size "X Y"` -- size of output image
- `--radius N` -- distance field computation radius
The resulting image can be then used with @ref Shaders::DistanceFieldVector
shader. See also @ref TextureTools::distanceField() for more information about
the algorithm and parameters.
@section magnum-distancefield-example Example usage
magnum-distancefieldconverter --importer PngImporter --output-size "256 256" --radius 24 logo.png logo.tga
This will open binary `logo.png` image using @ref Trade::PngImporter "PngImporter"
plugin and converts it to 256x256 distance field `logo.tga` using
@ref Trade::TgaImageConverter "TgaImageConverter".
*/
namespace TextureTools {
class DistanceFieldConverter: public Platform::WindowlessApplication { class DistanceFieldConverter: public Platform::WindowlessApplication {
public: public:
@ -64,11 +100,12 @@ class DistanceFieldConverter: public Platform::WindowlessApplication {
DistanceFieldConverter::DistanceFieldConverter(const Arguments& arguments): Platform::WindowlessApplication(arguments, nullptr) { DistanceFieldConverter::DistanceFieldConverter(const Arguments& arguments): Platform::WindowlessApplication(arguments, nullptr) {
args.addArgument("input").setHelp("input", "input image") args.addArgument("input").setHelp("input", "input image")
.addArgument("output").setHelp("output", "output image") .addArgument("output").setHelp("output", "output image")
.addOption("importer", "TgaImporter").setHelp("image importer plugin") .addOption("importer", "TgaImporter").setHelp("importer", "image importer plugin")
.addOption("converter", "TgaImageConverter").setHelp("image converter plugin") .addOption("converter", "TgaImageConverter").setHelp("converter", "image converter plugin")
.addOption("plugin-dir", MAGNUM_PLUGINS_DIR).setHelpKey("plugin-dir", "DIR").setHelp("plugin-dir", "base plugin dir")
.addNamedArgument("output-size").setHelpKey("output-size", "\"X Y\"").setHelp("output-size", "size of output image") .addNamedArgument("output-size").setHelpKey("output-size", "\"X Y\"").setHelp("output-size", "size of output image")
.addNamedArgument("radius").setHelpKey("radius", "N").setHelp("radius", "distance field computation radius") .addNamedArgument("radius").setHelpKey("radius", "N").setHelp("radius", "distance field computation radius")
.setHelp("Converts black&white image to distance-field representation.") .setHelp("Converts black&white image to distance field representation.")
.parse(arguments.argc, arguments.argv); .parse(arguments.argc, arguments.argv);
createContext(); createContext();
@ -76,13 +113,13 @@ DistanceFieldConverter::DistanceFieldConverter(const Arguments& arguments): Plat
int DistanceFieldConverter::exec() { int DistanceFieldConverter::exec() {
/* Load importer plugin */ /* Load importer plugin */
PluginManager::Manager<Trade::AbstractImporter> importerManager(MAGNUM_IMPORTER_PLUGIN_DIR); PluginManager::Manager<Trade::AbstractImporter> importerManager(Utility::Directory::join(args.value("plugin-dir"), "importers/"));
if(!(importerManager.load(args.value("importer")) & PluginManager::LoadState::Loaded)) if(!(importerManager.load(args.value("importer")) & PluginManager::LoadState::Loaded))
return 1; return 1;
std::unique_ptr<Trade::AbstractImporter> importer = importerManager.instance(args.value("importer")); std::unique_ptr<Trade::AbstractImporter> importer = importerManager.instance(args.value("importer"));
/* Load converter plugin */ /* Load converter plugin */
PluginManager::Manager<Trade::AbstractImageConverter> converterManager(MAGNUM_IMAGECONVERTER_PLUGIN_DIR); PluginManager::Manager<Trade::AbstractImageConverter> converterManager(Utility::Directory::join(args.value("plugin-dir"), "imageconverters/"));
if(!(converterManager.load(args.value("converter")) & PluginManager::LoadState::Loaded)) if(!(converterManager.load(args.value("converter")) & PluginManager::LoadState::Loaded))
return 1; return 1;
std::unique_ptr<Trade::AbstractImageConverter> converter = converterManager.instance(args.value("converter")); std::unique_ptr<Trade::AbstractImageConverter> converter = converterManager.instance(args.value("converter"));

7
src/Magnum/TextureTools/distancefieldconverterConfigure.h.cmake

@ -23,5 +23,8 @@
DEALINGS IN THE SOFTWARE. DEALINGS IN THE SOFTWARE.
*/ */
#define MAGNUM_IMPORTER_PLUGIN_DIR "${MAGNUM_LIBRARY_INSTALL_DIR}/magnum/importers" #ifdef CORRADE_IS_DEBUG_BUILD
#define MAGNUM_IMAGECONVERTER_PLUGIN_DIR "${MAGNUM_LIBRARY_INSTALL_DIR}/magnum/imageconverters" #define MAGNUM_PLUGINS_DIR "${MAGNUM_PLUGINS_DEBUG_INSTALL_DIR}"
#else
#define MAGNUM_PLUGINS_DIR "${MAGNUM_PLUGINS_INSTALL_DIR}"
#endif

2
src/Magnum/Timeline.h

@ -43,7 +43,7 @@ namespace Magnum {
Keeps track of time delta between frames and allows FPS limiting. Can be used Keeps track of time delta between frames and allows FPS limiting. Can be used
as source for animation speed computations. as source for animation speed computations.
@section Timeline-usage Basic usage ## Basic usage
Construct the timeline on initialization so the instance is available for Construct the timeline on initialization so the instance is available for
whole lifetime of the application. Call @ref start() before first draw event is whole lifetime of the application. Call @ref start() before first draw event is

2
src/Magnum/Trade/AbstractImageConverter.h

@ -44,7 +44,7 @@ Provides functionality for converting images between various internal formats
or compressing them. See @ref plugins for more information and `*ImageConverter` or compressing them. See @ref plugins for more information and `*ImageConverter`
classes in @ref Trade namespace for available image converter plugins. classes in @ref Trade namespace for available image converter plugins.
@section AbstractImageConverter-subclassing Subclassing ## Subclassing
Plugin implements function @ref doFeatures() and one or more of Plugin implements function @ref doFeatures() and one or more of
@ref doExportToImage(), @ref doExportToData() or @ref doExportToFile() @ref doExportToImage(), @ref doExportToData() or @ref doExportToFile()

2
src/Magnum/Trade/AbstractImporter.h

@ -47,7 +47,7 @@ Provides interface for importing 2D/3D scene, mesh, material, texture and image
data. See @ref plugins for more information and `*Importer` classes in data. See @ref plugins for more information and `*Importer` classes in
@ref Trade namespace for available importer plugins. @ref Trade namespace for available importer plugins.
@section AbstractImporter-subclassing Subclassing ## Subclassing
Plugin implements function @ref doFeatures(), @ref doIsOpened(), one of or both Plugin implements function @ref doFeatures(), @ref doIsOpened(), one of or both
@ref doOpenData() and @ref doOpenFile() functions, function @ref doClose() and @ref doOpenData() and @ref doOpenFile() functions, function @ref doClose() and

2
toolchains

@ -1 +1 @@
Subproject commit 19d1e7ee8bc61a6e1b4871c93e3aca4743e0ca9e Subproject commit 7380270cc5d8e399cb06f463ac681adcbd591d54
Loading…
Cancel
Save