Browse Source

Merge branch 'master' into compatibility

Conflicts:
	src/Primitives/Plane.cpp
	src/Primitives/Square.cpp
	src/SceneGraph/SceneGraph.h
Vladimír Vondruš 13 years ago
parent
commit
e2635345fa
  1. 5
      CMakeLists.txt
  2. 2
      PKGBUILD
  3. 10
      doc/best-practices.dox
  4. 5
      doc/building.dox
  5. 6
      doc/portability.dox
  6. 12
      doc/required-extensions.dox
  7. 15
      src/AbstractFramebuffer.h
  8. 17
      src/AbstractResourceLoader.h
  9. 11
      src/AbstractShaderProgram.h
  10. 11
      src/AbstractTexture.h
  11. 5
      src/Audio/AbstractImporter.cpp
  12. 13
      src/Audio/AbstractImporter.h
  13. 2
      src/Audio/Renderer.h
  14. 7
      src/Audio/Source.h
  15. 3
      src/Buffer.cpp
  16. 47
      src/Buffer.h
  17. 8
      src/Context.h
  18. 10
      src/CubeMapTexture.h
  19. 4
      src/CubeMapTextureArray.h
  20. 3
      src/DebugTools/DebugTools.h
  21. 11
      src/DebugTools/ShapeRenderer.h
  22. 8
      src/DefaultFramebuffer.h
  23. 63
      src/Magnum.h
  24. 3
      src/Math/Math.h
  25. 32
      src/Mesh.cpp
  26. 23
      src/Mesh.h
  27. 2
      src/MeshTools/CMakeLists.txt
  28. 59
      src/MeshTools/FullScreenTriangle.cpp
  29. 87
      src/MeshTools/FullScreenTriangle.h
  30. 2
      src/Platform/GlutApplication.h
  31. 8
      src/Platform/NaClApplication.h
  32. 4
      src/Platform/Sdl2Application.h
  33. 12
      src/Primitives/Plane.cpp
  34. 11
      src/Primitives/Plane.h
  35. 12
      src/Primitives/Square.cpp
  36. 11
      src/Primitives/Square.h
  37. 4
      src/Query.h
  38. 129
      src/Renderer.h
  39. 6
      src/Resource.h
  40. 4
      src/ResourceManager.h
  41. 16
      src/SceneGraph/AbstractFeature.h
  42. 89
      src/SceneGraph/Animable.h
  43. 3
      src/SceneGraph/SceneGraph.h
  44. 26
      src/Shaders/MeshVisualizer.h
  45. 17
      src/Shaders/Phong.h
  46. 4
      src/Shaders/Shaders.h
  47. 3
      src/Shapes/Shapes.h
  48. 5
      src/Text/AbstractFont.cpp
  49. 41
      src/Text/AbstractFont.h
  50. 204
      src/Text/AbstractFontConverter.h
  51. 2
      src/Text/DistanceFieldGlyphCache.h
  52. 2
      src/Text/GlyphCache.h
  53. 24
      src/Texture.h
  54. 15
      src/TextureTools/CMakeLists.txt
  55. 11
      src/TextureTools/DistanceField.h
  56. 26
      src/TextureTools/configure.h.cmake
  57. 134
      src/TextureTools/distance-field.cpp
  58. 22
      src/Trade/AbstractImageConverter.h
  59. 5
      src/Trade/AbstractImporter.cpp
  60. 22
      src/Trade/AbstractImporter.h
  61. 12
      src/Trade/PhongMaterialData.h
  62. 2
      src/Trade/TextureData.h
  63. 3
      src/Trade/Trade.h

5
CMakeLists.txt

@ -45,8 +45,9 @@ cmake_dependent_option(WITH_SCENEGRAPH "Build SceneGraph library" ON "NOT WITH_D
cmake_dependent_option(WITH_SHADERS "Build Shaders library" ON "NOT WITH_DEBUGTOOLS" ON) cmake_dependent_option(WITH_SHADERS "Build Shaders library" ON "NOT WITH_DEBUGTOOLS" ON)
cmake_dependent_option(WITH_SHAPES "Build Shapes library" ON "NOT WITH_DEBUGTOOLS" ON) cmake_dependent_option(WITH_SHAPES "Build Shapes library" ON "NOT WITH_DEBUGTOOLS" ON)
option(WITH_TEXT "Build Text library" ON) option(WITH_TEXT "Build Text library" ON)
cmake_dependent_option(WITH_TEXTURETOOLS "Build TextureTools library" ON "NOT WITH_TEXT" ON) cmake_dependent_option(WITH_TEXTURETOOLS "Build TextureTools library" ON "NOT WITH_TEXT;NOT WITH_DISTANCEFIELDCONVERTER" ON)
option(WITH_MAGNUMINFO "Build magnum-info utility" OFF) option(WITH_MAGNUMINFO "Build magnum-info utility" OFF)
cmake_dependent_option(WITH_DISTANCEFIELDCONVERTER "Build magnum-distancefield utility" OFF "NOT TARGET_GLES" OFF)
# Application libraries # Application libraries
if(CORRADE_TARGET_NACL) if(CORRADE_TARGET_NACL)
@ -54,7 +55,7 @@ if(CORRADE_TARGET_NACL)
cmake_dependent_option(WITH_WINDOWLESSNACLAPPLICATION "Build WindowlessNaClApplication library" OFF "NOT WITH_MAGNUMINFO" ON) cmake_dependent_option(WITH_WINDOWLESSNACLAPPLICATION "Build WindowlessNaClApplication library" OFF "NOT WITH_MAGNUMINFO" ON)
else() else()
option(WITH_GLXAPPLICATION "Build GlxApplication library" OFF) option(WITH_GLXAPPLICATION "Build GlxApplication library" OFF)
cmake_dependent_option(WITH_WINDOWLESSGLXAPPLICATION "Build WindowlessGlxApplication library" OFF "NOT WITH_MAGNUMINFO" ON) cmake_dependent_option(WITH_WINDOWLESSGLXAPPLICATION "Build WindowlessGlxApplication library" OFF "NOT WITH_MAGNUMINFO;NOT WITH_DISTANCEFIELDCONVERTER" ON)
cmake_dependent_option(WITH_XEGLAPPLICATION "Build XEglApplication library" OFF "TARGET_GLES" OFF) cmake_dependent_option(WITH_XEGLAPPLICATION "Build XEglApplication library" OFF "TARGET_GLES" OFF)
cmake_dependent_option(WITH_GLUTAPPLICATION "Build GlutApplication library" OFF "NOT TARGET_GLES" OFF) cmake_dependent_option(WITH_GLUTAPPLICATION "Build GlutApplication library" OFF "NOT TARGET_GLES" OFF)
option(WITH_SDL2APPLICATION "Build Sdl2Application library" OFF) option(WITH_SDL2APPLICATION "Build Sdl2Application library" OFF)

2
PKGBUILD

@ -6,7 +6,7 @@ pkgdesc="OpenGL graphics engine"
arch=('i686' 'x86_64') arch=('i686' 'x86_64')
url="https://github.com/mosra/magnum" url="https://github.com/mosra/magnum"
license=('MIT') license=('MIT')
depends=('corrade' 'glew' 'sdl-hg' 'freeglut') depends=('corrade' 'glew' 'freeglut' 'sdl2')
makedepends=('cmake') makedepends=('cmake')
options=(!strip) options=(!strip)
provides=('magnum-git') provides=('magnum-git')

10
doc/best-practices.dox

@ -56,11 +56,11 @@ information.
@subsubsection best-practices-nacl-buffer-types Native Client requires unique buffer binding @subsubsection best-practices-nacl-buffer-types Native Client requires unique buffer binding
As noted in the above link, buffers in NaCl implementation need to be bound As noted in the above link, buffers in NaCl implementation need to be bound
only to one unique target, i.e., Buffer bound to @ref Buffer::Target "Target::Array" only to one unique target, i.e., @ref Buffer bound to @ref Buffer::Target::Array
cannot be later rebound to @ref Buffer::Target "Target::ElementArray". However, cannot be later rebound to @ref Buffer::Target::ElementArray. However, %Magnum
%Magnum by default uses any sufficient target when binding the buffer by default uses any sufficient target when binding the buffer internally (e.g.
internally (e.g. for setting data or copying). To avoid this, set target hint for setting data or copying). To avoid this, set target hint to desired target,
to desired target, either in constructor or using Buffer::setTargetHint(). either in constructor or using @ref Buffer::setTargetHint().
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. vertex and index buffers.

5
doc/building.dox

@ -169,9 +169,12 @@ be built and which not:
Enabled automatically if `WITH_DEBUGTOOLS` is enabled. Enabled automatically if `WITH_DEBUGTOOLS` is enabled.
- `WITH_TEXT` - Text library. Enables also building of TextureTools library. - `WITH_TEXT` - Text library. Enables also building of TextureTools library.
- `WITH_TEXTURETOOLS` - TextureTools library. Enabled automatically if `WITH_TEXT` - `WITH_TEXTURETOOLS` - TextureTools library. Enabled automatically if `WITH_TEXT`
is enabled. or `WITH_DISTANCEFIELDCONVERTER` is enabled.
- `WITH_MAGNUMINFO` - `magnum-info` executable, provides information about the - `WITH_MAGNUMINFO` - `magnum-info` executable, provides information about the
engine and OpenGL capabilities. engine and OpenGL capabilities.
- `WITH_DISTANCEFIELDCONVERTER` - `magnum-distancefield` executable for
converting black&white images to distance field textures. Enables also
building of TextureTools library.
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
need at least one). Choose the one which suits your requirements and your need at least one). Choose the one which suits your requirements and your

6
doc/portability.dox

@ -39,9 +39,9 @@ format is not supported.
If you include Magnum.h, you get these predefined macros: If you include Magnum.h, you get these predefined macros:
- @ref MAGNUM_TARGET_GLES_ "MAGNUM_TARGET_GLES" if targeting OpenGL ES 2.0 or - @ref MAGNUM_TARGET_GLES if targeting OpenGL ES
3.0 - @ref MAGNUM_TARGET_GLES2 if targeting OpenGL ES 2.0
- @ref MAGNUM_TARGET_GLES2_ "MAGNUM_TARGET_GLES2" if targeting OpenGL ES 2.0 - @ref MAGNUM_TARGET_GLES3 if targeting OpenGL ES 3.0
Example usage: Example usage:
@code @code

12
doc/required-extensions.dox

@ -29,8 +29,8 @@ The engine is meant to be run on OpenGL 3 capable hardware, but most of the
functionality is working in OpenGL 2.1 hardware too (i.e. integrated Intel functionality is working in OpenGL 2.1 hardware too (i.e. integrated Intel
GPUs), unless stated otherwise. OpenGL ES is also supported. GPUs), unless stated otherwise. OpenGL ES is also supported.
@see @ref building, @ref cmake, @ref MAGNUM_TARGET_GLES_ "MAGNUM_TARGET_GLES", @see @ref building, @ref cmake, @ref MAGNUM_TARGET_GLES,
@ref MAGNUM_TARGET_GLES2_ "MAGNUM_TARGET_GLES2" @ref MAGNUM_TARGET_GLES2
Following are lists of functionality requiring specific OpenGL version. In Following are lists of functionality requiring specific OpenGL version. In
most cases it is also specified which extension is required for given most cases it is also specified which extension is required for given
@ -67,15 +67,15 @@ supported on Intel GPUs even if they are capable of OpenGL 2.1 only).
@page requires-extension Functionality requiring specific OpenGL extension @page requires-extension Functionality requiring specific OpenGL extension
@page requires-gl Functionality requiring desktop OpenGL (not available on OpenGL ES) @page requires-gl Functionality requiring desktop OpenGL (not available on OpenGL ES)
@see @ref MAGNUM_TARGET_GLES_ "MAGNUM_TARGET_GLES" @see @ref MAGNUM_TARGET_GLES
@page requires-gles20 Functionality requiring OpenGL ES 2.0 (not available in ES 3.0 and desktop OpenGL) @page requires-gles20 Functionality requiring OpenGL ES 2.0 (not available in ES 3.0 and desktop OpenGL)
@see @ref MAGNUM_TARGET_GLES2_ "MAGNUM_TARGET_GLES2" @see @ref MAGNUM_TARGET_GLES2
@page requires-gles30 Functionality requiring OpenGL ES 3.0 @page requires-gles30 Functionality requiring OpenGL ES 3.0
@see @ref MAGNUM_TARGET_GLES3_ "MAGNUM_TARGET_GLES3" @see @ref MAGNUM_TARGET_GLES3
@page requires-es-extension Functionality requiring specific OpenGL ES extension @page requires-es-extension Functionality requiring specific OpenGL ES extension
@see @ref MAGNUM_TARGET_GLES2_ "MAGNUM_TARGET_GLES2" @see @ref MAGNUM_TARGET_GLES2
*/ */

15
src/AbstractFramebuffer.h

@ -161,12 +161,12 @@ class MAGNUM_EXPORT AbstractFramebuffer {
* @param mask Which buffers to perform blit operation on * @param mask Which buffers to perform blit operation on
* @param filter Interpolation filter * @param filter Interpolation filter
* *
* Binds @p source framebuffer to @ref FramebufferTarget "FramebufferTarget::Read" * Binds @p source framebuffer to @ref FramebufferTarget::Read and
* and @p destination framebuffer to @ref FramebufferTarget "FramebufferTarget::Draw" * @p destination framebuffer to @ref FramebufferTarget::Draw and
* and performs blitting operation. See DefaultFramebuffer::mapForRead(), * performs blitting operation. See @ref DefaultFramebuffer::mapForRead(),
* Framebuffer::mapForRead(), DefaultFramebuffer::mapForDraw() and * @ref Framebuffer::mapForRead(), @ref DefaultFramebuffer::mapForDraw()
* Framebuffer::mapForDraw() for specifying particular buffers for * and @ref Framebuffer::mapForDraw() for specifying particular buffers
* blitting operation. * for blitting operation.
* @see @fn_gl{BlitFramebuffer} * @see @fn_gl{BlitFramebuffer}
* @requires_gles30 %Extension @es_extension{ANGLE,framebuffer_blit} or * @requires_gles30 %Extension @es_extension{ANGLE,framebuffer_blit} or
* @es_extension{NV,framebuffer_blit} * @es_extension{NV,framebuffer_blit}
@ -183,8 +183,7 @@ class MAGNUM_EXPORT AbstractFramebuffer {
* Convenience alternative to above function when source rectangle is * Convenience alternative to above function when source rectangle is
* the same as destination rectangle. As the image is copied * the same as destination rectangle. As the image is copied
* pixel-by-pixel, no interpolation is needed and thus * pixel-by-pixel, no interpolation is needed and thus
* @ref FramebufferBlitFilter "FramebufferBlitFilter::Nearest" * @ref FramebufferBlitFilter::Nearest filtering is used by default.
* filtering is used by default.
* @see @fn_gl{BlitFramebuffer} * @see @fn_gl{BlitFramebuffer}
* @requires_gles30 %Extension @es_extension{ANGLE,framebuffer_blit} or * @requires_gles30 %Extension @es_extension{ANGLE,framebuffer_blit} or
* @es_extension{NV,framebuffer_blit} * @es_extension{NV,framebuffer_blit}

17
src/AbstractResourceLoader.h

@ -140,9 +140,9 @@ template<class T> class AbstractResourceLoader {
* @brief Request resource to be loaded * @brief Request resource to be loaded
* *
* If the resource isn't yet loaded or loading, state of the resource * If the resource isn't yet loaded or loading, state of the resource
* is set to @ref Resource::ResourceState "ResourceState::Loading" and count of * is set to @ref ResourceState::Loading and count of requested
* requested features is incremented. Depending on implementation the * features is incremented. Depending on implementation the resource
* resource might be loaded synchronously or asynchronously. * might be loaded synchronously or asynchronously.
* *
* @see ResourceManager::state(), requestedCount(), notFoundCount(), * @see ResourceManager::state(), requestedCount(), notFoundCount(),
* loadedCount() * loadedCount()
@ -153,10 +153,9 @@ template<class T> class AbstractResourceLoader {
/** /**
* @brief Set loaded resource to resource manager * @brief Set loaded resource to resource manager
* *
* Also increments count of loaded resources. Parameter @p state * Also increments count of loaded resources. Parameter @p state must
* must be either @ref ResourceManager::ResourceDataState "ResourceDataState::Mutable" * be either @ref ResourceDataState::Mutable or @ref ResourceDataState::Final.
* or @ref ResourceManager::ResourceDataState "ResourceDataState::Final". See * See @ref ResourceManager::set() for more information.
* ResourceManager::set() for more information.
* @see loadedCount() * @see loadedCount()
*/ */
void set(ResourceKey key, T* data, ResourceDataState state, ResourcePolicy policy); void set(ResourceKey key, T* data, ResourceDataState state, ResourcePolicy policy);
@ -169,8 +168,8 @@ template<class T> class AbstractResourceLoader {
/** /**
* @brief Set loaded resource to resource manager * @brief Set loaded resource to resource manager
* *
* Same as above function with state set to @ref ResourceDataState "ResourceDataState::Final" * Same as above function with state set to @ref ResourceDataState::Final
* and policy to @ref ResourcePolicy "ResourcePolicy::Resident". * and policy to @ref ResourcePolicy::Resident.
*/ */
void set(ResourceKey key, T* data) { void set(ResourceKey key, T* data) {
set(key, data, ResourceDataState::Final, ResourcePolicy::Resident); set(key, data, ResourceDataState::Final, ResourcePolicy::Resident);

11
src/AbstractShaderProgram.h

@ -951,10 +951,9 @@ always have vertex attribute with location `0`.
Template parameter @p T is the type which is used for shader attribute, e.g. Template parameter @p T is the type which is used for shader attribute, e.g.
@ref Vector4i for `ivec4`. DataType is type of passed data when adding vertex @ref Vector4i for `ivec4`. DataType is type of passed data when adding vertex
buffers to mesh. By default it is the same as type used in shader (e.g. buffers to mesh. By default it is the same as type used in shader (e.g.
@ref DataType "DataType::Int" for @ref Vector4i). It's also possible to pass @ref DataType::Int for @ref Vector4i). It's also possible to pass integer data
integer data to floating-point shader inputs. In this case you may want to to floating-point shader inputs. In this case you may want to normalize the
normalize the values (e.g. color components from 0-255 to 0.0f - 1.0f) -- see values (e.g. color components from 0-255 to 0.0f - 1.0f) -- see @ref DataOption::Normalize.
@ref DataOption "DataOption::Normalize".
Only some types are allowed as attribute types, see @ref AbstractShaderProgram-types Only some types are allowed as attribute types, see @ref AbstractShaderProgram-types
or TypeTraits::AttributeType for more information. or TypeTraits::AttributeType for more information.
@ -1123,11 +1122,11 @@ template<UnsignedInt location, class T> class AbstractShaderProgram::Attribute {
/** /**
* @brief Constructor * @brief Constructor
* @param dataType Type of passed data. Default is the same as * @param dataType Type of passed data. Default is the same as
* type used in shader (e.g. DataType::Integer for Vector4i). * type used in shader (e.g. @ref DataType::Int for @ref Vector4i).
* @param dataOptions Data options. Default is no options. * @param dataOptions Data options. Default is no options.
* *
* Component count is set to the same value as in type used in shader * Component count is set to the same value as in type used in shader
* (e.g. @ref Components "Components::Three" for Vector3). * (e.g. @ref Components::Three for @ref Vector3).
*/ */
constexpr Attribute(DataType dataType = Implementation::Attribute<T>::DefaultDataType, DataOptions dataOptions = DataOptions()): _components(Implementation::Attribute<T>::DefaultComponents), _dataType(dataType), _dataOptions(dataOptions) {} constexpr Attribute(DataType dataType = Implementation::Attribute<T>::DefaultDataType, DataOptions dataOptions = DataOptions()): _components(Implementation::Attribute<T>::DefaultComponents), _dataType(dataType), _dataOptions(dataOptions) {}

11
src/AbstractTexture.h

@ -151,11 +151,10 @@ class MAGNUM_EXPORT AbstractTexture {
* Sets filter used when the object pixel size is smaller than the * Sets filter used when the object pixel size is smaller than the
* texture size. If @extension{EXT,direct_state_access} is not * texture size. If @extension{EXT,direct_state_access} is not
* available, the texture is bound to some layer before the operation. * available, the texture is bound to some layer before the operation.
* Initial value is (@ref Sampler::Filter "Sampler::Filter::Nearest", * Initial value is (@ref Sampler::Filter::Nearest, @ref Sampler::Mipmap::Linear).
* @ref Sampler::Mipmap "Sampler::Mipmap::Linear").
* @attention For rectangle textures only some modes are supported, * @attention For rectangle textures only some modes are supported,
* see @ref Sampler::Filter "Sampler::Filter" and @ref Sampler::Mipmap "Sampler::Mipmap" * see @ref Sampler::Filter and @ref Sampler::Mipmap documentation
* documentation for more information. * for more information.
* @see @fn_gl{ActiveTexture}, @fn_gl{BindTexture} and @fn_gl{TexParameter} * @see @fn_gl{ActiveTexture}, @fn_gl{BindTexture} and @fn_gl{TexParameter}
* or @fn_gl_extension{TextureParameter,EXT,direct_state_access} * or @fn_gl_extension{TextureParameter,EXT,direct_state_access}
* with @def_gl{TEXTURE_MIN_FILTER} * with @def_gl{TEXTURE_MIN_FILTER}
@ -170,7 +169,7 @@ class MAGNUM_EXPORT AbstractTexture {
* Sets filter used when the object pixel size is larger than largest * Sets filter used when the object pixel size is larger than largest
* texture size. If @extension{EXT,direct_state_access} is not * texture size. If @extension{EXT,direct_state_access} is not
* available, the texture is bound to some layer before the operation. * available, the texture is bound to some layer before the operation.
* Initial value is @ref Sampler::Filter "Sampler::Filter::Linear". * Initial value is @ref Sampler::Filter::Linear.
* @see @fn_gl{ActiveTexture}, @fn_gl{BindTexture} and @fn_gl{TexParameter} * @see @fn_gl{ActiveTexture}, @fn_gl{BindTexture} and @fn_gl{TexParameter}
* or @fn_gl_extension{TextureParameter,EXT,direct_state_access} * or @fn_gl_extension{TextureParameter,EXT,direct_state_access}
* with @def_gl{TEXTURE_MAG_FILTER} * with @def_gl{TEXTURE_MAG_FILTER}
@ -185,7 +184,7 @@ class MAGNUM_EXPORT AbstractTexture {
* @brief Set border color * @brief Set border color
* @return Reference to self (for method chaining) * @return Reference to self (for method chaining)
* *
* Border color when wrapping is set to @ref Sampler::Wrapping "Sampler::Wrapping::ClampToBorder". * Border color when wrapping is set to @ref Sampler::Wrapping::ClampToBorder.
* If @extension{EXT,direct_state_access} is not available, the texture * If @extension{EXT,direct_state_access} is not available, the texture
* is bound to some layer before the operation. Initial value is * is bound to some layer before the operation. Initial value is
* `{0.0f, 0.0f, 0.0f, 0.0f}`. * `{0.0f, 0.0f, 0.0f, 0.0f}`.

5
src/Audio/AbstractImporter.cpp

@ -76,7 +76,10 @@ void AbstractImporter::doOpenFile(const std::string& filename) {
} }
void AbstractImporter::close() { void AbstractImporter::close() {
if(isOpened()) doClose(); if(isOpened()) {
doClose();
CORRADE_INTERNAL_ASSERT(!isOpened());
}
} }
Buffer::Format AbstractImporter::format() const { Buffer::Format AbstractImporter::format() const {

13
src/Audio/AbstractImporter.h

@ -49,8 +49,8 @@ checked by the implementation:
- Functions doOpenData() and doOpenFile() are called after the previous file - Functions doOpenData() and doOpenFile() are called after the previous file
was closed, function doClose() is called only if there is any file opened. was closed, function doClose() is called only if there is any file opened.
- Function doOpenData() is called only if @ref Feature "Feature::OpenData" - Function doOpenData() is called only if @ref Feature::OpenData is
is supported. supported.
- All `do*()` implementations working on opened file are called only if - All `do*()` implementations working on opened file are called only if
there is any file opened. there is any file opened.
*/ */
@ -91,8 +91,8 @@ class MAGNUM_AUDIO_EXPORT AbstractImporter: public PluginManager::AbstractPlugin
* @brief Open raw data * @brief Open raw data
* *
* Closes previous file, if it was opened, and tries to open given * Closes previous file, if it was opened, and tries to open given
* file. Available only if @ref Feature "Feature::OpenData" is * file. Available only if @ref Feature::OpenData is supported. Returns
* supported. Returns `true` on success, `false` otherwise. * `true` on success, `false` otherwise.
* @see features(), openFile() * @see features(), openFile()
*/ */
bool openData(Containers::ArrayReference<const unsigned char> data); bool openData(Containers::ArrayReference<const unsigned char> data);
@ -139,9 +139,8 @@ class MAGNUM_AUDIO_EXPORT AbstractImporter: public PluginManager::AbstractPlugin
/** /**
* @brief Implementation for openFile() * @brief Implementation for openFile()
* *
* If @ref Feature "Feature::OpenData" is supported, default * If @ref Feature::OpenData is supported, default implementation opens
* implementation opens the file and calls doOpenData() with its * the file and calls @ref doOpenData() with its contents.
* contents.
*/ */
virtual void doOpenFile(const std::string& filename); virtual void doOpenFile(const std::string& filename);

2
src/Audio/Renderer.h

@ -174,7 +174,7 @@ class Renderer {
/** /**
* @brief Set distance model * @brief Set distance model
* *
* Default is @ref DistanceModel "DistanceModel::InverseClamped". * Default is @ref DistanceModel::InverseClamped.
* @see @fn_al{DistanceModel} * @see @fn_al{DistanceModel}
*/ */
static void setDistanceModel(DistanceModel model) { static void setDistanceModel(DistanceModel model) {

7
src/Audio/Source.h

@ -347,10 +347,9 @@ class MAGNUM_AUDIO_EXPORT Source {
* @param buffer Buffer to attach or `nullptr` * @param buffer Buffer to attach or `nullptr`
* @return Reference to self (for method chaining) * @return Reference to self (for method chaining)
* *
* If an buffer is attached, changes source type to * If an buffer is attached, changes source type to @ref Type::Static,
* @ref Type "Type::Static", if detached, changes source type to * if detached, changes source type to @ref Type::Undetermined. The
* @ref Type "Type::Undetermined". The buffer must be already filled * buffer must be already filled with data.
* with data.
* @see @ref type(), @fn_al{Sourcei} with @def_al{BUFFER} * @see @ref type(), @fn_al{Sourcei} with @def_al{BUFFER}
*/ */
Source& setBuffer(Buffer* buffer); Source& setBuffer(Buffer* buffer);

3
src/Buffer.cpp

@ -87,6 +87,9 @@ Buffer::Buffer(Buffer::Target targetHint): _targetHint(targetHint)
} }
Buffer::~Buffer() { Buffer::~Buffer() {
/* Moved out, nothing to do */
if(!_id) return;
GLuint* bindings = Context::current()->state().buffer->bindings; GLuint* bindings = Context::current()->state().buffer->bindings;
/* Remove all current bindings from the state */ /* Remove all current bindings from the state */

47
src/Buffer.h

@ -89,8 +89,8 @@ for(std::size_t i = 0; i != 200; ++i)
CORRADE_INTERNAL_ASSERT_OUTPUT(buffer.unmap()); CORRADE_INTERNAL_ASSERT_OUTPUT(buffer.unmap());
@endcode @endcode
If you are updating only a few discrete portions of the buffer, you can use If you are updating only a few discrete portions of the buffer, you can use
@ref MapFlag "MapFlag::FlushExplicit" and flushMappedRange() to reduce number @ref MapFlag::FlushExplicit and flushMappedRange() to reduce number of memory
of memory operations performed by OpenGL on unmapping. Example: operations performed by OpenGL on unmapping. Example:
@code @code
Vector3* data = static_cast<Vector3*>(buffer.map(0, 200*sizeof(Vector3), Buffer::MapFlag::Write|Buffer::MapFlag::FlushExplicit)); Vector3* data = static_cast<Vector3*>(buffer.map(0, 200*sizeof(Vector3), Buffer::MapFlag::Write|Buffer::MapFlag::FlushExplicit));
for(std::size_t i: {7, 27, 56, 128}) { for(std::size_t i: {7, 27, 56, 128}) {
@ -125,11 +125,6 @@ nothing.
class MAGNUM_EXPORT Buffer { class MAGNUM_EXPORT Buffer {
friend class Context; friend class Context;
Buffer(const Buffer&) = delete;
Buffer(Buffer&&) = delete;
Buffer& operator=(const Buffer&) = delete;
Buffer& operator=(Buffer&&) = delete;
public: public:
/** /**
* @brief %Buffer target * @brief %Buffer target
@ -382,7 +377,7 @@ class MAGNUM_EXPORT Buffer {
/** /**
* Previous contents of the entire buffer may be discarded. May * Previous contents of the entire buffer may be discarded. May
* not be used in combination with @ref MapFlag "MapFlag::Read". * not be used in combination with @ref MapFlag::Read.
* @see invalidateData() * @see invalidateData()
*/ */
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
@ -393,7 +388,7 @@ class MAGNUM_EXPORT Buffer {
/** /**
* Previous contents of mapped range may be discarded. May not * Previous contents of mapped range may be discarded. May not
* be used in combination with @ref MapFlag "MapFlag::Read". * be used in combination with @ref MapFlag::Read.
* @see invalidateSubData() * @see invalidateSubData()
*/ */
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
@ -405,7 +400,7 @@ class MAGNUM_EXPORT Buffer {
/** /**
* Only one or more discrete subranges of the mapping will be * Only one or more discrete subranges of the mapping will be
* modified. See flushMappedRange() for more information. May only * modified. See flushMappedRange() for more information. May only
* be used in conjuction with @ref MapFlag "MapFlag::Write". * be used in conjuction with @ref MapFlag::Write.
*/ */
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
FlushExplicit = GL_MAP_FLUSH_EXPLICIT_BIT, FlushExplicit = GL_MAP_FLUSH_EXPLICIT_BIT,
@ -474,6 +469,12 @@ class MAGNUM_EXPORT Buffer {
*/ */
explicit Buffer(Target targetHint = Target::Array); explicit Buffer(Target targetHint = Target::Array);
/** @brief Copying is not allowed */
Buffer(const Buffer&) = delete;
/** @brief Move constructor */
Buffer(Buffer&& other) noexcept;
/** /**
* @brief Destructor * @brief Destructor
* *
@ -482,6 +483,12 @@ class MAGNUM_EXPORT Buffer {
*/ */
~Buffer(); ~Buffer();
/** @brief Copying is not allowed */
Buffer& operator=(const Buffer&) = delete;
/** @brief Move assignment */
Buffer& operator=(Buffer&& other) noexcept;
/** @brief OpenGL buffer ID */ /** @brief OpenGL buffer ID */
GLuint id() const { return _id; } GLuint id() const { return _id; }
@ -683,7 +690,7 @@ class MAGNUM_EXPORT Buffer {
* *
* If running on OpenGL ES or extension @extension{ARB,invalidate_subdata} * If running on OpenGL ES or extension @extension{ARB,invalidate_subdata}
* is not available, this function does nothing. * is not available, this function does nothing.
* @see @ref MapFlag "MapFlag::InvalidateBuffer", @fn_gl{InvalidateBufferData} * @see @ref MapFlag::InvalidateBuffer, @fn_gl{InvalidateBufferData}
*/ */
Buffer& invalidateData() { Buffer& invalidateData() {
(this->*invalidateImplementation)(); (this->*invalidateImplementation)();
@ -698,7 +705,7 @@ class MAGNUM_EXPORT Buffer {
* *
* If running on OpenGL ES or extension @extension{ARB,invalidate_subdata} * If running on OpenGL ES or extension @extension{ARB,invalidate_subdata}
* is not available, this function does nothing. * is not available, this function does nothing.
* @see @ref MapFlag "MapFlag::InvalidateRange", @fn_gl{InvalidateBufferData} * @see @ref MapFlag::InvalidateRange, @fn_gl{InvalidateBufferData}
*/ */
Buffer& invalidateSubData(GLintptr offset, GLsizeiptr length) { Buffer& invalidateSubData(GLintptr offset, GLsizeiptr length) {
(this->*invalidateSubImplementation)(offset, length); (this->*invalidateSubImplementation)(offset, length);
@ -753,8 +760,8 @@ class MAGNUM_EXPORT Buffer {
* @brief Map buffer to client memory * @brief Map buffer to client memory
* @param offset Offset into the buffer * @param offset Offset into the buffer
* @param length Length of the mapped memory * @param length Length of the mapped memory
* @param flags Flags. At least @ref MapFlag "MapFlag::Read" or * @param flags Flags. At least @ref MapFlag::Read or @ref MapFlag::Write
* @ref MapFlag "MapFlag::Write" must be specified. * must be specified.
* @return Pointer to buffer data * @return Pointer to buffer data
* *
* If @extension{EXT,direct_state_access} is not available and the * If @extension{EXT,direct_state_access} is not available and the
@ -776,7 +783,7 @@ class MAGNUM_EXPORT Buffer {
* @return Reference to self (for method chaining) * @return Reference to self (for method chaining)
* *
* Flushes specified subsection of mapped range. Use only if you called * Flushes specified subsection of mapped range. Use only if you called
* map() with @ref MapFlag "MapFlag::FlushExplicit" flag. See * map() with @ref MapFlag::FlushExplicit flag. See
* @ref Buffer-data-mapping "class documentation" for usage example. * @ref Buffer-data-mapping "class documentation" for usage example.
* *
* If @extension{EXT,direct_state_access} is not available and the * If @extension{EXT,direct_state_access} is not available and the
@ -924,6 +931,16 @@ CORRADE_ENUMSET_OPERATORS(Buffer::MapFlags)
/** @debugoperator{Magnum::Buffer} */ /** @debugoperator{Magnum::Buffer} */
Debug MAGNUM_EXPORT operator<<(Debug debug, Buffer::Target value); Debug MAGNUM_EXPORT operator<<(Debug debug, Buffer::Target value);
inline Buffer::Buffer(Buffer&& other) noexcept: _id(other._id), _targetHint(other._targetHint) {
other._id = 0;
}
inline Buffer& Buffer::operator=(Buffer&& other) noexcept {
std::swap(_id, other._id);
std::swap(_targetHint, other._targetHint);
return *this;
}
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
template<class T> Containers::Array<T> inline Buffer::data() { template<class T> Containers::Array<T> inline Buffer::data() {
const Int bufferSize = size(); const Int bufferSize = size();

8
src/Context.h

@ -67,7 +67,7 @@ enum class Version: Int {
* *
* All the functionality is present in OpenGL 4.2 (extension * All the functionality is present in OpenGL 4.2 (extension
* @extension{ARB,ES2_compatibility}), so on desktop OpenGL this is * @extension{ARB,ES2_compatibility}), so on desktop OpenGL this is
* equivalent to @ref Version "Version::GL410". * equivalent to @ref Version::GL410.
*/ */
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
GLES200 = 410, GLES200 = 410,
@ -80,7 +80,7 @@ enum class Version: Int {
* *
* All the functionality is present in OpenGL 4.3 (extension * All the functionality is present in OpenGL 4.3 (extension
* @extension{ARB,ES3_compatibility}), so on desktop OpenGL this is the * @extension{ARB,ES3_compatibility}), so on desktop OpenGL this is the
* equivalent to @ref Version "Version::GL430". * equivalent to @ref Version::GL430.
*/ */
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
GLES300 = 430 GLES300 = 430
@ -319,8 +319,8 @@ class MAGNUM_EXPORT Context {
* @endcode * @endcode
* *
* If no version from the list is supported, returns lowest available * If no version from the list is supported, returns lowest available
* OpenGL version (@ref Version "Version::GL210" for desktop OpenGL, * OpenGL version (@ref Version::GL210 for desktop OpenGL, @ref Version::GLES200
* @ref Version "Version::GLES200" for OpenGL ES). * for OpenGL ES).
*/ */
Version supportedVersion(std::initializer_list<Version> versions) const; Version supportedVersion(std::initializer_list<Version> versions) const;

10
src/CubeMapTexture.h

@ -73,8 +73,8 @@ is signed three-part vector from the center of the cube, which intersects one
of the six sides of the cube map. See also AbstractShaderProgram for more of the six sides of the cube map. See also AbstractShaderProgram for more
information about usage in shaders. information about usage in shaders.
@see @ref Renderer::Feature "Renderer::Feature::SeamlessCubeMapTexture", @see @ref Renderer::Feature::SeamlessCubeMapTexture, @ref CubeMapTextureArray,
CubeMapTextureArray, Texture, BufferTexture @ref Texture, @ref BufferTexture
*/ */
class CubeMapTexture: public AbstractTexture { class CubeMapTexture: public AbstractTexture {
public: public:
@ -213,10 +213,10 @@ class CubeMapTexture: public AbstractTexture {
* @param size Size of invalidated data * @param size Size of invalidated data
* *
* Z coordinate is equivalent to number of texture face, i.e. * Z coordinate is equivalent to number of texture face, i.e.
* @ref Coordinate "Coordinate::PositiveX" is `0` and so on, in the * @ref Coordinate::PositiveX is `0` and so on, in the same order as in
* same order as in the enum. * the enum.
* *
* See Texture::invalidateSubImage() for more information. * See @ref Texture::invalidateSubImage() for more information.
*/ */
void invalidateSubImage(Int level, const Vector3i& offset, const Vector3i& size) { void invalidateSubImage(Int level, const Vector3i& offset, const Vector3i& size) {
DataHelper<3>::invalidateSubImage(this, level, offset, size); DataHelper<3>::invalidateSubImage(this, level, offset, size);

4
src/CubeMapTextureArray.h

@ -75,8 +75,8 @@ parts define vector from the center of the cube which intersects with one of
the six sides of the cube map, fourth part is layer in the array. See also the six sides of the cube map, fourth part is layer in the array. See also
AbstractShaderProgram for more information about usage in shaders. AbstractShaderProgram for more information about usage in shaders.
@see @ref Renderer::Feature "Renderer::Feature::SeamlessCubeMapTexture", @see @ref Renderer::Feature::SeamlessCubeMapTexture, @ref CubeMapTexture,
CubeMapTexture, Texture, BufferTexture @ref Texture, @ref BufferTexture
@requires_gl40 %Extension @extension{ARB,texture_cube_map_array} @requires_gl40 %Extension @extension{ARB,texture_cube_map_array}
@requires_gl Cube map texture arrays are not available in OpenGL ES. @requires_gl Cube map texture arrays are not available in OpenGL ES.
*/ */

3
src/DebugTools/DebugTools.h

@ -32,8 +32,6 @@
namespace Magnum { namespace DebugTools { namespace Magnum { namespace DebugTools {
/** @todoc Remove `ifndef` when Doxygen is sane again */
#ifndef DOXYGEN_GENERATING_OUTPUT
template<UnsignedInt> class ForceRenderer; template<UnsignedInt> class ForceRenderer;
typedef ForceRenderer<2> ForceRenderer2D; typedef ForceRenderer<2> ForceRenderer2D;
typedef ForceRenderer<3> ForceRenderer3D; typedef ForceRenderer<3> ForceRenderer3D;
@ -51,7 +49,6 @@ template<UnsignedInt> class ShapeRenderer;
typedef ShapeRenderer<2> ShapeRenderer2D; typedef ShapeRenderer<2> ShapeRenderer2D;
typedef ShapeRenderer<3> ShapeRenderer3D; typedef ShapeRenderer<3> ShapeRenderer3D;
class ShapeRendererOptions; class ShapeRendererOptions;
#endif
}} }}

11
src/DebugTools/ShapeRenderer.h

@ -38,10 +38,7 @@
namespace Magnum { namespace DebugTools { namespace Magnum { namespace DebugTools {
/** @todoc Remove `ifndef` when Doxygen is sane again */
#ifndef DOXYGEN_GENERATING_OUTPUT
template<UnsignedInt> class ShapeRenderer; template<UnsignedInt> class ShapeRenderer;
#endif
namespace Implementation { namespace Implementation {
template<UnsignedInt> class AbstractShapeRenderer; template<UnsignedInt> class AbstractShapeRenderer;
@ -62,8 +59,8 @@ class ShapeRendererOptions {
* @see setRenderMode() * @see setRenderMode()
*/ */
enum class RenderMode: UnsignedByte { enum class RenderMode: UnsignedByte {
Wireframe, Wireframe, /**< Wireframe rendering */
Solid Solid /**< Solid rendering */
}; };
constexpr ShapeRendererOptions(): _color(1.0f), _pointSize(0.25f), _renderMode(RenderMode::Wireframe) {} constexpr ShapeRendererOptions(): _color(1.0f), _pointSize(0.25f), _renderMode(RenderMode::Wireframe) {}
@ -75,7 +72,7 @@ class ShapeRendererOptions {
* @brief Set shape rendering mode * @brief Set shape rendering mode
* @return Reference to self (for method chaining) * @return Reference to self (for method chaining)
* *
* Default is @ref RenderMode "RenderMode::Wireframe". * Default is @ref RenderMode::Wireframe.
*/ */
ShapeRendererOptions& setRenderMode(RenderMode mode) { ShapeRendererOptions& setRenderMode(RenderMode mode) {
_renderMode = mode; _renderMode = mode;
@ -103,7 +100,7 @@ class ShapeRendererOptions {
* @brief Set point size * @brief Set point size
* @return Reference to self (for method chaining) * @return Reference to self (for method chaining)
* *
* Size of rendered crosshairs, representing Shapes::Point shapes. * Size of rendered crosshairs, representing @ref Shapes::Point shapes.
* Default is `0.25f`. * Default is `0.25f`.
*/ */
ShapeRendererOptions& setPointSize(Float size) { ShapeRendererOptions& setPointSize(Float size) {

8
src/DefaultFramebuffer.h

@ -142,7 +142,7 @@ class MAGNUM_EXPORT DefaultFramebuffer: public AbstractFramebuffer {
/** /**
* Write output to back buffer. * Write output to back buffer.
* *
* On desktop OpenGL, this is equal to @ref DrawAttachment "DrawAttachment::BackLeft". * On desktop OpenGL, this is equal to @ref DrawAttachment::BackLeft.
*/ */
#ifdef MAGNUM_TARGET_GLES #ifdef MAGNUM_TARGET_GLES
Back = GL_BACK, Back = GL_BACK,
@ -153,7 +153,7 @@ class MAGNUM_EXPORT DefaultFramebuffer: public AbstractFramebuffer {
/** /**
* Write output to front buffer. * Write output to front buffer.
* *
* On desktop OpenGL, this is equal to @ref DrawAttachment "DrawAttachment::FrontLeft". * On desktop OpenGL, this is equal to @ref DrawAttachment::FrontLeft.
*/ */
#ifdef MAGNUM_TARGET_GLES #ifdef MAGNUM_TARGET_GLES
Front = GL_FRONT Front = GL_FRONT
@ -313,8 +313,8 @@ class MAGNUM_EXPORT DefaultFramebuffer: public AbstractFramebuffer {
* *
* @p attachments is list of shader outputs mapped to buffer * @p attachments is list of shader outputs mapped to buffer
* attachments. %Shader outputs which are not listed are not used, you * attachments. %Shader outputs which are not listed are not used, you
* can achieve the same by passing @ref DrawAttachment "DrawAttachment::None" * can achieve the same by passing @ref DrawAttachment::None as
* as attachment. Example usage: * attachment. Example usage:
* @code * @code
* framebuffer.mapForDraw({{MyShader::ColorOutput, DefaultFramebuffer::DrawAttachment::BackLeft}, * framebuffer.mapForDraw({{MyShader::ColorOutput, DefaultFramebuffer::DrawAttachment::BackLeft},
* {MyShader::NormalOutput, DefaultFramebuffer::DrawAttachment::None}}); * {MyShader::NormalOutput, DefaultFramebuffer::DrawAttachment::None}});

63
src/Magnum.h

@ -40,11 +40,11 @@ typedef unsigned int GLenum; /* Needed for *Format and *Type enums */
namespace Magnum { namespace Magnum {
/** @todoc Remove `ifndef` when Doxygen is sane again */
#ifndef DOXYGEN_GENERATING_OUTPUT
namespace Math { namespace Math {
template<class T> struct Constants; template<class T> struct Constants;
/** @todoc Remove `ifndef` when Doxygen is able to handle operator"" */
#ifndef DOXYGEN_GENERATING_OUTPUT
#ifndef CORRADE_GCC46_COMPATIBILITY #ifndef CORRADE_GCC46_COMPATIBILITY
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
constexpr Rad<Double> operator "" _rad(long double); constexpr Rad<Double> operator "" _rad(long double);
@ -53,6 +53,7 @@ namespace Math {
constexpr Rad<Float> operator "" _radf(long double); constexpr Rad<Float> operator "" _radf(long double);
constexpr Deg<Float> operator "" _degf(long double); constexpr Deg<Float> operator "" _degf(long double);
#endif #endif
#endif
} }
/* Bring whole Corrade namespace */ /* Bring whole Corrade namespace */
@ -62,65 +63,56 @@ using namespace Corrade;
using Corrade::Utility::Debug; using Corrade::Utility::Debug;
using Corrade::Utility::Warning; using Corrade::Utility::Warning;
using Corrade::Utility::Error; using Corrade::Utility::Error;
#endif
#ifdef DOXYGEN_GENERATING_OUTPUT #ifdef DOXYGEN_GENERATING_OUTPUT
/** @todoc remove trailing underscores when Doxygen can handle `undef` */
/** /**
@brief Static library build @brief Static library build
`MAGNUM_BUILD_STATIC` is defined if build as static libraries. Default are Defined if built as static libraries. Default are shared libraries.
shared libraries.
@see @ref building-corrade @see @ref building-corrade
*/ */
#define MAGNUM_BUILD_STATIC_ #define MAGNUM_BUILD_STATIC
#undef MAGNUM_BUILD_STATIC
/** /**
@brief OpenGL ES target @brief OpenGL ES target
`MAGNUM_TARGET_GLES` is defined if the engine is built for OpenGL ES 3.0 or Defined if the engine is built for OpenGL ES 3.0 or OpenGL ES 2.0.
OpenGL ES 2.0. @see @ref MAGNUM_TARGET_GLES2, @ref MAGNUM_TARGET_GLES3,
@see @ref MAGNUM_TARGET_GLES2_ "MAGNUM_TARGET_GLES2", @ref MAGNUM_TARGET_DESKTOP_GLES, @ref building
@ref MAGNUM_TARGET_GLES3_ "MAGNUM_TARGET_GLES3",
@ref MAGNUM_TARGET_DESKTOP_GLES_ "MAGNUM_TARGET_DESKTOP_GLES",
@ref building
*/ */
#define MAGNUM_TARGET_GLES_ #define MAGNUM_TARGET_GLES
#undef MAGNUM_TARGET_GLES
/** /**
@brief OpenGL ES 2.0 target. @brief OpenGL ES 2.0 target.
`MAGNUM_TARGET_GLES2` is defined if the engine is built for OpenGL ES 2.0. Defined if the engine is built for OpenGL ES 2.0. Implies also
Implies also @ref MAGNUM_TARGET_GLES_ "MAGNUM_TARGET_GLES". @ref MAGNUM_TARGET_GLES.
@see @ref MAGNUM_TARGET_GLES3_ "MAGNUM_TARGET_GLES3", @see @ref MAGNUM_TARGET_GLES3, @ref MAGNUM_TARGET_DESKTOP_GLES, @ref building
@ref MAGNUM_TARGET_DESKTOP_GLES_ "MAGNUM_TARGET_DESKTOP_GLES",
@ref building
*/ */
#define MAGNUM_TARGET_GLES2_ #define MAGNUM_TARGET_GLES2
#undef MAGNUM_TARGET_GLES2
/** /**
@brief OpenGL ES 3.0 target. @brief OpenGL ES 3.0 target.
`MAGNUM_TARGET_GLES3` is defined if the engine is built for OpenGL ES 3.0. Defined if the engine is built for OpenGL ES 3.0. Implies also
Implies also @ref MAGNUM_TARGET_GLES_ "MAGNUM_TARGET_GLES". @ref MAGNUM_TARGET_GLES.
@see @ref MAGNUM_TARGET_GLES2_ "MAGNUM_TARGET_GLES2", @see @ref MAGNUM_TARGET_GLES2, @ref MAGNUM_TARGET_DESKTOP_GLES, @ref building
@ref MAGNUM_TARGET_DESKTOP_GLES_ "MAGNUM_TARGET_DESKTOP_GLES",
@ref building
*/ */
#define MAGNUM_TARGET_GLES3_ #define MAGNUM_TARGET_GLES3
#undef MAGNUM_TARGET_GLES3
/** /**
@brief Desktop emulation of OpenGL ES target @brief Desktop emulation of OpenGL ES target
`MAGNUM_TARGET_DESKTOP_GLES` is defined if the engine is built for OpenGL ES Defined if the engine is built for OpenGL ES 3.0 or OpenGL ES 2.0 emulated
3.0 or OpenGL ES 2.0 emulated within standard desktop OpenGL. Implies also within standard desktop OpenGL. Implies also @ref MAGNUM_TARGET_GLES.
@ref MAGNUM_TARGET_GLES_ "MAGNUM_TARGET_GLES". @see @ref MAGNUM_TARGET_GLES2, @ref building
@see @ref MAGNUM_TARGET_GLES2_ "MAGNUM_TARGET_GLES2", @ref building
*/ */
#define MAGNUM_TARGET_DESKTOP_GLES_ #define MAGNUM_TARGET_DESKTOP_GLES
#undef MAGNUM_TARGET_DESKTOP_GLES
#endif #endif
/** @{ @name Basic type definitions /** @{ @name Basic type definitions
@ -321,8 +313,6 @@ using Math::operator "" _degf;
using Math::operator "" _radf; using Math::operator "" _radf;
#endif #endif
/** @todoc Remove `ifndef` when Doxygen is sane again */
#ifndef DOXYGEN_GENERATING_OUTPUT
/* Forward declarations for all types in root namespace */ /* Forward declarations for all types in root namespace */
/* FramebufferClear[Mask], FramebufferBlit[Mask], FramebufferBlitFilter, /* FramebufferClear[Mask], FramebufferBlit[Mask], FramebufferBlitFilter,
@ -428,7 +418,6 @@ enum class TextureFormat: GLenum;
#endif #endif
class Timeline; class Timeline;
#endif
} }

3
src/Math/Math.h

@ -34,8 +34,6 @@ namespace Magnum { namespace Math {
/** @todo Denormals to zero */ /** @todo Denormals to zero */
/** @todoc Remove `ifndef` when Doxygen is sane again */
#ifndef DOXYGEN_GENERATING_OUTPUT
/* Class Constants used only statically */ /* Class Constants used only statically */
template<class> class Complex; template<class> class Complex;
@ -63,7 +61,6 @@ template<class> class Vector4;
namespace Geometry { namespace Geometry {
template<class> class Rectangle; template<class> class Rectangle;
} }
#endif
}} }}

32
src/Mesh.cpp

@ -75,7 +75,7 @@ Mesh::~Mesh() {
(this->*destroyImplementation)(); (this->*destroyImplementation)();
} }
Mesh::Mesh(Mesh&& other): _id(other._id), _primitive(other._primitive), _vertexCount(other._vertexCount), _indexCount(other._indexCount) Mesh::Mesh(Mesh&& other) noexcept: _id(other._id), _primitive(other._primitive), _vertexCount(other._vertexCount), _indexCount(other._indexCount)
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
, _indexStart(other._indexStart), _indexEnd(other._indexEnd) , _indexStart(other._indexStart), _indexEnd(other._indexEnd)
#endif #endif
@ -90,30 +90,26 @@ Mesh::Mesh(Mesh&& other): _id(other._id), _primitive(other._primitive), _vertexC
other._id = 0; other._id = 0;
} }
Mesh& Mesh::operator=(Mesh&& other) { Mesh& Mesh::operator=(Mesh&& other) noexcept {
(this->*destroyImplementation)(); std::swap(_id, other._id);
std::swap(_primitive, other._primitive);
_id = other._id; std::swap(_vertexCount, other._vertexCount);
_primitive = other._primitive; std::swap(_indexCount, other._indexCount);
_vertexCount = other._vertexCount;
_indexCount = other._indexCount;
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
_indexStart = other._indexStart; std::swap(_indexStart, other._indexStart);
_indexEnd = other._indexEnd; std::swap(_indexEnd, other._indexEnd);
#endif #endif
_indexOffset = other._indexOffset; std::swap(_indexOffset, other._indexOffset);
_indexType = other._indexType; std::swap(_indexType, other._indexType);
_indexBuffer = other._indexBuffer; std::swap(_indexBuffer, other._indexBuffer);
_attributes = std::move(other._attributes); std::swap(_attributes, other._attributes);
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
_integerAttributes = std::move(other._integerAttributes); std::swap(_integerAttributes, other._integerAttributes);
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
_longAttributes = std::move(other._longAttributes); std::swap(_longAttributes, other._longAttributes);
#endif #endif
#endif #endif
other._id = 0;
return *this; return *this;
} }

23
src/Mesh.h

@ -242,9 +242,6 @@ class MAGNUM_EXPORT Mesh {
friend class Context; friend class Context;
friend class MeshView; friend class MeshView;
Mesh(const Mesh&) = delete;
Mesh& operator=(const Mesh&) = delete;
public: public:
/** /**
* @brief Primitive type * @brief Primitive type
@ -353,8 +350,11 @@ class MAGNUM_EXPORT Mesh {
*/ */
explicit Mesh(Primitive primitive = Primitive::Triangles); explicit Mesh(Primitive primitive = Primitive::Triangles);
/** @brief Copying is not allowed */
Mesh(const Mesh&) = delete;
/** @brief Move constructor */ /** @brief Move constructor */
Mesh(Mesh&& other); Mesh(Mesh&& other) noexcept;
/** /**
* @brief Destructor * @brief Destructor
@ -364,8 +364,11 @@ class MAGNUM_EXPORT Mesh {
*/ */
~Mesh(); ~Mesh();
/** @brief Copying is not allowed */
Mesh& operator=(const Mesh&) = delete;
/** @brief Move assignment */ /** @brief Move assignment */
Mesh& operator=(Mesh&& other); Mesh& operator=(Mesh&& other) noexcept;
/** /**
* @brief Index size * @brief Index size
@ -381,9 +384,9 @@ class MAGNUM_EXPORT Mesh {
* @brief Set primitive type * @brief Set primitive type
* @return Reference to self (for method chaining) * @return Reference to self (for method chaining)
* *
* Default is @ref Primitive "Primitive::Triangles". * Default is @ref Primitive::Triangles.
* @see setVertexCount(), addVertexBuffer(), * @see @ref setVertexCount(), @ref addVertexBuffer(),
* addInterleavedVertexBuffer(), addVertexBufferStride() * @ref addInterleavedVertexBuffer(), @ref addVertexBufferStride()
*/ */
Mesh& setPrimitive(Primitive primitive) { Mesh& setPrimitive(Primitive primitive) {
_primitive = primitive; _primitive = primitive;
@ -834,7 +837,7 @@ template<> struct MAGNUM_EXPORT ConfigurationValue<Magnum::Mesh::Primitive> {
/** /**
* @brief Reads enum value as string * @brief Reads enum value as string
* *
* If the value is invalid, returns @ref Magnum::Mesh::Primitive "Mesh::Primitive::Points". * If the value is invalid, returns @ref Magnum::Mesh::Primitive::Points "Mesh::Primitive::Points".
*/ */
static Magnum::Mesh::Primitive fromString(const std::string& stringValue, ConfigurationValueFlags); static Magnum::Mesh::Primitive fromString(const std::string& stringValue, ConfigurationValueFlags);
}; };
@ -853,7 +856,7 @@ template<> struct MAGNUM_EXPORT ConfigurationValue<Magnum::Mesh::IndexType> {
/** /**
* @brief Read enum value as string * @brief Read enum value as string
* *
* If the value is invalid, returns @ref Magnum::Mesh::IndexType "Mesh::IndexType::UnsignedInt". * If the value is invalid, returns @ref Magnum::Mesh::IndexType::UnsignedInt "Mesh::IndexType::UnsignedInt".
*/ */
static Magnum::Mesh::IndexType fromString(const std::string& stringValue, ConfigurationValueFlags); static Magnum::Mesh::IndexType fromString(const std::string& stringValue, ConfigurationValueFlags);
}; };

2
src/MeshTools/CMakeLists.txt

@ -25,6 +25,7 @@
# Files shared between main library and unit test library # Files shared between main library and unit test library
set(MagnumMeshTools_SRCS set(MagnumMeshTools_SRCS
CompressIndices.cpp CompressIndices.cpp
FullScreenTriangle.cpp
Tipsify.cpp) Tipsify.cpp)
# Files compiled with different flags for main library and unit test library # Files compiled with different flags for main library and unit test library
@ -37,6 +38,7 @@ set(MagnumMeshTools_HEADERS
CompressIndices.h CompressIndices.h
Duplicate.h Duplicate.h
FlipNormals.h FlipNormals.h
FullScreenTriangle.h
GenerateFlatNormals.h GenerateFlatNormals.h
Interleave.h Interleave.h
RemoveDuplicates.h RemoveDuplicates.h

59
src/MeshTools/FullScreenTriangle.cpp

@ -0,0 +1,59 @@
/*
This file is part of Magnum.
Copyright © 2010, 2011, 2012, 2013 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 "FullScreenTriangle.h"
#include "Math/Vector2.h"
#include "AbstractShaderProgram.h"
#include "Buffer.h"
#include "Context.h"
#include "Mesh.h"
namespace Magnum { namespace MeshTools {
std::pair<Buffer, Mesh> fullScreenTriangle() {
Mesh mesh;
mesh.setPrimitive(Mesh::Primitive::Triangles)
.setVertexCount(3);
Buffer buffer;
#ifndef MAGNUM_TARGET_GLES
if(!Context::current()->isVersionSupported(Version::GL300))
#else
if(!Context::current()->isVersionSupported(Version::GLES300))
#endif
{
constexpr Vector2 triangle[] = {
Vector2(-1.0, 1.0),
Vector2(-1.0, -3.0),
Vector2( 3.0, 1.0)
};
buffer.setData(triangle, Buffer::Usage::StaticDraw);
mesh.addVertexBuffer(buffer, 0, AbstractShaderProgram::Attribute<0, Vector2>());
}
return {std::move(buffer), std::move(mesh)};
}
}}

87
src/MeshTools/FullScreenTriangle.h

@ -0,0 +1,87 @@
#ifndef Magnum_MeshTools_FullScreenTriangle_h
#define Magnum_MeshTools_FullScreenTriangle_h
/*
This file is part of Magnum.
Copyright © 2010, 2011, 2012, 2013 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.
*/
/** @file
* @brief Function @ref Magnum::MeshTools::fullScreenTriangle()
*/
#include <utility>
#include "Magnum.h"
#include "MeshTools/magnumMeshToolsVisibility.h"
namespace Magnum { namespace MeshTools {
/**
@brief Create full screen triangle mesh
Returns pre-configured mesh along with vertex buffer which can be used for
full-screen post-processing effects. The mesh is single triangle covering whole
screen area (@f$ (-1, -1) - (1, 1) @f$ on both dimensions) and provides only
vertex positions, as other attributes (such as texture coordinates) can be
computed from them. The vertex positions are, in order:
@f[
\begin{pmatrix} -1 \\ 1 \end{pmatrix},
\begin{pmatrix} -1 \\ -3 \end{pmatrix},
\begin{pmatrix} 3 \\ 1 \end{pmatrix}
@f]
On OpenGL 2.1 and OpenGL ES 2.0 the vertex positions are passed explicitly as
attribute `0`, contained in the buffer. On OpenGL 3.0+ and OpenGL ES 3.0+ the
mesh is attribute-less and the vertex positions can be computed using
`gl_VertexID` builtin shader variable, thus the returned vertex buffer is empty
and basically useless.
Computing positions in vertex shader in a portable way might be done like this.
For OpenGL 2.1 and OpenGL ES 2.0 you then need to bind the location of `position`
attribute to `0`.
@code
#if (!defined(GL_ES) && __VERSION__ >= 130) || (defined(GL_ES) && __VERSION__ >= 300)
#define NEW_GLSL
#endif
#ifndef NEW_GLSL
attribute lowp vec4 position;
#endif
void main() {
#ifdef NEW_GLSL
gl_Position = vec4((gl_VertexID == 2) ? 3.0 : -1.0,
(gl_VertexID == 1) ? -3.0 : 1.0, 0.0, 1.0);
#else
gl_Position = position;
#endif
}
@endcode
@attention The implementation needs to check OpenGL version, so it expects
active context.
*/
std::pair<Buffer, Mesh> MAGNUM_MESHTOOLS_EXPORT fullScreenTriangle();
}}
#endif

2
src/Platform/GlutApplication.h

@ -326,7 +326,7 @@ class GlutApplication::Configuration {
* *
* Default is `0`, thus no multisampling. The actual sample count is * Default is `0`, thus no multisampling. The actual sample count is
* ignored, GLUT either enables it or disables. See also * ignored, GLUT either enables it or disables. See also
* @ref Renderer::Feature "Renderer::Feature::Multisampling". * @ref Renderer::Feature::Multisampling.
*/ */
Configuration& setSampleCount(Int count) { Configuration& setSampleCount(Int count) {
_sampleCount = count; _sampleCount = count;

8
src/Platform/NaClApplication.h

@ -105,8 +105,8 @@ status displayed in the remaining two `&lt;div&gt;`s, if they are available.
The CSS file contains rudimentary style to avoid eye bleeding. The CSS file contains rudimentary style to avoid eye bleeding.
The `&lt;embed&gt;` file references NMF file which you need to provide too. If The `&lt;embed&gt;` file references NMF file which you need to provide too. If
you target @ref CORRADE_TARGET_NACL_NEWLIB_ "newlib", the file is pretty you target @ref CORRADE_TARGET_NACL_NEWLIB "newlib", the file is pretty simple,
simple, for example: for example:
@code @code
{ {
"program": { "program": {
@ -116,7 +116,7 @@ simple, for example:
} }
@endcode @endcode
If you target @ref CORRADE_TARGET_NACL_GLIBC_ "glibc", you need to specify also If you target @ref CORRADE_TARGET_NACL_GLIBC "glibc", you need to specify also
all additional dependencies. See [Native Client](https://developers.google.com/native-client/) all additional dependencies. See [Native Client](https://developers.google.com/native-client/)
documentation for more information. documentation for more information.
@ -337,7 +337,7 @@ class NaClApplication::Configuration {
* @return Reference to self (for method chaining) * @return Reference to self (for method chaining)
* *
* Default is `0`, thus no multisampling. See also * Default is `0`, thus no multisampling. See also
* @ref Renderer::Feature "Renderer::Feature::Multisampling". * @ref Renderer::Feature::Multisampling.
*/ */
Configuration& setSampleCount(Int count) { Configuration& setSampleCount(Int count) {
_sampleCount = count; _sampleCount = count;

4
src/Platform/Sdl2Application.h

@ -271,7 +271,7 @@ class Sdl2Application::Configuration {
* @brief Set window flags * @brief Set window flags
* @return Reference to self (for method chaining) * @return Reference to self (for method chaining)
* *
* Default is @ref Flag "Flag::Resizable". * Default is @ref Flag::Resizable.
*/ */
Configuration& setFlags(const Flags flags) { Configuration& setFlags(const Flags flags) {
_flags = flags; _flags = flags;
@ -286,7 +286,7 @@ class Sdl2Application::Configuration {
* @return Reference to self (for method chaining) * @return Reference to self (for method chaining)
* *
* Default is `0`, thus no multisampling. See also * Default is `0`, thus no multisampling. See also
* @ref Renderer::Feature "Renderer::Feature::Multisampling". * @ref Renderer::Feature::Multisampling.
*/ */
Configuration& setSampleCount(Int count) { Configuration& setSampleCount(Int count) {
_sampleCount = count; _sampleCount = count;

12
src/Primitives/Plane.cpp

@ -29,7 +29,15 @@
namespace Magnum { namespace Primitives { namespace Magnum { namespace Primitives {
Trade::MeshData3D Plane::solid() { Trade::MeshData3D Plane::solid(const TextureCoords textureCoords) {
std::vector<std::vector<Vector2>> coords;
if(textureCoords == TextureCoords::Generate) coords.push_back({
{1.0f, 0.0f},
{1.0f, 1.0f},
{0.0f, 0.0f},
{0.0f, 1.0f}
});
return Trade::MeshData3D(Mesh::Primitive::TriangleStrip, {}, {std::vector<Vector3>{ return Trade::MeshData3D(Mesh::Primitive::TriangleStrip, {}, {std::vector<Vector3>{
{1.0f, -1.0f, 0.0f}, {1.0f, -1.0f, 0.0f},
{1.0f, 1.0f, 0.0f}, {1.0f, 1.0f, 0.0f},
@ -40,7 +48,7 @@ Trade::MeshData3D Plane::solid() {
{0.0f, 0.0f, 1.0f}, {0.0f, 0.0f, 1.0f},
{0.0f, 0.0f, 1.0f}, {0.0f, 0.0f, 1.0f},
{0.0f, 0.0f, 1.0f} {0.0f, 0.0f, 1.0f}
}}, {}); }}, std::move(coords));
} }
Trade::MeshData3D Plane::wireframe() { Trade::MeshData3D Plane::wireframe() {

11
src/Primitives/Plane.h

@ -38,16 +38,25 @@ namespace Magnum { namespace Primitives {
@brief 3D plane primitive @brief 3D plane primitive
2x2 plane. 2x2 plane.
@see @ref Square
*/ */
class MAGNUM_PRIMITIVES_EXPORT Plane { class MAGNUM_PRIMITIVES_EXPORT Plane {
public: public:
/** @brief Whether to generate texture coordinates */
enum class TextureCoords: UnsignedByte {
DontGenerate, /**< Don't generate texture coordinates */
/** Generate texture coordinates with origin in bottom left corner. */
Generate
};
/** /**
* @brief Solid plane * @brief Solid plane
* *
* Non-indexed @ref Mesh::Primitive "TriangleStrip" with normals in * Non-indexed @ref Mesh::Primitive "TriangleStrip" with normals in
* positive Z direction. * positive Z direction.
*/ */
static Trade::MeshData3D solid(); static Trade::MeshData3D solid(TextureCoords textureCoords = TextureCoords::DontGenerate);
/** /**
* @brief Wireframe plane * @brief Wireframe plane

12
src/Primitives/Square.cpp

@ -29,13 +29,21 @@
namespace Magnum { namespace Primitives { namespace Magnum { namespace Primitives {
Trade::MeshData2D Square::solid() { Trade::MeshData2D Square::solid(const TextureCoords textureCoords) {
std::vector<std::vector<Vector2>> coords;
if(textureCoords == TextureCoords::Generate) coords.push_back({
{1.0f, 0.0f},
{1.0f, 1.0f},
{0.0f, 0.0f},
{0.0f, 1.0f}
});
return Trade::MeshData2D(Mesh::Primitive::TriangleStrip, {}, {std::vector<Vector2>{ return Trade::MeshData2D(Mesh::Primitive::TriangleStrip, {}, {std::vector<Vector2>{
{1.0f, -1.0f}, {1.0f, -1.0f},
{1.0f, 1.0f}, {1.0f, 1.0f},
{-1.0f, -1.0f}, {-1.0f, -1.0f},
{-1.0f, 1.0f} {-1.0f, 1.0f}
}}, {}); }}, std::move(coords));
} }
Trade::MeshData2D Square::wireframe() { Trade::MeshData2D Square::wireframe() {

11
src/Primitives/Square.h

@ -38,15 +38,24 @@ namespace Magnum { namespace Primitives {
@brief 2D square primitive @brief 2D square primitive
2x2 square. 2x2 square.
@see @ref Plane
*/ */
class MAGNUM_PRIMITIVES_EXPORT Square { class MAGNUM_PRIMITIVES_EXPORT Square {
public: public:
/** @brief Whether to generate texture coordinates */
enum class TextureCoords: UnsignedByte {
DontGenerate, /**< Don't generate texture coordinates */
/** Generate texture coordinates with origin in bottom left corner. */
Generate
};
/** /**
* @brief Solid square * @brief Solid square
* *
* Non-indexed @ref Mesh::Primitive "TriangleStrip". * Non-indexed @ref Mesh::Primitive "TriangleStrip".
*/ */
static Trade::MeshData2D solid(); static Trade::MeshData2D solid(TextureCoords textureCoords = TextureCoords::DontGenerate);
/** /**
* @brief Wireframe square * @brief Wireframe square

4
src/Query.h

@ -144,7 +144,7 @@ UnsignedInt primitiveCount = q.result<UnsignedInt>();
class PrimitiveQuery: public AbstractQuery { class PrimitiveQuery: public AbstractQuery {
public: public:
/** @brief Query target */ /** @brief Query target */
enum Target: GLenum { enum class Target: GLenum {
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
/** /**
* Count of primitives generated from vertex shader or geometry * Count of primitives generated from vertex shader or geometry
@ -210,7 +210,7 @@ q.endConditionalRender();
class SampleQuery: public AbstractQuery { class SampleQuery: public AbstractQuery {
public: public:
/** @brief Query target */ /** @brief Query target */
enum Target: GLenum { enum class Target: GLenum {
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
/** /**
* Count of samples passed from fragment shader * Count of samples passed from fragment shader

129
src/Renderer.h

@ -222,7 +222,7 @@ class MAGNUM_EXPORT Renderer {
/** /**
* @brief Set hint * @brief Set hint
* *
* Initial value is @ref HintMode "HintMode::DontCare" for all targets. * Initial value is @ref HintMode::DontCare for all targets.
* @see @fn_gl{Hint} * @see @fn_gl{Hint}
*/ */
static void setHint(Hint target, HintMode mode); static void setHint(Hint target, HintMode mode);
@ -244,7 +244,7 @@ class MAGNUM_EXPORT Renderer {
* @brief Set clear depth * @brief Set clear depth
* *
* Initial value is `1.0`. * Initial value is `1.0`.
* @see @ref Feature "Feature::DepthTest", @fn_gl{ClearDepth} * @see @ref Feature::DepthTest, @fn_gl{ClearDepth}
* @requires_gl See setClearDepth(Float), which is available in OpenGL ES. * @requires_gl See setClearDepth(Float), which is available in OpenGL ES.
*/ */
static void setClearDepth(Double depth); static void setClearDepth(Double depth);
@ -253,7 +253,7 @@ class MAGNUM_EXPORT Renderer {
/** /**
* @overload * @overload
* *
* @see @ref Feature "Feature::DepthTest", @fn_gl{ClearDepth} * @see @ref Feature::DepthTest, @fn_gl{ClearDepth}
* If OpenGL ES, OpenGL 4.1 or extension @extension{ARB,ES2_compatibility} * If OpenGL ES, OpenGL 4.1 or extension @extension{ARB,ES2_compatibility}
* is not available, this function behaves exactly as setClearDepth(Double). * is not available, this function behaves exactly as setClearDepth(Double).
*/ */
@ -265,7 +265,7 @@ class MAGNUM_EXPORT Renderer {
* @brief Set clear stencil * @brief Set clear stencil
* *
* Initial value is `0`. * Initial value is `0`.
* @see @ref Feature "Feature::StencilTest", @fn_gl{ClearStencil} * @see @ref Feature::StencilTest, @fn_gl{ClearStencil}
*/ */
static void setClearStencil(Int stencil); static void setClearStencil(Int stencil);
@ -278,7 +278,7 @@ class MAGNUM_EXPORT Renderer {
* *
* @see setFrontFace() * @see setFrontFace()
*/ */
enum FrontFace: GLenum { enum class FrontFace: GLenum {
/** @brief Counterclockwise polygons are front facing (default). */ /** @brief Counterclockwise polygons are front facing (default). */
CounterClockWise = GL_CCW, CounterClockWise = GL_CCW,
@ -297,9 +297,9 @@ class MAGNUM_EXPORT Renderer {
/** /**
* @brief Which polygon facing to cull * @brief Which polygon facing to cull
* *
* Initial value is @ref PolygonFacing "PolygonFacing::Back". If set to * Initial value is @ref PolygonFacing::Back. If set to both front and
* both front and back, only points and lines are drawn. * back, only points and lines are drawn.
* @see @ref Feature "Feature::FaceCulling", setFrontFace(), * @see @ref Feature::FaceCulling, setFrontFace(),
* @fn_gl{CullFace} * @fn_gl{CullFace}
*/ */
static void setFaceCullingMode(PolygonFacing mode); static void setFaceCullingMode(PolygonFacing mode);
@ -326,7 +326,7 @@ class MAGNUM_EXPORT Renderer {
/** /**
* @brief Set provoking vertex * @brief Set provoking vertex
* *
* Initial value is @ref ProvokingVertex "ProvokingVertex::LastVertexConvention". * Initial value is @ref ProvokingVertex::LastVertexConvention.
* @see @fn_gl{ProvokingVertex} * @see @fn_gl{ProvokingVertex}
* @requires_gl32 %Extension @extension{ARB,provoking_vertex}. Older * @requires_gl32 %Extension @extension{ARB,provoking_vertex}. Older
* versions behave always like the default. * versions behave always like the default.
@ -363,7 +363,7 @@ class MAGNUM_EXPORT Renderer {
/** /**
* @brief Set polygon drawing mode * @brief Set polygon drawing mode
* *
* Initial value is @ref PolygonMode "PolygonMode::Fill". * Initial value is @ref PolygonMode::Fill.
* @see @fn_gl{PolygonMode} * @see @fn_gl{PolygonMode}
* @requires_gl OpenGL ES behaves always like the default. See * @requires_gl OpenGL ES behaves always like the default. See
* @ref Magnum::Mesh::setPrimitive() "Mesh::setPrimitive()" for * @ref Magnum::Mesh::setPrimitive() "Mesh::setPrimitive()" for
@ -377,10 +377,8 @@ class MAGNUM_EXPORT Renderer {
* @param factor Scale factor * @param factor Scale factor
* @param units Offset units * @param units Offset units
* *
* @see @ref Feature "Feature::PolygonOffsetFill", * @see @ref Feature::PolygonOffsetFill, @ref Feature::PolygonOffsetLine,
* @ref Feature "Feature::PolygonOffsetLine", * @ref Feature::PolygonOffsetPoint, @fn_gl{PolygonOffset}
* @ref Feature "Feature::PolygonOffsetPoint",
* @fn_gl{PolygonOffset}
*/ */
static void setPolygonOffset(Float factor, Float units); static void setPolygonOffset(Float factor, Float units);
@ -397,7 +395,7 @@ class MAGNUM_EXPORT Renderer {
* @brief Set point size * @brief Set point size
* *
* Initial value is `1.0f`. * Initial value is `1.0f`.
* @see @ref Feature "Feature::ProgramPointSize", @fn_gl{PointSize} * @see @ref Feature::ProgramPointSize, @fn_gl{PointSize}
* @requires_gl In OpenGL ES use `gl_PointSize` builtin vertex shader * @requires_gl In OpenGL ES use `gl_PointSize` builtin vertex shader
* variable. * variable.
*/ */
@ -411,7 +409,7 @@ class MAGNUM_EXPORT Renderer {
/** /**
* @brief Set scissor rectangle * @brief Set scissor rectangle
* *
* @see @ref Feature "Feature::ScissorTest", @fn_gl{Scissor} * @see @ref Feature::ScissorTest, @fn_gl{Scissor}
*/ */
static void setScissor(const Rectanglei& rectangle); static void setScissor(const Rectanglei& rectangle);
@ -484,24 +482,22 @@ class MAGNUM_EXPORT Renderer {
* @brief Set stencil function * @brief Set stencil function
* @param facing Affected polygon facing * @param facing Affected polygon facing
* @param function Stencil function. Initial value is * @param function Stencil function. Initial value is
* @ref StencilFunction "StencilFunction::Always". * @ref StencilFunction::Always.
* @param referenceValue Reference value. Initial value is `0`. * @param referenceValue Reference value. Initial value is `0`.
* @param mask Mask for both reference and buffer value. * @param mask Mask for both reference and buffer value.
* Initial value is all `1`s. * Initial value is all `1`s.
* *
* @see @ref Feature "Feature::StencilTest", * @see @ref Feature::StencilTest, @ref setStencilFunction(StencilFunction, Int, UnsignedInt),
* setStencilFunction(StencilFunction, Int, UnsignedInt), * @ref setStencilOperation(), @fn_gl{StencilFuncSeparate}
* setStencilOperation(),
* @fn_gl{StencilFuncSeparate}
*/ */
static void setStencilFunction(PolygonFacing facing, StencilFunction function, Int referenceValue, UnsignedInt mask); static void setStencilFunction(PolygonFacing facing, StencilFunction function, Int referenceValue, UnsignedInt mask);
/** /**
* @brief Set stencil function * @brief Set stencil function
* *
* The same as setStencilFunction(PolygonFacing, StencilFunction, Int, UnsignedInt) * The same as @ref setStencilFunction(PolygonFacing, StencilFunction, Int, UnsignedInt)
* with @p facing set to @ref PolygonFacing "PolygonFacing::FrontAndBack". * with @p facing set to @ref PolygonFacing::FrontAndBack.
* @see @ref Feature "Feature::StencilTest", setStencilOperation(), * @see @ref Feature::StencilTest, @ref setStencilOperation(),
* @fn_gl{StencilFunc} * @fn_gl{StencilFunc}
*/ */
static void setStencilFunction(StencilFunction function, Int referenceValue, UnsignedInt mask); static void setStencilFunction(StencilFunction function, Int referenceValue, UnsignedInt mask);
@ -515,19 +511,18 @@ class MAGNUM_EXPORT Renderer {
* @param depthPass Action when both stencil and depth test * @param depthPass Action when both stencil and depth test
* pass * pass
* *
* Initial value for all fields is @ref StencilOperation "StencilOperation::Keep". * Initial value for all fields is @ref StencilOperation::Keep.
* @see @ref Feature "Feature::StencilTest", * @see @ref Feature::StencilTest, @ref setStencilOperation(StencilOperation, StencilOperation, StencilOperation),
* setStencilOperation(StencilOperation, StencilOperation, StencilOperation), * @ref setStencilFunction(), @fn_gl{StencilOpSeparate}
* setStencilFunction(), @fn_gl{StencilOpSeparate}
*/ */
static void setStencilOperation(PolygonFacing facing, StencilOperation stencilFail, StencilOperation depthFail, StencilOperation depthPass); static void setStencilOperation(PolygonFacing facing, StencilOperation stencilFail, StencilOperation depthFail, StencilOperation depthPass);
/** /**
* @brief Set stencil operation * @brief Set stencil operation
* *
* The same as setStencilOperation(PolygonFacing, StencilOperation, StencilOperation, StencilOperation) * The same as @ref setStencilOperation(PolygonFacing, StencilOperation, StencilOperation, StencilOperation)
* with @p facing set to @ref PolygonFacing "PolygonFacing::FrontAndBack". * with @p facing set to @ref PolygonFacing::FrontAndBack.
* @see @ref Feature "Feature::StencilTest", setStencilFunction(), * @see @ref Feature::StencilTest, @ref setStencilFunction(),
* @fn_gl{StencilOp} * @fn_gl{StencilOp}
*/ */
static void setStencilOperation(StencilOperation stencilFail, StencilOperation depthFail, StencilOperation depthPass); static void setStencilOperation(StencilOperation stencilFail, StencilOperation depthFail, StencilOperation depthPass);
@ -546,8 +541,8 @@ class MAGNUM_EXPORT Renderer {
/** /**
* @brief Set depth function * @brief Set depth function
* *
* Initial value is @ref DepthFunction "DepthFunction::Less". * Initial value is @ref DepthFunction::Less.
* @see @ref Feature "Feature::DepthTest", @fn_gl{DepthFunc} * @see @ref Feature::DepthTest, @fn_gl{DepthFunc}
*/ */
static void setDepthFunction(DepthFunction function); static void setDepthFunction(DepthFunction function);
@ -560,7 +555,7 @@ class MAGNUM_EXPORT Renderer {
* *
* Set to `false` to disallow writing to given color channel. Initial * Set to `false` to disallow writing to given color channel. Initial
* values are all `true`. * values are all `true`.
* @see setDepthMask(), setStencilMask(), @fn_gl{ColorMask} * @see @ref setDepthMask(), @ref setStencilMask(), @fn_gl{ColorMask}
* @todo Masking only given draw buffer * @todo Masking only given draw buffer
*/ */
static void setColorMask(GLboolean allowRed, GLboolean allowGreen, GLboolean allowBlue, GLboolean allowAlpha); static void setColorMask(GLboolean allowRed, GLboolean allowGreen, GLboolean allowBlue, GLboolean allowAlpha);
@ -587,8 +582,8 @@ class MAGNUM_EXPORT Renderer {
/** /**
* @brief Mask stencil writes * @brief Mask stencil writes
* *
* The same as calling setStencilMask(PolygonFacing, UnsignedInt) with * The same as calling @ref setStencilMask(PolygonFacing, UnsignedInt)
* `facing` set to @ref PolygonFacing "PolygonFacing::FrontAndBack". * with `facing` set to @ref PolygonFacing::FrontAndBack.
* @see @fn_gl{StencilMask} * @see @fn_gl{StencilMask}
*/ */
static void setStencilMask(UnsignedInt allowBits); static void setStencilMask(UnsignedInt allowBits);
@ -760,53 +755,52 @@ class MAGNUM_EXPORT Renderer {
* @brief Set blend equation * @brief Set blend equation
* *
* How to combine source color (pixel value) with destination color * How to combine source color (pixel value) with destination color
* (framebuffer). Initial value is @ref BlendEquation "BlendEquation::Add". * (framebuffer). Initial value is @ref BlendEquation::Add.
* @see @ref Feature "Feature::Blending", setBlendEquation(BlendEquation, BlendEquation), * @see @ref Feature::Blending, @ref setBlendEquation(BlendEquation, BlendEquation),
* setBlendFunction(), setBlendColor(), @fn_gl{BlendEquation} * @ref setBlendFunction(), @ref setBlendColor(),
* @fn_gl{BlendEquation}
*/ */
static void setBlendEquation(BlendEquation equation); static void setBlendEquation(BlendEquation equation);
/** /**
* @brief Set blend equation separately for RGB and alpha components * @brief Set blend equation separately for RGB and alpha components
* *
* See setBlendEquation(BlendEquation) for more information. * See @ref setBlendEquation(BlendEquation) for more information.
* @see @ref Feature "Feature::Blending", setBlendFunction(), * @see @ref Feature::Blending, @ref setBlendFunction(),
* setBlendColor(), @fn_gl{BlendEquationSeparate} * @ref setBlendColor(), @fn_gl{BlendEquationSeparate}
*/ */
static void setBlendEquation(BlendEquation rgb, BlendEquation alpha); static void setBlendEquation(BlendEquation rgb, BlendEquation alpha);
/** /**
* @brief Set blend function * @brief Set blend function
* @param source How the source blending factor is computed * @param source How the source blending factor is computed
* from pixel value. Initial value is @ref BlendFunction "BlendFunction::One". * from pixel value. Initial value is @ref BlendFunction::One.
* @param destination How the destination blending factor is * @param destination How the destination blending factor is
* computed from framebuffer. Initial value is @ref BlendFunction "BlendFunction::Zero". * computed from framebuffer. Initial value is @ref BlendFunction::Zero.
* *
* @see @ref Feature "Feature::Blending", * @see @ref Feature::Blending, @ref setBlendFunction(BlendFunction, BlendFunction, BlendFunction, BlendFunction),
* setBlendFunction(BlendFunction, BlendFunction, BlendFunction, BlendFunction), * @ref setBlendEquation(), @ref setBlendColor(),
* setBlendEquation(), setBlendColor(), @fn_gl{BlendFunc} * @fn_gl{BlendFunc}
*/ */
static void setBlendFunction(BlendFunction source, BlendFunction destination); static void setBlendFunction(BlendFunction source, BlendFunction destination);
/** /**
* @brief Set blend function separately for RGB and alpha components * @brief Set blend function separately for RGB and alpha components
* *
* See setBlendFunction(BlendFunction, BlendFunction) for more information. * See @ref setBlendFunction(BlendFunction, BlendFunction) for more information.
* @see @ref Feature "Feature::Blending", setBlendEquation(), * @see @ref Feature::Blending, @ref setBlendEquation(),
* setBlendColor(), @fn_gl{BlendFuncSeparate} * @ref setBlendColor(), @fn_gl{BlendFuncSeparate}
*/ */
static void setBlendFunction(BlendFunction sourceRgb, BlendFunction destinationRgb, BlendFunction sourceAlpha, BlendFunction destinationAlpha); static void setBlendFunction(BlendFunction sourceRgb, BlendFunction destinationRgb, BlendFunction sourceAlpha, BlendFunction destinationAlpha);
/** /**
* @brief Set blend color * @brief Set blend color
* *
* Sets constant color used in setBlendFunction() by * Sets constant color used in @ref setBlendFunction() by
* @ref BlendFunction "BlendFunction::ConstantColor", * @ref BlendFunction::ConstantColor, @ref BlendFunction::OneMinusConstantColor,
* @ref BlendFunction "BlendFunction::OneMinusConstantColor", * @ref BlendFunction::ConstantAlpha and @ref BlendFunction::OneMinusConstantAlpha.
* @ref BlendFunction "BlendFunction::ConstantAlpha" and * @see @ref Feature::Blending, @ref setBlendEquation(),
* @ref BlendFunction "BlendFunction::OneMinusConstantAlpha". * @ref setBlendFunction(), @fn_gl{BlendColor}
* @see @ref Feature "Feature::Blending", setBlendEquation(),
* setBlendFunction(), @fn_gl{BlendColor}
*/ */
static void setBlendColor(const Color4& color); static void setBlendColor(const Color4& color);
@ -818,7 +812,7 @@ class MAGNUM_EXPORT Renderer {
/** /**
* @brief Logical operation * @brief Logical operation
* *
* @see setLogicOperation() * @see @ref setLogicOperation()
* @requires_gl Logical operations on framebuffer are not available in * @requires_gl Logical operations on framebuffer are not available in
* OpenGL ES. * OpenGL ES.
*/ */
@ -844,7 +838,7 @@ class MAGNUM_EXPORT Renderer {
/** /**
* @brief Set logical operation * @brief Set logical operation
* *
* @see @ref Feature "Feature::LogicOperation", @fn_gl{LogicOp} * @see @ref Feature::LogicOperation, @fn_gl{LogicOp}
* @requires_gl Logical operations on framebuffer are not available in * @requires_gl Logical operations on framebuffer are not available in
* OpenGL ES. * OpenGL ES.
*/ */
@ -927,8 +921,8 @@ class MAGNUM_EXPORT Renderer {
* @brief Error status * @brief Error status
* *
* Returns error flag, if any set. If there aren't any more error * Returns error flag, if any set. If there aren't any more error
* flags, returns @ref Error "Error::NoError". Thus this function * flags, returns @ref Error::NoError. Thus this function should be
* should be always called in a loop until it returns @ref Error "Error::NoError". * always called in a loop until it returns @ref Error::NoError.
* @see @fn_gl{GetError} * @see @fn_gl{GetError}
*/ */
static Error error() { return static_cast<Error>(glGetError()); } static Error error() { return static_cast<Error>(glGetError()); }
@ -943,8 +937,8 @@ class MAGNUM_EXPORT Renderer {
*/ */
enum class ResetNotificationStrategy: GLint { enum class ResetNotificationStrategy: GLint {
/** /**
* No reset notification, thus graphicsResetStatus() will always * No reset notification, thus @ref graphicsResetStatus() will
* return @ref GraphicsResetStatus "GraphicsResetStatus::NoError". * always return @ref GraphicsResetStatus::NoError.
* However this doesn't mean that the context cannot be lost. * However this doesn't mean that the context cannot be lost.
*/ */
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
@ -955,7 +949,7 @@ class MAGNUM_EXPORT Renderer {
/** /**
* Graphics reset will result in context loss, cause of the reset * Graphics reset will result in context loss, cause of the reset
* can be queried with graphicsResetStatus(). * can be queried with @ref graphicsResetStatus().
*/ */
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
LoseContextOnReset = GL_LOSE_CONTEXT_ON_RESET_ARB LoseContextOnReset = GL_LOSE_CONTEXT_ON_RESET_ARB
@ -970,7 +964,7 @@ class MAGNUM_EXPORT Renderer {
* The result is cached, repeated queries don't result in repeated * The result is cached, repeated queries don't result in repeated
* OpenGL calls. If OpenGL extension @extension{ARB,robustness} or ES * OpenGL calls. If OpenGL extension @extension{ARB,robustness} or ES
* extension @es_extension{EXT,robustness} is not available, this * extension @es_extension{EXT,robustness} is not available, this
* function always returns @ref ResetNotificationStrategy "ResetNotificationStrategy::NoResetNotification". * function always returns @ref ResetNotificationStrategy::NoResetNotification.
* @see graphicsResetStatus(), @fn_gl{Get} with @def_gl{RESET_NOTIFICATION_STRATEGY_ARB} * @see graphicsResetStatus(), @fn_gl{Get} with @def_gl{RESET_NOTIFICATION_STRATEGY_ARB}
*/ */
static ResetNotificationStrategy resetNotificationStrategy(); static ResetNotificationStrategy resetNotificationStrategy();
@ -1013,9 +1007,8 @@ class MAGNUM_EXPORT Renderer {
* *
* Reset causes all context state to be lost. If OpenGL extension * Reset causes all context state to be lost. If OpenGL extension
* @extension{ARB,robustness} or ES extension @es_extension{EXT,robustness} * @extension{ARB,robustness} or ES extension @es_extension{EXT,robustness}
* is not available, this function always returns * is not available, this function always returns @ref GraphicsResetStatus::NoError.
* @ref GraphicsResetStatus "GraphicsResetStatus::NoError". * @see @ref resetNotificationStrategy(), @fn_gl_extension{GetGraphicsResetStatus,ARB,robustness}
* @see resetNotificationStrategy(), @fn_gl_extension{GetGraphicsResetStatus,ARB,robustness}
*/ */
static GraphicsResetStatus graphicsResetStatus() { static GraphicsResetStatus graphicsResetStatus() {
return graphicsResetStatusImplementation(); return graphicsResetStatusImplementation();

6
src/Resource.h

@ -169,9 +169,9 @@ class Resource {
* @brief Whether the resource is available * @brief Whether the resource is available
* *
* Returns `false` when resource is not loaded and no fallback is * Returns `false` when resource is not loaded and no fallback is
* available (i.e. state() is either @ref ResourceState "ResourceState::NotLoaded", * available (i.e. state() is either @ref ResourceState::NotLoaded,
* @ref ResourceState "ResourceState::Loading" or * @ref ResourceState::Loading or @ref ResourceState::NotFound), `true`
* @ref ResourceState "ResourceState::NotFound"), true otherwise. * otherwise.
*/ */
operator bool() { operator bool() {
acquire(); acquire();

4
src/ResourceManager.h

@ -322,8 +322,8 @@ template<class... Types> class ResourceManager: private Implementation::Resource
* @brief Set resource data * @brief Set resource data
* @return Reference to self (for method chaining) * @return Reference to self (for method chaining)
* *
* Same as above with state set to @ref ResourceDataState "ResourceDataState::Final" * Same as above with state set to @ref ResourceDataState::Final and
* and policy to @ref ResourcePolicy "ResourcePolicy::Resident". * policy to @ref ResourcePolicy::Resident.
*/ */
template<class T> ResourceManager<Types...>& set(ResourceKey key, T* data) { template<class T> ResourceManager<Types...>& set(ResourceKey key, T* data) {
return set(key, data, ResourceDataState::Final, ResourcePolicy::Resident); return set(key, data, ResourceDataState::Final, ResourcePolicy::Resident);

16
src/SceneGraph/AbstractFeature.h

@ -267,23 +267,21 @@ template<UnsignedInt dimensions, class T> class MAGNUM_SCENEGRAPH_EXPORT Abstrac
/** /**
* @brief Clean data based on absolute transformation * @brief Clean data based on absolute transformation
* *
* When object is cleaned and * When object is cleaned and @ref CachedTransformation::Absolute is
* @ref CachedTransformation "CachedTransformation::Absolute" is * enabled in @ref setCachedTransformations(), this function is called
* enabled in setCachedTransformations(), this function is called to * to recalculate data based on absolute object transformation.
* recalculate data based on absolute object transformation.
* *
* Default implementation does nothing. * Default implementation does nothing.
* @see @ref scenegraph-caching, cleanInverted() * @see @ref scenegraph-caching, @ref cleanInverted()
*/ */
virtual void clean(const typename DimensionTraits<dimensions, T>::MatrixType& absoluteTransformationMatrix); virtual void clean(const typename DimensionTraits<dimensions, T>::MatrixType& absoluteTransformationMatrix);
/** /**
* @brief Clean data based on inverted absolute transformation * @brief Clean data based on inverted absolute transformation
* *
* When object is cleaned and * When object is cleaned and @ref CachedTransformation::InvertedAbsolute
* @ref CachedTransformation "CachedTransformation::InvertedAbsolute" * is enabled in @ref setCachedTransformations(), this function is
* is enabled in setCachedTransformations(), this function is called * called to recalculate data based on inverted absolute object
* to recalculate data based on inverted absolute object
* transformation. * transformation.
* *
* Default implementation does nothing. * Default implementation does nothing.

89
src/SceneGraph/Animable.h

@ -42,13 +42,13 @@ namespace Magnum { namespace SceneGraph {
enum class AnimationState: UnsignedByte { enum class AnimationState: UnsignedByte {
/** /**
* The animation is stopped. The animation will be started from the * The animation is stopped. The animation will be started from the
* beginning when state is changed to @ref AnimationState "AnimationState::Running". * beginning when state is changed to @ref AnimationState::Running.
*/ */
Stopped, Stopped,
/** /**
* The animation is stopped. The animation will continue from paused * The animation is stopped. The animation will continue from paused
* position when state is changed to @ref AnimationState "AnimationState::Running". * position when state is changed to @ref AnimationState::Running.
*/ */
Paused, Paused,
@ -121,11 +121,11 @@ void MyApplication::drawEvent() {
@section Animable-performance Using animable groups to improve performance @section Animable-performance Using animable groups to improve performance
AnimableGroup is optimized for case when no animation is running - it just 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 puts itself to rest and waits until some animation changes its state to
@ref AnimationState "AnimationState::Running" again. If you put animations @ref AnimationState::Running again. If you put animations which are not
which are not pernamently running to separate group, they will not be always pernamently running to separate group, they will not be always traversed when
traversed when calling AnimableGroup::step(), saving precious frame time. calling @ref AnimableGroup::step(), saving precious frame time.
@section Animable-explicit-specializations Explicit template specializations @section Animable-explicit-specializations Explicit template specializations
@ -167,12 +167,12 @@ template<UnsignedInt dimensions, class T> class MAGNUM_SCENEGRAPH_EXPORT Animabl
* @brief Set animation state * @brief Set animation state
* @return Reference to self (for method chaining) * @return Reference to self (for method chaining)
* *
* Note that changing state from @ref AnimationState "AnimationState::Stopped" * Note that changing state from @ref AnimationState::Stopped to
* to @ref AnimationState "AnimationState::Paused" is ignored and * @ref AnimationState::Paused is ignored and animation remains in
* animation remains in @ref AnimationState "AnimationState::Stopped" * @ref AnimationState::Stopped state. See also @ref animationStep()
* state. See also animationStep() for more information. * for more information.
* @see animationStarted(), animationPaused(), animationResumed(), * @see @ref animationStarted(), @ref animationPaused(),
* animationStopped() * @ref animationResumed(), @ref animationStopped()
*/ */
Animable<dimensions, T>& setState(AnimationState state); Animable<dimensions, T>& setState(AnimationState state);
@ -242,78 +242,69 @@ template<UnsignedInt dimensions, class T> class MAGNUM_SCENEGRAPH_EXPORT Animabl
* @param time Time from start of the animation * @param time Time from start of the animation
* @param delta Time delta for current frame * @param delta Time delta for current frame
* *
* This function is periodically called from AnimableGroup::step() if * This function is periodically called from @ref AnimableGroup::step()
* the animation state is set to @ref AnimationState "AnimationState::Running". * if the animation state is set to @ref AnimationState::Running. After
* After animation duration is exceeded and repeat is not enabled or * animation duration is exceeded and repeat is not enabled or repeat
* repeat count is exceeded, the animation state is set to * count is exceeded, the animation state is set to @ref AnimationState::Stopped.
* @ref AnimationState "AnimationState::Stopped".
* *
* If the animation is resumed from @ref AnimationState "AnimationState::Paused", * If the animation is resumed from @ref AnimationState::Paused, this
* this function is called with @p time continuing from the point * function is called with @p time continuing from the point when it
* when it was paused. If the animation is resumed from * was paused. If the animation is resumed from @ref AnimationState::Stopped,
* @ref AnimationState "AnimationState::Stopped", @p time starts with * @p time starts with zero.
* zero.
* *
* @see state(), duration(), isRepeated(), repeatCount() * @see @ref state(), @ref duration(), @ref isRepeated(),
* @ref repeatCount()
*/ */
virtual void animationStep(Float time, Float delta) = 0; virtual void animationStep(Float time, Float delta) = 0;
/** /**
* @brief Action on animation start * @brief Action on animation start
* *
* Called from AnimableGroup::step() when state is changed from * Called from @ref AnimableGroup::step() when state is changed from
* @ref AnimationState "AnimationState::Stopped" to * @ref AnimationState::Stopped to @ref AnimationState::Running and
* @ref AnimationState "AnimationState::Running" and before first * before first @ref animationStep() is called.
* animationStep() is called.
* *
* Default implementation does nothing. * Default implementation does nothing.
* * @see @ref setState()
* @see setState()
*/ */
virtual void animationStarted() {} virtual void animationStarted() {}
/** /**
* @brief Action on animation pause * @brief Action on animation pause
* *
* Called from AnimableGroup::step() when state changes from * Called from @ref AnimableGroup::step() when state changes from
* @ref AnimationState "AnimationState::Running" to * @ref AnimationState::Running to @ref AnimationState::Paused and
* @ref AnimationState "AnimationState::Paused" and after last * after last @ref animationStep() is called.
* animationStep() is called.
* *
* Default implementation does nothing. * Default implementation does nothing.
* * @see @ref setState()
* @see setState()
*/ */
virtual void animationPaused() {} virtual void animationPaused() {}
/** /**
* @brief Action on animation resume * @brief Action on animation resume
* *
* Called from AnimableGroup::step() when state changes from * Called from @ref AnimableGroup::step() when state changes from
* @ref AnimationState "AnimationState::Paused" to * @ref AnimationState::Paused to @ref AnimationState::Running and
* @ref AnimationState "AnimationState::Running" and before first * before first @ref animationStep() is called.
* animationStep() is called.
* *
* Default implementation does nothing. * Default implementation does nothing.
* * @see @ref setState()
* @see setState()
*/ */
virtual void animationResumed() {} virtual void animationResumed() {}
/** /**
* @brief Action on animation stop * @brief Action on animation stop
* *
* Called from AnimableGroup::step() when state changes from either * Called from @ref AnimableGroup::step() when state changes from
* @ref AnimationState "AnimationState::Running" or * either @ref AnimationState::Running or @ref AnimationState::Paused
* @ref AnimationState "AnimationState::Paused" to * to @ref AnimationState::Stopped and after last @ref animationStep()
* @ref AnimationState "AnimationState::Stopped" and after last * is called.
* animationStep() is called.
* *
* You may want to use this function to properly finish the animation * You may want to use this function to properly finish the animation
* in case the framerate is not high enough to have animationStep() * in case the framerate is not high enough to have @ref animationStep()
* called enough times. Default implementation does nothing. * called enough times. Default implementation does nothing.
* * @see @ref setState()
* @see setState()
*/ */
virtual void animationStopped() {} virtual void animationStopped() {}

3
src/SceneGraph/SceneGraph.h

@ -34,8 +34,6 @@
namespace Magnum { namespace SceneGraph { namespace Magnum { namespace SceneGraph {
/** @todoc remove when doxygen is sane again */
#ifndef DOXYGEN_GENERATING_OUTPUT
#ifndef CORRADE_GCC45_COMPATIBILITY #ifndef CORRADE_GCC45_COMPATIBILITY
enum class AspectRatioPolicy: UnsignedByte; enum class AspectRatioPolicy: UnsignedByte;
#endif #endif
@ -187,7 +185,6 @@ typedef BasicRigidMatrixTransformation2D<Float> RigidMatrixTransformation2D;
typedef BasicRigidMatrixTransformation3D<Float> RigidMatrixTransformation3D; typedef BasicRigidMatrixTransformation3D<Float> RigidMatrixTransformation3D;
template<class Transformation> class Scene; template<class Transformation> class Scene;
#endif
}} }}

26
src/Shaders/MeshVisualizer.h

@ -45,15 +45,15 @@ to be able to render.
@section ShadersMeshVisualizer-wireframe Wireframe visualization @section ShadersMeshVisualizer-wireframe Wireframe visualization
Wireframe visualization is done by enabling @ref Flag "Flag::Wireframe". It is Wireframe visualization is done by enabling @ref Flag::Wireframe. It is done
done either using geometry shaders or with help of additional vertex information. either using geometry shaders or with help of additional vertex information.
If you have geometry shaders available, you don't need to do anything else. If you have geometry shaders available, you don't need to do anything else.
@requires_gl32 %Extension @extension{ARB,geometry_shader4} for wireframe @requires_gl32 %Extension @extension{ARB,geometry_shader4} for wireframe
rendering using geometry shaders. rendering using geometry shaders.
If you don't have geometry shaders, you need to set @ref Flag "Flag::NoGeometryShader" If you don't have geometry shaders, you need to set @ref Flag::NoGeometryShader
(it's enabled by default in OpenGL ES) and use only **non-indexed** triangle (it's enabled by default in OpenGL ES) and use only **non-indexed** triangle
meshes (see MeshTools::duplicate() for possible solution). Additionaly, if you meshes (see MeshTools::duplicate() for possible solution). Additionaly, if you
have OpenGL < 3.1 or OpenGL ES 2.0, you need to provide also @ref VertexIndex have OpenGL < 3.1 or OpenGL ES 2.0, you need to provide also @ref VertexIndex
@ -71,7 +71,7 @@ class MAGNUM_SHADERS_EXPORT MeshVisualizer: public AbstractShaderProgram {
/** /**
* @brief Vertex index * @brief Vertex index
* *
* Used only in OpenGL < 3.1 and OpenGL ES 2.0 if @ref Flag "Flag::Wireframe" * Used only in OpenGL < 3.1 and OpenGL ES 2.0 if @ref Flag::Wireframe
* is enabled. This attribute specifies index of given vertex in * is enabled. This attribute specifies index of given vertex in
* triangle, i.e. `0` for first, `1` for second, `2` for third. In * triangle, i.e. `0` for first, `1` for second, `2` for third. In
* OpenGL 3.1, OpenGL ES 3.0 and newer this value is provided by the * OpenGL 3.1, OpenGL ES 3.0 and newer this value is provided by the
@ -87,7 +87,7 @@ class MAGNUM_SHADERS_EXPORT MeshVisualizer: public AbstractShaderProgram {
enum class Flag: UnsignedByte { enum class Flag: UnsignedByte {
/** /**
* Visualize wireframe. On OpenGL ES this also enables * Visualize wireframe. On OpenGL ES this also enables
* @ref Flag "Flag::NoGeometryShader". * @ref Flag::NoGeometryShader.
*/ */
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
Wireframe = 1 << 0, Wireframe = 1 << 0,
@ -98,7 +98,7 @@ class MAGNUM_SHADERS_EXPORT MeshVisualizer: public AbstractShaderProgram {
/** /**
* Don't use geometry shader for wireframe visualization. If * Don't use geometry shader for wireframe visualization. If
* enabled, you might need to provide also VertexIndex attribute in * enabled, you might need to provide also VertexIndex attribute in
* the mesh. In OpenGL ES enabled alongside @ref Flag "Flag::Wireframe". * the mesh. In OpenGL ES enabled alongside @ref Flag::Wireframe.
*/ */
NoGeometryShader = 1 << 1 NoGeometryShader = 1 << 1
}; };
@ -125,8 +125,8 @@ class MAGNUM_SHADERS_EXPORT MeshVisualizer: public AbstractShaderProgram {
* @brief Set viewport size * @brief Set viewport size
* @return Reference to self (for method chaining) * @return Reference to self (for method chaining)
* *
* Has effect only if @ref Flag "Flag::Wireframe" is enabled and * Has effect only if @ref Flag::Wireframe is enabled and geometry
* geometry shaders are used. * shaders are used.
*/ */
MeshVisualizer& setViewportSize(const Vector2& size) { MeshVisualizer& setViewportSize(const Vector2& size) {
if(flags & Flag::Wireframe && !(flags & Flag::NoGeometryShader)) if(flags & Flag::Wireframe && !(flags & Flag::NoGeometryShader))
@ -150,7 +150,7 @@ class MAGNUM_SHADERS_EXPORT MeshVisualizer: public AbstractShaderProgram {
* @return Reference to self (for method chaining) * @return Reference to self (for method chaining)
* *
* Initial value is fully opaque black. Has effect only if * Initial value is fully opaque black. Has effect only if
* @ref Flag "Flag::Wireframe" is enabled. * @ref Flag::Wireframe is enabled.
*/ */
MeshVisualizer& setWireframeColor(const Color4& color) { MeshVisualizer& setWireframeColor(const Color4& color) {
if(flags & Flag::Wireframe) setUniform(wireframeColorUniform, color); if(flags & Flag::Wireframe) setUniform(wireframeColorUniform, color);
@ -161,8 +161,8 @@ class MAGNUM_SHADERS_EXPORT MeshVisualizer: public AbstractShaderProgram {
* @brief Set wireframe width * @brief Set wireframe width
* @return Reference to self (for method chaining) * @return Reference to self (for method chaining)
* *
* Initial value is `1.0f`. Has effect only if * Initial value is `1.0f`. Has effect only if @ref Flag::Wireframe is
* @ref Flag "Flag::Wireframe" is enabled. * enabled.
*/ */
MeshVisualizer& setWireframeWidth(Float width) { MeshVisualizer& setWireframeWidth(Float width) {
if(flags & Flag::Wireframe) setUniform(wireframeWidthUniform, width); if(flags & Flag::Wireframe) setUniform(wireframeWidthUniform, width);
@ -173,8 +173,8 @@ class MAGNUM_SHADERS_EXPORT MeshVisualizer: public AbstractShaderProgram {
* @brief Set line smoothness * @brief Set line smoothness
* @return Reference to self (for method chaining) * @return Reference to self (for method chaining)
* *
* Initial value is `2.0f`. Has effect only if * Initial value is `2.0f`. Has effect only if @ref Flag::Wireframe is
* @ref Flag "Flag::Wireframe" is enabled. * enabled.
*/ */
MeshVisualizer& setSmoothness(Float smoothness); MeshVisualizer& setSmoothness(Float smoothness);

17
src/Shaders/Phong.h

@ -64,27 +64,26 @@ class MAGNUM_SHADERS_EXPORT Phong: public AbstractShaderProgram {
/** /**
* @brief Texture coordinates * @brief Texture coordinates
* *
* Used only if one of @ref Flag "Flag::AmbientTexture", * Used only if one of @ref Flag::AmbientTexture, @ref Flag::DiffuseTexture
* @ref Flag "Flag::DiffuseTexture" or @ref Flag "Flag::SpecularTexture" * or @ref Flag::SpecularTexture is set.
* is set.
*/ */
typedef Attribute<2, Vector2> TextureCoordinates; typedef Attribute<2, Vector2> TextureCoordinates;
enum: Int { enum: Int {
/** /**
* Layer for ambient texture. Used only if @ref Flag "Flag::AmbientTexture" * Layer for ambient texture. Used only if @ref Flag::AmbientTexture
* is set. * is set.
*/ */
AmbientTextureLayer = 0, AmbientTextureLayer = 0,
/** /**
* Layer for diffuse texture. Used only if @ref Flag "Flag::DiffuseTexture" * Layer for diffuse texture. Used only if @ref Flag::DiffuseTexture
* is set. * is set.
*/ */
DiffuseTextureLayer = 1, DiffuseTextureLayer = 1,
/** /**
* Layer for specular texture. Used only if @ref Flag "Flag::SpecularTexture" * Layer for specular texture. Used only if @ref Flag::SpecularTexture
* is set. * is set.
*/ */
SpecularTextureLayer = 2 SpecularTextureLayer = 2
@ -122,7 +121,7 @@ class MAGNUM_SHADERS_EXPORT Phong: public AbstractShaderProgram {
* @return Reference to self (for method chaining) * @return Reference to self (for method chaining)
* *
* If not set, default value is `(0.0f, 0.0f, 0.0f)`. Has no effect if * If not set, default value is `(0.0f, 0.0f, 0.0f)`. Has no effect if
* @ref Flag "Flag::AmbientTexture" is set. * @ref Flag::AmbientTexture is set.
*/ */
Phong& setAmbientColor(const Color3& color); Phong& setAmbientColor(const Color3& color);
@ -130,7 +129,7 @@ class MAGNUM_SHADERS_EXPORT Phong: public AbstractShaderProgram {
* @brief Set diffuse color * @brief Set diffuse color
* @return Reference to self (for method chaining) * @return Reference to self (for method chaining)
* *
* Has no effect if @ref Flag "Flag::AmbientTexture" is used. * Has no effect if @ref Flag::AmbientTexture is used.
*/ */
Phong& setDiffuseColor(const Color3& color); Phong& setDiffuseColor(const Color3& color);
@ -139,7 +138,7 @@ class MAGNUM_SHADERS_EXPORT Phong: public AbstractShaderProgram {
* @return Reference to self (for method chaining) * @return Reference to self (for method chaining)
* *
* If not set, default value is `(1.0f, 1.0f, 1.0f)`. Has no effect if * If not set, default value is `(1.0f, 1.0f, 1.0f)`. Has no effect if
* @ref Flag "Flag::SpecularTexture" is set. * @ref Flag::SpecularTexture is set.
*/ */
Phong& setSpecularColor(const Color3& color); Phong& setSpecularColor(const Color3& color);

4
src/Shaders/Shaders.h

@ -32,9 +32,6 @@
namespace Magnum { namespace Shaders { namespace Magnum { namespace Shaders {
/** @todoc remove when doxygen is sane again */
#ifndef DOXYGEN_GENERATING_OUTPUT
template<UnsignedInt> class DistanceFieldVector; template<UnsignedInt> class DistanceFieldVector;
typedef DistanceFieldVector<2> DistanceFieldVector2D; typedef DistanceFieldVector<2> DistanceFieldVector2D;
typedef DistanceFieldVector<3> DistanceFieldVector3D; typedef DistanceFieldVector<3> DistanceFieldVector3D;
@ -57,7 +54,6 @@ typedef Vector<3> Vector3D;
template<UnsignedInt> class VertexColor; template<UnsignedInt> class VertexColor;
typedef VertexColor<2> VertexColor2D; typedef VertexColor<2> VertexColor2D;
typedef VertexColor<3> VertexColor3D; typedef VertexColor<3> VertexColor3D;
#endif
}} }}

3
src/Shapes/Shapes.h

@ -32,8 +32,6 @@
namespace Magnum { namespace Shapes { namespace Magnum { namespace Shapes {
/** @todoc remove when doxygen is sane again */
#ifndef DOXYGEN_GENERATING_OUTPUT
template<UnsignedInt> class AbstractShape; template<UnsignedInt> class AbstractShape;
typedef AbstractShape<2> AbstractShape2D; typedef AbstractShape<2> AbstractShape2D;
typedef AbstractShape<3> AbstractShape3D; typedef AbstractShape<3> AbstractShape3D;
@ -75,7 +73,6 @@ typedef ShapeGroup<3> ShapeGroup3D;
template<UnsignedInt> class Sphere; template<UnsignedInt> class Sphere;
typedef Sphere<2> Sphere2D; typedef Sphere<2> Sphere2D;
typedef Sphere<3> Sphere3D; typedef Sphere<3> Sphere3D;
#endif
class Plane; class Plane;

5
src/Text/AbstractFont.cpp

@ -100,7 +100,10 @@ void AbstractFont::doOpenFile(const std::string& filename, const Float size) {
} }
void AbstractFont::close() { void AbstractFont::close() {
if(isOpened()) doClose(); if(isOpened()) {
doClose();
CORRADE_INTERNAL_ASSERT(!isOpened());
}
} }
UnsignedInt AbstractFont::glyphId(const char32_t character) { UnsignedInt AbstractFont::glyphId(const char32_t character) {

41
src/Text/AbstractFont.h

@ -60,7 +60,7 @@ checked by the implementation:
after the previous file was closed, function doClose() is called only if after the previous file was closed, function doClose() is called only if
there is any file opened. there is any file opened.
- Functions doOpenData() and doOpenSingleData() are called only if - Functions doOpenData() and doOpenSingleData() are called only if
@ref Feature "Feature::OpenData" is supported. @ref Feature::OpenData is supported.
- All `do*()` implementations working on opened file are called only if - All `do*()` implementations working on opened file are called only if
there is any file opened. there is any file opened.
*/ */
@ -112,8 +112,8 @@ class MAGNUM_TEXT_EXPORT AbstractFont: public PluginManager::AbstractPlugin {
* @param size Font size * @param size Font size
* *
* Closes previous file, if it was opened, and tries to open given * Closes previous file, if it was opened, and tries to open given
* file. Available only if @ref Feature "Feature::OpenData" is * file. Available only if @ref Feature::OpenData is supported. Returns
* supported. Returns `true` on success, `false` otherwise. * `true` on success, `false` otherwise.
*/ */
bool openData(const std::vector<std::pair<std::string, Containers::ArrayReference<const unsigned char>>>& data, Float size); bool openData(const std::vector<std::pair<std::string, Containers::ArrayReference<const unsigned char>>>& data, Float size);
@ -123,9 +123,9 @@ class MAGNUM_TEXT_EXPORT AbstractFont: public PluginManager::AbstractPlugin {
* @param size Font size * @param size Font size
* *
* Closes previous file, if it was opened, and tries to open given * Closes previous file, if it was opened, and tries to open given
* file. Available only if @ref Feature "Feature::OpenData" is * file. Available only if @ref Feature::OpenData is supported and the
* supported and the plugin doesn't have @ref Feature "Feature::MultiFile". * plugin doesn't have @ref Feature::MultiFile. Returns `true` on
* Returns `true` on success, `false` otherwise. * success, `false` otherwise.
*/ */
bool openSingleData(Containers::ArrayReference<const unsigned char> data, Float size); bool openSingleData(Containers::ArrayReference<const unsigned char> data, Float size);
@ -135,10 +135,10 @@ class MAGNUM_TEXT_EXPORT AbstractFont: public PluginManager::AbstractPlugin {
* @param size Font size * @param size Font size
* *
* Closes previous file, if it was opened, and tries to open given * Closes previous file, if it was opened, and tries to open given
* file. If the plugin has @ref Feature "Feature::MultiFile", the * file. If the plugin has @ref Feature::MultiFile, the function will
* function will use additional files in given path, all sharing common * use additional files in given path, all sharing common basename
* basename derived from @p filename. Returns `true` on success, * derived from @p filename. Returns `true` on success, `false`
* `false` otherwise. * otherwise.
*/ */
bool openFile(const std::string& filename, Float size); bool openFile(const std::string& filename, Float size);
@ -172,8 +172,8 @@ class MAGNUM_TEXT_EXPORT AbstractFont: public PluginManager::AbstractPlugin {
* @param characters UTF-8 characters to render * @param characters UTF-8 characters to render
* *
* Fills the cache with given characters. Fonts having * Fills the cache with given characters. Fonts having
* @ref Feature "Feature::PreparedGlyphCache" do not support partial * @ref Feature::PreparedGlyphCache do not support partial glyph cache
* glyph cache filling, use createGlyphCache() instead. * filling, use @ref createGlyphCache() instead.
*/ */
void fillGlyphCache(GlyphCache& cache, const std::string& characters); void fillGlyphCache(GlyphCache& cache, const std::string& characters);
@ -181,9 +181,9 @@ class MAGNUM_TEXT_EXPORT AbstractFont: public PluginManager::AbstractPlugin {
* @brief Create glyph cache * @brief Create glyph cache
* *
* Configures and fills glyph cache with the contents of whole font. * Configures and fills glyph cache with the contents of whole font.
* Available only if @ref Feature "Feature::PreparedGlyphCache" is * Available only if @ref Feature::PreparedGlyphCache is supported.
* supported. Other fonts support only partial glyph cache filling, * Other fonts support only partial glyph cache filling, see
* see fillGlyphCache(). * @ref fillGlyphCache().
*/ */
GlyphCache* createGlyphCache(); GlyphCache* createGlyphCache();
@ -218,8 +218,8 @@ class MAGNUM_TEXT_EXPORT AbstractFont: public PluginManager::AbstractPlugin {
/** /**
* @brief Implementation for openData() * @brief Implementation for openData()
* *
* If the plugin doesn't have @ref Feature "Feature::MultiFile", * If the plugin doesn't have @ref Feature::MultiFile, default
* default implementation calls doOpenSingleData(). * implementation calls @ref doOpenSingleData().
*/ */
virtual void doOpenData(const std::vector<std::pair<std::string, Containers::ArrayReference<const unsigned char>>>& data, Float size); virtual void doOpenData(const std::vector<std::pair<std::string, Containers::ArrayReference<const unsigned char>>>& data, Float size);
@ -229,10 +229,9 @@ class MAGNUM_TEXT_EXPORT AbstractFont: public PluginManager::AbstractPlugin {
/** /**
* @brief Implementation for openFile() * @brief Implementation for openFile()
* *
* If @ref Feature "Feature::OpenData" is supported and the plugin * If @ref Feature::OpenData is supported and the plugin doesn't have
* doesn't have @ref Feature "Feature::MultiFile", default * @ref Feature::MultiFile, default implementation opens the file and
* implementation opens the file and calls doOpenSingleData() with its * calls @ref doOpenSingleData() with its contents.
* contents.
*/ */
virtual void doOpenFile(const std::string& filename, Float size); virtual void doOpenFile(const std::string& filename, Float size);

204
src/Text/AbstractFontConverter.h

@ -50,13 +50,13 @@ exporting functions are converted to list of unique UTF-32 characters.
You don't need to do most of the redundant sanity checks, these things are You don't need to do most of the redundant sanity checks, these things are
checked by the implementation: checked by the implementation:
- Functions `doExportFontTo*()` are called only if @ref Feature "Feature::ExportFont" - Functions `doExportFontTo*()` are called only if @ref Feature::ExportFont
is supported, functions `doExportGlyphCacheTo*()` are called only if is supported, functions `doExportGlyphCacheTo*()` are called only if
@ref Feature "Feature::ExportGlyphCache" is supported. @ref Feature::ExportGlyphCache is supported.
- Functions `doImportGlyphCacheFrom*()` are called only if - Functions `doImportGlyphCacheFrom*()` are called only if
@ref Feature "Feature::ImportGlyphCache" is supported. @ref Feature::ImportGlyphCache is supported.
- Functions `doExport*To*Data()` and `doImport*From*Data()` are called only - Functions `doExport*To*Data()` and `doImport*From*Data()` are called only
if @ref Feature "Feature::ConvertData" is supported. if @ref Feature::ConvertData is supported.
- Function `doImport*FromData()` is called only if there is at least one data - Function `doImport*FromData()` is called only if there is at least one data
array passed. array passed.
*/ */
@ -67,33 +67,42 @@ class MAGNUM_TEXT_EXPORT AbstractFontConverter: public PluginManager::AbstractPl
/** /**
* @brief Features supported by this converter * @brief Features supported by this converter
* *
* @see Features, features() * @see @ref Features, @ref features()
*/ */
enum class Feature: UnsignedByte { enum class Feature: UnsignedByte {
/** /**
* Exporting font using exportToFile() or exportToData() * Exporting font using @ref exportFontToFile(), @ref exportFontToData()
* @see @ref Feature "Feature::ConvertData" * or @ref exportFontToSingleData()
* @see @ref Feature::ConvertData
*/ */
ExportFont = 1 << 0, ExportFont = 1 << 0,
/** /**
* Export glyph cache using exportToFile() or exportToData() * Export glyph cache using @ref exportGlyphCacheToFile(),
* @see @ref Feature "Feature::ConvertData" * @ref exportGlyphCacheToData() or @ref exportGlyphCacheToSingleData()
* @see @ref Feature::ConvertData
*/ */
ExportGlyphCache = 1 << 1, ExportGlyphCache = 1 << 1,
/** /**
* Import glyph cache using importFromFile() or importFromData() * Import glyph cache using @ref importGlyphCacheFromFile(),
* @see @ref Feature "Feature::ConvertData" * @ref importGlyphCacheFromData() or @ref importGlyphCacheFromSingleData()
* @see @ref Feature::ConvertData
*/ */
ImportGlyphCache = 1 << 2, ImportGlyphCache = 1 << 2,
/** Convert from/to data using exportToData() or importFromData() */ /**
* Convert from/to data using @ref exportFontToData(),
* @ref exportFontToSingleData(), @ref exportGlyphCacheToData(),
* @ref exportGlyphCacheToSingleData(), @ref importGlyphCacheFromData()
* or @ref importGlyphCacheFromSingleData()
*/
ConvertData = 1 << 4, ConvertData = 1 << 4,
/** /**
* The format is multi-file, thus exportToSingleData() and * The format is multi-file, thus @ref exportFontToSingleData(),
* importFromSingleData() convenience functions cannot be used. * @ref exportGlyphCacheToSingleData() and @ref importGlyphCacheFromSingleData()
* convenience functions cannot be used.
*/ */
MultiFile = 1 << 5 MultiFile = 1 << 5
}; };
@ -121,38 +130,39 @@ class MAGNUM_TEXT_EXPORT AbstractFontConverter: public PluginManager::AbstractPl
* @param filename Output filename * @param filename Output filename
* @param characters Characters to export * @param characters Characters to export
* *
* Available only if @ref Feature "Feature::ConvertData" and * Available only if @ref Feature::ConvertData and @ref Feature::ExportFont
* @ref Feature "Feature::ExportFont" is supported. Returns pairs of * is supported. Returns pairs of filename and data on success, empty
* filename and data on success, empty vector otherwise. All data will * vector otherwise. All data will be sharing common basename derived
* be sharing common basename derived from @p filename. If the plugin * from @p filename. If the plugin doesn't have @ref Feature::MultiFile,
* doesn't have @ref Feature "Feature::MultiFile", only one pair is * only one pair is returned, thus using @ref exportFontToSingleData()
* returned, thus using exportFontToSingleData() might be more convenient * might be more convenient in that case.
* in that case. * @see @ref features(), @ref exportFontToFile(),
* @see features(), exportFontToFile(), exportGlyphCacheToData() * @ref exportGlyphCacheToData()
*/ */
std::vector<std::pair<std::string, Containers::Array<unsigned char>>> exportFontToData(AbstractFont& font, GlyphCache& cache, const std::string& filename, const std::string& characters) const; std::vector<std::pair<std::string, Containers::Array<unsigned char>>> exportFontToData(AbstractFont& font, GlyphCache& cache, const std::string& filename, const std::string& characters) const;
/** /**
* @brief Export font to single raw data * @brief Export font to single raw data
* *
* Available only if @ref Feature "Feature::ConvertData" and * Available only if @ref Feature::ConvertData and @ref Feature::ExportFont
* @ref Feature "Feature::ExportFont" is supported and the plugin * is supported and the plugin doesn't have @ref Feature::MultiFile.
* doesn't have @ref Feature "Feature::MultiFile". Returns data on * Returns data on success, zero-sized array otherwise. See
* success, zero-sized array otherwise. See exportFontToData() for * @ref exportFontToData() for more information.
* more information. * @see @ref features(), @ref exportFontToFile(),
* @see features(), exportFontToFile(), importFromSingleData() * @ref exportGlyphCacheToSingleData()
*/ */
Containers::Array<unsigned char> exportFontToSingleData(AbstractFont& font, GlyphCache& cache, const std::string& characters) const; Containers::Array<unsigned char> exportFontToSingleData(AbstractFont& font, GlyphCache& cache, const std::string& characters) const;
/** /**
* @brief Export font to file * @brief Export font to file
* *
* Available only if @ref Feature "Feature::ExportFont" is supported. * Available only if @ref Feature::ExportFont is supported. If the
* If the plugin has @ref Feature "Feature::MultiFile", the function * plugin has @ref Feature::MultiFile, the function will create more
* will create more than one file in given path, all sharing common * than one file in given path, all sharing common basename derived
* basename derived from @p filename. Returns `true` on success, * from @p filename. Returns `true` on success, `false` otherwise. See
* `false` otherwise. See exportFontToData() for more information. * @ref exportFontToData() for more information.
* @see features(), exportFontToData(), exportGlyphCacheToFile() * @see @ref features(), @ref exportFontToData(),
* @ref exportGlyphCacheToFile()
*/ */
bool exportFontToFile(AbstractFont& font, GlyphCache& cache, const std::string& filename, const std::string& characters) const; bool exportFontToFile(AbstractFont& font, GlyphCache& cache, const std::string& filename, const std::string& characters) const;
@ -161,41 +171,42 @@ class MAGNUM_TEXT_EXPORT AbstractFontConverter: public PluginManager::AbstractPl
* @param cache Populated glyph cache * @param cache Populated glyph cache
* @param filename Output filename * @param filename Output filename
* *
* Available only if @ref Feature "Feature::ConvertData" and * Available only if @ref Feature::ConvertData and @ref Feature::ExportGlyphCache
* @ref Feature "Feature::ExportGlyphCache" is supported. Returns pairs * is supported. Returns pairs of filename and data on success, empty
* of filename and data on success, empty vector otherwise. All data * vector otherwise. All data will be sharing common basename derived
* will be sharing common basename derived from @p filename. If the * from @p filename. If the plugin doesn't have @ref Feature::MultiFile,
* plugin doesn't have @ref Feature "Feature::MultiFile", only one pair * only one pair is returned, thus using @ref exportGlyphCacheToSingleData()
* is returned, thus using exportGlyphCacheToSingleData() might be more * might be more convenient in that case.
* convenient in that case.
* *
* All glyphs from given cache will be exported. If you want to export * All glyphs from given cache will be exported. If you want to export
* smaller subset, fill the cache with less characters. * smaller subset, fill the cache with less characters.
* @see features(), exportGlyphCacheToFile(), exportFontToData() * @see @ref features(), @ref exportGlyphCacheToFile(),
* @ref exportFontToData()
*/ */
std::vector<std::pair<std::string, Containers::Array<unsigned char>>> exportGlyphCacheToData(GlyphCache& cache, const std::string& filename) const; std::vector<std::pair<std::string, Containers::Array<unsigned char>>> exportGlyphCacheToData(GlyphCache& cache, const std::string& filename) const;
/** /**
* @brief Export glyph cache to single raw data * @brief Export glyph cache to single raw data
* *
* Available only if @ref Feature "Feature::ConvertData" and * Available only if @ref Feature::ConvertData and @ref Feature::ExportGlyphCache
* @ref Feature "Feature::ExportGlyphCache" is supported and the plugin * is supported and the plugin doesn't have @ref Feature::MultiFile.
* doesn't have @ref Feature "Feature::MultiFile". Returns data on * Returns data on success, zero-sized array otherwise. See
* success, zero-sized array otherwise. See exportGlyphCacheToData() * @ref exportGlyphCacheToData() for more information.
* for more information. * @see @ref features(), @ref exportGlyphCacheToFile(),
* @see features(), exportGlyphCacheToFile(), importGlyphCacheFromSingleData() * @ref importGlyphCacheFromSingleData()
*/ */
Containers::Array<unsigned char> exportGlyphCacheToSingleData(GlyphCache& cache) const; Containers::Array<unsigned char> exportGlyphCacheToSingleData(GlyphCache& cache) const;
/** /**
* @brief Export glyph cache to file * @brief Export glyph cache to file
* *
* Available only if @ref Feature "Feature::ExportGlyphCache" is * Available only if @ref Feature::ExportGlyphCache is supported. If
* supported. If the plugin has @ref Feature "Feature::MultiFile", the * the plugin has @ref Feature::MultiFile, the function will create
* function will create more than one file in given path, all sharing * more than one file in given path, all sharing common basename
* common basename derived from @p filename. Returns `true` on success, * derived from @p filename. Returns `true` on success, `false`
* `false` otherwise. * otherwise.
* @see features(), exportGlyphCacheToData(), exportFontToFile() * @see @ref features(), @ref exportGlyphCacheToData(),
* @ref exportFontToFile()
*/ */
bool exportGlyphCacheToFile(GlyphCache& cache, const std::string& filename) const; bool exportGlyphCacheToFile(GlyphCache& cache, const std::string& filename) const;
@ -203,37 +214,38 @@ class MAGNUM_TEXT_EXPORT AbstractFontConverter: public PluginManager::AbstractPl
* @brief Import glyph cache from raw data * @brief Import glyph cache from raw data
* @param data Pairs of filename and file data * @param data Pairs of filename and file data
* *
* Available only if @ref Feature "Feature::ConvertData" and * Available only if @ref Feature::ConvertData and @ref Feature::ImportGlyphCache
* @ref Feature "Feature::ImportGlyphCache" is supported. Returns * is supported. Returns imported cache on success, `nullptr`
* imported cache on success, `nullptr` otherwise. If the plugin * otherwise. If the plugin doesn't have @ref Feature::MultiFile, only
* doesn't have @ref Feature "Feature::MultiFile", only one file is * one file is needed, thus using @ref importGlyphCacheFromSingleData()
* needed, thus using convertToSingleData() might be more convenient in * might be more convenient in that case.
* that case. * @see @ref features(), @ref importGlyphCacheFromFile(),
* @see features(), importFromFile(), exportToData() * @ref exportGlyphCacheToData()
*/ */
GlyphCache* importGlyphCacheFromData(const std::vector<std::pair<std::string, Containers::ArrayReference<const unsigned char>>>& data) const; GlyphCache* importGlyphCacheFromData(const std::vector<std::pair<std::string, Containers::ArrayReference<const unsigned char>>>& data) const;
/** /**
* @brief Import glyph cache from single raw data * @brief Import glyph cache from single raw data
* *
* Available only if @ref Feature "Feature::ConvertData" and * Available only if @ref Feature::ConvertData and @ref Feature::ImportGlyphCache
* @ref Feature "Feature::ImportGlyphCache" is supported and the plugin * is supported and the plugin doesn't have @ref Feature::MultiFile.
* doesn't have @ref Feature "Feature::MultiFile". Returns imported * Returns imported cache on success, `nullptr` otherwise. See
* cache on success, `nullptr` otherwise. See importFromData() for * @ref importGlyphCacheFromData() for multi-file conversion.
* multi-file conversion. * @see @ref features(), @ref importGlyphCacheFromFile(),
* @see features(), importFromFile(), exportToSingleData() * @ref exportFontToSingleData()
*/ */
GlyphCache* importGlyphCacheFromSingleData(Containers::ArrayReference<const unsigned char> data) const; GlyphCache* importGlyphCacheFromSingleData(Containers::ArrayReference<const unsigned char> data) const;
/** /**
* @brief Import glyph cache from file * @brief Import glyph cache from file
* *
* Available only if @ref Feature "Feature::ImportGlyphCache" is * Available only if @ref Feature::ImportGlyphCache is supported. If
* supported. If the plugin has @ref Feature "Feature::MultiFile", the * the plugin has @ref Feature::MultiFile, the function will use
* function will use additional files in given path, all sharing common * additional files in given path, all sharing common basename derived
* basename derived from @p filename. Returns imported cache on * from @p filename. Returns imported cache on success, `nullptr`
* success, `nullptr` otherwise. * otherwise.
* @see features(), importFromData(), exportToFile() * @see @ref features(), @ref importGlyphCacheFromData(),
* @ref exportGlyphCacheToFile()
*/ */
GlyphCache* importGlyphCacheFromFile(const std::string& filename) const; GlyphCache* importGlyphCacheFromFile(const std::string& filename) const;
@ -242,14 +254,14 @@ class MAGNUM_TEXT_EXPORT AbstractFontConverter: public PluginManager::AbstractPl
#else #else
protected: protected:
#endif #endif
/** @brief Implementation for features() */ /** @brief Implementation for @ref features() */
virtual Features doFeatures() const = 0; virtual Features doFeatures() const = 0;
/** /**
* @brief Implementation for exportFontToData() * @brief Implementation for @ref exportFontToData()
* *
* If the plugin doesn't have @ref Feature "Feature::MultiFile", * If the plugin doesn't have @ref Feature::MultiFile, default
* default implementation calls doExportFontToSingleData(). * implementation calls @ref doExportFontToSingleData().
* @note On Windows uses `std::vector<char32_t>` instead of * @note On Windows uses `std::vector<char32_t>` instead of
* `std::u32string`. See @ref Corrade::Utility::Unicode::utf32() * `std::u32string`. See @ref Corrade::Utility::Unicode::utf32()
* for more information. * for more information.
@ -261,7 +273,7 @@ class MAGNUM_TEXT_EXPORT AbstractFontConverter: public PluginManager::AbstractPl
#endif #endif
/** /**
* @brief Implementation for exportFontToSingleData() * @brief Implementation for @ref exportFontToSingleData()
* *
* @note On Windows uses `std::vector<char32_t>` instead of * @note On Windows uses `std::vector<char32_t>` instead of
* `std::u32string`. See @ref Corrade::Utility::Unicode::utf32() * `std::u32string`. See @ref Corrade::Utility::Unicode::utf32()
@ -274,11 +286,10 @@ class MAGNUM_TEXT_EXPORT AbstractFontConverter: public PluginManager::AbstractPl
#endif #endif
/** /**
* @brief Implementation for exportFontToFile() * @brief Implementation for @ref exportFontToFile()
* *
* If @ref Feature "Feature::ConvertData" is supported, default * If @ref Feature::ConvertData is supported, default implementation
* implementation calls doExportFontToData() and saves the result to * calls doExportFontToData() and saves the result to given file(s).
* given file(s).
* @note On Windows uses `std::vector<char32_t>` instead of * @note On Windows uses `std::vector<char32_t>` instead of
* `std::u32string`. See @ref Corrade::Utility::Unicode::utf32() * `std::u32string`. See @ref Corrade::Utility::Unicode::utf32()
* for more information. * for more information.
@ -290,10 +301,10 @@ class MAGNUM_TEXT_EXPORT AbstractFontConverter: public PluginManager::AbstractPl
#endif #endif
/** /**
* @brief Implementation for exportGlyphCacheToData() * @brief Implementation for @ref exportGlyphCacheToData()
* *
* If the plugin doesn't have @ref Feature "Feature::MultiFile", * If the plugin doesn't have @ref Feature::MultiFile, default
* default implementation calls doExportGlyphCacheToSingleData(). * implementation calls @ref doExportGlyphCacheToSingleData().
*/ */
virtual std::vector<std::pair<std::string, Containers::Array<unsigned char>>> doExportGlyphCacheToData(GlyphCache& cache, const std::string& filename) const; virtual std::vector<std::pair<std::string, Containers::Array<unsigned char>>> doExportGlyphCacheToData(GlyphCache& cache, const std::string& filename) const;
@ -301,19 +312,19 @@ class MAGNUM_TEXT_EXPORT AbstractFontConverter: public PluginManager::AbstractPl
virtual Containers::Array<unsigned char> doExportGlyphCacheToSingleData(GlyphCache& cache) const; virtual Containers::Array<unsigned char> doExportGlyphCacheToSingleData(GlyphCache& cache) const;
/** /**
* @brief Implementation for exportGlyphCacheToFile() * @brief Implementation for @ref exportGlyphCacheToFile()
* *
* If @ref Feature "Feature::ConvertData" is supported, default * If @ref Feature::ConvertData is supported, default implementation
* implementation calls doExportGlyphCacheToData() and saves the result * calls @ref doExportGlyphCacheToData() and saves the result to given
* to given file(s). * file(s).
*/ */
virtual bool doExportGlyphCacheToFile(GlyphCache& cache, const std::string& filename) const; virtual bool doExportGlyphCacheToFile(GlyphCache& cache, const std::string& filename) const;
/** /**
* @brief Implementation for importGlyphCacheFromData() * @brief Implementation for @ref importGlyphCacheFromData()
* *
* If the plugin doesn't have @ref Feature "Feature::MultiFile", * If the plugin doesn't have @ref Feature::MultiFile, default
* default implementation calls doImportGlyphCacheFromSingleData(). * implementation calls @ref doImportGlyphCacheFromSingleData().
*/ */
virtual GlyphCache* doImportGlyphCacheFromData(const std::vector<std::pair<std::string, Containers::ArrayReference<const unsigned char>>>& data) const; virtual GlyphCache* doImportGlyphCacheFromData(const std::vector<std::pair<std::string, Containers::ArrayReference<const unsigned char>>>& data) const;
@ -321,12 +332,11 @@ class MAGNUM_TEXT_EXPORT AbstractFontConverter: public PluginManager::AbstractPl
virtual GlyphCache* doImportGlyphCacheFromSingleData(Containers::ArrayReference<const unsigned char> data) const; virtual GlyphCache* doImportGlyphCacheFromSingleData(Containers::ArrayReference<const unsigned char> data) const;
/** /**
* @brief Implementation for importGlyphCacheFromFile() * @brief Implementation for @ref importGlyphCacheFromFile()
* *
* If @ref Feature "Feature::ConvertData" is supported and the plugin * If @ref Feature::ConvertData is supported and the plugin doesn't
* doesn't have @ref Feature "Feature::MultiFile", default * have @ref Feature::MultiFile, default implementation opens the file
* implementation opens the file and calls doImportGlyphCacheFromSingleData() * and calls @ref doImportGlyphCacheFromSingleData() with its contents.
* with its contents.
*/ */
virtual GlyphCache* doImportGlyphCacheFromFile(const std::string& filename) const; virtual GlyphCache* doImportGlyphCacheFromFile(const std::string& filename) const;

2
src/Text/DistanceFieldGlyphCache.h

@ -65,7 +65,7 @@ class MAGNUM_TEXT_EXPORT DistanceFieldGlyphCache: public GlyphCache {
* parameters. Sets internal texture format to red channel only. On * parameters. Sets internal texture format to red channel only. On
* desktop OpenGL requires @extension{ARB,texture_rg} (also part of * desktop OpenGL requires @extension{ARB,texture_rg} (also part of
* OpenGL ES 3.0), in ES2 uses @es_extension{EXT,texture_rg} if * OpenGL ES 3.0), in ES2 uses @es_extension{EXT,texture_rg} if
* available or @ref TextureFormat "TextureFormat::RGB" as fallback. * available or @ref TextureFormat::RGB as fallback.
* @todo Is Luminance format renderable anywhere? Also would it be * @todo Is Luminance format renderable anywhere? Also would it be
* possible to convert the RGB texture to Luminance after it has * possible to convert the RGB texture to Luminance after it has
* been rendered when blitting is not supported to save memory? * been rendered when blitting is not supported to save memory?

2
src/Text/GlyphCache.h

@ -87,7 +87,7 @@ class MAGNUM_TEXT_EXPORT GlyphCache {
* Sets internal texture format to red channel only. On desktop OpenGL * Sets internal texture format to red channel only. On desktop OpenGL
* requires @extension{ARB,texture_rg} (also part of OpenGL ES 3.0), in * requires @extension{ARB,texture_rg} (also part of OpenGL ES 3.0), in
* ES2 uses @es_extension{EXT,texture_rg}, if available, or * ES2 uses @es_extension{EXT,texture_rg}, if available, or
* @ref TextureFormat "TextureFormat::Luminance" as fallback. * @ref TextureFormat::Luminance as fallback.
*/ */
explicit GlyphCache(const Vector2i& originalSize, const Vector2i& size, const Vector2i& padding = Vector2i()); explicit GlyphCache(const Vector2i& originalSize, const Vector2i& size, const Vector2i& padding = Vector2i());

24
src/Texture.h

@ -73,8 +73,9 @@ information about usage in shaders.
@section Texture-array Texture arrays @section Texture-array Texture arrays
You can create texture arrays by passing @ref Target "Texture2D::Target::Texture1DArray" You can create texture arrays by passing
or @ref Target "Texture3D::Target::Texture2DArray" to constructor. @ref Target::Texture1DArray "Texture2D::Target::Texture1DArray" or
@ref Target::Texture2DArray "Texture3D::Target::Texture2DArray" to constructor.
It is possible to specify each layer separately using setSubImage(), but you It is possible to specify each layer separately using setSubImage(), but you
have to allocate the memory for all layers first either by calling setStorage() have to allocate the memory for all layers first either by calling setStorage()
@ -104,8 +105,10 @@ etc.).
@section Texture-multisample Multisample textures @section Texture-multisample Multisample textures
You can create multisample textures by passing @ref Target "Texture2D::Target::Texture2DMultisample" You can create multisample textures by passing
or @ref Target "Texture3D::Target::Texture2DMultisampleArray" to constructor. @ref Target::Texture2DMultisample "Texture2D::Target::Texture2DMultisample" or
@ref Target::Texture2DMultisampleArray "Texture3D::Target::Texture2DMultisampleArray"
to constructor.
@todoc finish this when fully implemented @todoc finish this when fully implemented
@ -115,13 +118,13 @@ or @ref Target "Texture3D::Target::Texture2DMultisampleArray" to constructor.
@section Texture-rectangle Rectangle textures @section Texture-rectangle Rectangle textures
Rectangle texture is created by passing @ref Target "Target::Rectangle" to Rectangle texture is created by passing @ref Target::Rectangle "Texture2D::Target::Rectangle"
constructor. In shader, the texture is used via `sampler2DRect` and friends. to constructor. In shader, the texture is used via `sampler2DRect` and friends.
Unlike `sampler2D`, which accepts coordinates between 0 and 1, `sampler2DRect` Unlike `sampler2D`, which accepts coordinates between 0 and 1, `sampler2DRect`
accepts coordinates between 0 and `textureSizeInGivenDirection-1`. Note that accepts coordinates between 0 and `textureSizeInGivenDirection-1`. Note that
rectangle textures don't support mipmapping and repeating wrapping modes, see rectangle textures don't support mipmapping and repeating wrapping modes, see
@ref Sampler::Filter "Sampler::Filter", @ref Sampler::Mipmap "Sampler::Mipmap" @ref Sampler::Filter, @ref Sampler::Mipmap and @ref generateMipmap()
and generateMipmap() documentation for more information. documentation for more information.
@requires_gl31 %Extension @extension{ARB,texture_rectangle} for rectangle @requires_gl31 %Extension @extension{ARB,texture_rectangle} for rectangle
textures. textures.
@ -255,10 +258,9 @@ template<UnsignedInt dimensions> class Texture: public AbstractTexture {
* textures and (0, textureSizeInGivenDirection-1) for rectangle * textures and (0, textureSizeInGivenDirection-1) for rectangle
* textures. If @extension{EXT,direct_state_access} is not available, * textures. If @extension{EXT,direct_state_access} is not available,
* the texture is bound to some layer before the operation. Initial * the texture is bound to some layer before the operation. Initial
* value is @ref Sampler::Wrapping "Sampler::Wrapping::Repeat". * value is @ref Sampler::Wrapping::Repeat.
* @attention For rectangle textures only some modes are supported, * @attention For rectangle textures only some modes are supported,
* see @ref Sampler::Wrapping "Sampler::Wrapping" documentation * see @ref Sampler::Wrapping documentation for more information.
* for more information.
* @see @fn_gl{ActiveTexture}, @fn_gl{BindTexture} and @fn_gl{TexParameter} * @see @fn_gl{ActiveTexture}, @fn_gl{BindTexture} and @fn_gl{TexParameter}
* or @fn_gl_extension{TextureParameter,EXT,direct_state_access} * or @fn_gl_extension{TextureParameter,EXT,direct_state_access}
* with @def_gl{TEXTURE_WRAP_S}, @def_gl{TEXTURE_WRAP_T}, * with @def_gl{TEXTURE_WRAP_S}, @def_gl{TEXTURE_WRAP_T},

15
src/TextureTools/CMakeLists.txt

@ -46,6 +46,21 @@ if(BUILD_STATIC_PIC)
endif() endif()
target_link_libraries(MagnumTextureTools Magnum) target_link_libraries(MagnumTextureTools Magnum)
if(WITH_DISTANCEFIELDCONVERTER)
if(NOT UNIX OR TARGET_GLES)
message(FATAL_ERROR "magnum-distancefield is not available on this platform. Set WITH_DISTANCEFIELDCONVERTER to OFF to suppress this warning.")
endif()
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/configure.h.cmake
${CMAKE_CURRENT_BINARY_DIR}/configure.h)
include_directories(${CMAKE_CURRENT_BINARY_DIR})
add_executable(magnum-distancefield distance-field.cpp)
target_link_libraries(magnum-distancefield MagnumTextureTools Magnum MagnumWindowlessGlxApplication ${X11_LIBRARIES})
install(TARGETS magnum-distancefield DESTINATION ${MAGNUM_BINARY_INSTALL_DIR})
endif()
install(TARGETS MagnumTextureTools DESTINATION ${MAGNUM_LIBRARY_INSTALL_DIR}) install(TARGETS MagnumTextureTools DESTINATION ${MAGNUM_LIBRARY_INSTALL_DIR})
install(FILES ${MagnumTextureTools_HEADERS} DESTINATION ${MAGNUM_INCLUDE_INSTALL_DIR}/TextureTools) install(FILES ${MagnumTextureTools_HEADERS} DESTINATION ${MAGNUM_INCLUDE_INSTALL_DIR}/TextureTools)

11
src/TextureTools/DistanceField.h

@ -75,12 +75,11 @@ http://www.valvesoftware.com/publications/2007/SIGGRAPH2007_AlphaTestedMagnifica
@note If internal format of @p output texture is not renderable, this function @note If internal format of @p output texture is not renderable, this function
prints message to error output and does nothing. In desktop OpenGL and prints message to error output and does nothing. In desktop OpenGL and
OpenGL ES 3.0 it's common to render to @ref TextureFormat "TextureFormat::R8". OpenGL ES 3.0 it's common to render to @ref TextureFormat::R8. In OpenGL ES
In OpenGL ES 2.0 you can use @ref TextureFormat "TextureFormat::Red" if 2.0 you can use @ref TextureFormat::Red if @es_extension{EXT,texture_rg} is
@es_extension{EXT,texture_rg} is available, if not, the smallest but still available, if not, the smallest but still inefficient supported format is
inefficient supported format is in most cases @ref TextureFormat "TextureFormat::RGB", in most cases @ref TextureFormat::RGB, rendering to @ref TextureFormat::Luminance
rendering to @ref TextureFormat "TextureFormat::Luminance" is not supported is not supported in most cases.
in most cases.
@bug ES (and maybe GL < 3.20) implementation behaves slightly different @bug ES (and maybe GL < 3.20) implementation behaves slightly different
(jaggies, visible e.g. when rendering outlined fonts) (jaggies, visible e.g. when rendering outlined fonts)

26
src/TextureTools/configure.h.cmake

@ -0,0 +1,26 @@
/*
This file is part of Magnum.
Copyright © 2010, 2011, 2012, 2013 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.
*/
#define MAGNUM_IMPORTER_PLUGIN_DIR "${MAGNUM_LIBRARY_INSTALL_DIR}/magnum/importers"
#define MAGNUM_IMAGECONVERTER_PLUGIN_DIR "${MAGNUM_LIBRARY_INSTALL_DIR}/magnum/imageconverters"

134
src/TextureTools/distance-field.cpp

@ -0,0 +1,134 @@
/*
This file is part of Magnum.
Copyright © 2010, 2011, 2012, 2013 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 <Utility/Arguments.h>
#include <PluginManager/Manager.h>
#include "Math/Geometry/Rectangle.h"
#include "Image.h"
#include "ImageFormat.h"
#include "Renderer.h"
#include "Texture.h"
#include "TextureFormat.h"
#include "Platform/WindowlessGlxApplication.h"
#include "TextureTools/DistanceField.h"
#include "Trade/AbstractImporter.h"
#include "Trade/AbstractImageConverter.h"
#include "Trade/ImageData.h"
#include "configure.h"
namespace Magnum {
class DistanceFieldConverter: public Platform::WindowlessApplication {
public:
explicit DistanceFieldConverter(const Arguments& arguments);
int exec() override;
private:
Utility::Arguments args;
};
DistanceFieldConverter::DistanceFieldConverter(const Arguments& arguments): WindowlessGlxApplication(arguments, nullptr) {
args.addArgument("input").setHelp("input", "input image")
.addArgument("output").setHelp("output", "output image")
.addOption("importer", "TgaImporter").setHelp("image importer plugin")
.addOption("converter", "TgaImageConverter").setHelp("image converter plugin")
.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")
.setHelp("Converts black&white image to distance-field representation.")
.parse(arguments.argc, arguments.argv);
createContext({});
}
int DistanceFieldConverter::exec() {
/* Load plugins */
PluginManager::Manager<Trade::AbstractImporter> importerManager(MAGNUM_IMPORTER_PLUGIN_DIR);
if(!(importerManager.load(args.value("importer")) & PluginManager::LoadState::Loaded)) {
Error() << "Cannot load importer plugin" << args.value("importer") << "from" << MAGNUM_IMPORTER_PLUGIN_DIR;
return 1;
}
PluginManager::Manager<Trade::AbstractImageConverter> converterManager(MAGNUM_IMAGECONVERTER_PLUGIN_DIR);
if(!(converterManager.load(args.value("converter")) & PluginManager::LoadState::Loaded)) {
Error() << "Cannot load converter plugin" << args.value("converter") << "from" << MAGNUM_IMAGECONVERTER_PLUGIN_DIR;
return 1;
}
/* Instance plugins */
Trade::AbstractImporter* importer = importerManager.instance(args.value("importer"));
Trade::AbstractImageConverter* converter = converterManager.instance(args.value("converter"));
CORRADE_INTERNAL_ASSERT(importer && converter);
/* Open input file */
Trade::ImageData2D* image = nullptr;
if(!importer->openFile(args.value("input")) || !(image = importer->image2D(0))) {
Error() << "Cannot open file" << args.value("input");
delete importer;
delete converter;
return 1;
}
delete importer;
if(image->format() != ImageFormat::Red) {
Error() << "Unsupported image format" << image->format();
delete converter;
return 1;
}
/* Input texture */
Texture2D input;
input.setMinificationFilter(Sampler::Filter::Linear)
.setMagnificationFilter(Sampler::Filter::Linear)
.setWrapping(Sampler::Wrapping::ClampToEdge)
.setImage(0, TextureFormat::R8, *image);
/* Output texture */
Texture2D output;
output.setStorage(1, TextureFormat::R8, args.value<Vector2i>("output-size"));
CORRADE_INTERNAL_ASSERT(Renderer::error() == Renderer::Error::NoError);
/* Do it */
Debug() << "Converting image of size" << image->size() << "to distance field...";
TextureTools::distanceField(input, output, {{}, args.value<Vector2i>("output-size")}, args.value<Int>("radius"), image->size());
delete image;
/* Save image */
Image2D result(ImageFormat::Red, ImageType::UnsignedByte);
output.image(0, result);
if(!converter->exportToFile(result, args.value("output"))) {
Error() << "Cannot save file" << args.value("output");
delete converter;
return 1;
}
delete converter;
return 0;
}
}
MAGNUM_WINDOWLESSAPPLICATION_MAIN(Magnum::DistanceFieldConverter)

22
src/Trade/AbstractImageConverter.h

@ -51,9 +51,8 @@ supported.
You don't need to do most of the redundant sanity checks, these things are You don't need to do most of the redundant sanity checks, these things are
checked by the implementation: checked by the implementation:
- Functions doExportToImage() or doExportToData() are called only if - Functions @ref doExportToImage() or @ref doExportToData() are called only
@ref Feature "Feature::ConvertImage" or @ref Feature "Feature::ConvertData" if @ref Feature::ConvertImage or @ref Feature::ConvertData is supported.
is supported.
*/ */
class MAGNUM_EXPORT AbstractImageConverter: public PluginManager::AbstractPlugin { class MAGNUM_EXPORT AbstractImageConverter: public PluginManager::AbstractPlugin {
CORRADE_PLUGIN_INTERFACE("cz.mosra.magnum.Trade.AbstractImageConverter/0.2.1") CORRADE_PLUGIN_INTERFACE("cz.mosra.magnum.Trade.AbstractImageConverter/0.2.1")
@ -91,18 +90,18 @@ class MAGNUM_EXPORT AbstractImageConverter: public PluginManager::AbstractPlugin
/** /**
* @brief Convert image to different format * @brief Convert image to different format
* *
* Available only if @ref Feature "Feature::ConvertImage" is supported. * Available only if @ref Feature::ConvertImage is supported. Returns
* Returns converted image on success, `nullptr` otherwise. * converted image on success, `nullptr` otherwise.
* @see features(), exportToData(), exportToFile() * @see @ref features(), @ref exportToData(), @ref exportToFile()
*/ */
Image2D* exportToImage(const ImageReference2D& image) const; Image2D* exportToImage(const ImageReference2D& image) const;
/** /**
* @brief Export image to raw data * @brief Export image to raw data
* *
* Available only if @ref Feature "Feature::ConvertData" is supported. * Available only if @ref Feature::ConvertData is supported. Returns
* Returns data on success, zero-sized array otherwise. * data on success, zero-sized array otherwise.
* @see features(), exportToImage(), exportToFile() * @see @ref features(), @ref exportToImage(), @ref exportToFile()
*/ */
Containers::Array<unsigned char> exportToData(const ImageReference2D& image) const; Containers::Array<unsigned char> exportToData(const ImageReference2D& image) const;
@ -131,9 +130,8 @@ class MAGNUM_EXPORT AbstractImageConverter: public PluginManager::AbstractPlugin
/** /**
* @brief Implementation of exportToFile() * @brief Implementation of exportToFile()
* *
* If @ref Feature "Feature::ConvertData" is supported, default * If @ref Feature::ConvertData is supported, default implementation
* implementation calls doExportToData() and saves the result to given * calls @ref doExportToData() and saves the result to given file.
* file.
*/ */
virtual bool doExportToFile(const ImageReference2D& image, const std::string& filename) const; virtual bool doExportToFile(const ImageReference2D& image, const std::string& filename) const;
}; };

5
src/Trade/AbstractImporter.cpp

@ -76,7 +76,10 @@ void AbstractImporter::doOpenFile(const std::string& filename) {
} }
void AbstractImporter::close() { void AbstractImporter::close() {
if(isOpened()) doClose(); if(isOpened()) {
doClose();
CORRADE_INTERNAL_ASSERT(!isOpened());
}
} }
Int AbstractImporter::defaultScene() { Int AbstractImporter::defaultScene() {

22
src/Trade/AbstractImporter.h

@ -58,12 +58,13 @@ as the file contains all data user wants to import.
You don't need to do most of the redundant sanity checks, these things are You don't need to do most of the redundant sanity checks, these things are
checked by the implementation: checked by the implementation:
- Functions doOpenData() and doOpenFile() are called after the previous file - Functions @ref doOpenData() and @ref doOpenFile() are called after the
was closed, function doClose() is called only if there is any file opened. previous file was closed, function @ref doClose() is called only if there
- Function doOpenData() is called only if @ref Feature "Feature::OpenData" is any file opened.
is supported. - Function @ref doOpenData() is called only if @ref Feature::OpenData is
- All `do*()` implementations working on opened file are called only if supported.
there is any file opened. - All `do*()` implementations working on opened file are called only if there
is any file opened.
- All `do*()` implementations taking data ID as parameter are called only if - All `do*()` implementations taking data ID as parameter are called only if
the ID is from valid range. the ID is from valid range.
*/ */
@ -100,8 +101,8 @@ class MAGNUM_EXPORT AbstractImporter: public PluginManager::AbstractPlugin {
* @brief Open raw data * @brief Open raw data
* *
* Closes previous file, if it was opened, and tries to open given * Closes previous file, if it was opened, and tries to open given
* file. Available only if @ref Feature "Feature::OpenData" is * file. Available only if @ref Feature::OpenData is supported. Returns
* supported. Returns `true` on success, `false` otherwise. * `true` on success, `false` otherwise.
* @see features(), openFile() * @see features(), openFile()
*/ */
bool openData(Containers::ArrayReference<const unsigned char> data); bool openData(Containers::ArrayReference<const unsigned char> data);
@ -488,9 +489,8 @@ class MAGNUM_EXPORT AbstractImporter: public PluginManager::AbstractPlugin {
/** /**
* @brief Implementation for openFile() * @brief Implementation for openFile()
* *
* If @ref Feature "Feature::OpenData" is supported, default * If @ref Feature::OpenData is supported, default implementation opens
* implementation opens the file and calls doOpenData() with its * the file and calls @ref doOpenData() with its contents.
* contents.
*/ */
virtual void doOpenFile(const std::string& filename); virtual void doOpenFile(const std::string& filename);

12
src/Trade/PhongMaterialData.h

@ -79,7 +79,7 @@ class MAGNUM_EXPORT PhongMaterialData: public AbstractMaterialData {
/** /**
* @brief Ambient color * @brief Ambient color
* *
* Available only if the material doesn't have @ref Flag "Flag::AmbientTexture". * Available only if the material doesn't have @ref Flag::AmbientTexture.
* @see @ref flags() * @see @ref flags()
*/ */
Vector3& ambientColor(); Vector3& ambientColor();
@ -88,7 +88,7 @@ class MAGNUM_EXPORT PhongMaterialData: public AbstractMaterialData {
/** /**
* @brief Ambient texture ID * @brief Ambient texture ID
* *
* Available only if the material has @ref Flag "Flag::AmbientTexture". * Available only if the material has @ref Flag::AmbientTexture.
* @see @ref flags(), @ref AbstractImporter::texture() * @see @ref flags(), @ref AbstractImporter::texture()
*/ */
UnsignedInt& ambientTexture(); UnsignedInt& ambientTexture();
@ -97,7 +97,7 @@ class MAGNUM_EXPORT PhongMaterialData: public AbstractMaterialData {
/** /**
* @brief Diffuse color * @brief Diffuse color
* *
* Available only if the material doesn't have @ref Flag "Flag::DiffuseTexture". * Available only if the material doesn't have @ref Flag::DiffuseTexture.
* @see @ref flags() * @see @ref flags()
*/ */
Vector3& diffuseColor(); Vector3& diffuseColor();
@ -106,7 +106,7 @@ class MAGNUM_EXPORT PhongMaterialData: public AbstractMaterialData {
/** /**
* @brief Diffuse texture ID * @brief Diffuse texture ID
* *
* Available only if the material has @ref Flag "Flag::DiffuseTexture". * Available only if the material has @ref Flag::DiffuseTexture.
* @see @ref flags(), @ref AbstractImporter::texture() * @see @ref flags(), @ref AbstractImporter::texture()
*/ */
UnsignedInt& diffuseTexture(); UnsignedInt& diffuseTexture();
@ -115,7 +115,7 @@ class MAGNUM_EXPORT PhongMaterialData: public AbstractMaterialData {
/** /**
* @brief Specular color * @brief Specular color
* *
* Available only if the material doesn't have @ref Flag "Flag::SpecularTexture". * Available only if the material doesn't have @ref Flag::SpecularTexture.
* @see @ref flags() * @see @ref flags()
*/ */
Vector3& specularColor(); Vector3& specularColor();
@ -124,7 +124,7 @@ class MAGNUM_EXPORT PhongMaterialData: public AbstractMaterialData {
/** /**
* @brief Specular texture ID * @brief Specular texture ID
* *
* Available only if the material has @ref Flag "Flag::SpecularTexture". * Available only if the material has @ref Flag::SpecularTexture.
* @see @ref flags(), @ref AbstractImporter::texture() * @see @ref flags(), @ref AbstractImporter::texture()
*/ */
UnsignedInt& specularTexture(); UnsignedInt& specularTexture();

2
src/Trade/TextureData.h

@ -93,7 +93,7 @@ class TextureData {
* @brief Image ID * @brief Image ID
* *
* ID of 1D, 2D or 3D image based on texture type. If type is * ID of 1D, 2D or 3D image based on texture type. If type is
* @ref Type "Type::Cube" the function returns first of six consecutive * @ref Type::Cube the function returns first of six consecutive
* IDs of cube map sides, ordered +X, -X, +Y, -Y, +Z, -Z. * IDs of cube map sides, ordered +X, -X, +Y, -Y, +Z, -Z.
* @see @ref type(), @ref AbstractImporter::image1D(), * @see @ref type(), @ref AbstractImporter::image1D(),
* @ref AbstractImporter::image2D(), @ref AbstractImporter::image3D() * @ref AbstractImporter::image2D(), @ref AbstractImporter::image3D()

3
src/Trade/Trade.h

@ -32,8 +32,6 @@
namespace Magnum { namespace Trade { namespace Magnum { namespace Trade {
/** @todoc Remove `ifndef` when Doxygen is sane again */
#ifndef DOXYGEN_GENERATING_OUTPUT
class AbstractImageConverter; class AbstractImageConverter;
class AbstractImporter; class AbstractImporter;
class AbstractMaterialData; class AbstractMaterialData;
@ -54,7 +52,6 @@ class ObjectData3D;
class PhongMaterialData; class PhongMaterialData;
class TextureData; class TextureData;
class SceneData; class SceneData;
#endif
}} }}

Loading…
Cancel
Save