diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3f66db2e3..09f2138da 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -13,9 +13,11 @@ option(WITH_EVERYTHING "Build everything (doesn't include contexts)" ON)
option(WITH_MESHTOOLS "Build MeshTools library" OFF)
option(WITH_PHYSICS "Build Physics library" OFF)
option(WITH_PRIMITIVES "Builf Primitives library" OFF)
+option(WITH_SCENEGRAPH "Build SceneGraph library" OFF)
option(WITH_SHADERS "Build Shaders library" OFF)
-cmake_dependent_option(WITH_EGLCONTEXT "Build EglContext library" OFF "TARGET_GLES" OFF)
+option(WITH_GLXCONTEXT "Build GlxContext library" OFF)
+cmake_dependent_option(WITH_XEGLCONTEXT "Build XEglContext library" OFF "TARGET_GLES" OFF)
cmake_dependent_option(WITH_GLUTCONTEXT "Build GlutContext library" OFF "NOT TARGET_GLES" OFF)
option(WITH_SDL2CONTEXT "Build Sdl2Context library" OFF)
@@ -25,6 +27,7 @@ if(WITH_EVERYTHING)
set(WITH_MESHTOOLS ON)
set(WITH_PHYSICS ON)
set(WITH_PRIMITIVES ON)
+ set(WITH_SCENEGRAPH ON)
set(WITH_SHADERS ON)
endif()
diff --git a/Doxyfile b/Doxyfile
index 40f5bcd66..a9b8a684f 100644
--- a/Doxyfile
+++ b/Doxyfile
@@ -195,7 +195,9 @@ TAB_SIZE = 8
# You can put \n's in the value part of an alias to insert newlines.
ALIASES = \
- "debugoperator{1}=@relates \1\n@brief Debug output operator" \
+ "debugoperator{1}=@relates \1\n@brief Debug output operator @xrefitem debugoperators \"Debug output operator\" \"Debug output operators for custom types\" Allows printing \1 with Corrade::Utility::Debug and friends." \
+ "configurationvalueref{1}=@see @ref configurationvalues \"Corrade::Utility::ConfigurationValue<\1>\"" \
+ "configurationvalue{1}=@brief %Configuration value parser and writer @xrefitem configurationvalues \"Configuration value parser and writer\" \"Configuration value parsers and writers for custom types\" Allows parsing and writing \1 from and to Corrade::Utility::Configuration." \
"collisionoperator{2}=@relates \1\n@brief Collision of %\1 and %\2\n@see \2::operator%(const \1&) const" \
"todoc=@xrefitem todoc \"Documentation todo\" \"Documentation-related todo list\"" \
"requires_gl=@xrefitem requires-gl \"Requires desktop OpenGL\" \"Functionality requiring desktop OpenGL (not available on OpenGL ES)\" Not available on OpenGL ES." \
@@ -206,8 +208,12 @@ ALIASES = \
"requires_gl40=@xrefitem requires-gl40 \"Requires OpenGL 4.0\" \"Functionality requiring OpenGL 4.0\"" \
"requires_gl41=@xrefitem requires-gl41 \"Requires OpenGL 4.1\" \"Functionality requiring OpenGL 4.1\"" \
"requires_gl42=@xrefitem requires-gl42 \"Requires OpenGL 4.2\" \"Functionality requiring OpenGL 4.2\"" \
- "requires_extension=@xrefitem requires-extension \"Requires extension\" \"Functionality requiring specific OpenGL extension\"" \
- "extension{2}=\1_\2"
+ "requires_gl43=@xrefitem requires-gl43 \"Requires OpenGL 4.3\" \"Functionality requiring OpenGL 4.3\"" \
+ "requires_extension=@xrefitem requires-extension \"Requires OpenGL extension\" \"Functionality requiring specific OpenGL extension\"" \
+ "extension{2}=\1_\2" \
+ "requires_gles30=@xrefitem requires-gles30 \"Requires OpenGL ES 3.0\" \"Functionality requiring OpenGL ES 3.0\"" \
+ "requires_es_extension=@xrefitem requires-es-extension \"Requires OpenGL ES extension\" \"Functionality requiring specific OpenGL ES extension\"" \
+ "es_extension{2}=\1_\2"
# This tag can be used to specify a number of word-keyword mappings (TCL only).
# A mapping has the form "name=value". For example adding
diff --git a/doc/building.dox b/doc/building.dox
index 5f85874d8..5153bf4b4 100644
--- a/doc/building.dox
+++ b/doc/building.dox
@@ -15,7 +15,7 @@ Minimal set of tools and libraries required for building is:
which are tested to support everything needed: **GCC** >= 4.6 and **Clang**
>= 3.1.
- **CMake** >= 2.8.8 (needed for `OBJECT` library target)
-- **OpenGL** headers, on Linux most probably shipped with Mesa or
+- **OpenGL** headers, on Linux most probably shipped with Mesa, or
**OpenGL ES 2** headers, if targeting OpenGL ES (see below).
- **GLEW** - OpenGL extension wrangler
- **Corrade** - Plugin management and utility library. You can get it at
diff --git a/doc/coding-style.dox b/doc/coding-style.dox
index acab6dc81..09fbdcb80 100644
--- a/doc/coding-style.dox
+++ b/doc/coding-style.dox
@@ -33,8 +33,8 @@ removing redundant prefixes) is encouraged.
@subsection documentation-commands Special documentation commands
-Additionally to @c \@todoc and @c \@debugoperator (same as in Corrade), these
-are defined:
+Additionally to @c \@todoc, @c \@debugoperator @c \@configurationvalue and
+@c \@configurationvalueref (same as in Corrade), these are defined:
@subsubsection documentation-commands-collisionoperator Physics collision operators
diff --git a/doc/groups.dox b/doc/groups.dox
deleted file mode 100644
index 22e833e4b..000000000
--- a/doc/groups.dox
+++ /dev/null
@@ -1,29 +0,0 @@
-namespace Magnum {
-
-/** @page modules */
-
-/**
-@defgroup scene Scene graph
-@brief %Scene hierarchy, cameras, lights and other objects
-*/
-
-/**
-@defgroup mesh Meshes
-@brief Creating, modifying and rendering meshes
-*/
-
-/**
-@defgroup rendering Rendering
-@brief %Shader, buffer and mesh management, render queries
-*/
-
-/** @ingroup rendering
-@defgroup textures Textures
-@brief Access to OpenGL textures, image data wrappers and framebuffer operations
-*/
-
-/**
-@defgroup utility Utility
-@brief Various supporting utility classes
-*/
-}
diff --git a/doc/mainpage.dox b/doc/mainpage.dox
index 3e369b994..093bcf0ce 100644
--- a/doc/mainpage.dox
+++ b/doc/mainpage.dox
@@ -6,8 +6,8 @@ Features:
- Easy-to-use templated @ref Math "mathematical library" for matrix/vector
calculations and @ref Math::Geometry "geometry".
-- Hierarchical @ref Object "scene graph" which supports transformation caching
- for better performance, classes for convenient usage of
+- Hierarchical @ref SceneGraph "scene graph" which supports transformation
+ caching for better performance, classes for convenient usage of
@ref AbstractShaderProgram "shaders", @ref Buffer "buffers" and
@ref AbstractTexture "textures". Access to @ref Framebuffer "framebuffer"
and @ref AbstractQuery "occlusion queries".
@@ -50,11 +50,6 @@ in step-by-step tutorial. Then you can dig deeper and try @ref example-index
"other examples", read about fundamental principles in the documentation or
start experimenting on your own!
-@subsection module-overview Module overview
-
-Classes in %Magnum are grouped into a few modules for a better orientation.
-Check the @ref modules "module index" for more information about all classes.
-
@subsection getting-started-hacking Hacking Magnum
If you want to hack on this engine, if you spotted a bug, need an feature or
diff --git a/doc/namespaces.dox b/doc/namespaces.dox
index 1905ab375..63587bca1 100644
--- a/doc/namespaces.dox
+++ b/doc/namespaces.dox
@@ -7,8 +7,7 @@
/** @namespace Magnum
@brief Root namespace
-Contains classes needed for building meshes, setting up and rendering the
-scene.
+Contains classes for interacting with OpenGL.
*/
/** @dir Contexts
@@ -41,8 +40,7 @@ Functions for computing intersections, distances, areas and volumes.
/** @dir MeshTools
* @brief Namespace Magnum::MeshTools
*/
-/** @ingroup mesh
-@namespace Magnum::MeshTools
+/** @namespace Magnum::MeshTools
@brief %Mesh tools
Tools for generating, optimizing and cleaning meshes.
@@ -51,18 +49,26 @@ Tools for generating, optimizing and cleaning meshes.
/** @dir Primitives
* @brief Namespace Magnum::Primitives
*/
-/** @ingroup mesh
-@namespace Magnum::Primitives
+/** @namespace Magnum::Primitives
@brief Primitive library
Basic primitives for testing purposes.
*/
+/** @dir SceneGraph
+ * @brief Namespace Magnum::SceneGraph
+ */
+/**
+@namespace Magnum::SceneGraph
+@brief %Scene graph library
+
+Setting up and rendering the scene.
+*/
+
/** @dir Shaders
* @brief Namespace Magnum::Shaders
*/
-/** @ingroup rendering
-@namespace Magnum::Shaders
+/** @namespace Magnum::Shaders
@brief Sample shaders
Collection of shaders for testing purposes.
diff --git a/doc/required-extensions.dox b/doc/required-extensions.dox
index c35629ca5..443109d1a 100644
--- a/doc/required-extensions.dox
+++ b/doc/required-extensions.dox
@@ -20,7 +20,10 @@ supported on Intel GPUs even if they are capable of OpenGL 2.1 only).
- @subpage requires-gl40
- @subpage requires-gl41
- @subpage requires-gl42
+- @subpage requires-gl43
- @subpage requires-extension
+- @subpage requires-gles30
+- @subpage requires-es-extension
@page requires-gl Functionality requiring desktop OpenGL (not available on OpenGL ES)
@page requires-gl30 Functionality requiring OpenGL 3.0
@@ -30,6 +33,9 @@ supported on Intel GPUs even if they are capable of OpenGL 2.1 only).
@page requires-gl40 Functionality requiring OpenGL 4.0
@page requires-gl41 Functionality requiring OpenGL 4.1
@page requires-gl42 Functionality requiring OpenGL 4.2
+@page requires-gl43 Functionality requiring OpenGL 4.3
@page requires-extension Functionality requiring specific OpenGL extension
+@page requires-gles30 Functionality requiring OpenGL ES 3.0
+@page requires-es-extension Functionality requiring specific OpenGL ES extension
*/
diff --git a/modules/FindMagnum.cmake b/modules/FindMagnum.cmake
index 09a41585c..fada6ad10 100644
--- a/modules/FindMagnum.cmake
+++ b/modules/FindMagnum.cmake
@@ -18,8 +18,10 @@
# MeshTools - MeshTools library
# Physics - Physics library
# Primitives - Library with stock geometric primitives (static)
+# SceneGraph - Scene graph library
# Shaders - Library with stock shaders
-# EglContext - EGL context (depends on EGL and X11 libraries)
+# GlxContext - GLX context (depends on X11 libraries)
+# XEglContext - X/EGL context (depends on EGL and X11 libraries)
# GlutContext - GLUT context (depends on GLUT library)
# Sdl2Context - SDL2 context (depends on SDL2 library)
# Example usage with specifying additional components is:
@@ -110,8 +112,18 @@ foreach(component ${Magnum_FIND_COMPONENTS})
endif()
endif()
+ # GLX context dependencies
+ if(${component} STREQUAL GlxContext)
+ find_package(X11)
+ if(X11_FOUND)
+ set(_MAGNUM_${_COMPONENT}_LIBRARIES ${X11_LIBRARIES})
+ else()
+ unset(MAGNUM_${_COMPONENT}_LIBRARY)
+ endif()
+ endif()
+
# X/EGL context dependencies
- if(${component} STREQUAL EglContext)
+ if(${component} STREQUAL XEglContext)
find_package(EGL)
find_package(X11)
if(EGL_FOUND AND X11_FOUND)
@@ -137,6 +149,11 @@ foreach(component ${Magnum_FIND_COMPONENTS})
set(_MAGNUM_${_COMPONENT}_INCLUDE_PATH_NAMES Cube.h)
endif()
+ # Scene graph library
+ if(${component} STREQUAL SceneGraph)
+ set(_MAGNUM_${_COMPONENT}_INCLUDE_PATH_NAMES Scene.h)
+ endif()
+
# Shaders library
if(${component} STREQUAL Shaders)
set(_MAGNUM_${_COMPONENT}_INCLUDE_PATH_NAMES PhongShader.h)
diff --git a/src/AbstractImage.h b/src/AbstractImage.h
index 3dea087db..1a86e4313 100644
--- a/src/AbstractImage.h
+++ b/src/AbstractImage.h
@@ -23,7 +23,7 @@
namespace Magnum {
-/** @ingroup textures
+/**
@brief Non-templated base for one-, two- or three-dimensional images
See Image, BufferedImage, Trade::ImageData documentation for more information.
@@ -44,6 +44,7 @@ class MAGNUM_EXPORT AbstractImage {
*/
/** @brief Color components */
+ /** @todo Support *_INTEGER types */
enum class Components: GLenum {
#ifndef MAGNUM_TARGET_GLES
/**
diff --git a/src/AbstractShaderProgram.cpp b/src/AbstractShaderProgram.cpp
index 4fd606973..47ea3eeb4 100644
--- a/src/AbstractShaderProgram.cpp
+++ b/src/AbstractShaderProgram.cpp
@@ -50,6 +50,11 @@ void AbstractShaderProgram::bindFragmentDataLocation(GLuint location, const std:
glBindFragDataLocation(program, location, name.c_str());
}
+void AbstractShaderProgram::bindFragmentDataLocationIndexed(GLuint location, GLuint index, const std::string& name) {
+ CORRADE_ASSERT(state == Initialized, "AbstractShaderProgram: fragment data location cannot be bound after linking.", );
+
+ glBindFragDataLocationIndexed(program, location, index, name.c_str());
+}
#endif
void AbstractShaderProgram::link() {
diff --git a/src/AbstractShaderProgram.h b/src/AbstractShaderProgram.h
index d15c2aeb9..f50d20040 100644
--- a/src/AbstractShaderProgram.h
+++ b/src/AbstractShaderProgram.h
@@ -25,7 +25,7 @@
namespace Magnum {
-/** @ingroup rendering
+/**
@brief Base class for shaders
@section AbstractShaderProgram-subclassing Subclassing workflow
@@ -39,6 +39,8 @@ typedef Attribute<0, Vector4> Vertex;
typedef Attribute<1, Vector3> Normal;
typedef Attribute<2, Vector2> TextureCoords;
@endcode
+ @todoc Output attribute location (for bindFragmentDataLocationIndexed(),
+ referenced also from Framebuffer::mapDefaultForDraw() / Framebuffer::mapForDraw())
- **Layers for texture uniforms** to which the textures will be bound before
rendering, for example:
@code
@@ -78,22 +80,33 @@ The preferred workflow is to specify attribute location for vertex shader
input attributes and fragment shader output attributes explicitly in the
shader code, e.g.:
@code
+#version 330
+// or #extension GL_ARB_explicit_attrib_location: enable
layout(location = 0) in vec4 vertex;
layout(location = 1) in vec3 normal;
layout(location = 2) in vec2 textureCoords;
@endcode
+Similarly for ouput attributes, you can also specify blend equation color
+index for them (see Framebuffer::BlendFunction for more information about
+using color input index):
+@code
+layout(location = 0, index = 0) out vec4 color;
+layout(location = 1, index = 1) out vec4 ambient;
+@endcode
@requires_gl (for explicit input attribute location instead of using
bindAttributeLocation())
@requires_gl (for explicit output attribute location or using
- bindFragmentDataLocation())
+ bindFragmentDataLocation() / bindFragmentDataLocationIndexed())
@requires_gl30 Extension @extension{EXT,gpu_shader4} (for using
bindFragmentDataLocation())
+@requires_gl33 Extension @extension{ARB,blend_func_extended} (for using
+ bindFragmentDataLocationIndexed())
@requires_gl33 Extension @extension{ARB,explicit_attrib_location} (for
explicit attribute location instead of using bindAttributeLocation())
If you don't have the required extension, you can use functions bindAttributeLocation()
-and bindFragmentDataLocation() between attaching of shaders and linking the
-program:
+and bindFragmentDataLocation() / bindFragmentDataLocationIndexed() between
+attaching the shaders and linking the program:
@code
// Shaders attached...
@@ -101,6 +114,9 @@ bindAttributeLocation(Vertex::Location, "vertex");
bindAttributeLocation(Normal::Location, "normal");
bindAttributeLocation(TextureCoords::Location, "textureCoords");
+bindFragmentDataLocationIndexed(0, 0, "color");
+bindFragmentDataLocationIndexed(1, 1, "ambient");
+
// Link...
@endcode
@@ -108,6 +124,8 @@ bindAttributeLocation(TextureCoords::Location, "textureCoords");
The preferred workflow is to specify texture layers directly in the shader
code, e.g.:
@code
+#version 420
+// or #extension GL_ARB_shading_language_420pack: enable
layout(binding = 0) uniform sampler2D diffuseTexture;
layout(binding = 1) uniform sampler2D specularTexture;
@endcode
@@ -236,8 +254,8 @@ class MAGNUM_EXPORT AbstractShaderProgram {
* @param location Location
* @param name Attribute name
*
- * Binds attribute to location which is be used later for binding
- * vertex buffers. Preferred usage is to
+ * Binds attribute to location which is used later for binding vertex
+ * buffers.
* @note This function should be called after attachShader() calls and
* before link().
* @deprecated Preferred usage is to specify attribute location
@@ -249,16 +267,32 @@ class MAGNUM_EXPORT AbstractShaderProgram {
#ifndef MAGNUM_TARGET_GLES
/**
- * @brief Bind fragment data to given location
+ * @brief Bind fragment data to given location and color input index
* @param location Location
* @param name Fragment output variable name
+ * @param index Blend equation color input index (`0` or `1`)
*
+ * Binds fragment data to location which is used later for framebuffer
+ * operations. See also Framebuffer::BlendFunction for more
+ * information about using color input index.
+ * @requires_gl
+ * @requires_gl33 Extension @extension{ARB,blend_func_extended}
* @note This function should be called after attachShader() calls and
* before link().
* @deprecated Preferred usage is to specify attribute location
* explicitly in the shader instead of using this function. See
* @ref AbstractShaderProgram-attribute-location "class documentation"
* for more information.
+ */
+ void bindFragmentDataLocationIndexed(GLuint location, GLuint index, const std::string& name);
+
+ /**
+ * @brief Bind fragment data to given location and first color input index
+ * @param location Location
+ * @param name Fragment output variable name
+ *
+ * The same as bindFragmentDataLocationIndexed(), but with `index` set
+ * to `0`.
* @requires_gl
* @requires_gl30 Extension @extension{EXT,gpu_shader4}
*/
diff --git a/src/AbstractTexture.h b/src/AbstractTexture.h
index cae04f499..5dd213d17 100644
--- a/src/AbstractTexture.h
+++ b/src/AbstractTexture.h
@@ -24,7 +24,7 @@
namespace Magnum {
-/** @ingroup textures
+/**
@brief Base for textures
@attention Don't forget to call @ref Texture::setWrapping() "setWrapping()",
@@ -122,12 +122,14 @@ class MAGNUM_EXPORT AbstractTexture {
/**
* Red component only. Green and blue are set to `0`, alpha is set
* to `1`.
+ * @requires_gl30 Extension @extension{ARB,texture_rg}
*/
Red,
/**
* Red and green component. Blue is set to `0`, alpha is set to
* `1`.
+ * @requires_gl30 Extension @extension{ARB,texture_rg}
*/
RedGreen,
@@ -145,85 +147,75 @@ class MAGNUM_EXPORT AbstractTexture {
enum class ComponentType {
/**
* (Non-normalized) unsigned byte
- *
* @requires_gl30 Extension @extension{EXT,texture_integer}
*/
UnsignedByte,
/**
* (Non-normalized) byte
- *
* @requires_gl30 Extension @extension{EXT,texture_integer}
*/
Byte,
/**
* (Non-normalized) unsigned short
- *
* @requires_gl30 Extension @extension{EXT,texture_integer}
*/
UnsignedShort,
/**
* (Non-normalized) short
- *
* @requires_gl30 Extension @extension{EXT,texture_integer}
*/
Short,
/**
* (Non-normalized) unsigned integer
- *
* @requires_gl30 Extension @extension{EXT,texture_integer}
*/
UnsignedInt,
/**
* (Non-normalized) integer
- *
* @requires_gl30 Extension @extension{EXT,texture_integer}
*/
Int,
/**
* Half float (16 bit)
- *
* @requires_gl30 Extension @extension{ARB,texture_float}
*/
Half,
/**
* Float (32 bit)
- *
* @requires_gl30 Extension @extension{ARB,texture_float}
*/
Float,
/**
- * Normalized unsigned byte, i.e. values from range
- * @f$ [0; 255] @f$ are converted to range @f$ [0.0; 1.0] @f$.
+ * Normalized unsigned byte, i.e. values from range @f$ [0; 255] @f$
+ * are converted to range @f$ [0.0; 1.0] @f$.
*/
NormalizedUnsignedByte,
/**
- * Normalized byte, i.e. values from range
- * @f$ [-128; 127] @f$ are converted to range @f$ [0.0; 1.0] @f$.
- *
- * @requires_gl31 (no extension providing this functionality)
+ * Normalized signed byte, i.e. values from range @f$ [-128; 127] @f$
+ * are converted to range @f$ [-1.0; 1.0] @f$.
+ * @requires_gl31 Extension @extension{EXT,texture_snorm}
*/
NormalizedByte,
/**
- * Normalized unsigned short, i.e. values from range
- * @f$ [0; 65536] @f$ are converted to range @f$ [0.0; 1.0] @f$.
+ * Normalized unsigned short, i.e. values from range @f$ [0; 65536] @f$
+ * are converted to range @f$ [0.0; 1.0] @f$.
*/
NormalizedUnsignedShort,
/**
- * Normalized short, i.e. values from range
- * @f$ [-32768; 32767] @f$ are converted to range @f$ [0.0; 1.0] @f$.
- *
- * @requires_gl31 (no extension providing this functionality)
+ * Normalized signed short, i.e. values from range @f$ [-32768; 32767] @f$
+ * are converted to range @f$ [-1.0; 1.0] @f$.
+ * @requires_gl31 Extension @extension{EXT,texture_snorm}
*/
NormalizedShort
};
@@ -241,7 +233,7 @@ class MAGNUM_EXPORT AbstractTexture {
* One-component (red channel), unsigned normalized, probably
* 8bit.
* @requires_gl
- * @requires_gl30 (no extension providing this functionality)
+ * @requires_gl30 Extension @extension{ARB,texture_rg}
*/
Red = GL_RED,
@@ -249,7 +241,7 @@ class MAGNUM_EXPORT AbstractTexture {
* Two-component (red and green channel), unsigned normalized,
* each component probably 8bit, 16bit total.
* @requires_gl
- * @requires_gl30 (no extension providing this functionality)
+ * @requires_gl30 Extension @extension{ARB,texture_rg}
*/
RedGreen = GL_RG,
#endif
@@ -365,12 +357,14 @@ class MAGNUM_EXPORT AbstractTexture {
/**
* Compressed red channel, unsigned normalized.
* @requires_gl
+ * @requires_gl30 Extension @extension{ARB,texture_rg}
*/
CompressedRed = GL_COMPRESSED_RED,
/**
* Compressed red and green channel, unsigned normalized.
* @requires_gl
+ * @requires_gl30 Extension @extension{ARB,texture_rg}
*/
CompressedRedGreen = GL_COMPRESSED_RG,
diff --git a/src/Buffer.h b/src/Buffer.h
index 940dcaae5..c76260f3e 100644
--- a/src/Buffer.h
+++ b/src/Buffer.h
@@ -23,7 +23,7 @@
namespace Magnum {
-/** @ingroup rendering
+/**
@brief Class for managing buffers
@todo Support for buffer copying (OpenGL 3.1, @extension{ARB,copy_buffer})
@@ -69,7 +69,10 @@ class Buffer {
*/
PixelUnpack = GL_PIXEL_UNPACK_BUFFER,
- /** Target for pixel pack operations. */
+ /**
+ * Target for pixel pack operations.
+ * @requires_gl
+ */
PixelPack = GL_PIXEL_PACK_BUFFER,
/**
diff --git a/src/BufferedImage.h b/src/BufferedImage.h
index c8efa5181..5489716df 100644
--- a/src/BufferedImage.h
+++ b/src/BufferedImage.h
@@ -16,7 +16,7 @@
*/
/** @file
- * @brief Class Magnum::BufferedImage
+ * @brief Class Magnum::BufferedImage, typedef Magnum::BufferedImage1D, Magnum::BufferedImage2D, Magnum::BufferedImage3D
*/
#include "AbstractImage.h"
@@ -26,10 +26,6 @@
namespace Magnum {
#ifndef MAGNUM_TARGET_GLES
-/** @addtogroup textures
- * @{
- */
-
/**
@brief %Buffered image
@@ -116,8 +112,6 @@ typedef BufferedImage<2> BufferedImage2D;
/** @brief Three-dimensional buffered image */
typedef BufferedImage<3> BufferedImage3D;
-
-/*@}*/
#endif
}
diff --git a/src/BufferedTexture.h b/src/BufferedTexture.h
index fca8f74fc..12f2b05c0 100644
--- a/src/BufferedTexture.h
+++ b/src/BufferedTexture.h
@@ -25,7 +25,7 @@
namespace Magnum {
#ifndef MAGNUM_TARGET_GLES
-/** @ingroup textures
+/**
@brief Buffered texture
This texture is, unlike classic textures such as Texture or CubeMapTexture,
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 026bbcfbe..ee32fe700 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -33,10 +33,8 @@ set(Magnum_SRCS
AbstractTexture.cpp
AbstractShaderProgram.cpp
BufferedTexture.cpp
- Camera.cpp
Framebuffer.cpp
IndexedMesh.cpp
- Light.cpp
Mesh.cpp
Query.cpp
Renderbuffer.cpp
@@ -53,7 +51,6 @@ set(Magnum_HEADERS
BufferedImage.h
BufferedTexture.h
Buffer.h
- Camera.h
Color.h
CubeMapTextureArray.h
CubeMapTexture.h
@@ -61,15 +58,13 @@ set(Magnum_HEADERS
Image.h
ImageWrapper.h
IndexedMesh.h
- Light.h
Magnum.h
Mesh.h
- Object.h
Query.h
Renderbuffer.h
- Scene.h
Shader.h
SizeTraits.h
+ Swizzle.h
Texture.h
TypeTraits.h
@@ -86,10 +81,6 @@ if(NOT CMAKE_NO_OBJECT_TARGET)
add_library(MagnumMathObjects OBJECT ${MagnumMath_SRCS})
endif()
-# Files compiled with different flags for main library and unit test library
-set(Magnum_GracefulAssert_SRCS
- Object.cpp)
-
# Set shared library flags for the objects, as they will be part of shared lib
# TODO: fix when CMake sets target_EXPORTS for OBJECT targets as well
if(NOT CMAKE_NO_OBJECT_TARGET)
@@ -100,13 +91,11 @@ endif()
if(NOT CMAKE_NO_OBJECT_TARGET)
add_library(Magnum SHARED
$
- $
- ${Magnum_GracefulAssert_SRCS})
+ $)
else()
add_library(Magnum SHARED
${Magnum_SRCS}
- ${MagnumMath_SRCS}
- ${Magnum_GracefulAssert_SRCS})
+ ${MagnumMath_SRCS})
endif()
target_link_libraries(Magnum ${CORRADE_UTILITY_LIBRARY} ${CORRADE_PLUGINMANAGER_LIBRARY})
if(NOT TARGET_GLES)
@@ -137,6 +126,10 @@ if(WITH_PRIMITIVES)
add_subdirectory(Primitives)
endif()
+if(WITH_SCENEGRAPH)
+ add_subdirectory(SceneGraph)
+endif()
+
if(WITH_SHADERS)
add_subdirectory(Shaders)
endif()
@@ -147,12 +140,10 @@ if(BUILD_TESTS)
# Library with graceful assert for testing
if(NOT CMAKE_NO_OBJECT_TARGET)
add_library(MagnumTestLib SHARED
- $
- ${Magnum_GracefulAssert_SRCS})
+ $)
else()
add_library(MagnumTestLib SHARED
- ${Magnum_SRCS}
- ${Magnum_GracefulAssert_SRCS})
+ ${Magnum_SRCS})
endif()
set_target_properties(MagnumTestLib PROPERTIES COMPILE_FLAGS -DCORRADE_GRACEFUL_ASSERT)
target_link_libraries(MagnumTestLib ${CORRADE_UTILITY_LIBRARY} ${CORRADE_PLUGINMANAGER_LIBRARY})
diff --git a/src/Camera.cpp b/src/Camera.cpp
deleted file mode 100644
index f15454a27..000000000
--- a/src/Camera.cpp
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- Copyright © 2010, 2011, 2012 Vladimír Vondruš
-
- This file is part of Magnum.
-
- Magnum is free software: you can redistribute it and/or modify
- it under the terms of the GNU Lesser General Public License version 3
- only, as published by the Free Software Foundation.
-
- Magnum is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU Lesser General Public License version 3 for more details.
-*/
-
-#include "Camera.h"
-#include "Framebuffer.h"
-#include "Scene.h"
-
-using namespace std;
-
-namespace Magnum {
-
-Camera::Camera(Object* parent): Object(parent), _aspectRatioPolicy(AspectRatioPolicy::Extend) {}
-
-void Camera::setOrthographic(GLfloat size, GLfloat near, GLfloat far) {
- _near = near;
- _far = far;
-
- /* Scale the volume down so it fits in (-1, 1) in all directions */
- GLfloat xyScale = 2/size;
- GLfloat zScale = 2/(far-near);
- rawProjectionMatrix = Matrix4::scaling({xyScale, xyScale, -zScale});
-
- /* Move the volume on z into (-1, 1) range */
- rawProjectionMatrix = Matrix4::translation(Vector3::zAxis(-1-near*zScale))*rawProjectionMatrix;
-
- fixAspectRatio();
-}
-
-void Camera::setPerspective(GLfloat fov, GLfloat near, GLfloat far) {
- _near = near;
- _far = far;
-
- /* First move the volume on z in (-1, 1) range */
- rawProjectionMatrix = Matrix4::translation(Vector3::zAxis(2*far*near/(far+near)));
-
- /* Then apply magic perspective matrix (with reversed Z) */
- static const Matrix4 a(1.0f, 0.0f, 0.0f, 0.0f,
- 0.0f, 1.0f, 0.0f, 0.0f,
- 0.0f, 0.0f, -1.0f, -1.0f,
- 0.0f, 0.0f, 0.0f, 0.0f);
- rawProjectionMatrix = a*rawProjectionMatrix;
-
- /* Then scale the volume down so it fits in (-1, 1) in all directions */
- GLfloat xyScale = 1/tan(fov/2);
- GLfloat zScale = 1+2*near/(far-near);
- rawProjectionMatrix = Matrix4::scaling({xyScale, xyScale, zScale})*rawProjectionMatrix;
-
- /* And... another magic */
- rawProjectionMatrix[3][3] = 0;
-
- fixAspectRatio();
-}
-
-void Camera::setViewport(const Math::Vector2& size) {
- Framebuffer::setViewport({0, 0}, size);
-
- _viewport = size;
- fixAspectRatio();
-}
-
-void Camera::clean(const Matrix4& absoluteTransformation) {
- Object::clean(absoluteTransformation);
-
- _cameraMatrix = absoluteTransformation.inverted();
-}
-
-void Camera::fixAspectRatio() {
- /* Don't divide by zero */
- if(_viewport.x() == 0 || _viewport.y() == 0) {
- _projectionMatrix = rawProjectionMatrix;
- return;
- }
-
- /* Extend on larger side = scale larger side down */
- if(_aspectRatioPolicy == AspectRatioPolicy::Extend) {
- _projectionMatrix = ((_viewport.x() > _viewport.y()) ?
- Matrix4::scaling({GLfloat(_viewport.y())/_viewport.x(), 1, 1}) :
- Matrix4::scaling({1, GLfloat(_viewport.x())/_viewport.y(), 1})
- )*rawProjectionMatrix;
-
- /* Clip on smaller side = scale smaller side up */
- } else if(_aspectRatioPolicy == AspectRatioPolicy::Clip) {
- _projectionMatrix = ((_viewport.x() > _viewport.y()) ?
- Matrix4::scaling({1, GLfloat(_viewport.x())/_viewport.y(), 1}) :
- Matrix4::scaling({GLfloat(_viewport.y())/_viewport.x(), 1, 1})
- )*rawProjectionMatrix;
-
- /* Don't preserve anything */
- } else _projectionMatrix = rawProjectionMatrix;
-}
-
-void Camera::draw() {
- Scene* s = scene();
- CORRADE_ASSERT(s, "Camera: cannot draw without camera attached to scene", );
-
- Framebuffer::clear();
-
- /* Recursively draw child objects */
- drawChildren(s, cameraMatrix());
-}
-
-void Camera::drawChildren(Object* object, const Matrix4& transformationMatrix) {
- for(set