diff --git a/CMakeLists.txt b/CMakeLists.txt index ba081b807..5b7fec559 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -164,8 +164,8 @@ set(MAGNUM_PLUGINS_AUDIOIMPORTER_INSTALL_DIR ${MAGNUM_PLUGINS_INSTALL_DIR}/audio set(MAGNUM_DATA_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/share/magnum) set(MAGNUM_CMAKE_FIND_MODULE_INSTALL_DIR ${CMAKE_ROOT}/Modules) set(MAGNUM_INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/include/Magnum) -set(MAGNUM_PLUGINS_INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/include/Magnum/Plugins) +set(MAGNUM_EXTERNAL_INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/include/MagnumExternal) +set(MAGNUM_PLUGINS_INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/include/MagnumPlugins) -add_subdirectory(external) add_subdirectory(modules) add_subdirectory(src) diff --git a/Doxyfile b/Doxyfile index 72837b78a..542a114ab 100644 --- a/Doxyfile +++ b/Doxyfile @@ -132,7 +132,9 @@ FULL_PATH_NAMES = YES # relative paths, which will be relative from the directory where doxygen is # started. -STRIP_FROM_PATH = ../ +STRIP_FROM_PATH = ../magnum/src \ + ../magnum-plugins/src \ + ../magnum-integration/src # The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of # the path mentioned in the documentation of a class, which tells @@ -207,11 +209,13 @@ ALIASES = \ "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\"" \ "fn_gl{1}=gl\1()" \ + "fn_gl2{2}=gl\1()" \ "fn_gl_extension{3}=gl\1\2()" \ "fn_gl_extension2{3}=gl\1\2()" \ "fn_gles_extension{3}=gl\1\2()" \ "def_gl{1}=`GL_\1`" \ - "deprecated_gl=@xrefitem deprecated-gl \"Deprecated OpenGL API\" \"Deprecated OpenGL API list\"" \ + "def_gl_extension{3}=GL_\1_\2" \ + "deprecated_gl=@xrefitem opengl-deprecated \"Deprecated OpenGL API\" \"Deprecated OpenGL API list\"" \ "requires_gl30=@xrefitem requires-gl30 \"Requires OpenGL 3.0\" \"Functionality requiring OpenGL 3.0\"" \ "requires_gl31=@xrefitem requires-gl31 \"Requires OpenGL 3.1\" \"Functionality requiring OpenGL 3.1\"" \ "requires_gl32=@xrefitem requires-gl32 \"Requires OpenGL 3.2\" \"Functionality requiring OpenGL 3.2\"" \ @@ -478,7 +482,7 @@ HIDE_SCOPE_NAMES = NO # will put a list of the files that are included by a file in the documentation # of that file. -SHOW_INCLUDE_FILES = NO +SHOW_INCLUDE_FILES = YES # If the FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen # will list include files with double quotes in the documentation @@ -584,7 +588,7 @@ MAX_INITIALIZER_LINES = 30 # at the bottom of the documentation of classes and structs. If set to YES the # list will mention the files that were used to generate the documentation. -SHOW_USED_FILES = YES +SHOW_USED_FILES = NO # Set the SHOW_FILES tag to NO to disable the generation of the Files page. # This will remove the Files entry from the Quick Index and from the @@ -689,11 +693,12 @@ WARN_LOGFILE = # directories like "/usr/src/myproject". Separate the files or directories # with spaces. -INPUT = src/ \ +INPUT = src/Magnum \ + src/MagnumPlugins \ doc/ \ - ../magnum-plugins/src/ \ + ../magnum-plugins/src/MagnumPlugins \ ../magnum-plugins/doc/ \ - ../magnum-integration/src/ \ + ../magnum-integration/src/Magnum \ ../magnum-integration/doc/ \ ../magnum-examples/doc/ diff --git a/DoxygenLayout.xml b/DoxygenLayout.xml new file mode 100644 index 000000000..646da8cdf --- /dev/null +++ b/DoxygenLayout.xml @@ -0,0 +1,194 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doc/building.dox b/doc/building.dox index 3a05ead28..aed528280 100644 --- a/doc/building.dox +++ b/doc/building.dox @@ -139,9 +139,9 @@ available for desktop OpenGL only, see @ref requires-gl. emulation in desktop OpenGL library. Might not be supported in all drivers. The features used can be conveniently detected in depending projects both in -CMake and C++ sources, see @ref cmake and @ref src/Magnum.h for more -information. See also @ref corrade-cmake and @ref src/Corrade.h for additional -information. +CMake and C++ sources, see @ref cmake and @ref Magnum/Magnum.h for more +information. See also @ref corrade-cmake and @ref Corrade/Corrade.h for +additional information. By default the engine is built with nearly everything except Audio library, plugins and application libraries (see below). Using `WITH_*` CMake parameters diff --git a/doc/cmake.dox b/doc/cmake.dox index 7ce68f46e..0624e07d2 100644 --- a/doc/cmake.dox +++ b/doc/cmake.dox @@ -47,7 +47,6 @@ variables: (e.g. set it to `.` when deploying on Windows with plugins stored relatively to the executable), the following `MAGNUM_PLUGINS_*_DIR` variables depend on it. -- `MAGNUM_PLUGINS_INCLUDE_DIR` -- Include dir with plugins - `MAGNUM_PLUGINS_FONT_DIR` -- Directory with font plugins - `MAGNUM_PLUGINS_FONTCONVERTER_DIR` -- Directory with font converter plugins - `MAGNUM_PLUGINS_IMAGECONVERTER_DIR` -- Directory with image converter @@ -135,6 +134,11 @@ are also available as preprocessor variables if including Magnum.h: - `MAGNUM_TARGET_DESKTOP_GLES` -- Defined if compiled with OpenGL ES emulation on desktop OpenGL +If `MAGNUM_BUILD_DEPRECATED` is defined, the `MAGNUM_INCLUDE_DIR` variable also +contains path directly to Magnum directory (i.e. for includes without `Magnum/` +prefix) and `MAGNUM_PLUGINS_INCLUDE_DIR` contains include dir for plugins (i.e. +instead of `MagnumPlugins/` prefix). + %Corrade library provides also its own set of CMake macros and variables, see @ref corrade-cmake "its documentation" for more information. @ref cmake-plugins "Plugins repository" and @ref cmake-integration "Integration library" diff --git a/doc/coding-style.dox b/doc/coding-style.dox index b20bab75d..ceffb19b1 100644 --- a/doc/coding-style.dox +++ b/doc/coding-style.dox @@ -187,7 +187,7 @@ and OpenGL ES version/extension, first come desktop requirements, then ES requirements. All classes and functions using those commands are cross-referenced in page -@ref required-extensions. +@ref opengl-required-extensions. @section unit-tests Unit tests diff --git a/doc/getting-started.dox b/doc/getting-started.dox index 297862778..0e9daef78 100644 --- a/doc/getting-started.dox +++ b/doc/getting-started.dox @@ -85,8 +85,8 @@ repository. Directory `src/` contains the actual project. To keep things simple, the project consists of just one source file with the most minimal code possible: @code -#include -#include +#include +#include using namespace Magnum; @@ -160,9 +160,9 @@ the concepts of graphics programming, we can change clear color to something else and also print basic information about the GPU the engine is running on. First include the needed headers: @code -#include -#include -#include +#include +#include +#include @endcode And in the constructor (which is currently empty) change the clear color and diff --git a/doc/namespaces.dox b/doc/namespaces.dox index 1bd43d68a..94bea4b1f 100644 --- a/doc/namespaces.dox +++ b/doc/namespaces.dox @@ -22,11 +22,8 @@ DEALINGS IN THE SOFTWARE. */ -/** @dir magnum - * @brief %Magnum library - */ -/** @dir magnum/src - * @brief Namespace Magnum +/** @dir magnum/src/Magnum + * @brief Namespace Magnum (part of @ref building "Magnum library") */ /** @namespace Magnum @brief Root namespace @@ -39,7 +36,7 @@ to `${MAGNUM_LIBRARIES}`. See @ref building and @ref cmake for more information. */ -/** @dir Platform +/** @dir Magnum/Platform * @brief Namespace Magnum::Platform */ /** @namespace Magnum::Platform @@ -57,7 +54,7 @@ documentation, @ref building, @ref cmake and @ref platform for more information. */ -/** @dir Math +/** @dir Magnum/Math * @brief Namespace Magnum::Math */ /** @namespace Magnum::Math @@ -71,7 +68,7 @@ to `${MAGNUM_LIBRARIES}`. See @ref building, @ref cmake, @ref matrix-vector and @ref transformations for more information. */ -/** @dir Math/Algorithms +/** @dir Magnum/Math/Algorithms * @brief Namespace Magnum::Math::Algorithms */ /** @namespace Magnum::Math::Algorithms @@ -85,7 +82,7 @@ to `${MAGNUM_LIBRARIES}`. See @ref building and @ref cmake for more information. */ -/** @dir Math/Geometry +/** @dir Magnum/Math/Geometry * @brief Namespace Magnum::Math::Geometry */ /** @namespace Magnum::Math::Geometry @@ -99,7 +96,7 @@ to `${MAGNUM_LIBRARIES}`. See @ref building and @ref cmake for more information. */ -/** @dir Audio +/** @dir Magnum/Audio * @brief Namespace Magnum::Audio */ /** @namespace Magnum::Audio @@ -116,7 +113,7 @@ particular `*Importer` class documentation, @ref building-plugins, @ref cmake-plugins and @ref plugins for more information. */ -/** @dir DebugTools +/** @dir Magnum/DebugTools * @brief Namespace Magnum::DebugTools */ /** @namespace Magnum::DebugTools @@ -130,7 +127,7 @@ package in CMake and link to `${MAGNUM_DEBUGTOOLS_LIBRARIES}`. See @ref building, @ref cmake and @ref debug-tools for more information. */ -/** @dir MeshTools +/** @dir Magnum/MeshTools * @brief Namespace Magnum::MeshTools */ /** @namespace Magnum::MeshTools @@ -144,11 +141,7 @@ package in CMake and link to `${MAGNUM_MESHTOOLS_LIBRARIES}`. See @ref building and @ref cmake for more information. */ -/** @dir Plugins - * @brief Basic plugins - */ - -/** @dir Primitives +/** @dir Magnum/Primitives * @brief Namespace Magnum::Primitives */ /** @namespace Magnum::Primitives @@ -162,7 +155,7 @@ package in CMake and link to `${MAGNUM_PRIMITIVES_LIBRARIES}`. See @ref building and @ref cmake for more information. */ -/** @dir SceneGraph +/** @dir Magnum/SceneGraph * @brief Namespace Magnum::SceneGraph */ /** @@ -177,7 +170,7 @@ package in CMake and link to `${MAGNUM_SCENEGRAPH_LIBRARIES}`. See @ref building, @ref cmake and @ref scenegraph for more information. */ -/** @dir Shaders +/** @dir Magnum/Shaders * @brief Namespace Magnum::Shaders */ /** @namespace Magnum::Shaders @@ -191,7 +184,7 @@ in CMake and link to `${MAGNUM_MESHTOOLS_SHADERS}`. See @ref building and @ref cmake for more information. */ -/** @dir Shapes +/** @dir Magnum/Shapes * @brief Namespace Magnum::Shapes */ /** @namespace Magnum::Shapes @@ -205,7 +198,7 @@ CMake and link to `${MAGNUM_SHAPES_LIBRARIES}`. See @ref building, @ref cmake and @ref shapes for more information. */ -/** @dir Text +/** @dir Magnum/Text * @brief Namespace Magnum::Text */ /** @namespace Magnum::Text @@ -221,7 +214,7 @@ for more information. Additional plugins are enabled separately, see particular @ref cmake-plugins and @ref plugins for more information. */ -/** @dir TextureTools +/** @dir Magnum/TextureTools * @brief Namespace Magnum::TextureTools */ /** @namespace Magnum::TextureTools @@ -235,7 +228,7 @@ package in CMake and link to `${MAGNUM_TEXTURETOOLS_LIBRARIES}`. See @ref building and @ref cmake for more information. */ -/** @dir Trade +/** @dir Magnum/Trade * @brief Namespace Magnum::Trade */ /** @namespace Magnum::Trade @@ -251,3 +244,7 @@ information. Additional plugins are enabled separately, see particular `*Importer` and `*ImageConverter` class documentation, @ref building-plugins, @ref cmake-plugins and @ref plugins for more information. */ + +/** @dir magnum/src/MagnumPlugins + * @brief %Magnum plugins (part of @ref building "Magnum library") + */ diff --git a/doc/opengl-mapping.dox b/doc/opengl-mapping.dox new file mode 100644 index 000000000..a9c6c4b2f --- /dev/null +++ b/doc/opengl-mapping.dox @@ -0,0 +1,390 @@ +/* + This file is part of Magnum. + + Copyright © 2010, 2011, 2012, 2013 Vladimír Vondruš + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. +*/ + +namespace Magnum { + +/** @page opengl-mapping OpenGL command mapping +@brief List of OpenGL commands corresponding to particular %Magnum API. + +@tableofcontents + +Legend: +- *not needed* -- given feature is implemented in a way that makes the + function unnecessary +- *not queryable*, *not supported* -- see @ref opengl-unsupported +- (empty) -- given feature is not yet implemented + +@section opengl-mapping-functions Functions + +OpenGL function | Matching API +-------------------------------------- | ------------ +@fn_gl{ActiveShaderProgram} | | +@fn_gl{ActiveTexture} | @ref AbstractTexture::bind() +@fn_gl{AttachShader} | @ref AbstractShaderProgram::attachShader() +@fn_gl{BeginConditionalRender}, `glEndConditionalRender()` | @ref SampleQuery::beginConditionalRender(), \n @ref SampleQuery::endConditionalRender() +@fn_gl{BeginQuery}, `glEndQuery()` | @ref PrimitiveQuery::begin(), \n @ref SampleQuery::begin(), \n @ref TimeQuery::begin(), \n @ref AbstractQuery::end() +@fn_gl{BeginQueryIndexed}, `glEndQueryIndexed()` | | +@fn_gl{BeginTransformFeedback}, `glEndTransformFeedback()` | | +@fn_gl{BindAttribLocation} | @ref AbstractShaderProgram::bindAttributeLocation() +@fn_gl{BindBuffer} | not needed, handhled internally in @ref Buffer and elsewhere +@fn_gl{BindBufferBase} | | +@fn_gl{BindBufferRange} | | +@fn_gl{BindBuffersBase} | | +@fn_gl{BindBuffersRange} | | +@fn_gl{BindFragDataLocation} | @ref AbstractShaderProgram::bindFragmentDataLocation() +@fn_gl{BindFragDataLocationIndexed} | @ref AbstractShaderProgram::bindFragmentDataLocationIndexed() +@fn_gl{BindFramebuffer} | @ref Framebuffer::bind() +@fn_gl{BindImageTexture} | | +@fn_gl{BindImageTextures} | | +@fn_gl{BindProgramPipeline} | | +@fn_gl{BindRenderbuffer} | not needed, handhled internally in @ref Renderbuffer +@fn_gl{BindSampler} | | +@fn_gl{BindSamplers} | | +@fn_gl{BindTexture}, \n @fn_gl_extension{BindMultiTexture,EXT,direct_state_access} | @ref AbstractTexture::bind() +@fn_gl{BindTextures} | | +@fn_gl{BindTransformFeedback} | | +@fn_gl{BindVertexArray} | not needed, handhled internally in @ref Mesh +@fn_gl{BindVertexBuffer} | | +@fn_gl{BindVertexBuffers} | | +@fn_gl{BlendColor} | @ref Renderer::setBlendColor() +@fn_gl{BlendEquation}, \n @fn_gl{BlendEquationSeparate} | @ref Renderer::setBlendEquation() +@fn_gl{BlendFunc}, \n @fn_gl{BlendFuncSeparate} | @ref Renderer::setBlendFunction() +@fn_gl{BlitFramebuffer} | @ref AbstractFramebuffer::blit() +@fn_gl{BufferData}, \n @fn_gl_extension{NamedBufferData,EXT,direct_state_access} | @ref Buffer::setData() +@fn_gl{BufferStorage} | | +@fn_gl{BufferSubData}, \n @fn_gl_extension{NamedBufferSubData,EXT,direct_state_access} | @ref Buffer::setSubData() +@fn_gl{CheckFramebufferStatus}, \n @fn_gl_extension{CheckNamedFramebufferStatus,EXT,direct_state_access} | @ref DefaultFramebuffer::checkStatus(), \n @ref Framebuffer::checkStatus() +@fn_gl{ClampColor} | | +@fn_gl{Clear} | @ref AbstractFramebuffer::clear() +@fn_gl{ClearBuffer} | | +@fn_gl{ClearBufferData} | | +@fn_gl{ClearBufferSubData} | | +@fn_gl{ClearColor} | @ref Renderer::setClearColor() +@fn_gl{ClearDepth} | @ref Renderer::setClearDepth() +@fn_gl{ClearStencil} | @ref Renderer::setClearStencil() +@fn_gl{ClearTexImage} | | +@fn_gl{ClearTexSubImage} | | +@fn_gl{ClientWaitSync} | | +@fn_gl{ColorMask} | @ref Renderer::setColorMask() +@fn_gl{CompileShader} | @ref Shader::compile() +@fn_gl{CompressedTexImage1D}, \n @fn_gl{CompressedTexImage2D}, \n @fn_gl{CompressedTexImage3D} | | +@fn_gl{CompressedTexSubImage1D}, \n @fn_gl{CompressedTexSubImage2D}, \n @fn_gl{CompressedTexSubImage3D} | | +@fn_gl{CopyBufferSubData}, \n @fn_gl_extension{NamedCopyBufferSubData,EXT,direct_state_access} | @ref Buffer::copy() +@fn_gl{CopyImageSubData} | | +@fn_gl{CopyTexImage1D}, \n @fn_gl{CopyTexImage2D} | | +@fn_gl{CopyTexSubImage1D}, \n @fn_gl{CopyTexSubImage2D}, \n @fn_gl{CopyTexSubImage3D} | | +@fn_gl{CreateProgram}, @fn_gl{DeleteProgram} | @ref AbstractShaderProgram constructor and destructor +@fn_gl{CreateShader}, @fn_gl{DeleteShader} | @ref Shader constructor and destructor +@fn_gl{CreateShaderProgram} | | +@fn_gl{CullFace} | @ref Renderer::setFaceCullingMode() +@fn_gl{DebugMessageCallback} | @ref DebugMessage::setCallback() +@fn_gl{DebugMessageControl} | | +@fn_gl{DebugMessageInsert}, \n @fn_gl_extension2{InsertEventMarker,EXT,debug_marker}, \n @fn_gl_extension{StringMarker,GREMEDY,string_marker} | @ref DebugMessage::insert() +@fn_gl{DepthFunc} | @ref Renderer::setDepthFunction() +@fn_gl{DepthMask} | @ref Renderer::setDepthMask() +@fn_gl{DepthRange} | | +@fn_gl{DepthRangeArray} | | +@fn_gl{DepthRangeIndexed} | | +@fn_gl{DetachShader} | | +@fn_gl{DispatchCompute} | | +@fn_gl{DispatchComputeIndirect} | | +@fn_gl{DrawArrays}, \n @fn_gl{DrawElements}, \n @fn_gl{DrawRangeElements} | @ref Mesh::draw() +@fn_gl{DrawArraysIndirect}, \n @fn_gl{DrawArraysInstanced}, \n @fn_gl{DrawArraysInstancedBaseInstance}, \n @fn_gl{DrawElementsBaseVertex}, \n @fn_gl{DrawElementsIndirect}, \n @fn_gl{DrawElementsInstanced}, \n @fn_gl{DrawElementsInstancedBaseInstance}, \n @fn_gl{DrawElementsInstancedBaseVertex}, \n @fn_gl{DrawElementsInstancedBaseVertexBaseInstance}, \n @fn_gl{DrawRangeElementsBaseVertex} | | +@fn_gl{DrawBuffer}, \n @fn_gl_extension{FramebufferDrawBuffers,EXT,direct_state_access}, \n @fn_gl{DrawBuffers}, \n @fn_gl_extension{FramebufferDrawBuffers,EXT,direct_state_access} | @ref DefaultFramebuffer::mapForDraw(), \n @ref Framebuffer::mapForDraw() +@fn_gl{DrawTransformFeedback}, \n @fn_gl{DrawTransformFeedbackInstanced}, \n @fn_gl{DrawTransformFeedbackStream}, \n @fn_gl{DrawTransformFeedbackStreamInstanced} | | +@fn_gl{Enable}, `glDisable()` | @ref Renderer::setFeature() +@fn_gl{EnableVertexAttribArray}, \n @fn_gl_extension{EnableVertexArrayAttrib,EXT,direct_state_access} \n @fn_gl2{DisableVertexAttribArray,EnableVertexAttribArray}, \n @fn_gl_extension{DisableVertexArrayAttrib,EXT,direct_state_access} | @ref Mesh::addVertexBuffer() +@fn_gl{FenceSync}, @fn_gl{DeleteSync} | | +@fn_gl{Finish} | @ref Renderer::finish() +@fn_gl{Flush} | @ref Renderer::flush() +@fn_gl{FlushMappedBufferRange}, \n @fn_gl_extension{FlushMappedNamedBufferRange,EXT,direct_state_access} | @ref Buffer::flushMappedRange() +@fn_gl2{FramebufferParameter,FramebufferParameteri} | | +@fn_gl{FramebufferRenderbuffer}, \n @fn_gl_extension{NamedFramebufferRenderbuffer,EXT,direct_state_access} | @ref Framebuffer::attachRenderbuffer() +@fn_gl{FramebufferTexture} | | +@fn_gl2{FramebufferTexture1D,FramebufferTexture}, \n @fn_gl_extension{NamedFramebufferTexture1D,EXT,direct_state_access} | @ref Framebuffer::attachTexture1D() +@fn_gl2{FramebufferTexture2D,FramebufferTexture}, \n @fn_gl_extension{NamedFramebufferTexture2D,EXT,direct_state_access} | @ref Framebuffer::attachTexture2D() +@fn_gl2{FramebufferTexture3D,FramebufferTexture}, \n @fn_gl_extension{NamedFramebufferTexture3D,EXT,direct_state_access} | @ref Framebuffer::attachTexture3D() +@fn_gl{FramebufferTextureLayer} | | +@fn_gl{FrontFace} | @ref Renderer::setFrontFace() +@fn_gl{GenBuffers}, @fn_gl{DeleteBuffers} | @ref Buffer constructor and destructor +@fn_gl{GenFramebuffers}, @fn_gl{DeleteFramebuffers} | @ref Framebuffer constructor and destructor +@fn_gl{GenProgramPipelines}, @fn_gl{DeleteProgramPipelines} | | +@fn_gl{GenQueries}, @fn_gl{DeleteQueries} | @ref AbstractQuery constructor and destructor +@fn_gl{GenRenderbuffers}, @fn_gl{DeleteRenderbuffers} | @ref Renderbuffer constructor and destructor +@fn_gl{GenSamplers}, @fn_gl{DeleteSamplers} | | +@fn_gl{GenTextures}, @fn_gl{DeleteTextures} | @ref AbstractTexture constructor and destructor +@fn_gl{GenTransformFeedbacks}, @fn_gl{DeleteTransformFeedbacks} | | +@fn_gl{GenVertexArrays}, @fn_gl{DeleteVertexArrays} | @ref Mesh constructor and destructor +@fn_gl{GenerateMipmap}, \n @fn_gl_extension{GenerateTextureMipmap,EXT,direct_state_access} | @ref AbstractTexture::generateMipmap() +@fn_gl{Get} | see @ref opengl-mapping-state "table below" +@fn_gl2{GetActiveAtomicCounterBuffer,GetActiveAtomicCounterBufferiv} | not queryable +@fn_gl{GetActiveAttrib}, \n @fn_gl{GetActiveSubroutineName}, \n @fn_gl{GetActiveSubroutineUniform}, \n @fn_gl{GetActiveSubroutineUniformName}, \n @fn_gl{GetActiveUniform}, \n @fn_gl{GetActiveUniformBlock}, \n @fn_gl{GetActiveUniformBlockName}, \n @fn_gl{GetActiveUniformName}, \n @fn_gl{GetActiveUniforms} | not queryable +@fn_gl{GetAttachedShaders} | not queryable, @ref AbstractShaderProgram::attachShader() setter only +@fn_gl{GetAttribLocation} | not queryable, @ref AbstractShaderProgram::bindAttributeLocation() setter only +@fn_gl{GetBufferParameter}, \n @fn_gl_extension{GetNamedBufferParameter,EXT,direct_state_access} | @ref Buffer::size() +@fn_gl2{GetBufferPointer,GetBufferPointerv} | not queryable, @ref Buffer::map() setter only +@fn_gl{GetBufferSubData}, \n @fn_gl_extension{GetNamedBufferSubData,EXT,direct_state_access} | @ref Buffer::data(), \n @ref Buffer::subData() +@fn_gl{GetCompressedTexImage} | | +@fn_gl{GetDebugMessageLog} | | +@fn_gl{GetError} | @ref Renderer::error() +@fn_gl{GetFragDataIndex}, @fn_gl{GetFragDataLocation} | not queryable, @ref AbstractShaderProgram::bindFragmentDataLocation() and \n @ref AbstractShaderProgram::bindFragmentDataLocationIndexed() setters only +@fn_gl{GetFramebufferAttachmentParameter} | not queryable, @ref Framebuffer setters only +@fn_gl{GetFramebufferParameter} | not queryable, @ref DefaultFramebuffer and \n @ref Framebuffer setters only +@fn_gl_extension{GetGraphicsResetStatus,ARB,robustness} | @ref Renderer::graphicsResetStatus() +@fn_gl{GetInternalformat} | | +@fn_gl{GetMultisample} | | +@fn_gl{GetObjectLabel}, \n @fn_gl{GetObjectPtrLabel} | not queryable, @ref AbstractShaderProgram::setLabel(), \n @ref AbstractQuery::setLabel(), \n @ref AbstractTexture::setLabel(), \n @ref Buffer::setLabel(), \n @ref Framebuffer::setLabel(), \n @ref Mesh::setLabel(), \n @ref Renderbuffer::setLabel() and \n @ref Shader::setLabel() setters only +@fn_gl{GetProgram}, \n @fn_gl{GetProgramInfoLog} | @ref AbstractShaderProgram::link(), \n @ref AbstractShaderProgram::validate() +@fn_gl{GetProgramBinary} | | +@fn_gl{GetProgramInterface} | | +@fn_gl{GetProgramPipeline} | | +@fn_gl{GetProgramPipelineInfoLog} | | +@fn_gl{GetProgramResource} | | +@fn_gl{GetProgramResourceIndex} | | +@fn_gl{GetProgramResourceLocation} | | +@fn_gl{GetProgramResourceLocationIndex}| | +@fn_gl{GetProgramResourceName} | | +@fn_gl{GetProgramStage} | | +@fn_gl{GetQueryIndexed} | | +@fn_gl{GetQueryObject} | @ref AbstractQuery::result() +@fn_gl2{GetQuery,GetQueryiv} | | +@fn_gl{GetRenderbufferParameter} | not queryable, @ref Renderbuffer::setStorage() and \n @ref Renderbuffer::setStorageMultisample() setter only +@fn_gl{GetSamplerParameter} | | +@fn_gl{GetShader}, \n @fn_gl{GetShaderInfoLog} | @ref Shader::compile() +@fn_gl{GetShaderPrecisionFormat} | | +@fn_gl{GetShaderSource} | not queryable but tracked in @ref Shader::sources() +@fn_gl{GetString} | @ref Context::supportedExtensions(), \n @ref Context::rendererString(), \n @ref Context::shadingLanguageVersionString(), \n @ref Context::vendorString(), \n @ref Context::versionString() +@fn_gl{GetSubroutineIndex} | | +@fn_gl{GetSubroutineUniformLocation} | | +@fn_gl{GetSync} | | +@fn_gl{GetTexImage}, \n @fn_gl_extension{GetTextureImage,EXT,direct_state_access}, \n @fn_gl_extension{GetnTexImage,ARB,robustness} | @ref Texture::image(), \n @ref CubeMapTexture::image(), \n @ref CubeMapTextureArray::image() +@fn_gl{GetTexLevelParameter}, \n @fn_gl_extension{GetTextureLevelParameter,EXT,direct_state_access} | @ref Texture::imageSize(), \n @ref CubeMapTexture::imageSize(), \n @ref CubeMapTextureArray::imageSize() +@fn_gl{GetTexParameter} | | +@fn_gl{GetTransformFeedbackVarying} | | +@fn_gl{GetUniform} | not queryable, @ref AbstractShaderProgram::setUniform() setter only +@fn_gl{GetUniformBlockIndex} | | +@fn_gl{GetUniformIndices} | | +@fn_gl{GetUniformLocation} | @ref AbstractShaderProgram::uniformLocation() +@fn_gl{GetUniformSubroutine} | | +@fn_gl{GetVertexAttrib} | not queryable, @ref Mesh::addVertexBuffer() setter only +@fn_gl{InvalidateBufferData} | @ref Buffer::invalidateData() +@fn_gl{InvalidateBufferSubData} | @ref Buffer::invalidateSubData() +@fn_gl{InvalidateFramebuffer}, \n @fn_gles_extension{DiscardFramebuffer,EXT,discard_framebuffer} | @ref DefaultFramebuffer::invalidate(), \n @ref Framebuffer::invalidate() +@fn_gl{InvalidateSubFramebuffer}, \n @fn_gles_extension{DiscardSubFramebuffer,EXT,discard_framebuffer} | @ref DefaultFramebuffer::invalidate(), \n @ref Framebuffer::invalidate() +@fn_gl{InvalidateTexImage} | @ref AbstractTexture::invalidateImage() +@fn_gl{InvalidateTexSubImage} | @ref Texture::invalidateSubImage(),\n @ref CubeMapTexture::invalidateSubImage(), \n @ref CubeMapTextureArray::invalidateSubImage() +@fn_gl{IsBuffer}, \n @fn_gl{IsFramebuffer}, \n @fn_gl{IsProgram}, \n @fn_gl{IsProgramPipeline}, \n @fn_gl{IsQuery}, \n @fn_gl{IsRenderbuffer}, \n @fn_gl{IsSampler}, \n @fn_gl{IsShader}, \n @fn_gl{IsSync}, \n @fn_gl{IsTexture}, \n @fn_gl{IsTransformFeedback}, \n @fn_gl{IsVertexArray} | not needed, objects are strongly typed +@fn_gl{IsEnabled} | not queryable, @ref Renderer::setFeature() setter only +@fn_gl{LineWidth} | @ref Renderer::setLineWidth() +@fn_gl{LinkProgram} | @ref AbstractShaderProgram::link() +@fn_gl{LogicOp} | @ref Renderer::setLogicOperation() +@fn_gl{MapBuffer}, `glUnmapBuffer()`, \n @fn_gl_extension{MapNamedBuffer,EXT,direct_state_access}, @fn_gl_extension{UnmapNamedBuffer,EXT,direct_state_access}, \n @fn_gl{MapBufferRange}, \n @fn_gl_extension{MapNamedBufferRange,EXT,direct_state_access} | @ref Buffer::map(), @ref Buffer::unmap() +@fn_gl_extension{MapBufferSubData,CHROMIUM,map_sub}, @fn_gl_extension{UnmapBufferSubData,CHROMIUM,map_sub} | @ref Buffer::mapSub(), @ref Buffer::unmapSub() +@fn_gl{MemoryBarrier} | | +@fn_gl{MinSampleShading} | | +@fn_gl{MultiDrawArrays}, \n @fn_gl{MultiDrawArraysIndirect}, \n @fn_gl{MultiDrawElements}, \n @fn_gl{MultiDrawElementsBaseVertex}, \n @fn_gl{MultiDrawElementsIndirect} | | +@fn_gl{ObjectLabel}, \n @fn_gl{ObjectPtrLabel}, \n @fn_gl_extension2{LabelObject,EXT,debug_label} | @ref AbstractShaderProgram::setLabel(), \n @ref AbstractQuery::setLabel(), \n @ref AbstractTexture::setLabel(), \n @ref Buffer::setLabel(), \n @ref Framebuffer::setLabel(), \n @ref Mesh::setLabel(), \n @ref Renderbuffer::setLabel(), \n @ref Shader::setLabel() +@fn_gl{PatchParameter} | | +@fn_gl{PauseTransformFeedback}, @fn_gl{ResumeTransformFeedback} | | +@fn_gl{PixelStore} | | +@fn_gl{PointParameter} | | +@fn_gl{PointSize} | @ref Renderer::setPointSize() +@fn_gl{PolygonMode} | @ref Renderer::setPolygonMode() +@fn_gl{PolygonOffset} | @ref Renderer::setPolygonOffset() +@fn_gl{PrimitiveRestartIndex} | | +@fn_gl{ProgramBinary} | | +@fn_gl{ProgramParameter} | @ref AbstractShaderProgram::setRetrievableBinary(), \n @ref AbstractShaderProgram::setSeparable() +@fn_gl{ProvokingVertex} | @ref Renderer::setProvokingVertex() +@fn_gl{PushDebugGroup}, @fn_gl{PopDebugGroup} | | +@fn_gl{QueryCounter} | @ref TimeQuery::timestamp() +@fn_gl{ReadBuffer}, \n @fn_gl_extension{FramebufferReadBuffer,EXT,direct_state_access} | @ref DefaultFramebuffer::mapForRead(), \n @ref Framebuffer::mapForRead() +@fn_gl{ReadPixels}, \n @fn_gl_extension{ReadnPixels,ARB,robustness} | @ref DefaultFramebuffer::read(), \n @ref Framebuffer::read() +@fn_gl{ReleaseShaderCompiler} | | +@fn_gl{RenderbufferStorage}, \n @fn_gl_extension{NamedRenderbufferStorage,EXT,direct_state_access} | @ref Renderbuffer::setStorage() +@fn_gl{RenderbufferStorageMultisample}, \n @fn_gl_extension{NamedRenderbufferStorageMultisample,EXT,direct_state_access} | @ref Renderbuffer::setStorageMultisample() +@fn_gl{SampleCoverage} | | +@fn_gl{SampleMaski} | | +@fn_gl{SamplerParameter} | | +@fn_gl{Scissor} | @ref Renderer::setScissor() +@fn_gl{ScissorArray} | | +@fn_gl{ScissorIndexed} | | +@fn_gl{ShaderBinary} | | +@fn_gl{ShaderSource} | @ref Shader::addFile(), \n @ref Shader::addSource() +@fn_gl{ShaderStorageBlockBinding} | | +@fn_gl{StencilFunc}, \n @fn_gl{StencilFuncSeparate} | @ref Renderer::setStencilFunction() +@fn_gl{StencilMask}, \n @fn_gl{StencilMaskSeparate} | @ref Renderer::setStencilMask() +@fn_gl{StencilOp}, \n @fn_gl{StencilOpSeparate} | @ref Renderer::setStencilOperation() +@fn_gl{TexBuffer}, \n @fn_gl_extension{TextureBuffer,EXT,direct_state_access}, \n @fn_gl{TexBufferRange}, \n @fn_gl_extension{TextureBufferRange,EXT,direct_state_access} | @ref BufferTexture::setBuffer() +@fn_gl{TexImage1D}, \n @fn_gl_extension{TextureImage1D,EXT,direct_state_access} \n @fn_gl{TexImage2D}, \n @fn_gl_extension{TextureImage2D,EXT,direct_state_access}, \n @fn_gl{TexImage3D}, \n @fn_gl_extension{TextureImage3D,EXT,direct_state_access} | @ref Texture::setImage(), \n @ref CubeMapTexture::setImage(), \n @ref CubeMapTextureArray::setImage() +@fn_gl{TexImage2DMultisample}, \n @fn_gl{TexImage3DMultisample} | | +@fn_gl{TexParameter}, \n @fn_gl_extension{TextureParameter,EXT,direct_state_access} | @ref AbstractTexture::setMinificationFilter(), \n @ref AbstractTexture::setMagnificationFilter(), \n @ref AbstractTexture::setBorderColor(), \n @ref AbstractTexture::setMaxAnisotropy(), \n @ref Texture::setWrapping(), \n @ref CubeMapTexture::setWrapping(), \n @ref CubeMapTextureArray::setWrapping() +@fn_gl{TexStorage1D}, \n @fn_gl_extension{TextureStorage1D,EXT,direct_state_access}, \n @fn_gl{TexStorage2D}, \n @fn_gl_extension{TextureStorage2D,EXT,direct_state_access}, \n @fn_gl{TexStorage3D}, \n @fn_gl_extension{TextureStorage3D,EXT,direct_state_access} | @ref Texture::setStorage(), \n @ref CubeMapTexture::setStorage(), \n @ref CubeMapTextureArray::setStorage() +@fn_gl{TexStorage2DMultisample}, \n @fn_gl{TexStorage3DMultisample} | | +@fn_gl{TexSubImage1D}, \n @fn_gl_extension{TextureSubImage1D,EXT,direct_state_access}, \n @fn_gl{TexSubImage2D}, \n @fn_gl_extension{TextureSubImage2D,EXT,direct_state_access}, \n @fn_gl{TexSubImage3D}, \n @fn_gl_extension{TextureSubImage3D,EXT,direct_state_access} | @ref Texture::setSubImage(), \n @ref CubeMapTexture::setSubImage(), \n @ref CubeMapTextureArray::setSubImage() +@fn_gl{TextureView} | | +@fn_gl{TransformFeedbackVaryings} | | +@fn_gl{Uniform}, \n @fn_gl{ProgramUniform}, \n @fn_gl_extension{ProgramUniform,EXT,direct_state_access} | @ref AbstractShaderProgram::setUniform() +@fn_gl{UniformBlockBinding} | | +@fn_gl{UniformSubroutines} | | +@fn_gl{UseProgram} | @ref AbstractShaderProgram::use() +@fn_gl{UseProgramStages} | | +@fn_gl{ValidateProgram} | @ref AbstractShaderProgram::validate() +@fn_gl{ValidateProgramPipeline} | | +@fn_gl{VertexAttrib} | not supported (@ref opengl-unsupported "details") +@fn_gl{VertexAttribBinding} | | +@fn_gl{VertexAttribDivisor} | | +@fn_gl{VertexAttribFormat} | | +@fn_gl{VertexAttribPointer}, \n @fn_gl_extension{VertexArrayVertexAttribOffset,EXT,direct_state_access} | @ref Mesh::addVertexBuffer() +@fn_gl{VertexBindingDivisor} | | +@fn_gl{Viewport} | @ref DefaultFramebuffer::setViewport(), \n @ref Framebuffer::setViewport() +@fn_gl{ViewportArray} | | +@fn_gl{ViewportIndexed} | | +@fn_gl{WaitSync} | | + +@section opengl-mapping-state Limit and state queries + +@todo Things marked only as *not queryable* should have at least setter + +@fn_gl{Get} parameter | Matching API +-------------------------------------- | ------------ +@def_gl{ACTIVE_TEXTURE}, \n @def_gl{TEXTURE_BINDING_1D_ARRAY}, \n @def_gl{TEXTURE_BINDING_1D}, \n @def_gl{TEXTURE_BINDING_2D_ARRAY}, \n @def_gl{TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY}, \n @def_gl{TEXTURE_BINDING_2D_MULTISAMPLE}, \n @def_gl{TEXTURE_BINDING_2D} , \n @def_gl{TEXTURE_BINDING_3D}, \n @def_gl{TEXTURE_BINDING_BUFFER}, \n @def_gl{TEXTURE_BINDING_BUFFER}, \n @def_gl{TEXTURE_BINDING_CUBE_MAP}, \n @def_gl{TEXTURE_BINDING_RECTANGLE} | not queryable but tracked internally +@def_gl{ALIASED_LINE_WIDTH_RANGE} | | +@def_gl{ARRAY_BUFFER_BINDING}, \n @def_gl{DISPATCH_INDIRECT_BUFFER_BINDING}, \n @def_gl{ELEMENT_ARRAY_BUFFER_BINDING}, \n @def_gl{PIXEL_PACK_BUFFER_BINDING}, \n @def_gl{PIXEL_UNPACK_BUFFER_BINDING} | not queryable but tracked internally +@def_gl{BLEND_COLOR} | not queryable, @ref Renderer::setBlendColor() setter only +@def_gl{BLEND_DST_ALPHA}, \n @def_gl{BLEND_DST_RGB}, \n @def_gl{BLEND_SRC_ALPHA}, \n @def_gl{BLEND_SRC_RGB} | not queryable, @ref Renderer::setBlendFunction() setter only +@def_gl{BLEND_EQUATION_ALPHA}, \n @def_gl{BLEND_EQUATION_RGB} | not queryable, @ref Renderer::setBlendEquation() setter only +@def_gl{BLEND}, \n @def_gl{COLOR_LOGIC_OP}, \n @def_gl{CULL_FACE}, \n @def_gl{DEBUG_OUTPUT}, \n @def_gl{DEBUG_OUTPUT_SYNCHRONOUS}, \n @def_gl{DEPTH_CLAMP}, \n @def_gl{DEPTH_TEST}, \n @def_gl{DITHER}, \n @def_gl{MULTISAMPLE}, \n @def_gl{POLYGON_OFFSET_FILL}, \n @def_gl{POLYGON_OFFSET_LINE}, \n @def_gl{POLYGON_OFFSET_POINT}, \n @def_gl{PROGRAM_POINT_SIZE}, \n @def_gl{SCISSOR}, \n @def_gl{TEXTURE_CUBE_MAP_SEAMLESS}, \n @def_gl{STENCIL_TEST} | not queryable, @ref Renderer::setFeature() setter only +@def_gl{COLOR_CLEAR_VALUE}, \n @def_gl{DEPTH_CLEAR_VALUE}, \n @def_gl{STENCIL_CLEAR_VALUE} | not queryable, @ref Renderer::setClearColor(), \n @ref Renderer::setClearDepth() and \n @ref Renderer::setClearStencil() setters only +@def_gl{COLOR_WRITEMASK}, \n @def_gl{DEPTH_WRITEMASK}, \n @def_gl{STENCIL_BACK_WRITEMASK}, \n @def_gl{STENCIL_WRITEMASK} | not queryable, @ref Renderer::setColorMask(), \n @ref Renderer::setDepthMask() and \n @ref Renderer::setStencilMask() setters only +@def_gl{COMPRESSED_TEXTURE_FORMATS} | | +@def_gl{CONTEXT_FLAGS} | @ref Context::flags() +@def_gl{CURRENT_PROGRAM} | not queryable but tracked internally +@def_gl{DEBUG_GROUP_STACK_DEPTH} | | +@def_gl{DEPTH_FUNC} | not queryable, @ref Renderer::setDepthFunction() setter only +@def_gl{DEPTH_RANGE} | not queryable +@def_gl{DOUBLEBUFFER}, \n @def_gl{STEREO} | | +@def_gl{DRAW_BUFFERi}, \n @def_gl{DRAW_BUFFER}, \n @def_gl{READ_BUFFER} | not queryable, @ref DefaultFramebuffer::mapForDraw(), \n @ref DefaultFramebuffer::mapForRead(), \n @ref Framebuffer::mapForDraw() and \n @ref Framebuffer::mapForRead() setters only +@def_gl{DRAW_FRAMEBUFFER_BINDING}, \n @def_gl{READ_FRAMEBUFFER_BINDING} | not queryable but tracked internally +@def_gl{FRAGMENT_SHADER_DERIVATIVE_HINT}, \n @def_gl{LINE_SMOOTH_HINT}, \n @def_gl{POLYGON_SMOOTH_HINT}, \n @def_gl{TEXTURE_COMPRESSION_HINT} | not queryable +@def_gl{IMPLEMENTATION_COLOR_READ_FORMAT} | | +@def_gl{IMPLEMENTATION_COLOR_READ_TYPE} | | +@def_gl{LAYER_PROVOKING_VERTEX} | | +@def_gl{LINE_SMOOTH}, \n @def_gl{POLYGON_SMOOTH} | not supported (@ref opengl-unsupported "details") +@def_gl{LINE_WIDTH_GRANULARITY}, \n @def_gl{LINE_WIDTH_RANGE} | | +@def_gl{LINE_WIDTH} | not queryable, @ref Renderer::setLineWidth() setter only +@def_gl{LOGIC_OP_MODE} | not queryable, @ref Renderer::setLogicOperation() setter only +@def_gl{MAJOR_VERSION}, \n @def_gl{MINOR_VERSION} | @ref Context::version() +`GL_MAX_*_ATOMIC_COUNTER_BUFFERS`, \n @def_gl{MAX_COMBINED_ATOMIC_COUNTER_BUFFERS} | @ref Shader::maxAtomicCounterBuffers(), \n @ref Shader::maxCombinedAtomicCounterBuffers() +`GL_MAX_*_ATOMIC_COUNTERS`, \n @def_gl{MAX_COMBINED_ATOMIC_COUNTERS} | @ref Shader::maxAtomicCounters(), \n @ref Shader::maxCombinedAtomicCounters() +`GL_MAX_*_IMAGE_UNIFORMS`, \n @def_gl{MAX_COMBINED_IMAGE_UNIFORMS} | @ref Shader::maxImageUniforms(), \n @ref Shader::maxCombinedImageUniforms() +`GL_MAX_*_SHADER_STORAGE_BLOCKS`, \n @def_gl{MAX_COMBINED_SHADER_STORAGE_BLOCKS} | @ref Shader::maxShaderStorageBlocks(), \n @ref Shader::maxCombinedShaderStorageBlocks() +`GL_MAX_*_TEXTURE_IMAGE_UNITS`, \n @def_gl{MAX_TEXTURE_IMAGE_UNITS}, \n @def_gl{MAX_COMBINED_TEXTURE_IMAGE_UNITS} | @ref Shader::maxTextureImageUnits(), \n @ref Shader::maxCombinedTextureImageUnits() +`GL_MAX_*_UNIFORM_BLOCKS`, \n @def_gl{MAX_COMBINED_UNIFORM_BLOCKS} | @ref Shader::maxUniformBlocks(), \n @ref Shader::maxCombinedUniformBlocks() +`GL_MAX_*_UNIFORM_COMPONENTS`, \n @def_gl{MAX_VERTEX_UNIFORM_VECTORS}, \n @def_gl{MAX_FRAGMENT_UNIFORM_VECTORS} | @ref Shader::maxUniformComponents() +`GL_MAX_COMBINED_*_UNIFORM_COMPONENTS` | @ref Shader::maxCombinedUniformComponents() +@def_gl{MAX_3D_TEXTURE_SIZE}, \n @def_gl{MAX_ARRAY_TEXTURE_LAYERS}, \n @def_gl{MAX_CUBE_MAP_TEXTURE_SIZE}, \n @def_gl{MAX_RECTANGLE_TEXTURE_SIZE}, \n @def_gl{MAX_TEXTURE_SIZE} | | +@def_gl{MAX_ATOMIC_COUNTER_BUFFER_SIZE} | @ref AbstractShaderProgram::maxAtomicCounterBufferSize() +@def_gl{MAX_ATOMIC_COUNTER_BUFFER_BINDINGS} | @ref Buffer::maxAtomicCounterBindings() +@def_gl{MAX_COLOR_ATTACHMENTS} | @ref Framebuffer::maxColorAttachments() +@def_gl{MAX_COMBINED_SHADER_OUTPUT_RESOURCES} | @ref AbstractShaderProgram::maxCombinedShaderOutputResources() +@def_gl{MAX_COMPUTE_SHARED_MEMORY_SIZE} | @ref AbstractShaderProgram::maxComputeSharedMemorySize() +@def_gl{MAX_COMPUTE_WORK_GROUP_COUNT} | | +@def_gl{MAX_COMPUTE_WORK_GROUP_INVOCATIONS} | @ref AbstractShaderProgram::maxComputeWorkGroupInvocations() +@def_gl{MAX_COMPUTE_WORK_GROUP_SIZE} | | +@def_gl{MAX_DEBUG_LOGGED_MESSAGES} | @ref DebugMessage::maxLoggedMessages() +@def_gl{MAX_DEBUG_MESSAGE_LENGTH} | @ref DebugMessage::maxMessageLength() +@def_gl{MAX_DEBUG_GROUP_STACK_DEPTH} | | +@def_gl{MAX_CLIP_DISTANCES} | | +@def_gl{MAX_COLOR_TEXTURE_SAMPLES}, \n @def_gl{MAX_DEPTH_TEXTURE_SAMPLES}, \n @def_gl{MAX_INTEGER_SAMPLES} | @ref AbstractTexture::maxColorSamples(), \n @ref AbstractTexture::maxDepthSamples(), \n @ref AbstractTexture::maxIntegerSamples() +@def_gl{MAX_DRAW_BUFFERS} | @ref AbstractFramebuffer::maxDrawBuffers() +@def_gl{MAX_DUAL_SOURCE_DRAW_BUFFERS} | @ref AbstractFramebuffer::maxDualSourceDrawBuffers() +@def_gl{MAX_ELEMENTS_INDICES} | @ref Mesh::maxElementsIndices() +@def_gl{MAX_ELEMENTS_VERTICES} | @ref Mesh::maxElementsVertices() +@def_gl{MAX_ELEMENT_INDEX} | | +@def_gl{MAX_FRAMEBUFFER_HEIGHT} | | +@def_gl{MAX_FRAMEBUFFER_LAYERS} | | +@def_gl{MAX_FRAMEBUFFER_SAMPLES} | | +@def_gl{MAX_FRAMEBUFFER_WIDTH} | | +@def_gl{MAX_FRAGMENT_INPUT_COMPONENTS}, \n @def_gl{MAX_GEOMETRY_INPUT_COMPONENTS}, \n @def_gl{MAX_GEOMETRY_OUTPUT_COMPONENTS}, \n @def_gl{MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS}, \n @def_gl{MAX_TESS_CONTROL_INPUT_COMPONENTS}, \n @def_gl{MAX_TESS_CONTROL_OUTPUT_COMPONENTS}, \n @def_gl{MAX_TESS_CONTROL_TOTAL_OUTPUT_COMPONENTS}, \n @def_gl{MAX_TESS_EVALUATION_INPUT_COMPONENTS}, \n @def_gl{MAX_TESS_EVALUATION_OUTPUT_COMPONENTS}, \n @def_gl{MAX_VERTEX_OUTPUT_COMPONENTS}, \n @def_gl{MAX_VARYING_COMPONENTS}, \n @def_gl{MAX_VARYING_FLOATS}, \n @def_gl{MAX_VARYING_VECTORS} | @ref Shader::maxFragmentInputComponents(), \n @ref Shader::maxGeometryInputComponents(), \n @ref Shader::maxGeometryOutputComponents(), \n @ref Shader::maxGeometryTotalOutputComponents(), \n @ref Shader::maxTessellationControlInputComponents(), \n @ref Shader::maxTessellationControlOutputComponents(), \n @ref Shader::maxTessellationControlTotalOutputComponents(), \n @ref Shader::maxTessellationEvaluationInputComponents(), \n @ref Shader::maxTessellationEvaluationOutputComponents(), \n @ref Shader::maxVertexOutputComponents() +@def_gl{MAX_IMAGE_SAMPLES} | @ref AbstractShaderProgram::maxImageSamples() +@def_gl{MAX_IMAGE_UNITS} | @ref AbstractShaderProgram::maxImageUnits() +@def_gl{MAX_LABEL_LENGTH} | @ref AbstractObject::maxLabelLength() +@def_gl{MAX_RENDERBUFFER_SIZE} | @ref Renderbuffer::maxSize() +@def_gl{MAX_SAMPLE_MASK_WORDS} | | +@def_gl{MAX_SERVER_WAIT_TIMEOUT} | | +@def_gl{MAX_SHADER_STORAGE_BLOCK_SIZE} | @ref AbstractShaderProgram::maxShaderStorageBlockSize() +@def_gl{MAX_SHADER_STORAGE_BUFFER_BINDINGS} | @ref Buffer::maxShaderStorageBindings() +@def_gl{MAX_TEXTURE_BUFFER_SIZE} | | +@def_gl_extension{MAX_TEXTURE_MAX_ANISOTROPY,EXT,texture_filter_anisotropic} | @ref Sampler::maxMaxAnisotropy() +@def_gl{MAX_TEXTURE_LOD_BIAS} | | +@def_gl{MAX_UNIFORM_BLOCK_SIZE} | @ref AbstractShaderProgram::maxUniformBlockSize() +@def_gl{MAX_UNIFORM_BUFFER_BINDINGS} | @ref Buffer::maxUniformBindings() +@def_gl{MAX_UNIFORM_LOCATIONS} | @ref AbstractShaderProgram::maxUniformLocations() +@def_gl{MAX_VERTEX_ATTRIBS} | @ref AbstractShaderProgram::maxVertexAttributes() +@def_gl{MAX_VERTEX_ATTRIB_BINDINGS} | @ref Buffer::maxVertexAttributeBindings() +@def_gl{MAX_VERTEX_ATTRIB_RELATIVE_OFFSET} | | +@def_gl{MAX_VIEWPORTS} | | +@def_gl{MAX_VIEWPORT_DIMS} | @ref AbstractFramebuffer::maxViewportSize() +@def_gl{MIN_MAP_BUFFER_ALIGNMENT} | @ref Buffer::minMapAlignment() +@def_gl{MIN_PROGRAM_TEXEL_OFFSET}, \n @def_gl{MAX_PROGRAM_TEXEL_OFFSET} | @ref AbstractShaderProgram::minTexelOffset(), \n @ref AbstractShaderProgram::maxTexelOffset() +@def_gl{NUM_COMPRESSED_TEXTURE_FORMATS} | | +@def_gl{NUM_EXTENSIONS} | @ref Context::supportedExtensions() +@def_gl{NUM_PROGRAM_BINARY_FORMATS}, \n @def_gl{PROGRAM_BINARY_FORMATS} | | +@def_gl{NUM_SHADER_BINARY_FORMATS}, \n @def_gl{SHADER_BINARY_FORMATS} | | +@def_gl{PACK_ALIGNMENT}, \n @def_gl{PACK_IMAGE_HEIGHT}, \n @def_gl{PACK_LSB_FIRST}, \n @def_gl{PACK_ROW_LENGTH}, \n @def_gl{PACK_SKIP_IMAGES}, \n @def_gl{PACK_SKIP_PIXELS}, \n @def_gl{PACK_SKIP_ROWS}, \n @def_gl{PACK_SWAP_BYTES}, \n @def_gl{UNPACK_ALIGNMENT}, \n @def_gl{UNPACK_IMAGE_HEIGHT}, \n @def_gl{UNPACK_LSB_FIRST}, \n @def_gl{UNPACK_ROW_LENGTH}, \n @def_gl{UNPACK_SKIP_IMAGES}, \n @def_gl{UNPACK_SKIP_PIXELS}, \n @def_gl{UNPACK_SKIP_ROWS}, \n @def_gl{UNPACK_SWAP_BYTES} | not queryable +@def_gl{POINT_FADE_THRESHOLD_SIZE} | | +@def_gl{POINT_SIZE_GRANULARITY}, \n @def_gl{POINT_SIZE_RANGE} | | +@def_gl{POINT_SIZE} | not queryable, @ref Renderer::setPointSize() setter only +@def_gl{POLYGON_OFFSET_FACTOR}, \n @def_gl{POLYGON_OFFSET_UNITS} | not queryable, @ref Renderer::setPolygonOffset() setter only +@def_gl{PRIMITIVE_RESTART_INDEX} | not queryable +@def_gl{PROGRAM_PIPELINE_BINDING} | not queryable +@def_gl{PROVOKING_VERTEX} | not queryable, @ref Renderer::setProvokingVertex() setter only +@def_gl{RENDERBUFFER_BINDING} | not queryable but tracked internally +@def_gl{SAMPLER_BINDING} | not queryable +@def_gl{SAMPLES} | @ref Renderbuffer::maxSamples() +@def_gl{SAMPLE_BUFFERS} | | +@def_gl{SAMPLE_COVERAGE_INVERT}, \n @def_gl{SAMPLE_COVERAGE_VALUE} | | +@def_gl{SCISSOR_BOX} | not queryable, @ref Renderer::setScissor() setter only +@def_gl{SHADER_COMPILER} | not supported (@ref opengl-unsupported "details") +@def_gl{SHADER_STORAGE_BUFFER_BINDING}, \n @def_gl{SHADER_STORAGE_BUFFER_SIZE}, \n @def_gl{SHADER_STORAGE_BUFFER_START} | not queryable +@def_gl{SHADER_STORAGE_BUFFER_OFFSET_ALIGNMENT} | @ref Buffer::shaderStorageOffsetAlignment() +@def_gl{SMOOTH_LINE_WIDTH_GRANULARITY}, \n @def_gl{SMOOTH_LINE_WIDTH_RANGE} | | +@def_gl{STENCIL_BACK_FUNC}, \n @def_gl{STENCIL_BACK_REF}, \n @def_gl{STENCIL_BACK_VALUE_MASK}, \n @def_gl{STENCIL_FUNC}, \n @def_gl{STENCIL_REF}, \n @def_gl{STENCIL_VALUE_MASK} | not queryable, @ref Renderer::setStencilFunction() setter only +@def_gl{STENCIL_BACK_FAIL}, \n @def_gl{STENCIL_BACK_PASS_DEPTH_FAIL}, \n @def_gl{STENCIL_BACK_PASS_DEPTH_PASS}, \n @def_gl{STENCIL_FAIL}, \n @def_gl{STENCIL_PASS_DEPTH_FAIL}, \n @def_gl{STENCIL_PASS_DEPTH_PASS} | not queryable, @ref Renderer::setStencilOperation() setter only +@def_gl{SUBPIXEL_BITS} | | +@def_gl{TEXTURE_BUFFER_OFFSET_ALIGNMENT} | @ref BufferTexture::offsetAlignment() +@def_gl{TIMESTAMP} | | +@def_gl{TRANSFORM_FEEDBACK_BUFFER_BINDING}, \n @def_gl{TRANSFORM_FEEDBACK_BUFFER_SIZE}, \n @def_gl{TRANSFORM_FEEDBACK_BUFFER_START} | not queryable +@def_gl{UNIFORM_BUFFER_OFFSET_ALIGNMENT} | | +@def_gl{UNIFORM_BUFFER_BINDING}, \n @def_gl{UNIFORM_BUFFER_SIZE}, \n @def_gl{UNIFORM_BUFFER_START} | not queryable +@def_gl{VERTEX_BINDING_DIVISOR}, \n @def_gl{VERTEX_BINDING_OFFSET}, \n @def_gl{VERTEX_BINDING_STRIDE} | not queryable +@def_gl{VERTEX_PROGRAM_POINT_SIZE} | not queryable +@def_gl{VIEWPORT_BOUNDS_RANGE} | | +@def_gl{VIEWPORT_INDEX_PROVOKING_VERTEX} | | +@def_gl{VIEWPORT_SUBPIXEL_BITS} | | +@def_gl{VIEWPORT} | not queryable but tracked in @ref AbstractFramebuffer::viewport() + +*/ + +} diff --git a/doc/opengl-support.dox b/doc/opengl-support.dox new file mode 100644 index 000000000..948d2874c --- /dev/null +++ b/doc/opengl-support.dox @@ -0,0 +1,342 @@ +/* + This file is part of Magnum. + + Copyright © 2010, 2011, 2012, 2013 Vladimír Vondruš + + 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. +*/ + +/** @page opengl-support OpenGL support state +@brief List of (un)supported OpenGL features and extensions. + +@tableofcontents + +@section opengl-support-state OpenGL implementation state + +The extension implementation is considered complete if all its defined types, +functions and enum values are exposed through the API, except for features +listed below in @ref opengl-unsupported-features. + +@subsection opengl-support-21 OpenGL 2.1 + +The core subset of OpenGL 2.1 should be fully implemented, except for the +following: + +- Pixel store state (@fn_gl{PixelStore} function) +- Compressed texture upload +- Proxy textures +- Copying framebuffer to texture (@fn_gl{CopyTexImage2D} etc.) +- Some forgotten limit queries + +@subsection opengl-support-30 OpenGL 3.0 + +@todo @extension{APPLE,flush_buffer_range} doesn't add anything to @extension{ARB,map_buffer_range} +@todo @extension{EXT,texture_array} overlaps with @extension{ARB,framebuffer_object} + +%Extension | Status +-------------------------------------------- | ------ +@extension{APPLE,flush_buffer_range} | done (GL 3.0 subset) +@extension{APPLE,vertex_array_object} | done (GL 3.0 subset) +@extension{ARB,map_buffer_range} | done +@extension{ARB,color_buffer_float} | | +@extension{ARB,half_float_pixel} | done +@extension{ARB,texture_float} | done +@extension{ARB,depth_buffer_float} | done +@extension{ARB,texture_rg} | done +@extension{ARB,framebuffer_object} | missing texture layer attachments +@extension{EXT,gpu_shader4} | done +@extension{EXT,packed_float} | done +@extension{EXT,texture_array} | missing texture layer attachments +@extension{EXT,texture_compression_rgtc} | done +@extension{EXT,texture_shared_exponent} | done +@extension{EXT,framebuffer_sRGB} | | +@extension{EXT,draw_buffers2} | | +@extension{EXT,texture_integer} | missing integer color specification functions +@extension{EXT,transform_feedback} | | +@extension{NV,half_float} | done (GL 3.0 subset) +@extension{NV,depth_buffer_float} | | +@extension{NV,conditional_render} | done + +@subsection opengl-support-31 OpenGL 3.1 + +%Extension | Status +-------------------------------------------- | ------ +@extension{ARB,texture_rectangle} | missing limit query +@extension{ARB,draw_instanced} | | +@extension{ARB,texture_buffer_object} | missing limit query +@extension{ARB,uniform_buffer_object} | | +@extension{ARB,copy_buffer} | done +@extension{EXT,texture_snorm} | done +@extension{NV,primitive_restart} | | + +@subsection opengl-support-32 OpenGL 3.2 + +%Extension | Status +-------------------------------------------- | ------ +@extension{ARB,geometry_shader4} | done (GL 3.2 subset) +@extension{ARB,depth_clamp} | done +@extension{ARB,draw_elements_base_vertex} | | +@extension{ARB,fragment_coord_conventions} | done (shading language only) +@extension{ARB,provoking_vertex} | done +@extension{ARB,seamless_cube_map} | done +@extension{ARB,sync} | | +@extension{ARB,texture_multisample} | | +@extension{ARB,vertex_array_bgra} | done + +@subsection opengl-support-33 OpenGL 3.3 + +%Extension | Status +-------------------------------------------- | ------ +@extension{ARB,instanced_arrays} | | +@extension{ARB,blend_func_extended} | missing limit query +@extension{ARB,explicit_attrib_location} | done (shading language only) +@extension{ARB,occlusion_query2} | done +@extension{ARB,sampler_objects} | | +@extension{ARB,shader_bit_encoding} | done (shading language only) +@extension{ARB,texture_rgb10_a2ui} | done +@extension{ARB,texture_swizzle} | | +@extension{ARB,timer_query} | missing direct query +@extension{ARB,vertex_type_2_10_10_10_rev} | done + +@subsection opengl-support-40 OpenGL 4.0 + +%Extension | Status +-------------------------------------------- | ------ +@extension{ARB,draw_buffers_blend} | | +@extension{ARB,sample_shading} | | +@extension{ARB,texture_cube_map_array} | done +@extension{ARB,texture_gather} | missing limit queries +@extension{ARB,texture_query_lod} | done (shading language only) +@extension{ARB,draw_indirect} | | +@extension{ARB,gpu_shader5} | missing limit queries +@extension{ARB,gpu_shader_fp64} | done +@extension{ARB,shader_subroutine} | | +@extension{ARB,tessellation_shader} | missing some limit queries and patch parameter specification function +@extension{ARB,texture_buffer_object_rgb32} | done +@extension{ARB,transform_feedback2} | | +@extension{ARB,transform_feedback3} | | + +@subsection opengl-support-41 OpenGL 4.1 + +%Extension | Status +-------------------------------------------- | ------ +@extension{ARB,ES2_compatibility} | only float depth clear +@extension{ARB,get_program_binary} | | +@extension{ARB,separate_shader_objects} | | +@extension{ARB,shader_precision} | done (shading language only) +@extension{ARB,vertex_attrib_64bit} | done +@extension{ARB,viewport_array} | | + +@subsection opengl-support-42 OpenGL 4.2 + +%Extension | Status +-------------------------------------------- | ------ +@extension{ARB,texture_compression_bptc} | done +@extension{ARB,base_instance} | | +@extension{ARB,shading_language_420pack} | done (shading language only) +@extension{ARB,transform_feedback_instanced} | | +@extension{ARB,compressed_texture_pixel_storage} | | +@extension{ARB,conservative_depth} | done (shading language only) +@extension{ARB,internalformat_query} | | +@extension{ARB,map_buffer_alignment} | done +@extension{ARB,shader_atomic_counters} | | +@extension{ARB,shader_image_load_store} | | +@extension{ARB,shading_language_packing} | done (shading language only) +@extension{ARB,texture_storage} | done + +@subsection opengl-support-43 OpenGL 4.3 + +%Extension | Status +-------------------------------------------- | ------ +@extension{ARB,arrays_of_arrays} | done (shading language only) +@extension{ARB,ES3_compatibility} | only conservative sample query +@extension{ARB,clear_buffer_object} | | +@extension{ARB,compute_shader} | | +@extension{ARB,copy_image} | | +@extension{KHR,debug} (also in ES) | missing log control and retrieval, sync, pipeline, transform feedback and sampler label and debug groups +@extension{ARB,explicit_uniform_location} | done +@extension{ARB,fragment_layer_viewport} | done (shading language only) +@extension{ARB,framebuffer_no_attachments} | | +@extension{ARB,internalformat_query2} | | +@extension{ARB,invalidate_subdata} | done +@extension{ARB,multi_draw_indirect} | | +@extension{ARB,program_interface_query} | | +@extension{ARB,robust_buffer_access_behavior} | done (nothing to do) +@extension{ARB,shader_image_size} | done (shading language only) +@extension{ARB,shader_storage_buffer_object} | only limit queries +@extension{ARB,stencil_texturing} | | +@extension{ARB,texture_buffer_range} | done +@extension{ARB,texture_query_levels} | done (shading language only) +@extension{ARB,texture_storage_multisample} | | +@extension{ARB,texture_view} | | +@extension{ARB,vertex_attrib_binding} | | + +@subsection opengl-support-44 OpenGL 4.4 + +%Extension | Status +-------------------------------------------- | ------ +@extension{ARB,buffer_storage} | | +@extension{ARB,clear_texture} | | +@extension{ARB,enhanced_layouts} | done (shading language only) +@extension{ARB,multi_bind} | | +@extension{ARB,query_buffer_object} | | +@extension{ARB,texture_mirror_clamp_to_edge} | done +@extension{ARB,texture_stencil8} | done +@extension{ARB,vertex_type_10f_11f_11f_rev} | | + +@subsection opengl-support-extensions OpenGL extensions + +%Extension | Status +-------------------------------------------- | ------ +@extension{AMD,vertex_shader_layer} | done (shading language only) +@extension{AMD,shader_trinary_minmax} | done (shading language only) +@extension{ARB,robustness} | done +@extension{ATI,texture_mirror_once} | done (GL 4.4 subset) +@extension{EXT,texture_filter_anisotropic} (also in ES) | done +@extension{EXT,texture_mirror_clamp} | only GL 4.4 subset +@extension{EXT,direct_state_access} | done for implemented functionality +@extension2{EXT,debug_label} (also in ES) | missing pipeline, transform feedback and sampler label +@extension2{EXT,debug_marker} (also in ES) | missing marker groups +@extension{GREMEDY,string_marker} | done + +@subsection opengl-support-es20 OpenGL ES 2.0 + +Features that have their equivalents implemented in desktop version are +supported. + +@subsection opengl-support-es30 OpenGL ES 3.0 + +Features that have their equivalents implemented in desktop version are +supported. + +@subsection opengl-support-es30-extensions OpenGL ES 2.0 extensions to match ES 3.0 functionality + +%Extension | Status +-------------------------------------------- | ------ +@es_extension{ANGLE,framebuffer_blit} | done +@es_extension{ANGLE,framebuffer_multisample} | done +@es_extension{ANGLE,depth_texture} | done +@es_extension{APPLE,framebuffer_multisample} | done (ES 3.0 subset) +@es_extension{ARM,rgba8} | done +@es_extension{EXT,texture_type_2_10_10_10_REV} | done +@es_extension{EXT,discard_framebuffer} | done +@es_extension2{EXT,blend_minmax,blend_minmax} | done +@es_extension{EXT,occlusion_query_boolean} | done +@es_extension{EXT,texture_rg} | done +@es_extension{EXT,texture_storage} | done +@es_extension{EXT,map_buffer_range} | done +@es_extension{NV,draw_buffers} | done +@es_extension{NV,fbo_color_attachments} | done +@es_extension{NV,read_buffer} | done +@es_extension{NV,framebuffer_blit} | done +@es_extension{NV,framebuffer_multisample} | done +@es_extension{OES,depth24} | done +@es_extension{OES,element_index_uint} | done +@es_extension{OES,rgb8_rgba8} | done (desktop-compatible subset) +@es_extension2{OES,texture_half_float_linear,OES_texture_float_linear} | done +@es_extension{OES,texture_float_linear} | done +@es_extension2{OES,texture_half_float,OES_texture_float} | done +@es_extension{OES,texture_float} | done +@es_extension{OES,vertex_half_float} | done +@es_extension{OES,packed_depth_stencil} | done +@es_extension{OES,depth_texture} | done +@es_extension{OES,standard_derivatives} | done +@es_extension{OES,vertex_array_object} | done +@es_extension{OES,required_internalformat} | done (desktop-compatible subset) +@es_extension{OES,surfaceless_context} | done + +@subsection opengl-support-es-extensions OpenGL ES extensions to match desktop functionality + +Only extensions not already listed in above tables are included here. + +%Extension | Status +-------------------------------------------- | ------ +@es_extension{APPLE,texture_format_BGRA8888} | done +@es_extension{CHROMIUM,map_sub} | only buffer mapping +@es_extension{EXT,texture_format_BGRA8888} | done +@es_extension{EXT,read_format_bgra} | done +@es_extension{EXT,disjoint_timer_query} | only time elapsed query +@es_extension{EXT,separate_shader_objects} | | +@es_extension{EXT,sRGB} | done +@es_extension{EXT,multisampled_render_to_texture} | only renderbuffer storage +@es_extension{EXT,robustness} | done +@es_extension2{NV,read_buffer_front,NV_read_buffer} | done +@es_extension2{NV,read_depth,NV_read_depth_stencil} | done +@es_extension2{NV,read_stencil,NV_read_depth_stencil} | done +@es_extension{NV,read_depth_stencil} | done +@es_extension{NV,texture_border_clamp} | done +@es_extension{OES,depth32} | done +@es_extension{OES,mapbuffer} | done +@es_extension{OES,stencil1} | done +@es_extension{OES,stencil4} | done +@es_extension{OES,texture_3D} | missing limit query + +@section opengl-unsupported Unsupported OpenGL features + +Some functionality, which is either soon-to-be deprecated or isn't proven to +add any performance gains, is not supported in %Magnum. See also +@ref opengl-deprecated. + +@subsection opengl-unsupported-features Unsupported features + +- State queries (various `glIs*()`, `glGet*()` functions) are not supported. + %Magnum API is designed to prevent the need for majority of them, many of + them are tracked internally to avoid redundant state changes and in many + cases it is easier to set the state to some value rather than query it and + then decide on the result. For detailed state introspection please use + external debugger (such as ApiTrace), which is more convenient to use than + manual queries. Queries of implementation-defined values (various limits + etc.) and queries of generated values (buffer data, texture data) are + supported. +- Line and polygon smoothing (`GL_LINE_SMOOTH`, `GL_POLYGON_SMOOTH`) and + related functions are not supported, as the driver might do it in software + with serious performance drops. Multisampling is far superior solution. +- Fixed precision data types (`GL_FIXED` in OpenGL ES) are not supported, as + they occupy the same memory as floats and they aren't faster than floats on + current hardware anymore. +- Shader compiler is assumed to be present (`GL_SHADER_COMPILER` returning + true), as all desktop GL implementations and also ES3 are required to + support it. +- Querying shader attribute locations (as opposed to setting them) is not + supported, as newer GL versions encourage setting them explicitly in shader + code. +- Direct vertex data specification (as opposed to using buffers) is not + supported, as it encourages bad practices. + +@subsection opengl-unsupported-extensions Unsupported extensions + +- @extension{INTEL,map_texture} negatively affects texture access performance. + Combination of buffer mapping and pixel buffers might be of the same or + better performance, without affecting texture access speed. +- @extension{NV,draw_texture} can be done with framebuffer blitting and + doesn't make any full-screen postprocessing easier, as shaders are excluded. + +*/ + +/** @page opengl-deprecated Deprecated OpenGL API list + +See also @ref opengl-unsupported and @ref deprecated. + +*/ + +/** @page deprecated Deprecated list + +See also @ref opengl-deprecated. + +*/ diff --git a/doc/required-extensions.dox b/doc/opengl.dox similarity index 71% rename from doc/required-extensions.dox rename to doc/opengl.dox index 8761f2254..8f6b5e392 100644 --- a/doc/required-extensions.dox +++ b/doc/opengl.dox @@ -22,21 +22,28 @@ DEALINGS IN THE SOFTWARE. */ -/** @page required-extensions Functionality requiring specific OpenGL version or extensions -@brief List of functions not available on OpenGL 2.1 / OpenGL ES 2. +/** @page opengl OpenGL +@brief State of OpenGL support, version and extension requirements. -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 -GPUs), unless stated otherwise. OpenGL ES is also supported. +The following table maps OpenGL function names to %Magnum API, useful for +developers with existing OpenGL background. Note that, as reverse mapping, each +function documentation also contains list of OpenGL functions used. -@see @ref building, @ref cmake, @ref MAGNUM_TARGET_GLES, - @ref MAGNUM_TARGET_GLES2 +- @subpage opengl-mapping + +State of implementation of particular OpenGL versions and extensions is in the +following table. + +- @subpage opengl-support -Following are lists of functionality requiring specific OpenGL version. In -most cases it is also specified which extension is required for given -functionality, so if given hardware supports required extension, it doesn't -need to have required OpenGL version too (e.g. `APPLE_vertex_array_object` is -supported on Intel GPUs even if they are capable of OpenGL 2.1 only). +@section opengl-required-extensions Version and extension requirements + +The engine requires at least OpenGL 2.1 or OpenGL ES 2.0, but some specific +functionality has greater requirements. Following are lists of features +requiring specific OpenGL version. In most cases it is also specified which +extension is required, so if given hardware supports required extension, it +doesn't need to have required OpenGL version too (e.g. `APPLE_vertex_array_object` +is supported on older Intel GPUs even if they are capable of OpenGL 2.1 only). - @subpage requires-gl30 - @subpage requires-gl31 @@ -52,7 +59,9 @@ supported on Intel GPUs even if they are capable of OpenGL 2.1 only). - @subpage requires-gles20 - @subpage requires-gles30 - @subpage requires-es-extension -- @subpage unsupported + +@see @ref building, @ref cmake, @ref MAGNUM_TARGET_GLES, + @ref MAGNUM_TARGET_GLES2 @page requires-gl30 Functionality requiring OpenGL 3.0 @page requires-gl31 Functionality requiring OpenGL 3.1 @@ -69,7 +78,7 @@ supported on Intel GPUs even if they are capable of OpenGL 2.1 only). @page requires-gl Functionality requiring desktop OpenGL (not available on OpenGL ES) @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 on desktop or ES 3.0) @see @ref MAGNUM_TARGET_GLES2 @page requires-gles30 Functionality requiring OpenGL ES 3.0 diff --git a/doc/portability.dox b/doc/portability.dox index 1596e55d0..c697221fe 100644 --- a/doc/portability.dox +++ b/doc/portability.dox @@ -107,7 +107,7 @@ advantage of some extensions and enable faster code paths if given extension is available, but also have proper fallback when it's not, see for example @ref AbstractShaderProgram-performance-optimization "AbstractShaderProgram", @ref AbstractTexture-performance-optimization "AbstractTexture" or -@ref Mesh-performance-optimization "Mesh". See also @ref required-extensions. +@ref Mesh-performance-optimization "Mesh". See also @ref opengl-required-extensions. @section portability-shaders Writing portable shaders @@ -145,8 +145,8 @@ void main() { It is often desirable to query extension presence based on actually used GLSL version -- while the extension might be supported in the driver, it might not be available in given GLSL version (e.g. causing compilation errors). You can -use @ref Context::isExtensionSupported(Version) to check that the extension -is present in given version: +use @ref Context::isExtensionSupported(Version) const to check that the +extension is present in given version: @code if(!Context::instance()->isExtensionSupported(version)) { bindAttributeLocation(Position::Location, "position"); diff --git a/doc/tips.dox b/doc/tips.dox index 3931ccd7f..c1407728e 100644 --- a/doc/tips.dox +++ b/doc/tips.dox @@ -30,5 +30,7 @@ namespace Magnum { - @subpage portability -- @copybrief portability - @subpage best-practices -- @copybrief best-practices - @subpage compilation-speedup -- @copybrief compilation-speedup +- @subpage troubleshooting -- @copybrief troubleshooting + */ } diff --git a/doc/troubleshooting.dox b/doc/troubleshooting.dox new file mode 100644 index 000000000..81897e5a2 --- /dev/null +++ b/doc/troubleshooting.dox @@ -0,0 +1,93 @@ +/* + This file is part of Magnum. + + Copyright © 2010, 2011, 2012, 2013 Vladimír Vondruš + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. +*/ + +namespace Magnum { +/** @page troubleshooting Troubleshooting + +@brief Various tricks to overcome to common building and rendering issues. + +@section troubleshooting-building Building issues + +If your project suddenly stops building after %Magnum upgrade, check these +things: + +- If the building fails on CMake step, be sure that you have up-to-date + `FindCorrade.cmake`, `FindMagnum.cmake` and other CMake modules in your + project (`FindSDL2.cmake`). They are contained in `modules/` directory of + %Magnum sources (and sources of other projects) also are installed into + `share/cmake/Magnum`. +- In some cases when the changes done to build system are too drastic, + recreating the build dir or clearing CMake cache is needed, but this is + a very rare occasion. +- The library is constantly evolving, thus some API might get deprecated over + time (and later removed). Either build the libraries with `BUILD_DEPRECATED` + or switch to non-deprecated features. See @ref building for more + information. + +@section troubleshooting-rendering Rendering issues + +If you are experiencing so-called "black screen of death", you might want to +try these things: + +- Verify that @ref Renderer::error() "no OpenGL error was emitted". +- Check that you use only extensions that are + @ref Context::isExtensionSupported() "available on your system". +- Check that you didn't exceed any implementation-defined limit (see + `magnum-info` output for list of all of them). +- Enable @ref DebugMessage "debug output" to see more detailed errors, + warnings and performance hints. +- If using framebuffer objects, @ref Framebuffer::checkStatus() "check that they are complete". +- Change @ref Renderer::setClearColor() "framebuffer clear color" to + something else than black to verify that at least something is drawn. +- If nothing is drawn, use @ref PrimitiveQuery to check that at least some + primitives were generated. Use @ref SampleQuery to check whether fragments + were drawn. +- Verify that the mesh is properly set up -- nonzero vertex/index count, + matching type in buffer and @ref Mesh::addVertexBuffer() "vertex specification", + properly set up @ref Mesh::setIndexBuffer() "index buffer" and index count + for indexed mesh. If you specified index range, be sure that all indices + fall into it, otherwise you would get undefined behavior. +- Try disabling @ref Renderer::Feature::DepthTest "depth test", + @ref Renderer::Feature::FaceCulling "face culling" and other renderer + features that might affect the fragments. +- Verify that your projection and transformation matrix is properly set up -- + try drawing points instead of triangles, to see if they are at least at + proper places. +- @ref AbstractShaderProgram::validate() "Validate the shader", check that + all used uniforms and attributes have proper locations. Try reducing it + until it is able to draw something, possibly also with some simpler mesh. + +@section troubleshooting-debugging Debugging rendering + +- Enable @ref DebugMessage "debug output" to see additional performance hints + and implementation-dependent information. +- Use @ref TimeQuery to find hot spots in the rendering code. +- @ref DebugMessage::insert() "Mark relevant parts of code" to find them + easier in the debugger. +- Use ApiTrace to trace the program call by call, verify buffer and texture + contents, vertex binding and count of generated primitives, rendered + fragments and time spent in various calls. + +*/ +} diff --git a/doc/unsupported.dox b/doc/unsupported.dox deleted file mode 100644 index e4e371880..000000000 --- a/doc/unsupported.dox +++ /dev/null @@ -1,62 +0,0 @@ -/* - This file is part of Magnum. - - Copyright © 2010, 2011, 2012, 2013 Vladimír Vondruš - - 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. -*/ - -/** @page unsupported Unsupported OpenGL features - -Some functionality, which is either soon-to-be deprecated or isn't proven to -add any performance gains, is not supported in %Magnum. See also @ref deprecated-gl. - -@section unsupported-features Unsupported features - -- Line and polygon smoothing (`GL_LINE_SMOOTH`, `GL_POLYGON_SMOOTH`) and - related functions are not supported, as the driver might do it in software - with serious performance drops. Multisampling is far superior solution. -- Fixed precision data types (`GL_FIXED` in OpenGL ES) are not supported, as - they occupy the same memory as floats and they aren't faster than floats on - current hardware anymore. -- Shader compiler is assumed to be present (`GL_SHADER_COMPILER` returning - true), as all desktop GL implementations and also ES3 are required to - support it. - -@section unsupported-extensions Unsupported extensions - -- @extension{INTEL,map_texture} negatively affects texture access performance. - Combination of buffer mapping and pixel buffers might be of the same or - better performance, without affecting texture access speed. -- @extension{NV,draw_texture} can be done with framebuffer blitting and - doesn't make any full-screen postprocessing easier, as shaders are excluded. - -*/ - -/** @page deprecated-gl Deprecated OpenGL API list - -See also @ref unsupported and @ref deprecated. - -*/ - -/** @page deprecated Deprecated list - -See also @ref deprecated-gl. - -*/ diff --git a/modules/FindCorrade.cmake b/modules/FindCorrade.cmake index 286b1f638..55a532b23 100644 --- a/modules/FindCorrade.cmake +++ b/modules/FindCorrade.cmake @@ -43,6 +43,10 @@ # Native Client with `glibc` toolchain # CORRADE_TARGET_EMSCRIPTEN - Defined if compiled for Emscripten # +# If CORRADE_BUILD_DEPRECATED is defined, the CORRADE_INCLUDE_DIR variable also +# contains path directly to Corrade directory (i.e. for includes without +# `Corrade/` prefix). +# # Corrade provides these macros and functions: # # @@ -132,8 +136,7 @@ find_program(CORRADE_RC_EXECUTABLE corrade-rc) # Include dir find_path(CORRADE_INCLUDE_DIR - NAMES PluginManager Utility - PATH_SUFFIXES Corrade) + NAMES Corrade/PluginManager Corrade/Utility) # CMake module dir find_path(_CORRADE_MODULE_DIR @@ -161,7 +164,7 @@ if(NOT CORRADE_FOUND) endif() # Configuration -file(READ ${CORRADE_INCLUDE_DIR}/corradeConfigure.h _corradeConfigure) +file(READ ${CORRADE_INCLUDE_DIR}/Corrade/configure.h _corradeConfigure) # Compatibility? string(FIND "${_corradeConfigure}" "#define CORRADE_GCC47_COMPATIBILITY" _GCC47_COMPATIBILITY) @@ -233,6 +236,11 @@ mark_as_advanced(CORRADE_UTILITY_LIBRARY CORRADE_TESTSUITE_LIBRARY _CORRADE_MODULE_DIR) +# Add Corrade dir to include path if this is deprecated build +if(CORRADE_BUILD_DEPRECATED) + set(CORRADE_INCLUDE_DIR ${CORRADE_INCLUDE_DIR} ${CORRADE_INCLUDE_DIR}/Corrade) +endif() + # Include our module dir, if we have any if(NOT "${_CORRADE_MODULE_DIR}" STREQUAL "${CMAKE_ROOT}/Modules") set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${_CORRADE_MODULE_DIR}") diff --git a/modules/FindMagnum.cmake b/modules/FindMagnum.cmake index 4991b5758..a2cd65275 100644 --- a/modules/FindMagnum.cmake +++ b/modules/FindMagnum.cmake @@ -7,7 +7,6 @@ # MAGNUM_LIBRARIES - Magnum library and dependent libraries # MAGNUM_INCLUDE_DIRS - Root include dir and include dirs of # dependencies -# MAGNUM_PLUGINS_INCLUDE_DIR - Include dir with plugins # MAGNUM_PLUGINS_DIR - Base directory with plugins. You can modify # it (e.g. set it to `.` when deploying on Windows with plugins stored # relatively to the executable), the following MAGNUM_PLUGINS_*_DIR @@ -68,6 +67,11 @@ # MAGNUM_TARGET_DESKTOP_GLES - Defined if compiled with OpenGL ES # emulation on desktop OpenGL # +# If `MAGNUM_BUILD_DEPRECATED` is defined, the `MAGNUM_INCLUDE_DIR` variable +# also contains path directly to Magnum directory (i.e. for includes without +# `Magnum/` prefix) and `MAGNUM_PLUGINS_INCLUDE_DIR` contains include dir for +# plugins (i.e. instead of `MagnumPlugins/` prefix). +# # Additionally these variables are defined for internal usage: # MAGNUM_INCLUDE_DIR - Root include dir (w/o # dependencies) @@ -126,11 +130,10 @@ find_library(MAGNUM_LIBRARY Magnum) # Root include dir find_path(MAGNUM_INCLUDE_DIR - NAMES Magnum.h - PATH_SUFFIXES Magnum) + NAMES Magnum/Magnum.h) # Configuration -file(READ ${MAGNUM_INCLUDE_DIR}/magnumConfigure.h _magnumConfigure) +file(READ ${MAGNUM_INCLUDE_DIR}/Magnum/configure.h _magnumConfigure) string(FIND "${_magnumConfigure}" "#define MAGNUM_BUILD_DEPRECATED" _BUILD_DEPRECATED) if(NOT _BUILD_DEPRECATED EQUAL -1) @@ -208,7 +211,7 @@ foreach(component ${Magnum_FIND_COMPONENTS}) # Set plugin defaults, find the plugin if(_MAGNUM_${_COMPONENT}_IS_PLUGIN) - set(_MAGNUM_${_COMPONENT}_INCLUDE_PATH_SUFFIX Plugins/${component}) + set(_MAGNUM_${_COMPONENT}_INCLUDE_PATH_SUFFIX MagnumPlugins/${component}) # Don't override the one for *AudioImporter plugins if(NOT _MAGNUM_${_COMPONENT}_INCLUDE_PATH_NAMES) @@ -226,7 +229,7 @@ foreach(component ${Magnum_FIND_COMPONENTS}) # Set library defaults, find the library else() - set(_MAGNUM_${_COMPONENT}_INCLUDE_PATH_SUFFIX ${component}) + set(_MAGNUM_${_COMPONENT}_INCLUDE_PATH_SUFFIX Magnum/${component}) set(_MAGNUM_${_COMPONENT}_INCLUDE_PATH_NAMES ${component}.h) find_library(MAGNUM_${_COMPONENT}_LIBRARY Magnum${component}) @@ -234,7 +237,7 @@ foreach(component ${Magnum_FIND_COMPONENTS}) # Applications if(${component} MATCHES .+Application) - set(_MAGNUM_${_COMPONENT}_INCLUDE_PATH_SUFFIX Platform) + set(_MAGNUM_${_COMPONENT}_INCLUDE_PATH_SUFFIX Magnum/Platform) # GLUT application dependencies if(${component} STREQUAL GlutApplication) @@ -354,7 +357,7 @@ find_package_handle_standard_args(Magnum # Dependent libraries and includes set(MAGNUM_INCLUDE_DIRS ${MAGNUM_INCLUDE_DIR} - ${MAGNUM_INCLUDE_DIR}/OpenGL + ${MAGNUM_INCLUDE_DIR}/MagnumExternal/OpenGL ${CORRADE_INCLUDE_DIR}) set(MAGNUM_LIBRARIES ${MAGNUM_LIBRARY} ${CORRADE_UTILITY_LIBRARIES} @@ -376,7 +379,7 @@ set(MAGNUM_PLUGINS_IMPORTER_INSTALL_DIR ${MAGNUM_PLUGINS_INSTALL_DIR}/importers) set(MAGNUM_PLUGINS_AUDIOIMPORTER_INSTALL_DIR ${MAGNUM_PLUGINS_INSTALL_DIR}/audioimporters) set(MAGNUM_CMAKE_FIND_MODULE_INSTALL_DIR ${CMAKE_ROOT}/Modules) set(MAGNUM_INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/include/Magnum) -set(MAGNUM_PLUGINS_INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/include/Magnum/Plugins) +set(MAGNUM_PLUGINS_INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/include/MagnumPlugins) mark_as_advanced(FORCE MAGNUM_LIBRARY MAGNUM_INCLUDE_DIR @@ -391,11 +394,19 @@ mark_as_advanced(FORCE MAGNUM_INCLUDE_INSTALL_DIR MAGNUM_PLUGINS_INCLUDE_INSTALL_DIR) +# Add Magnum dir to include path and create MAGNUM_PLUGINS_INCLUDE_DIR if this +# is deprecated build +if(MAGNUM_BUILD_DEPRECATED) + set(MAGNUM_INCLUDE_DIRS ${MAGNUM_INCLUDE_DIRS} + ${MAGNUM_INCLUDE_DIR}/Magnum + ${MAGNUM_INCLUDE_DIR}/MagnumExternal) + set(MAGNUM_PLUGINS_INCLUDE_DIR ${MAGNUM_INCLUDE_DIR}/MagnumPlugins) +endif() + set(MAGNUM_PLUGINS_DIR ${MAGNUM_PLUGINS_INSTALL_DIR} CACHE PATH "Base directory where to look for Magnum plugins") # Plugin directories -set(MAGNUM_PLUGINS_INCLUDE_DIR ${MAGNUM_INCLUDE_DIR}/Plugins) set(MAGNUM_PLUGINS_FONT_DIR ${MAGNUM_PLUGINS_DIR}/fonts) set(MAGNUM_PLUGINS_FONTCONVERTER_DIR ${MAGNUM_PLUGINS_DIR}/fontconverters) set(MAGNUM_PLUGINS_IMAGECONVERTER_DIR ${MAGNUM_PLUGINS_DIR}/imageconverters) diff --git a/package/archlinux/PKGBUILD b/package/archlinux/PKGBUILD index b4812b88a..79a64b1a6 100644 --- a/package/archlinux/PKGBUILD +++ b/package/archlinux/PKGBUILD @@ -26,6 +26,7 @@ build() { -DWITH_GLUTAPPLICATION=ON \ -DWITH_GLXAPPLICATION=ON \ -DWITH_SDL2APPLICATION=ON \ + -DWITH_WINDOWLESSGLXAPPLICATION=ON \ -DWITH_MAGNUMFONT=ON \ -DWITH_MAGNUMFONTCONVERTER=ON \ -DWITH_TGAIMAGECONVERTER=ON \ diff --git a/package/archlinux/PKGBUILD-clang b/package/archlinux/PKGBUILD-clang index bcd3ed954..f98b4b14e 100644 --- a/package/archlinux/PKGBUILD-clang +++ b/package/archlinux/PKGBUILD-clang @@ -30,6 +30,7 @@ build() { -DWITH_GLUTAPPLICATION=ON \ -DWITH_GLXAPPLICATION=ON \ -DWITH_SDL2APPLICATION=ON \ + -DWITH_WINDOWLESSGLXAPPLICATION=ON \ -DWITH_MAGNUMFONT=ON \ -DWITH_MAGNUMFONTCONVERTER=ON \ -DWITH_TGAIMAGECONVERTER=ON \ diff --git a/package/archlinux/PKGBUILD-clang-libc++ b/package/archlinux/PKGBUILD-clang-libc++ index e146e0129..e11965e27 100644 --- a/package/archlinux/PKGBUILD-clang-libc++ +++ b/package/archlinux/PKGBUILD-clang-libc++ @@ -32,6 +32,7 @@ build() { -DWITH_GLUTAPPLICATION=ON \ -DWITH_GLXAPPLICATION=ON \ -DWITH_SDL2APPLICATION=ON \ + -DWITH_WINDOWLESSGLXAPPLICATION=ON \ -DWITH_MAGNUMFONT=ON \ -DWITH_MAGNUMFONTCONVERTER=ON \ -DWITH_TGAIMAGECONVERTER=ON \ diff --git a/package/archlinux/PKGBUILD-gcc46 b/package/archlinux/PKGBUILD-gcc46 index c8623c153..ba70ed497 100644 --- a/package/archlinux/PKGBUILD-gcc46 +++ b/package/archlinux/PKGBUILD-gcc46 @@ -30,6 +30,7 @@ build() { -DWITH_GLUTAPPLICATION=ON \ -DWITH_GLXAPPLICATION=ON \ -DWITH_SDL2APPLICATION=ON \ + -DWITH_WINDOWLESSGLXAPPLICATION=ON \ -DWITH_MAGNUMFONT=ON \ -DWITH_MAGNUMFONTCONVERTER=ON \ -DWITH_TGAIMAGECONVERTER=ON \ diff --git a/package/archlinux/PKGBUILD-gcc47 b/package/archlinux/PKGBUILD-gcc47 index cacacf17c..5867486a8 100644 --- a/package/archlinux/PKGBUILD-gcc47 +++ b/package/archlinux/PKGBUILD-gcc47 @@ -30,6 +30,7 @@ build() { -DWITH_GLUTAPPLICATION=ON \ -DWITH_GLXAPPLICATION=ON \ -DWITH_SDL2APPLICATION=ON \ + -DWITH_WINDOWLESSGLXAPPLICATION=ON \ -DWITH_MAGNUMFONT=ON \ -DWITH_MAGNUMFONTCONVERTER=ON \ -DWITH_TGAIMAGECONVERTER=ON \ diff --git a/package/archlinux/PKGBUILD-gcc49 b/package/archlinux/PKGBUILD-gcc49 index e20f7bb93..a8043f0f2 100644 --- a/package/archlinux/PKGBUILD-gcc49 +++ b/package/archlinux/PKGBUILD-gcc49 @@ -30,6 +30,7 @@ build() { -DWITH_GLUTAPPLICATION=ON \ -DWITH_GLXAPPLICATION=ON \ -DWITH_SDL2APPLICATION=ON \ + -DWITH_WINDOWLESSGLXAPPLICATION=ON \ -DWITH_MAGNUMFONT=ON \ -DWITH_MAGNUMFONTCONVERTER=ON \ -DWITH_TGAIMAGECONVERTER=ON \ diff --git a/package/archlinux/PKGBUILD-release b/package/archlinux/PKGBUILD-release index 0bdee15b7..031abcd9d 100644 --- a/package/archlinux/PKGBUILD-release +++ b/package/archlinux/PKGBUILD-release @@ -21,6 +21,7 @@ build() { -DWITH_GLUTAPPLICATION=ON \ -DWITH_GLXAPPLICATION=ON \ -DWITH_SDL2APPLICATION=ON \ + -DWITH_WINDOWLESSGLXAPPLICATION=ON \ -DWITH_MAGNUMFONT=ON \ -DWITH_MAGNUMFONTCONVERTER=ON \ -DWITH_TGAIMAGECONVERTER=ON \ diff --git a/package/ci/jenkins-emscripten.xml b/package/ci/jenkins-emscripten.xml index 70cff54fd..bea34b38b 100644 --- a/package/ci/jenkins-emscripten.xml +++ b/package/ci/jenkins-emscripten.xml @@ -67,9 +67,8 @@ cmake .. \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_MODULE_PATH="${WORKSPACE}/toolchains/modules" \ -DCMAKE_TOOLCHAIN_FILE="../toolchains/generic/Emscripten.cmake" \ - -DCMAKE_FIND_ROOT_PATH=${JENKINS_HOME}/filesystem/emscripten \ + -DCMAKE_FIND_ROOT_PATH=${JENKINS_HOME}/filesystem/emscripten-${compatibility} \ -DCMAKE_INSTALL_PREFIX=${JENKINS_HOME}/filesystem/emscripten-${compatibility} \ - -DBUILD_TESTS=ON \ -DBUILD_DEPRECATED=${deprecated_build_flag} \ `#-DWITH_AUDIO=ON` \ -DWITH_SDL2APPLICATION=ON \ @@ -81,7 +80,6 @@ cmake .. \ -G Ninja ninja -ctest --output-on-failure || true ninja install ]]> diff --git a/package/ci/jenkins-mingw32.xml b/package/ci/jenkins-mingw32.xml index 81c54c69d..343df8bf8 100644 --- a/package/ci/jenkins-mingw32.xml +++ b/package/ci/jenkins-mingw32.xml @@ -77,7 +77,7 @@ cd build-mingw32-${libraries}-${compatibility} cmake .. \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_TOOLCHAIN_FILE=../toolchains/archlinux/basic-mingw32.cmake \ - -DCMAKE_FIND_ROOT_PATH=${JENKINS_HOME}/filesystem/mingw32-${libraries} \ + -DCMAKE_FIND_ROOT_PATH=${JENKINS_HOME}/filesystem/mingw32-${libraries}-${compatibility} \ -DCMAKE_INSTALL_PREFIX=${JENKINS_HOME}/filesystem/mingw32-${libraries}-${compatibility} \ -DBUILD_TESTS=ON \ -DBUILD_DEPRECATED=${deprecated_build_flag} \ diff --git a/package/ci/jenkins-nacl.xml b/package/ci/jenkins-nacl.xml new file mode 100644 index 000000000..a975bd245 --- /dev/null +++ b/package/ci/jenkins-nacl.xml @@ -0,0 +1,120 @@ + + + + + + -1 + 10 + -1 + -1 + + false + + + 2 + + + git://github.com/mosra/magnum.git + + + + + */master + + + false + + + + true + + + + + true + false + false + false + + false + Magnum + + + toolchain + + newlib-x86-32 + newlib-x86-64 + + + + compatibility + + + deprecated + + + + + + + + + + + + + Errors while running CTest + false + true + true + + + + + true + + + + + UNSTABLE + 1 + YELLOW + true + + + . + diff --git a/package/ci/jenkins.xml b/package/ci/jenkins.xml index 341505ca5..1984332d6 100644 --- a/package/ci/jenkins.xml +++ b/package/ci/jenkins.xml @@ -123,9 +123,9 @@ cd build-${compiler}-${libraries}-${compatibility}-${gl} cmake .. \ -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_FIND_ROOT_PATH=${JENKINS_HOME}/filesystem/compatibility-${compiler}-${libraries} \ + -DCMAKE_FIND_ROOT_PATH=${JENKINS_HOME}/filesystem/compatibility-${compiler}-${libraries}-${compatibility} \ -DCMAKE_INSTALL_PREFIX=${JENKINS_HOME}/filesystem/compatibility-${compiler}-${libraries}-${compatibility}-${gl} \ - -DCMAKE_INSTALL_RPATH="${JENKINS_HOME}/filesystem/compatibility-${compiler}-${libraries}/lib;${JENKINS_HOME}/filesystem/compatibility-${compiler}-${libraries}-${compatibility}-${gl}/lib" \ + -DCMAKE_INSTALL_RPATH="${JENKINS_HOME}/filesystem/compatibility-${compiler}-${libraries}-${compatibility}/lib;${JENKINS_HOME}/filesystem/compatibility-${compiler}-${libraries}-${compatibility}-${gl}/lib" \ -DCMAKE_CXX_COMPILER=${compiler_binary} \ "${compiler_flags[@]}" \ -DBUILD_TESTS=ON \ diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index cc6a61656..dc9f4a32f 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -49,240 +49,14 @@ elseif(CORRADE_GCC45_COMPATIBILITY AND NOT CORRADE_GCC44_COMPATIBILITY) endif() set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CORRADE_CXX_FLAGS}") -include_directories( - ${CMAKE_CURRENT_SOURCE_DIR} - ${CMAKE_CURRENT_BINARY_DIR} - ${CORRADE_INCLUDE_DIR} - # We can use both implicit include path (GLES2/gl2.h) where our headers can - # be overriden with system ones or explicit (OpenGL/GLES2/gl2ext.h) where - # only our headers will be used - ${CMAKE_SOURCE_DIR}/external - ${CMAKE_SOURCE_DIR}/external/OpenGL) +include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${CORRADE_INCLUDE_DIR}) -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/magnumConfigure.h.cmake - ${CMAKE_CURRENT_BINARY_DIR}/magnumConfigure.h) +# We can use both implicit include path (GLES2/gl2.h) where our headers can +# be overriden with system ones or explicit (MagnumExternal/OpenGL/GLES2/gl2ext.h) +# where only our headers will be used +include_directories(${CMAKE_SOURCE_DIR}/src/MagnumExternal/OpenGL) -# Files shared between main library and unit test library -set(Magnum_SRCS - AbstractFramebuffer.cpp - AbstractImage.cpp - AbstractObject.cpp - AbstractTexture.cpp - AbstractShaderProgram.cpp - Buffer.cpp - ColorFormat.cpp - Context.cpp - DebugMessage.cpp - DefaultFramebuffer.cpp - Framebuffer.cpp - Image.cpp - Mesh.cpp - MeshView.cpp - OpenGL.cpp - Query.cpp - Renderbuffer.cpp - Renderer.cpp - Resource.cpp - Sampler.cpp - Shader.cpp - Timeline.cpp - Version.cpp - - Implementation/BufferState.cpp - Implementation/DebugState.cpp - Implementation/State.cpp - Implementation/TextureState.cpp - - Trade/AbstractImageConverter.cpp - Trade/AbstractImporter.cpp - Trade/AbstractMaterialData.cpp - Trade/MeshData2D.cpp - Trade/MeshData3D.cpp - Trade/MeshObjectData2D.cpp - Trade/MeshObjectData3D.cpp - Trade/ObjectData2D.cpp - Trade/ObjectData3D.cpp - Trade/PhongMaterialData.cpp - Trade/SceneData.cpp - Trade/TextureData.cpp) -set(Magnum_OBJECTS $) - -# Desktop-only code -if(NOT TARGET_GLES) - set(Magnum_SRCS ${Magnum_SRCS} - BufferTexture.cpp) -endif() - -# Not-ES2 code -if(NOT TARGET_GLES2) - set(Magnum_SRCS ${Magnum_SRCS} - BufferImage.cpp) -endif() - -set(Magnum_HEADERS - AbstractFramebuffer.h - AbstractImage.h - AbstractObject.h - AbstractResourceLoader.h - AbstractShaderProgram.h - AbstractTexture.h - Array.h - Buffer.h - Color.h - ColorFormat.h - Context.h - CubeMapTexture.h - DebugMessage.h - DefaultFramebuffer.h - DimensionTraits.h - Extensions.h - Framebuffer.h - Image.h - ImageReference.h - Magnum.h - Mesh.h - MeshView.h - OpenGL.h - Query.h - Renderbuffer.h - RenderbufferFormat.h - Renderer.h - Resource.h - ResourceManager.h - Sampler.h - Shader.h - Texture.h - TextureFormat.h - Timeline.h - Types.h - Version.h - - magnumVisibility.h) - -# Deprecated headers -if(BUILD_DEPRECATED) - set(Magnum_HEADERS ${Magnum_HEADERS} - DebugMarker.h - ImageFormat.h - Swizzle.h) -endif() - -# Desktop-only headers and libraries -if(NOT TARGET_GLES) - set(Magnum_HEADERS ${Magnum_HEADERS} - BufferTexture.h - CubeMapTextureArray.h) - set(Magnum_OBJECTS ${Magnum_OBJECTS} $) -endif() - -# Not-ES2 headers -if(NOT TARGET_GLES2) - set(Magnum_HEADERS ${Magnum_HEADERS} - BufferImage.h) -endif() - -# Files shared between main library and math unit test library -set(MagnumMath_SRCS - Math/Functions.cpp - Math/instantiation.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 -add_library(MagnumMathObjects OBJECT ${MagnumMath_SRCS}) -add_library(MagnumObjects OBJECT ${Magnum_SRCS}) -set_target_properties(MagnumMathObjects PROPERTIES COMPILE_FLAGS "-DMagnumMathObjects_EXPORTS -DGLLoadGen_EXPORTS ${CMAKE_SHARED_LIBRARY_CXX_FLAGS}") -set_target_properties(MagnumObjects PROPERTIES COMPILE_FLAGS "-DMagnumObjects_EXPORTS -DGLLoadGen_EXPORTS ${CMAKE_SHARED_LIBRARY_CXX_FLAGS}") - -# Main library -add_library(Magnum ${SHARED_OR_STATIC} - ${Magnum_OBJECTS} - $) -if(BUILD_STATIC_PIC) - # TODO: CMake 2.8.9 has this as POSITION_INDEPENDENT_CODE property - set_target_properties(Magnum PROPERTIES COMPILE_FLAGS "${CMAKE_SHARED_LIBRARY_CXX_FLAGS}") -endif() -set(Magnum_LIBS - ${CORRADE_UTILITY_LIBRARIES} - ${CORRADE_PLUGINMANAGER_LIBRARIES}) -if(NOT TARGET_GLES OR TARGET_DESKTOP_GLES) - set(Magnum_LIBS ${Magnum_LIBS} ${OPENGL_gl_LIBRARY}) -elseif(TARGET_GLES2) - set(Magnum_LIBS ${Magnum_LIBS} ${OPENGLES2_LIBRARY}) -else() - set(Magnum_LIBS ${Magnum_LIBS} ${OPENGLES3_LIBRARY}) -endif() -target_link_libraries(Magnum ${Magnum_LIBS}) - -install(TARGETS Magnum - RUNTIME DESTINATION ${MAGNUM_BINARY_INSTALL_DIR} - LIBRARY DESTINATION ${MAGNUM_LIBRARY_INSTALL_DIR} - ARCHIVE DESTINATION ${MAGNUM_LIBRARY_INSTALL_DIR}) -install(FILES ${Magnum_HEADERS} DESTINATION ${MAGNUM_INCLUDE_INSTALL_DIR}) -install(FILES ${CMAKE_CURRENT_BINARY_DIR}/magnumConfigure.h DESTINATION ${MAGNUM_INCLUDE_INSTALL_DIR}) - -add_subdirectory(Math) -add_subdirectory(Platform) -add_subdirectory(Plugins) -add_subdirectory(Trade) - -if(WITH_AUDIO) - add_subdirectory(Audio) -endif() - -if(WITH_DEBUGTOOLS) - add_subdirectory(DebugTools) -endif() - -if(WITH_MESHTOOLS) - add_subdirectory(MeshTools) -endif() - -if(WITH_PRIMITIVES) - add_subdirectory(Primitives) -endif() - -if(WITH_SCENEGRAPH) - add_subdirectory(SceneGraph) -endif() - -if(WITH_SHADERS) - add_subdirectory(Shaders) -endif() - -if(WITH_SHAPES) - add_subdirectory(Shapes) -endif() - -if(WITH_TEXT) - add_subdirectory(Text) -endif() - -if(WITH_TEXTURETOOLS) - add_subdirectory(TextureTools) -endif() - -if(BUILD_TESTS) - # Libraries with graceful assert for testing - add_library(MagnumMathTestLib ${SHARED_OR_STATIC} - $) - set_target_properties(MagnumMathTestLib PROPERTIES COMPILE_FLAGS -DCORRADE_GRACEFUL_ASSERT) - target_link_libraries(MagnumMathTestLib ${CORRADE_UTILITY_LIBRARY}) - - add_library(MagnumTestLib ${SHARED_OR_STATIC} - ${Magnum_OBJECTS} - $) - set_target_properties(MagnumTestLib PROPERTIES COMPILE_FLAGS -DCORRADE_GRACEFUL_ASSERT) - target_link_libraries(MagnumTestLib ${Magnum_LIBS}) - - # On Windows we need to install first and then run the tests to avoid "DLL - # not found" hell, thus we need to install this too - if(WIN32 AND NOT CMAKE_CROSSCOMPILING) - install(TARGETS MagnumMathTestLib MagnumTestLib - RUNTIME DESTINATION ${MAGNUM_BINARY_INSTALL_DIR} - LIBRARY DESTINATION ${MAGNUM_LIBRARY_INSTALL_DIR} - ARCHIVE DESTINATION ${MAGNUM_LIBRARY_INSTALL_DIR}) - endif() - - add_subdirectory(Test) -endif() +add_subdirectory(MagnumExternal) +add_subdirectory(Magnum) +add_subdirectory(MagnumPlugins) diff --git a/src/AbstractFramebuffer.cpp b/src/Magnum/AbstractFramebuffer.cpp similarity index 98% rename from src/AbstractFramebuffer.cpp rename to src/Magnum/AbstractFramebuffer.cpp index aceb75896..03219ad3d 100644 --- a/src/AbstractFramebuffer.cpp +++ b/src/Magnum/AbstractFramebuffer.cpp @@ -24,10 +24,12 @@ #include "AbstractFramebuffer.h" -#include "BufferImage.h" -#include "Context.h" -#include "Extensions.h" -#include "Image.h" +#ifndef MAGNUM_TARGET_GLES2 +#include "Magnum/BufferImage.h" +#endif +#include "Magnum/Context.h" +#include "Magnum/Extensions.h" +#include "Magnum/Image.h" #include "Implementation/FramebufferState.h" #include "Implementation/State.h" @@ -194,7 +196,7 @@ void AbstractFramebuffer::read(const Vector2i& offset, const Vector2i& size, Ima #else bindInternal(readTarget); #endif - const std::size_t dataSize = image.pixelSize()*size.product(); + const std::size_t dataSize = image.dataSize(size); char* const data = new char[dataSize]; readImplementation(offset, size, image.format(), image.type(), dataSize, data); image.setData(image.format(), image.type(), size, data); @@ -213,8 +215,7 @@ void AbstractFramebuffer::read(const Vector2i& offset, const Vector2i& size, Buf image.setData(image.format(), image.type(), size, nullptr, usage); image.buffer().bind(Buffer::Target::PixelPack); - /** @todo De-duplicate buffer size computation */ - readImplementation(offset, size, image.format(), image.type(), image.pixelSize()*size.product(), nullptr); + readImplementation(offset, size, image.format(), image.type(), image.dataSize(size), nullptr); } #endif diff --git a/src/AbstractFramebuffer.h b/src/Magnum/AbstractFramebuffer.h similarity index 89% rename from src/AbstractFramebuffer.h rename to src/Magnum/AbstractFramebuffer.h index 143e415bd..fb92ba9bf 100644 --- a/src/AbstractFramebuffer.h +++ b/src/Magnum/AbstractFramebuffer.h @@ -25,14 +25,14 @@ */ /** @file - * @brief Class Magnum::AbstractFramebuffer + * @brief Class @ref Magnum::AbstractFramebuffer, enum @ref Magnum::FramebufferClear, @ref Magnum::FramebufferBlit, @ref Magnum::FramebufferBlitFilter, @ref Magnum::FramebufferTarget, enum set @ref Magnum::FramebufferClearMask */ -#include +#include -#include "Math/Range.h" -#include "Magnum.h" -#include "OpenGL.h" +#include "Magnum/Magnum.h" +#include "Magnum/OpenGL.h" +#include "Magnum/Math/Range.h" #ifdef CORRADE_GCC45_COMPATIBILITY #include "Buffer.h" @@ -44,7 +44,7 @@ namespace Magnum { /** @brief Mask for framebuffer clearing -@see AbstractFramebuffer, FramebufferClearMask +@see @ref AbstractFramebuffer, @ref FramebufferClearMask */ enum class FramebufferClear: GLbitfield { Color = GL_COLOR_BUFFER_BIT, /**< Color */ @@ -55,7 +55,7 @@ enum class FramebufferClear: GLbitfield { /** @brief Mask for clearing -@see AbstractFramebuffer::clear() +@see @ref AbstractFramebuffer::clear() */ typedef Containers::EnumSet FramebufferClearMask; @@ -63,10 +63,11 @@ typedef Containers::EnumSet +#include -#include "ColorFormat.h" +#include "Magnum/ColorFormat.h" +#include "Magnum/Math/Vector.h" namespace Magnum { @@ -97,6 +98,8 @@ std::size_t AbstractImage::pixelSize(ColorFormat format, ColorType type) { #ifdef MAGNUM_TARGET_GLES2 case ColorFormat::Luminance: #endif + case ColorFormat::DepthComponent: + case ColorFormat::StencilIndex: return 1*size; case ColorFormat::RG: #ifndef MAGNUM_TARGET_GLES2 @@ -126,13 +129,25 @@ std::size_t AbstractImage::pixelSize(ColorFormat format, ColorType type) { return 4*size; /* Handled above */ - case ColorFormat::DepthComponent: - case ColorFormat::StencilIndex: case ColorFormat::DepthStencil: - CORRADE_ASSERT_UNREACHABLE(); + CORRADE_ASSERT(false, "AbstractImage::pixelSize(): invalid ColorType specified for depth/stencil ColorFormat", 0); } CORRADE_ASSERT_UNREACHABLE(); } +template std::size_t AbstractImage::dataSize(Math::Vector size) const { + /** @todo Code this properly when all @fn_gl{PixelStore} parameters are implemented */ + /* Row size, rounded to multiple of 4 bytes */ + const std::size_t rowSize = ((size[0]*pixelSize() + 3)/4)*4; + + /** @todo Can't this be done somewhat nicer? */ + size[0] = 1; + return rowSize*size.product(); +} + +template MAGNUM_EXPORT std::size_t AbstractImage::dataSize<1>(Math::Vector<1, Int>) const; +template MAGNUM_EXPORT std::size_t AbstractImage::dataSize<2>(Math::Vector<2, Int>) const; +template MAGNUM_EXPORT std::size_t AbstractImage::dataSize<3>(Math::Vector<3, Int>) const; + } diff --git a/src/AbstractImage.h b/src/Magnum/AbstractImage.h similarity index 95% rename from src/AbstractImage.h rename to src/Magnum/AbstractImage.h index 33d9aa757..bd2f3a8d3 100644 --- a/src/AbstractImage.h +++ b/src/Magnum/AbstractImage.h @@ -30,8 +30,8 @@ #include -#include "Magnum.h" -#include "magnumVisibility.h" +#include "Magnum/Magnum.h" +#include "Magnum/visibility.h" #ifdef CORRADE_GCC45_COMPATIBILITY #include "ColorFormat.h" @@ -89,6 +89,8 @@ class MAGNUM_EXPORT AbstractImage { ~AbstractImage(); #endif + template std::size_t dataSize(Math::Vector size) const; + #ifdef DOXYGEN_GENERATING_OUTPUT private: #else diff --git a/src/AbstractObject.cpp b/src/Magnum/AbstractObject.cpp similarity index 98% rename from src/AbstractObject.cpp rename to src/Magnum/AbstractObject.cpp index 74b2df9ba..2c55735e0 100644 --- a/src/AbstractObject.cpp +++ b/src/Magnum/AbstractObject.cpp @@ -24,10 +24,11 @@ #include "AbstractObject.h" -#include +#include + +#include "Magnum/Context.h" +#include "Magnum/Extensions.h" -#include "Context.h" -#include "Extensions.h" #include "Implementation/State.h" #include "Implementation/DebugState.h" diff --git a/src/AbstractObject.h b/src/Magnum/AbstractObject.h similarity index 97% rename from src/AbstractObject.h rename to src/Magnum/AbstractObject.h index 3fea9ca38..130a901bc 100644 --- a/src/AbstractObject.h +++ b/src/Magnum/AbstractObject.h @@ -30,9 +30,9 @@ #include -#include "OpenGL.h" -#include "Types.h" -#include "magnumVisibility.h" +#include "Magnum/OpenGL.h" +#include "Magnum/Types.h" +#include "Magnum/visibility.h" namespace Magnum { diff --git a/src/AbstractResourceLoader.h b/src/Magnum/AbstractResourceLoader.h similarity index 99% rename from src/AbstractResourceLoader.h rename to src/Magnum/AbstractResourceLoader.h index 892f13de3..a30c3c899 100644 --- a/src/AbstractResourceLoader.h +++ b/src/Magnum/AbstractResourceLoader.h @@ -30,7 +30,7 @@ #include -#include "ResourceManager.h" +#include "Magnum/ResourceManager.h" namespace Magnum { diff --git a/src/AbstractShaderProgram.cpp b/src/Magnum/AbstractShaderProgram.cpp similarity index 99% rename from src/AbstractShaderProgram.cpp rename to src/Magnum/AbstractShaderProgram.cpp index a3a150f1b..c1ce59c86 100644 --- a/src/AbstractShaderProgram.cpp +++ b/src/Magnum/AbstractShaderProgram.cpp @@ -26,10 +26,11 @@ #include /* std::max(), needed by MSVC */ -#include "Math/RectangularMatrix.h" -#include "Context.h" -#include "Extensions.h" -#include "Shader.h" +#include "Magnum/Context.h" +#include "Magnum/Extensions.h" +#include "Magnum/Shader.h" +#include "Magnum/Math/RectangularMatrix.h" + #include "Implementation/DebugState.h" #include "Implementation/ShaderProgramState.h" #include "Implementation/State.h" diff --git a/src/AbstractShaderProgram.h b/src/Magnum/AbstractShaderProgram.h similarity index 93% rename from src/AbstractShaderProgram.h rename to src/Magnum/AbstractShaderProgram.h index ebeee7994..52fd1fe57 100644 --- a/src/AbstractShaderProgram.h +++ b/src/Magnum/AbstractShaderProgram.h @@ -25,15 +25,14 @@ */ /** @file - * @brief Class Magnum::AbstractShaderProgram + * @brief Class @ref Magnum::AbstractShaderProgram */ #include -#include +#include -#include "AbstractObject.h" -#include "Magnum.h" -#include "magnumVisibility.h" +#include "Magnum/AbstractObject.h" +#include "Magnum/Magnum.h" namespace Magnum { @@ -48,38 +47,38 @@ namespace Implementation { This class is designed to be used via subclassing. Subclasses define these functions and properties: - - %Attribute definitions with location and type for - configuring meshes, for example: +- %Attribute definitions with location and type for + configuring meshes, for example: @code typedef Attribute<0, Vector3> Position; typedef Attribute<1, Vector3> Normal; typedef Attribute<2, Vector2> TextureCoordinates; @endcode - - **Output attribute locations**, if desired, for example: +- **Output attribute locations**, if desired, for example: @code enum: UnsignedInt { ColorOutput = 0, NormalOutput = 1 }; @endcode - - **Layers for texture uniforms** to which the textures will be bound before - rendering, for example: +- **Layers for texture uniforms** to which the textures will be bound before + rendering, for example: @code enum: Int { DiffuseTextureLayer = 0, SpecularTextureLayer = 1 }; @endcode - - **Uniform locations** for setting uniform data (see below) (private - variables), for example: +- **Uniform locations** for setting uniform data (see below) (private + variables), for example: @code Int TransformationUniform = 0, ProjectionUniform = 1, DiffuseTextureUniform = 2, SpecularTextureUniform = 3; @endcode - - **Constructor**, which attaches particular shaders, links the program and - gets uniform locations, for example: +- **Constructor**, which attaches particular shaders, links the program and + gets uniform locations, for example: @code MyShader() { // Load shaders, compile them and attach them to the program @@ -97,9 +96,9 @@ MyShader() { CORRADE_INTERNAL_ASSERT_OUTPUT(link()); } @endcode - - **Uniform setting functions**, which will provide public interface for - protected setUniform() functions. For usability purposes you can implement - also method chaining. Example: +- **Uniform setting functions**, which will provide public interface for + protected @ref setUniform() functions. For usability purposes you can + implement also method chaining. Example: @code MyShader& setTransformation(const Matrix4& matrix) { setUniform(TransformationUniform, matrix); @@ -113,9 +112,9 @@ MyShader& setProjection(const Matrix4& matrix) { @subsection AbstractShaderProgram-attribute-location Binding attribute location -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.: +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 // GLSL 3.30, or #extension GL_ARB_explicit_attrib_location: enable @@ -124,9 +123,9 @@ layout(location = 1) in vec3 normal; layout(location = 2) in vec2 textureCoordinates; @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): +Similarly for ouput attributes, you can also specify blend equation color index +for them (see @ref Renderer::BlendFunction for more information about using +color input index): @code layout(location = 0, index = 0) out vec4 color; layout(location = 1, index = 1) out vec3 normal; @@ -161,14 +160,17 @@ bindFragmentDataLocationIndexed(NormalOutput, 1, "normal"); @see @ref Mesh::maxVertexAttributes(), @ref AbstractFramebuffer::maxDrawBuffers() @requires_gl30 %Extension @extension{EXT,gpu_shader4} for using - bindFragmentDataLocation(). + @ref Magnum::AbstractShaderProgram::bindFragmentDataLocation() "bindFragmentDataLocation()". @requires_gl33 %Extension @extension{ARB,blend_func_extended} for using - bindFragmentDataLocationIndexed(). + @ref Magnum::AbstractShaderProgram::bindFragmentDataLocationIndexed() "bindFragmentDataLocationIndexed()". @requires_gl33 %Extension @extension{ARB,explicit_attrib_location} for - explicit attribute location instead of using bindAttributeLocation(), - bindFragmentDataLocation() or bindFragmentDataLocationIndexed(). + explicit attribute location instead of using + @ref Magnum::AbstractShaderProgram::bindAttributeLocation() "bindAttributeLocation()", + @ref Magnum::AbstractShaderProgram::bindFragmentDataLocation() "bindFragmentDataLocation()" + or @ref Magnum::AbstractShaderProgram::bindFragmentDataLocationIndexed() "bindFragmentDataLocationIndexed()". @requires_gles30 Explicit location specification of input attributes is not - supported in OpenGL ES 2.0, use bindAttributeLocation() instead. + supported in OpenGL ES 2.0, use @ref Magnum::AbstractShaderProgram::bindAttributeLocation() "bindAttributeLocation()" + instead. @requires_gles30 Multiple fragment shader outputs are not available in OpenGL ES 2.0, similar functionality is available in extension @es_extension{NV,draw_buffers}. @@ -199,9 +201,11 @@ Int projectionUniform = uniformLocation("projection"); @see @ref maxUniformLocations() @requires_gl43 %Extension @extension{ARB,explicit_uniform_location} for - explicit uniform location instead of using uniformLocation(). + explicit uniform location instead of using + @ref Magnum::AbstractShaderProgram::uniformLocation() "uniformLocation()". @requires_gl Explicit uniform location is not supported in OpenGL ES. Use - uniformLocation() instead. + @ref Magnum::AbstractShaderProgram::uniformLocation() "uniformLocation()" + instead. @subsection AbstractShaderProgram-texture-layer Binding texture layer uniforms @@ -216,7 +220,7 @@ layout(binding = 1) uniform sampler2D specularTexture; If you don't have the required extension (or if you want to change the layer later), declare the uniforms without the `layout()` qualifier and set the -texture layer uniform using @ref Magnum::AbstractShaderProgram::setUniform(Int, const T&) "setUniform(Int, Int)". +texture layer uniform using @ref setUniform(Int, const T&) "setUniform(Int, Int)". Note that additional syntax changes may be needed for GLSL 1.20 and GLSL ES 1.0. @code @@ -244,8 +248,8 @@ for more information) and map shader outputs to framebuffer attachments if needed (see @ref Framebuffer-usage "Framebuffer documentation" for more information). In each draw event set uniforms, mark the shader for use, bind specific framebuffer (if needed) and bind required textures to their -respective layers using AbstractTexture::bind(Int). Then call Mesh::draw(). -Example: +respective layers using @ref AbstractTexture::bind(Int). Then call +@ref Mesh::draw(). Example: @code shader.setTransformation(transformation) .setProjection(projection) @@ -260,7 +264,8 @@ mesh.draw(); @section AbstractShaderProgram-types Mapping between GLSL and Magnum types See @ref types for more information, only types with GLSL equivalent can be used -(and their super- or subclasses with the same size and underlying type). +(and their super- or subclasses with the same size and underlying type). See +also @ref Attribute::DataType enum for additional type options. @requires_gl30 %Extension @extension{EXT,gpu_shader4} is required when using integer attributes (i.e. @ref Magnum::UnsignedInt "UnsignedInt", @@ -270,32 +275,29 @@ See @ref types for more information, only types with GLSL equivalent can be used @ref Magnum::Vector4i "Vector4i") or unsigned integer uniforms (i.e. @ref Magnum::UnsignedInt "UnsignedInt", @ref Magnum::Vector2ui "Vector2ui", @ref Magnum::Vector3ui "Vector3ui" and @ref Magnum::Vector4ui "Vector4ui"). -@requires_gles30 Integer attributes and unsigned integer uniforms are not - available in OpenGL ES 2.0. - @requires_gl40 %Extension @extension{ARB,gpu_shader_fp64} is required when using double uniforms (i.e. @ref Magnum::Double "Double", @ref Magnum::Vector2d "Vector2d", @ref Magnum::Vector3d "Vector3d", - @ref Magnum::Vector4d "Vector4d", @ref Magnum::Matrix2d "Matrix2d", - @ref Magnum::Matrix3d "Matrix3d", @ref Magnum::Matrix4d "Matrix4d", + @ref Magnum::Vector4d "Vector4d", @ref Magnum::Matrix2x2d "Matrix2x2d", + @ref Magnum::Matrix3x3d "Matrix3x3d", @ref Magnum::Matrix4x4d "Matrix4x4d", @ref Magnum::Matrix2x3d "Matrix2x3d", @ref Magnum::Matrix3x2d "Matrix3x2d", @ref Magnum::Matrix2x4d "Matrix2x4d", @ref Magnum::Matrix4x2d "Matrix4x2d", @ref Magnum::Matrix3x4d "Matrix3x4d" and @ref Magnum::Matrix4x3d "Matrix4x3d"). @requires_gl41 %Extension @extension{ARB,vertex_attrib_64bit} is required when using double attributes (i.e. @ref Magnum::Double "Double", @ref Magnum::Vector2d "Vector2d", @ref Magnum::Vector3d "Vector3d", - @ref Magnum::Vector4d "Vector4d", @ref Magnum::Matrix2d "Matrix2d", - @ref Magnum::Matrix3d "Matrix3d", @ref Magnum::Matrix4d "Matrix4d", + @ref Magnum::Vector4d "Vector4d", @ref Magnum::Matrix2x2d "Matrix2x2d", + @ref Magnum::Matrix3x3d "Matrix3x3d", @ref Magnum::Matrix4x4d "Matrix4x4d", @ref Magnum::Matrix2x3d "Matrix2x3d", @ref Magnum::Matrix3x2d "Matrix3x2d", @ref Magnum::Matrix2x4d "Matrix2x4d", @ref Magnum::Matrix4x2d "Matrix4x2d", @ref Magnum::Matrix3x4d "Matrix3x4d" and @ref Magnum::Matrix4x3d "Matrix4x3d"). -@requires_gl Double attributes and uniforms are not available in OpenGL ES. -@requires_gles30 Non-square matrix attributes and uniforms (i.e. - @ref Magnum::Matrix2x3 "Matrix2x3", @ref Magnum::Matrix3x2 "Matrix3x2", - @ref Magnum::Matrix2x4 "Matrix2x4", @ref Magnum::Matrix4x2d "Matrix4x2", - @ref Magnum::Matrix3x4 "Matrix3x4" and @ref Magnum::Matrix4x3 "Matrix4x3") - are not available in OpenGL ES 2.0. +@requires_gles30 Integer attributes, unsigned integer uniforms and non-square + matrix attributes and uniforms (i.e. @ref Magnum::Matrix2x3 "Matrix2x3", + @ref Magnum::Matrix3x2 "Matrix3x2", @ref Magnum::Matrix2x4 "Matrix2x4", + @ref Magnum::Matrix4x2d "Matrix4x2", @ref Magnum::Matrix3x4 "Matrix3x4" and + @ref Magnum::Matrix4x3 "Matrix4x3") are not available in OpenGL ES 2.0. +@requires_gl Double attributes and uniforms are not available in OpenGL ES. @section AbstractShaderProgram-performance-optimization Performance optimizations @@ -303,16 +305,17 @@ The engine tracks currently used shader program to avoid unnecessary calls to @fn_gl{UseProgram}. %Shader limits (such as @ref maxVertexAttributes()) are cached, so repeated queries don't result in repeated @fn_gl{Get} calls. -If extension @extension{ARB,separate_shader_objects} or +If extension @extension{ARB,separate_shader_objects} (part of OpenGL 4.1) or @extension{EXT,direct_state_access} is available, uniform setting functions use DSA functions to avoid unnecessary calls to @fn_gl{UseProgram}. See -setUniform() documentation for more information. +@ref setUniform() documentation for more information. To achieve least state changes, set all uniforms in one run -- method chaining comes in handy. @see @ref portability-shaders +@todo Use Containers::ArrayReference for setting uniform arrays? @todo Compiling and linking more than one shader in parallel, then checking status, should be faster -- https://twitter.com/g_truc/status/352778836657700866 @todo `GL_NUM_{PROGRAM,SHADER}_BINARY_FORMATS` + `GL_{PROGRAM,SHADER}_BINARY_FORMATS` (vector), (@extension{ARB,ES2_compatibility}) @@ -586,7 +589,7 @@ class MAGNUM_EXPORT AbstractShaderProgram: public AbstractObject { /** * @brief Attach shader * - * @fn_gl{AttachShader} + * @see @fn_gl{AttachShader} */ void attachShader(Shader& shader); @@ -609,11 +612,11 @@ class MAGNUM_EXPORT AbstractShaderProgram: public AbstractObject { /** * @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`) + * @param name Fragment output variable name * * Binds fragment data to location which is used later for framebuffer - * operations. See also Framebuffer::BlendFunction for more + * operations. See also @ref Renderer::BlendFunction for more * information about using color input index. * @deprecated_gl Preferred usage is to specify attribute location * explicitly in the shader instead of using this function. See @@ -631,12 +634,13 @@ class MAGNUM_EXPORT AbstractShaderProgram: public AbstractObject { * @param location Location * @param name Fragment output variable name * - * The same as bindFragmentDataLocationIndexed(), but with `index` set - * to `0`. + * The same as @ref bindFragmentDataLocationIndexed(), but with `index` + * set to `0`. * @see @fn_gl{BindFragDataLocation} * @requires_gl30 %Extension @extension{EXT,gpu_shader4} * @requires_gl Use explicit location specification in OpenGL ES 3.0 - * instead. + * and `gl_FragData[n]` provided by @es_extension2{NV,draw_buffers,GL_NV_draw_buffers} + * in OpenGL ES 2.0. */ void bindFragmentDataLocation(UnsignedInt location, const std::string& name); #endif @@ -646,7 +650,7 @@ class MAGNUM_EXPORT AbstractShaderProgram: public AbstractObject { * * Returns `false` if linking failed, `true` otherwise. Compiler * message (if any) is printed to error output. All attached shaders - * must be explicitly compiled with Shader::compile() before linking. + * must be compiled with @ref Shader::compile() before linking. * @see @fn_gl{LinkProgram}, @fn_gl{GetProgram} with * @def_gl{LINK_STATUS} and @def_gl{INFO_LOG_LENGTH}, * @fn_gl{GetProgramInfoLog} @@ -671,7 +675,8 @@ class MAGNUM_EXPORT AbstractShaderProgram: public AbstractObject { * @param value Value * * Convenience alternative for setting one value, see - * setUniform(Int, UnsignedInt, const Float*) for more information. + * @ref setUniform(Int, UnsignedInt, const Float*) for more + * information. */ #ifdef DOXYGEN_GENERATING_OUTPUT template inline void setUniform(Int location, const T& value); @@ -706,10 +711,10 @@ class MAGNUM_EXPORT AbstractShaderProgram: public AbstractObject { * @param count Value count * @param values Values * - * If neither @extension{ARB,separate_shader_objects} nor - * @extension{EXT,direct_state_access} is available, the shader is - * marked for use before the operation. - * @see setUniform(Int, const T&), @fn_gl{UseProgram}, @fn_gl{Uniform} + * If neither @extension{ARB,separate_shader_objects} (part of OpenGL + * 4.1) nor @extension{EXT,direct_state_access} is available, the + * shader is marked for use before the operation. + * @see @ref setUniform(Int, const T&), @fn_gl{UseProgram}, @fn_gl{Uniform} * or @fn_gl{ProgramUniform}/@fn_gl_extension{ProgramUniform,EXT,direct_state_access}. */ void setUniform(Int location, UnsignedInt count, const Float* values) { @@ -1155,10 +1160,10 @@ Template parameter @p T is the type which is used for shader attribute, e.g. buffers to mesh. By default it is the same as type used in shader (e.g. @ref DataType::Int for @ref Vector4i). It's also possible to pass integer data to floating-point shader inputs. In this case you may want to normalize the -values (e.g. color components from 0-255 to 0.0f - 1.0f) -- see @ref DataOption::Normalize. +values (e.g. color components from 0-255 to 0.0f - 1.0f) -- see @ref DataOption::Normalized. Only some types are allowed as attribute types, see @ref AbstractShaderProgram-types -or TypeTraits::AttributeType for more information. +for more information. See @ref AbstractShaderProgram-subclassing for example usage in shaders and @ref Mesh-configuration for example usage when adding vertex buffers to mesh. @@ -1166,14 +1171,21 @@ See @ref AbstractShaderProgram-subclassing for example usage in shaders and template class AbstractShaderProgram::Attribute { public: enum: UnsignedInt { - Location = location /**< Location to which the attribute is bound */ + Location = location, /**< Location to which the attribute is bound */ + + /** + * Count of vectors in this type + * + * @see @ref vectorSize() + */ + VectorCount = Implementation::Attribute::VectorCount }; /** * @brief Type * * Type used in shader code. - * @see DataType + * @see @ref DataType */ typedef typename Implementation::Attribute::Type Type; @@ -1216,12 +1228,13 @@ template class AbstractShaderProgram::Attribute { #ifndef MAGNUM_TARGET_GLES /** * Four components with BGRA ordering. Only for four-component - * float vector type. + * float vector type. Must be used along with @ref DataType::UnsignedByte + * and @ref DataOption::Normalized. * @requires_gl32 %Extension @extension{ARB,vertex_array_bgra} * @requires_gl Only RGBA component ordering is supported in OpenGL * ES. */ - BGRA = 1 << 1 + BGRA = GL_BGRA #endif }; #else @@ -1232,7 +1245,7 @@ template class AbstractShaderProgram::Attribute { * @brief Data type * * Type of data passed to shader. - * @see Type, DataOptions, Attribute() + * @see @ref Type, @ref DataOptions, @ref Attribute() */ #ifdef DOXYGEN_GENERATING_OUTPUT enum class DataType: GLenum { @@ -1288,7 +1301,7 @@ template class AbstractShaderProgram::Attribute { /** * @brief Data option - * @see DataOptions, Attribute() + * @see @ref DataOptions, @ref Attribute() */ #ifdef DOXYGEN_GENERATING_OUTPUT enum class DataOption: UnsignedByte { @@ -1296,7 +1309,7 @@ template class AbstractShaderProgram::Attribute { * Normalize integer components. Only for float attribute types. * Default is to not normalize. */ - Normalize = 1 << 0 + Normalized = 1 << 0 }; #else typedef typename Implementation::Attribute::DataOption DataOption; @@ -1304,7 +1317,7 @@ template class AbstractShaderProgram::Attribute { /** * @brief Data options - * @see Attribute() + * @see @ref Attribute() */ #ifdef DOXYGEN_GENERATING_OUTPUT typedef typename Containers::EnumSet DataOptions; @@ -1316,7 +1329,7 @@ template class AbstractShaderProgram::Attribute { * @brief Constructor * @param components Component count * @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. */ constexpr Attribute(Components components, DataType dataType = Implementation::Attribute::DefaultDataType, DataOptions dataOptions = DataOptions()): _components(components), _dataType(dataType), _dataOptions(dataOptions) {} @@ -1338,9 +1351,13 @@ template class AbstractShaderProgram::Attribute { /** @brief Type of passed data */ constexpr DataType dataType() const { return _dataType; } - /** @brief Size of passed data */ - std::size_t dataSize() const { - return Implementation::Attribute::size(GLint(_components)*Implementation::Attribute::vectorCount(), _dataType); + /** + * @brief Size of each vector in passed data + * + * @see @ref VectorCount + */ + UnsignedInt vectorSize() const { + return Implementation::Attribute::size(GLint(_components), _dataType); } /** @brief Data options */ @@ -1367,7 +1384,7 @@ template struct SizedAttribute; /* Vector attribute sizes */ template struct SizedVectorAttribute { - constexpr static std::size_t vectorCount() { return cols; } + enum: UnsignedInt { VectorCount = UnsignedInt(cols) }; }; template<> struct SizedAttribute<1, 1>: SizedVectorAttribute<1> { enum class Components: GLint { One = 1 }; @@ -1628,7 +1645,7 @@ template<> struct Attribute> { }; typedef Containers::EnumSet DataOptions; - constexpr static std::size_t vectorCount() { return 1; } + enum: UnsignedInt { VectorCount = 1 }; static std::size_t MAGNUM_EXPORT size(GLint components, DataType dataType); }; diff --git a/src/AbstractTexture.cpp b/src/Magnum/AbstractTexture.cpp similarity index 99% rename from src/AbstractTexture.cpp rename to src/Magnum/AbstractTexture.cpp index 424e47ca9..f1facbed0 100644 --- a/src/AbstractTexture.cpp +++ b/src/Magnum/AbstractTexture.cpp @@ -24,13 +24,16 @@ #include "AbstractTexture.h" -#include "BufferImage.h" -#include "ColorFormat.h" -#include "Context.h" -#include "Extensions.h" -#include "Image.h" -#include "Shader.h" -#include "TextureFormat.h" +#ifndef MAGNUM_TARGET_GLES2 +#include "Magnum/BufferImage.h" +#endif +#include "Magnum/ColorFormat.h" +#include "Magnum/Context.h" +#include "Magnum/Extensions.h" +#include "Magnum/Image.h" +#include "Magnum/Shader.h" +#include "Magnum/TextureFormat.h" + #include "Implementation/DebugState.h" #include "Implementation/State.h" #include "Implementation/TextureState.h" diff --git a/src/AbstractTexture.h b/src/Magnum/AbstractTexture.h similarity index 99% rename from src/AbstractTexture.h rename to src/Magnum/AbstractTexture.h index 817afa5bb..90a9e7ebe 100644 --- a/src/AbstractTexture.h +++ b/src/Magnum/AbstractTexture.h @@ -28,10 +28,10 @@ * @brief Class @ref Magnum::AbstractTexture */ -#include "Array.h" -#include "Color.h" -#include "Sampler.h" -#include "AbstractObject.h" +#include "Magnum/Array.h" +#include "Magnum/Color.h" +#include "Magnum/Sampler.h" +#include "Magnum/AbstractObject.h" #ifdef CORRADE_GCC45_COMPATIBILITY #include "Buffer.h" @@ -101,6 +101,7 @@ nothing. @todo `GL_MAX_TEXTURE_LOD_BIAS` when `TEXTURE_LOD_BIAS` is implemented @todo `GL_NUM_COMPRESSED_TEXTURE_FORMATS` when compressed textures are implemented @todo `GL_MAX_SAMPLE_MASK_WORDS` when @extension{ARB,texture_multisample} is done +@todo Query for immutable levels (@extension{ARB,ES3_compatibility}) */ class MAGNUM_EXPORT AbstractTexture: public AbstractObject { friend class Context; @@ -299,7 +300,7 @@ class MAGNUM_EXPORT AbstractTexture: public AbstractObject { * @param level Mip level * * If running on OpenGL ES or extension @extension{ARB,invalidate_subdata} - * is not available, this function does nothing. + * (part of OpenGL 4.3) is not available, this function does nothing. * @see @ref Texture::invalidateSubImage() "invalidateSubImage()", * @fn_gl{InvalidateTexImage} */ diff --git a/src/Array.h b/src/Magnum/Array.h similarity index 98% rename from src/Array.h rename to src/Magnum/Array.h index 76bc627f9..60496d16d 100644 --- a/src/Array.h +++ b/src/Magnum/Array.h @@ -24,14 +24,14 @@ DEALINGS IN THE SOFTWARE. */ -/** @file /Array.h +/** @file * @brief Class Magnum::Array, Magnum::Array1D, Magnum::Array2D, Magnum::Array3D */ #include -#include "Math/BoolVector.h" /* for Math::Implementation::Sequence */ -#include "Magnum.h" +#include "Magnum/Magnum.h" +#include "Magnum/Math/BoolVector.h" /* for Math::Implementation::Sequence */ #ifdef CORRADE_MSVC2013_COMPATIBILITY #include diff --git a/src/Audio/AbstractImporter.cpp b/src/Magnum/Audio/AbstractImporter.cpp similarity index 96% rename from src/Audio/AbstractImporter.cpp rename to src/Magnum/Audio/AbstractImporter.cpp index e5591e202..8f364831b 100644 --- a/src/Audio/AbstractImporter.cpp +++ b/src/Magnum/Audio/AbstractImporter.cpp @@ -24,9 +24,9 @@ #include "AbstractImporter.h" -#include -#include -#include +#include +#include +#include namespace Magnum { namespace Audio { diff --git a/src/Audio/AbstractImporter.h b/src/Magnum/Audio/AbstractImporter.h similarity index 98% rename from src/Audio/AbstractImporter.h rename to src/Magnum/Audio/AbstractImporter.h index f4ba8b15b..5494e53f5 100644 --- a/src/Audio/AbstractImporter.h +++ b/src/Magnum/Audio/AbstractImporter.h @@ -28,10 +28,10 @@ * @brief Class Magnum::Audio::AbstractImporter */ -#include +#include -#include "Magnum.h" -#include "Audio/Buffer.h" +#include "Magnum/Magnum.h" +#include "Magnum/Audio/Buffer.h" namespace Magnum { namespace Audio { diff --git a/src/Audio/Audio.cpp b/src/Magnum/Audio/Audio.cpp similarity index 98% rename from src/Audio/Audio.cpp rename to src/Magnum/Audio/Audio.cpp index fa382b100..cac27fa93 100644 --- a/src/Audio/Audio.cpp +++ b/src/Magnum/Audio/Audio.cpp @@ -25,7 +25,7 @@ #include #include -#include "Types.h" +#include "Magnum/Types.h" namespace Magnum { namespace Audio { diff --git a/src/Audio/Audio.h b/src/Magnum/Audio/Audio.h similarity index 100% rename from src/Audio/Audio.h rename to src/Magnum/Audio/Audio.h diff --git a/src/Audio/Buffer.cpp b/src/Magnum/Audio/Buffer.cpp similarity index 97% rename from src/Audio/Buffer.cpp rename to src/Magnum/Audio/Buffer.cpp index 1a28d95c1..36de21bd9 100644 --- a/src/Audio/Buffer.cpp +++ b/src/Magnum/Audio/Buffer.cpp @@ -24,7 +24,7 @@ #include "Buffer.h" -#include +#include namespace Magnum { namespace Audio { diff --git a/src/Audio/Buffer.h b/src/Magnum/Audio/Buffer.h similarity index 97% rename from src/Audio/Buffer.h rename to src/Magnum/Audio/Buffer.h index 31774c9e5..3f2d44bc5 100644 --- a/src/Audio/Buffer.h +++ b/src/Magnum/Audio/Buffer.h @@ -30,10 +30,10 @@ #include #include -#include +#include -#include "Magnum.h" -#include "Audio/magnumAudioVisibility.h" +#include "Magnum/Magnum.h" +#include "Magnum/Audio/visibility.h" namespace Magnum { namespace Audio { diff --git a/src/Audio/CMakeLists.txt b/src/Magnum/Audio/CMakeLists.txt similarity index 98% rename from src/Audio/CMakeLists.txt rename to src/Magnum/Audio/CMakeLists.txt index 3f1a20870..ce213f309 100644 --- a/src/Audio/CMakeLists.txt +++ b/src/Magnum/Audio/CMakeLists.txt @@ -42,7 +42,7 @@ set(MagnumAudio_HEADERS Renderer.h Source.h - magnumAudioVisibility.h) + visibility.h) add_library(MagnumAudio ${SHARED_OR_STATIC} ${MagnumAudio_SOURCES}) target_link_libraries(MagnumAudio ${CORRADE_PLUGINMANAGER_LIBRARIES} ${OPENAL_LIBRARY}) diff --git a/src/Audio/Context.cpp b/src/Magnum/Audio/Context.cpp similarity index 95% rename from src/Audio/Context.cpp rename to src/Magnum/Audio/Context.cpp index 86af094de..e0f7a5785 100644 --- a/src/Audio/Context.cpp +++ b/src/Magnum/Audio/Context.cpp @@ -25,10 +25,10 @@ #include "Context.h" #include -#include -#include +#include +#include -#include "Magnum.h" +#include "Magnum/Magnum.h" namespace Magnum { namespace Audio { diff --git a/src/Audio/Context.h b/src/Magnum/Audio/Context.h similarity index 98% rename from src/Audio/Context.h rename to src/Magnum/Audio/Context.h index 3969fb87b..c129d43bc 100644 --- a/src/Audio/Context.h +++ b/src/Magnum/Audio/Context.h @@ -28,10 +28,10 @@ * @brief Class Magnum::Audio::Context */ -#include #include +#include -#include "Audio/magnumAudioVisibility.h" +#include "Magnum/Audio/visibility.h" #ifndef DOXYGEN_GENERATING_OUTPUT typedef struct ALCdevice_struct ALCdevice; diff --git a/src/Audio/Renderer.cpp b/src/Magnum/Audio/Renderer.cpp similarity index 97% rename from src/Audio/Renderer.cpp rename to src/Magnum/Audio/Renderer.cpp index 4dbeae53f..5dd492c2c 100644 --- a/src/Audio/Renderer.cpp +++ b/src/Magnum/Audio/Renderer.cpp @@ -24,7 +24,7 @@ #include "Renderer.h" -#include +#include namespace Magnum { namespace Audio { diff --git a/src/Audio/Renderer.h b/src/Magnum/Audio/Renderer.h similarity index 98% rename from src/Audio/Renderer.h rename to src/Magnum/Audio/Renderer.h index 6d40a7bd1..a2171b8e6 100644 --- a/src/Audio/Renderer.h +++ b/src/Magnum/Audio/Renderer.h @@ -30,9 +30,9 @@ #include -#include "Math/Vector3.h" -#include "Magnum.h" -#include "Audio/magnumAudioVisibility.h" +#include "Magnum/Magnum.h" +#include "Magnum/Audio/visibility.h" +#include "Magnum/Math/Vector3.h" namespace Magnum { namespace Audio { diff --git a/src/Audio/Source.cpp b/src/Magnum/Audio/Source.cpp similarity index 98% rename from src/Audio/Source.cpp rename to src/Magnum/Audio/Source.cpp index aaa0ab9d4..9c8ceb5e2 100644 --- a/src/Audio/Source.cpp +++ b/src/Magnum/Audio/Source.cpp @@ -24,9 +24,9 @@ #include "Source.h" -#include +#include -#include "Audio/Buffer.h" +#include "Magnum/Audio/Buffer.h" namespace Magnum { namespace Audio { diff --git a/src/Audio/Source.h b/src/Magnum/Audio/Source.h similarity index 99% rename from src/Audio/Source.h rename to src/Magnum/Audio/Source.h index 2aeae5325..17248dcb5 100644 --- a/src/Audio/Source.h +++ b/src/Magnum/Audio/Source.h @@ -32,10 +32,10 @@ #include #include -#include "Math/Vector3.h" -#include "Magnum.h" -#include "Audio/Audio.h" -#include "Audio/magnumAudioVisibility.h" +#include "Magnum/Magnum.h" +#include "Magnum/Audio/Audio.h" +#include "Magnum/Audio/visibility.h" +#include "Magnum/Math/Vector3.h" namespace Magnum { namespace Audio { diff --git a/src/Audio/Test/AbstractImporterTest.cpp b/src/Magnum/Audio/Test/AbstractImporterTest.cpp similarity index 93% rename from src/Audio/Test/AbstractImporterTest.cpp rename to src/Magnum/Audio/Test/AbstractImporterTest.cpp index 57edac8b4..533a3fe74 100644 --- a/src/Audio/Test/AbstractImporterTest.cpp +++ b/src/Magnum/Audio/Test/AbstractImporterTest.cpp @@ -22,13 +22,13 @@ DEALINGS IN THE SOFTWARE. */ -#include -#include -#include +#include +#include +#include -#include "Audio/AbstractImporter.h" +#include "Magnum/Audio/AbstractImporter.h" -#include "testConfigure.h" +#include "configure.h" namespace Magnum { namespace Audio { namespace Test { diff --git a/src/Audio/Test/BufferTest.cpp b/src/Magnum/Audio/Test/BufferTest.cpp similarity index 96% rename from src/Audio/Test/BufferTest.cpp rename to src/Magnum/Audio/Test/BufferTest.cpp index 56c6f2ba9..e13def785 100644 --- a/src/Audio/Test/BufferTest.cpp +++ b/src/Magnum/Audio/Test/BufferTest.cpp @@ -23,9 +23,9 @@ */ #include -#include +#include -#include "Audio/Buffer.h" +#include "Magnum/Audio/Buffer.h" namespace Magnum { namespace Audio { namespace Test { diff --git a/src/Audio/Test/CMakeLists.txt b/src/Magnum/Audio/Test/CMakeLists.txt similarity index 89% rename from src/Audio/Test/CMakeLists.txt rename to src/Magnum/Audio/Test/CMakeLists.txt index 3a42d1f27..132ece4fa 100644 --- a/src/Audio/Test/CMakeLists.txt +++ b/src/Magnum/Audio/Test/CMakeLists.txt @@ -22,10 +22,10 @@ # DEALINGS IN THE SOFTWARE. # -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/testConfigure.h.cmake - ${CMAKE_CURRENT_BINARY_DIR}/testConfigure.h) +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/configure.h.cmake + ${CMAKE_CURRENT_BINARY_DIR}/configure.h) -include_directories(${CMAKE_CURRENT_BINARY_DIR}) +include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR}) corrade_add_test(AudioAbstractImporterTest AbstractImporterTest.cpp LIBRARIES MagnumAudio) corrade_add_test(AudioBufferTest BufferTest.cpp LIBRARIES MagnumAudio) diff --git a/src/Audio/Test/RendererTest.cpp b/src/Magnum/Audio/Test/RendererTest.cpp similarity index 95% rename from src/Audio/Test/RendererTest.cpp rename to src/Magnum/Audio/Test/RendererTest.cpp index 9be69593d..6a4a953a8 100644 --- a/src/Audio/Test/RendererTest.cpp +++ b/src/Magnum/Audio/Test/RendererTest.cpp @@ -23,9 +23,9 @@ */ #include -#include +#include -#include "Audio/Renderer.h" +#include "Magnum/Audio/Renderer.h" namespace Magnum { namespace Audio { namespace Test { diff --git a/src/Audio/Test/SourceTest.cpp b/src/Magnum/Audio/Test/SourceTest.cpp similarity index 95% rename from src/Audio/Test/SourceTest.cpp rename to src/Magnum/Audio/Test/SourceTest.cpp index 90424ce29..79f388895 100644 --- a/src/Audio/Test/SourceTest.cpp +++ b/src/Magnum/Audio/Test/SourceTest.cpp @@ -23,9 +23,9 @@ */ #include -#include +#include -#include "Audio/Source.h" +#include "Magnum/Audio/Source.h" namespace Magnum { namespace Audio { namespace Test { diff --git a/src/Audio/Test/testConfigure.h.cmake b/src/Magnum/Audio/Test/configure.h.cmake similarity index 100% rename from src/Audio/Test/testConfigure.h.cmake rename to src/Magnum/Audio/Test/configure.h.cmake diff --git a/src/Audio/Test/file.bin b/src/Magnum/Audio/Test/file.bin similarity index 100% rename from src/Audio/Test/file.bin rename to src/Magnum/Audio/Test/file.bin diff --git a/src/Audio/magnumAudioVisibility.h b/src/Magnum/Audio/visibility.h similarity index 90% rename from src/Audio/magnumAudioVisibility.h rename to src/Magnum/Audio/visibility.h index cc4600394..9e20065a0 100644 --- a/src/Audio/magnumAudioVisibility.h +++ b/src/Magnum/Audio/visibility.h @@ -1,5 +1,5 @@ -#ifndef Magnum_Audio_magnumAudioVisibility_h -#define Magnum_Audio_magnumAudioVisibility_h +#ifndef Magnum_Audio_visibility_h +#define Magnum_Audio_visibility_h /* This file is part of Magnum. @@ -24,9 +24,9 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include -#include "magnumConfigure.h" +#include "Magnum/configure.h" #ifndef MAGNUM_BUILD_STATIC #ifdef MagnumAudio_EXPORTS diff --git a/src/Buffer.cpp b/src/Magnum/Buffer.cpp similarity index 98% rename from src/Buffer.cpp rename to src/Magnum/Buffer.cpp index aaf53b5ca..7f5369a65 100644 --- a/src/Buffer.cpp +++ b/src/Magnum/Buffer.cpp @@ -24,10 +24,11 @@ #include "Buffer.h" -#include +#include + +#include "Magnum/Context.h" +#include "Magnum/Extensions.h" -#include "Context.h" -#include "Extensions.h" #include "Implementation/State.h" #include "Implementation/BufferState.h" #include "Implementation/DebugState.h" @@ -79,6 +80,9 @@ void Buffer::initializeContextBasedFunctionality(Context& context) { #ifndef MAGNUM_TARGET_GLES Int Buffer::minMapAlignment() { + if(!Context::current()->isExtensionSupported()) + return 0; + GLint& value = Context::current()->state().buffer->minMapAlignment; if(value == 0) diff --git a/src/Buffer.h b/src/Magnum/Buffer.h similarity index 98% rename from src/Buffer.h rename to src/Magnum/Buffer.h index 59f56c84b..828ffe740 100644 --- a/src/Buffer.h +++ b/src/Magnum/Buffer.h @@ -24,19 +24,19 @@ DEALINGS IN THE SOFTWARE. */ -/** @file /Buffer.h +/** @file * @brief Class @ref Magnum::Buffer, enum @ref Magnum::BufferUsage */ #include #include #include -#include -#include -#include +#include +#include +#include -#include "AbstractObject.h" -#include "Magnum.h" +#include "Magnum/AbstractObject.h" +#include "Magnum/Magnum.h" namespace Magnum { @@ -422,7 +422,8 @@ class MAGNUM_EXPORT Buffer: public AbstractObject { * @brief Minimal supported mapping alignment * * The result is cached, repeated queries don't result in repeated - * OpenGL calls. + * OpenGL calls. If extension @extension{ARB,map_buffer_alignment} is + * not available, returns `0`. * @see @ref map(), @fn_gl{Get} with @def_gl{MIN_MAP_BUFFER_ALIGNMENT} * @requires_gl No minimal value is specified for OpenGL ES. */ @@ -636,7 +637,7 @@ class MAGNUM_EXPORT Buffer: public AbstractObject { * @requires_gl %Buffer data queries are not available in OpenGL ES. * Use @ref Magnum::Buffer::map() "map()" instead. */ - template Containers::Array data(); + template Containers::Array data(); /** * @brief %Buffer subdata @@ -652,7 +653,7 @@ class MAGNUM_EXPORT Buffer: public AbstractObject { * @requires_gl %Buffer data queries are not available in OpenGL ES. * Use @ref Magnum::Buffer::map() "map()" instead. */ - template Containers::Array subData(GLintptr offset, GLsizeiptr size); + template Containers::Array subData(GLintptr offset, GLsizeiptr size); #endif /** @@ -741,7 +742,7 @@ class MAGNUM_EXPORT Buffer: public AbstractObject { * @return Reference to self (for method chaining) * * If running on OpenGL ES or extension @extension{ARB,invalidate_subdata} - * is not available, this function does nothing. + * (part of OpenGL 4.3) is not available, this function does nothing. * @see @ref MapFlag::InvalidateBuffer, @fn_gl{InvalidateBufferData} */ Buffer& invalidateData() { @@ -756,7 +757,7 @@ class MAGNUM_EXPORT Buffer: public AbstractObject { * @return Reference to self (for method chaining) * * If running on OpenGL ES or extension @extension{ARB,invalidate_subdata} - * is not available, this function does nothing. + * (part of OpenGL 4.3) is not available, this function does nothing. * @see @ref MapFlag::InvalidateRange, @fn_gl{InvalidateBufferData} */ Buffer& invalidateSubData(GLintptr offset, GLsizeiptr length) { diff --git a/src/BufferImage.cpp b/src/Magnum/BufferImage.cpp similarity index 100% rename from src/BufferImage.cpp rename to src/Magnum/BufferImage.cpp diff --git a/src/BufferImage.h b/src/Magnum/BufferImage.h similarity index 93% rename from src/BufferImage.h rename to src/Magnum/BufferImage.h index 637a995e5..3d23a3844 100644 --- a/src/BufferImage.h +++ b/src/Magnum/BufferImage.h @@ -30,10 +30,10 @@ */ #endif -#include "Math/Vector3.h" -#include "AbstractImage.h" -#include "Buffer.h" -#include "DimensionTraits.h" +#include "Magnum/AbstractImage.h" +#include "Magnum/Buffer.h" +#include "Magnum/DimensionTraits.h" +#include "Magnum/Math/Vector3.h" namespace Magnum { @@ -88,6 +88,11 @@ template class MAGNUM_EXPORT BufferImage: public Abstrac /** @brief %Image size */ typename DimensionTraits::VectorType size() const { return _size; } + /** @copydoc Image::dataSize() */ + std::size_t dataSize(const typename DimensionTraits::VectorType& size) const { + return AbstractImage::dataSize(size); + } + /** @brief %Image buffer */ Buffer& buffer() { return _buffer; } @@ -139,6 +144,8 @@ template inline BufferImage& BufferImage +# +# 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. +# + +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/configure.h.cmake + ${CMAKE_CURRENT_BINARY_DIR}/configure.h) + +# Files shared between main library and unit test library +set(Magnum_SRCS + AbstractFramebuffer.cpp + AbstractImage.cpp + AbstractObject.cpp + AbstractTexture.cpp + AbstractShaderProgram.cpp + Buffer.cpp + ColorFormat.cpp + Context.cpp + DebugMessage.cpp + DefaultFramebuffer.cpp + Framebuffer.cpp + Image.cpp + Mesh.cpp + MeshView.cpp + OpenGL.cpp + Query.cpp + Renderbuffer.cpp + Renderer.cpp + Resource.cpp + Sampler.cpp + Shader.cpp + Timeline.cpp + Version.cpp + + Implementation/BufferState.cpp + Implementation/DebugState.cpp + Implementation/State.cpp + Implementation/TextureState.cpp + + Trade/AbstractImageConverter.cpp + Trade/AbstractImporter.cpp + Trade/AbstractMaterialData.cpp + Trade/MeshData2D.cpp + Trade/MeshData3D.cpp + Trade/MeshObjectData2D.cpp + Trade/MeshObjectData3D.cpp + Trade/ObjectData2D.cpp + Trade/ObjectData3D.cpp + Trade/PhongMaterialData.cpp + Trade/SceneData.cpp + Trade/TextureData.cpp) + +# Desktop-only code +if(NOT TARGET_GLES) + set(Magnum_SRCS ${Magnum_SRCS} + BufferTexture.cpp) +endif() + +# Not-ES2 code +if(NOT TARGET_GLES2) + set(Magnum_SRCS ${Magnum_SRCS} + BufferImage.cpp) +endif() + +set(Magnum_HEADERS + AbstractFramebuffer.h + AbstractImage.h + AbstractObject.h + AbstractResourceLoader.h + AbstractShaderProgram.h + AbstractTexture.h + Array.h + Buffer.h + Color.h + ColorFormat.h + Context.h + CubeMapTexture.h + DebugMessage.h + DefaultFramebuffer.h + DimensionTraits.h + Extensions.h + Framebuffer.h + Image.h + ImageReference.h + Magnum.h + Mesh.h + MeshView.h + OpenGL.h + Query.h + Renderbuffer.h + RenderbufferFormat.h + Renderer.h + Resource.h + ResourceManager.h + Sampler.h + Shader.h + Texture.h + TextureFormat.h + Timeline.h + Types.h + Version.h + + visibility.h) + +# Deprecated headers +if(BUILD_DEPRECATED) + set(Magnum_HEADERS ${Magnum_HEADERS} + DebugMarker.h + ImageFormat.h + Swizzle.h) +endif() + +# Desktop-only headers and libraries +if(NOT TARGET_GLES) + set(Magnum_HEADERS ${Magnum_HEADERS} + BufferTexture.h + CubeMapTextureArray.h) + set(Magnum_SRCS ${Magnum_SRCS} $) +endif() + +# Not-ES2 headers +if(NOT TARGET_GLES2) + set(Magnum_HEADERS ${Magnum_HEADERS} + BufferImage.h) +endif() + +# Files shared between main library and math unit test library +set(MagnumMath_SRCS + Math/Functions.cpp + Math/instantiation.cpp) + +# Main library +add_library(MagnumMathObjects OBJECT ${MagnumMath_SRCS}) +add_library(Magnum ${SHARED_OR_STATIC} + ${Magnum_SRCS} + $) + +# TODO: fix when CMake sets target_EXPORTS for OBJECT targets as well +if(NOT BUILD_STATIC OR BUILD_STATIC_PIC) + # Set shared library flags for the objects, as they will be part of shared lib + # TODO: CMake 2.8.9 has this as POSITION_INDEPENDENT_CODE property + set_target_properties(MagnumMathObjects PROPERTIES COMPILE_FLAGS "-DMagnumMathObjects_EXPORTS ${CMAKE_SHARED_LIBRARY_CXX_FLAGS}") + set_target_properties(Magnum PROPERTIES COMPILE_FLAGS "-DGLLoadGen_EXPORTS ${CMAKE_SHARED_LIBRARY_CXX_FLAGS}") +else() + set_target_properties(MagnumMathObjects PROPERTIES COMPILE_FLAGS "-DMagnumMathObjects_EXPORTS") + set_target_properties(Magnum PROPERTIES COMPILE_FLAGS "-DGLLoadGen_EXPORTS") +endif() + +set(Magnum_LIBS + ${CORRADE_UTILITY_LIBRARIES} + ${CORRADE_PLUGINMANAGER_LIBRARIES}) +if(NOT TARGET_GLES OR TARGET_DESKTOP_GLES) + set(Magnum_LIBS ${Magnum_LIBS} ${OPENGL_gl_LIBRARY}) +elseif(TARGET_GLES2) + set(Magnum_LIBS ${Magnum_LIBS} ${OPENGLES2_LIBRARY}) +else() + set(Magnum_LIBS ${Magnum_LIBS} ${OPENGLES3_LIBRARY}) +endif() +target_link_libraries(Magnum ${Magnum_LIBS}) + +install(TARGETS Magnum + RUNTIME DESTINATION ${MAGNUM_BINARY_INSTALL_DIR} + LIBRARY DESTINATION ${MAGNUM_LIBRARY_INSTALL_DIR} + ARCHIVE DESTINATION ${MAGNUM_LIBRARY_INSTALL_DIR}) +install(FILES ${Magnum_HEADERS} DESTINATION ${MAGNUM_INCLUDE_INSTALL_DIR}) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/configure.h DESTINATION ${MAGNUM_INCLUDE_INSTALL_DIR}) + +add_subdirectory(Math) +add_subdirectory(Platform) +add_subdirectory(Trade) + +if(WITH_AUDIO) + add_subdirectory(Audio) +endif() + +if(WITH_DEBUGTOOLS) + add_subdirectory(DebugTools) +endif() + +if(WITH_MESHTOOLS) + add_subdirectory(MeshTools) +endif() + +if(WITH_PRIMITIVES) + add_subdirectory(Primitives) +endif() + +if(WITH_SCENEGRAPH) + add_subdirectory(SceneGraph) +endif() + +if(WITH_SHADERS) + add_subdirectory(Shaders) +endif() + +if(WITH_SHAPES) + add_subdirectory(Shapes) +endif() + +if(WITH_TEXT) + add_subdirectory(Text) +endif() + +if(WITH_TEXTURETOOLS) + add_subdirectory(TextureTools) +endif() + +if(BUILD_TESTS) + # Libraries with graceful assert for testing + add_library(MagnumMathTestLib ${SHARED_OR_STATIC} + $) + set_target_properties(MagnumMathTestLib PROPERTIES COMPILE_FLAGS -DCORRADE_GRACEFUL_ASSERT) + target_link_libraries(MagnumMathTestLib ${CORRADE_UTILITY_LIBRARY}) + + # On Windows we need to install first and then run the tests to avoid "DLL + # not found" hell, thus we need to install this too + if(WIN32 AND NOT CMAKE_CROSSCOMPILING) + install(TARGETS MagnumMathTestLib + RUNTIME DESTINATION ${MAGNUM_BINARY_INSTALL_DIR} + LIBRARY DESTINATION ${MAGNUM_LIBRARY_INSTALL_DIR} + ARCHIVE DESTINATION ${MAGNUM_LIBRARY_INSTALL_DIR}) + endif() + + add_subdirectory(Test) +endif() diff --git a/src/Color.h b/src/Magnum/Color.h similarity index 95% rename from src/Color.h rename to src/Magnum/Color.h index b3235a877..8e3f70a51 100644 --- a/src/Color.h +++ b/src/Magnum/Color.h @@ -25,14 +25,14 @@ */ /** @file - * @brief Class Magnum::BasicColor3, Magnum::BasicColor4, typedef Magnum::Color3, Magnum::Color4 + * @brief Class @ref Magnum::BasicColor3, @ref Magnum::BasicColor4, typedef @ref Magnum::Color3, @ref Magnum::Color4 */ #include -#include "Math/Functions.h" -#include "Math/Vector4.h" -#include "Magnum.h" +#include "Magnum/Magnum.h" +#include "Magnum/Math/Functions.h" +#include "Magnum/Math/Vector4.h" namespace Magnum { @@ -151,7 +151,7 @@ Conversion from and to HSV is done always using floating-point types, so hue is always in range in range @f$ [0.0, 360.0] @f$, saturation and value in range @f$ [0.0, 1.0] @f$. -@see @ref Color3, @ref BasicColor4 +@see @ref Color3, @ref Color3ub, @ref BasicColor4 */ /* Not using template specialization because some internal functions are impossible to explicitly instantiate */ @@ -305,7 +305,7 @@ template class BasicColor3: public Math::Vector3 { * std::tie(hue, saturation, value) = color.toHSV(); * @endcode * - * @see hue(), saturation(), value(), fromHSV() + * @see @ref hue(), @ref saturation(), @ref value(), @ref fromHSV() */ constexpr HSV toHSV() const { return Implementation::toHSV(*this); @@ -315,7 +315,7 @@ template class BasicColor3: public Math::Vector3 { * @brief Hue * @return Hue in range @f$ [0.0, 360.0] @f$. * - * @see saturation(), value(), toHSV(), fromHSV() + * @see @ref saturation(), @ref value(), @ref toHSV(), @ref fromHSV() */ constexpr Math::Deg hue() const { return Math::Deg(Implementation::hue(*this)); @@ -325,7 +325,7 @@ template class BasicColor3: public Math::Vector3 { * @brief Saturation * @return Saturation in range @f$ [0.0, 1.0] @f$. * - * @see hue(), value(), toHSV(), fromHSV() + * @see @ref hue(), @ref value(), @ref toHSV(), @ref fromHSV() */ constexpr FloatingPointType saturation() const { return Implementation::saturation(*this); @@ -335,7 +335,7 @@ template class BasicColor3: public Math::Vector3 { * @brief Value * @return Value in range @f$ [0.0, 1.0] @f$. * - * @see hue(), saturation(), toHSV(), fromHSV() + * @see @ref hue(), @ref saturation(), @ref toHSV(), @ref fromHSV() */ constexpr FloatingPointType value() const { return Implementation::value(*this); @@ -353,13 +353,16 @@ template class BasicColor3: public Math::Vector3 { /** @brief Three-component (RGB) float color */ typedef BasicColor3 Color3; +/** @brief Three-component (RGB) unsigned byte color */ +typedef BasicColor3 Color3ub; + MAGNUM_VECTORn_OPERATOR_IMPLEMENTATION(3, BasicColor3) /** @brief Four-component (RGBA) color See @ref BasicColor3 for more information. -@see @ref Color4 +@see @ref Color4, @ref Color4ub */ /* Not using template specialization because some internal functions are impossible to explicitly instantiate */ @@ -468,7 +471,7 @@ class BasicColor4: public Math::Vector4 { /** * @copydoc BasicColor3::fromHSV() - * @param a Alpha value, defaults to 1.0 for floating-point types + * @param a Alpha value, defaults to `1.0` for floating-point types * and maximum positive value for integral types. */ #ifndef CORRADE_MSVC2013_COMPATIBILITY @@ -487,14 +490,14 @@ class BasicColor4: public Math::Vector4 { /** * @brief Default constructor * - * RGB components are set to zero, A component is set to 1.0 for + * RGB components are set to zero, A component is set to `1.0` for * floating-point types and maximum positive value for integral types. */ constexpr /*implicit*/ BasicColor4(): Math::Vector4(T(0), T(0), T(0), Implementation::fullChannel()) {} /** * @copydoc BasicColor3::BasicColor3(T) - * @param alpha Alpha value, defaults to 1.0 for floating-point types + * @param alpha Alpha value, defaults to `1.0` for floating-point types * and maximum positive value for integral types. */ #ifndef CORRADE_MSVC2013_COMPATIBILITY @@ -508,7 +511,7 @@ class BasicColor4: public Math::Vector4 { * @param r R value * @param g G value * @param b B value - * @param a A value, defaults to 1.0 for floating-point types and + * @param a A value, defaults to `1.0` for floating-point types and * maximum positive value for integral types. */ #ifndef CORRADE_MSVC2013_COMPATIBILITY @@ -574,6 +577,9 @@ class BasicColor4: public Math::Vector4 { /** @brief Four-component (RGBA) float color */ typedef BasicColor4 Color4; +/** @brief Four-component (RGBA) unsigned byte color */ +typedef BasicColor4 Color4ub; + MAGNUM_VECTORn_OPERATOR_IMPLEMENTATION(4, BasicColor4) /** @debugoperator{Magnum::BasicColor3} */ diff --git a/src/ColorFormat.cpp b/src/Magnum/ColorFormat.cpp similarity index 99% rename from src/ColorFormat.cpp rename to src/Magnum/ColorFormat.cpp index 7b3403ec2..d4b493297 100644 --- a/src/ColorFormat.cpp +++ b/src/Magnum/ColorFormat.cpp @@ -24,7 +24,7 @@ #include "ColorFormat.h" -#include +#include namespace Magnum { diff --git a/src/ColorFormat.h b/src/Magnum/ColorFormat.h similarity index 99% rename from src/ColorFormat.h rename to src/Magnum/ColorFormat.h index dadccf2cd..a25a1d79a 100644 --- a/src/ColorFormat.h +++ b/src/Magnum/ColorFormat.h @@ -28,9 +28,9 @@ * @brief Enum @ref Magnum::ColorFormat, @ref Magnum::ColorType */ -#include "Magnum.h" -#include "OpenGL.h" -#include "magnumVisibility.h" +#include "Magnum/Magnum.h" +#include "Magnum/OpenGL.h" +#include "Magnum/visibility.h" namespace Magnum { diff --git a/src/Context.cpp b/src/Magnum/Context.cpp similarity index 96% rename from src/Context.cpp rename to src/Magnum/Context.cpp index 8590432ac..bbc7f0b6b 100644 --- a/src/Context.cpp +++ b/src/Magnum/Context.cpp @@ -26,20 +26,22 @@ #include #include -#include -#include - -#include "AbstractFramebuffer.h" -#include "AbstractShaderProgram.h" -#include "AbstractTexture.h" -#include "Buffer.h" -#include "BufferTexture.h" -#include "DefaultFramebuffer.h" -#include "Extensions.h" -#include "Framebuffer.h" -#include "Mesh.h" -#include "Renderbuffer.h" -#include "Renderer.h" +#include +#include + +#include "Magnum/AbstractFramebuffer.h" +#include "Magnum/AbstractShaderProgram.h" +#include "Magnum/AbstractTexture.h" +#include "Magnum/Buffer.h" +#ifndef MAGNUM_TARGET_GLES +#include "Magnum/BufferTexture.h" +#endif +#include "Magnum/DefaultFramebuffer.h" +#include "Magnum/Extensions.h" +#include "Magnum/Framebuffer.h" +#include "Magnum/Mesh.h" +#include "Magnum/Renderbuffer.h" +#include "Magnum/Renderer.h" #include "Implementation/State.h" @@ -213,6 +215,7 @@ const std::vector& Extension::extensions(Version version) { _extension(GL,OES,stencil1), _extension(GL,OES,stencil4), _extension(GL,OES,texture_3D)}; + #ifdef MAGNUM_TARGET_GLES2 static const std::vector extensionsES300{ _extension(GL,ANGLE,framebuffer_blit), _extension(GL,ANGLE,framebuffer_multisample), @@ -246,6 +249,7 @@ const std::vector& Extension::extensions(Version version) { _extension(GL,OES,required_internalformat), _extension(GL,OES,surfaceless_context)}; // done #endif + #endif switch(version) { case Version::None: return extensions; @@ -264,7 +268,12 @@ const std::vector& Extension::extensions(Version version) { case Version::GL440: return extensions440; #else case Version::GLES200: return empty; - case Version::GLES300: return extensionsES300; + case Version::GLES300: + #ifdef MAGNUM_TARGET_GLES2 + return extensionsES300; + #else + return empty; + #endif #endif } diff --git a/src/Context.h b/src/Magnum/Context.h similarity index 97% rename from src/Context.h rename to src/Magnum/Context.h index 55a43478a..a7d2e6d65 100644 --- a/src/Context.h +++ b/src/Magnum/Context.h @@ -24,18 +24,18 @@ DEALINGS IN THE SOFTWARE. */ -/** @file /Context.h +/** @file * @brief Class @ref Magnum::Context, @ref Magnum::Extension, macro @ref MAGNUM_ASSERT_VERSION_SUPPORTED(), @ref MAGNUM_ASSERT_EXTENSION_SUPPORTED() */ #include #include #include -#include +#include -#include "Magnum.h" -#include "OpenGL.h" -#include "magnumVisibility.h" +#include "Magnum/Magnum.h" +#include "Magnum/OpenGL.h" +#include "Magnum/visibility.h" #ifdef CORRADE_GCC45_COMPATIBILITY #include "Version.h" @@ -273,7 +273,8 @@ class MAGNUM_EXPORT Context { * If no version from the list is supported, returns lowest available * OpenGL version (@ref Version::GL210 for desktop OpenGL, * @ref Version::GLES200 for OpenGL ES). - * @see @ref isExtensionSupported(Version) + * @see isExtensionSupported(Version) const + * @todoc Explicit reference when Doxygen is sane */ Version supportedVersion(std::initializer_list versions) const; @@ -290,8 +291,9 @@ class MAGNUM_EXPORT Context { * } * @endcode * - * @see @ref isExtensionSupported(const Extension&) const, + * @see isExtensionSupported(const Extension&) const, * @ref MAGNUM_ASSERT_EXTENSION_SUPPORTED() + * @todoc Explicit reference when Doxygen is sane */ template bool isExtensionSupported() const { return isVersionSupported(T::coreVersion()) || (isVersionSupported(T::requiredVersion()) && extensionStatus[T::Index]); diff --git a/src/CubeMapTexture.h b/src/Magnum/CubeMapTexture.h similarity index 99% rename from src/CubeMapTexture.h rename to src/Magnum/CubeMapTexture.h index b4c4a30b9..fe2045348 100644 --- a/src/CubeMapTexture.h +++ b/src/Magnum/CubeMapTexture.h @@ -28,7 +28,7 @@ * @brief Class @ref Magnum::CubeMapTexture */ -#include "AbstractTexture.h" +#include "Magnum/AbstractTexture.h" namespace Magnum { diff --git a/src/CubeMapTextureArray.h b/src/Magnum/CubeMapTextureArray.h similarity index 99% rename from src/CubeMapTextureArray.h rename to src/Magnum/CubeMapTextureArray.h index 558a8b89b..9b976132e 100644 --- a/src/CubeMapTextureArray.h +++ b/src/Magnum/CubeMapTextureArray.h @@ -30,7 +30,7 @@ */ #endif -#include "AbstractTexture.h" +#include "Magnum/AbstractTexture.h" #ifndef MAGNUM_TARGET_GLES namespace Magnum { @@ -261,6 +261,8 @@ class CubeMapTextureArray: public AbstractTexture { }; } +#else +#error this header is available only on desktop OpenGL build #endif #endif diff --git a/src/DebugMarker.h b/src/Magnum/DebugMarker.h similarity index 98% rename from src/DebugMarker.h rename to src/Magnum/DebugMarker.h index 802ade424..28f28860e 100644 --- a/src/DebugMarker.h +++ b/src/Magnum/DebugMarker.h @@ -29,7 +29,7 @@ * @deprecated Use @ref DebugMessage.h instead. */ -#include "DebugMessage.h" +#include "Magnum/DebugMessage.h" #ifdef MAGNUM_BUILD_DEPRECATED namespace Magnum { diff --git a/src/DebugMessage.cpp b/src/Magnum/DebugMessage.cpp similarity index 97% rename from src/DebugMessage.cpp rename to src/Magnum/DebugMessage.cpp index 763c322de..726fbb441 100644 --- a/src/DebugMessage.cpp +++ b/src/Magnum/DebugMessage.cpp @@ -24,12 +24,12 @@ #include "DebugMessage.h" -#include +#include -#include "Context.h" -#include "Extensions.h" -#include "Implementation/State.h" -#include "Implementation/DebugState.h" +#include "Magnum/Context.h" +#include "Magnum/Extensions.h" +#include "Magnum/Implementation/State.h" +#include "Magnum/Implementation/DebugState.h" namespace Magnum { diff --git a/src/DebugMessage.h b/src/Magnum/DebugMessage.h similarity index 96% rename from src/DebugMessage.h rename to src/Magnum/DebugMessage.h index 4f9804390..9be705f51 100644 --- a/src/DebugMessage.h +++ b/src/Magnum/DebugMessage.h @@ -30,9 +30,9 @@ #include -#include "Magnum.h" -#include "OpenGL.h" -#include "magnumVisibility.h" +#include "Magnum/Magnum.h" +#include "Magnum/OpenGL.h" +#include "Magnum/visibility.h" namespace Magnum { @@ -281,7 +281,8 @@ class MAGNUM_EXPORT DebugMessage { * supported and @extension{KHR,debug} is not available, this function * does nothing. * @see @ref setDefaultCallback(), - * @ref Renderer::Feature::DebugOutputSynchronous + * @ref Renderer::Feature::DebugOutputSynchronous, + * @fn_gl{DebugMessageCallback} */ static void setCallback(Callback callback, const void* userParam = nullptr); @@ -296,8 +297,8 @@ class MAGNUM_EXPORT DebugMessage { * DebugMessage::Type::Marker, 1337, DebugMessage::Severity::Notification, "Hello from OpenGL command stream!"); * @endcode * - *
%DebugMessage::Source::Application %DebugMessage::Type::Marker -1 %DebugMessage::Severity::Notification
-         *     Hello from OpenGL command stream!
+ * > %DebugMessage::Source::Application %DebugMessage::Type::Marker -1 %DebugMessage::Severity::Notification\n + * >     Hello from OpenGL command stream! */ static void setDefaultCallback(); diff --git a/src/DebugTools/CMakeLists.txt b/src/Magnum/DebugTools/CMakeLists.txt similarity index 98% rename from src/DebugTools/CMakeLists.txt rename to src/Magnum/DebugTools/CMakeLists.txt index 987e07a5e..5c1743b57 100644 --- a/src/DebugTools/CMakeLists.txt +++ b/src/Magnum/DebugTools/CMakeLists.txt @@ -47,7 +47,7 @@ set(MagnumDebugTools_HEADERS ResourceManager.h ShapeRenderer.h - magnumDebugToolsVisibility.h) + visibility.h) add_library(MagnumDebugTools ${SHARED_OR_STATIC} ${MagnumDebugTools_SRCS}) if(BUILD_STATIC_PIC) diff --git a/src/DebugTools/DebugTools.h b/src/Magnum/DebugTools/DebugTools.h similarity index 98% rename from src/DebugTools/DebugTools.h rename to src/Magnum/DebugTools/DebugTools.h index 3fee8ab9a..f8d0f5f2c 100644 --- a/src/DebugTools/DebugTools.h +++ b/src/Magnum/DebugTools/DebugTools.h @@ -28,7 +28,7 @@ * @brief Forward declarations for Magnum::DebugTools namespace */ -#include "Types.h" +#include "Magnum/Types.h" namespace Magnum { namespace DebugTools { diff --git a/src/DebugTools/ForceRenderer.cpp b/src/Magnum/DebugTools/ForceRenderer.cpp similarity index 95% rename from src/DebugTools/ForceRenderer.cpp rename to src/Magnum/DebugTools/ForceRenderer.cpp index cf5f75421..b250fbf5e 100644 --- a/src/DebugTools/ForceRenderer.cpp +++ b/src/Magnum/DebugTools/ForceRenderer.cpp @@ -24,13 +24,13 @@ #include "ForceRenderer.h" -#include "Buffer.h" -#include "Mesh.h" -#include "DebugTools/ResourceManager.h" -#include "SceneGraph/AbstractCamera.h" -#include "Shaders/Flat.h" +#include "Magnum/Buffer.h" +#include "Magnum/Mesh.h" +#include "Magnum/DebugTools/ResourceManager.h" +#include "Magnum/SceneGraph/AbstractCamera.h" +#include "Magnum/Shaders/Flat.h" -#include "DebugTools/Implementation/ForceRendererTransformation.h" +#include "Implementation/ForceRendererTransformation.h" namespace Magnum { namespace DebugTools { diff --git a/src/DebugTools/ForceRenderer.h b/src/Magnum/DebugTools/ForceRenderer.h similarity index 96% rename from src/DebugTools/ForceRenderer.h rename to src/Magnum/DebugTools/ForceRenderer.h index f54b892db..6d2f00aba 100644 --- a/src/DebugTools/ForceRenderer.h +++ b/src/Magnum/DebugTools/ForceRenderer.h @@ -28,12 +28,11 @@ * @brief Class Magnum::DebugTools::ForceRenderer, Magnum::DebugTools::ForceRendererOptions, typedef Magnum::DebugTools::ForceRenderer2D, Magnum::DebugTools::ForceRenderer3D */ -#include "Color.h" -#include "Resource.h" -#include "SceneGraph/Drawable.h" -#include "Shaders/Shaders.h" - -#include "magnumDebugToolsVisibility.h" +#include "Magnum/Color.h" +#include "Magnum/Resource.h" +#include "Magnum/SceneGraph/Drawable.h" +#include "Magnum/Shaders/Shaders.h" +#include "Magnum/DebugTools/visibility.h" namespace Magnum { namespace DebugTools { diff --git a/src/DebugTools/Implementation/AbstractBoxRenderer.cpp b/src/Magnum/DebugTools/Implementation/AbstractBoxRenderer.cpp similarity index 91% rename from src/DebugTools/Implementation/AbstractBoxRenderer.cpp rename to src/Magnum/DebugTools/Implementation/AbstractBoxRenderer.cpp index 8e5cd07b6..41621d133 100644 --- a/src/DebugTools/Implementation/AbstractBoxRenderer.cpp +++ b/src/Magnum/DebugTools/Implementation/AbstractBoxRenderer.cpp @@ -24,11 +24,11 @@ #include "AbstractBoxRenderer.h" -#include "Mesh.h" -#include "Primitives/Cube.h" -#include "Primitives/Square.h" -#include "Trade/MeshData2D.h" -#include "Trade/MeshData3D.h" +#include "Magnum/Mesh.h" +#include "Magnum/Primitives/Cube.h" +#include "Magnum/Primitives/Square.h" +#include "Magnum/Trade/MeshData2D.h" +#include "Magnum/Trade/MeshData3D.h" namespace Magnum { namespace DebugTools { namespace Implementation { diff --git a/src/DebugTools/Implementation/AbstractBoxRenderer.h b/src/Magnum/DebugTools/Implementation/AbstractBoxRenderer.h similarity index 95% rename from src/DebugTools/Implementation/AbstractBoxRenderer.h rename to src/Magnum/DebugTools/Implementation/AbstractBoxRenderer.h index 0996a20f7..369346190 100644 --- a/src/DebugTools/Implementation/AbstractBoxRenderer.h +++ b/src/Magnum/DebugTools/Implementation/AbstractBoxRenderer.h @@ -26,10 +26,8 @@ #include "AbstractShapeRenderer.h" -#include "Resource.h" -#include "Shaders/Shaders.h" - -#include "corradeCompatibility.h" +#include "Magnum/Resource.h" +#include "Magnum/Shaders/Shaders.h" namespace Magnum { namespace DebugTools { namespace Implementation { diff --git a/src/DebugTools/Implementation/AbstractShapeRenderer.cpp b/src/Magnum/DebugTools/Implementation/AbstractShapeRenderer.cpp similarity index 94% rename from src/DebugTools/Implementation/AbstractShapeRenderer.cpp rename to src/Magnum/DebugTools/Implementation/AbstractShapeRenderer.cpp index d570806b0..a3703b010 100644 --- a/src/DebugTools/Implementation/AbstractShapeRenderer.cpp +++ b/src/Magnum/DebugTools/Implementation/AbstractShapeRenderer.cpp @@ -24,14 +24,14 @@ #include "AbstractShapeRenderer.h" -#include "AbstractShaderProgram.h" -#include "Buffer.h" -#include "Mesh.h" -#include "DebugTools/ResourceManager.h" -#include "MeshTools/CompressIndices.h" -#include "Shaders/Flat.h" -#include "Trade/MeshData2D.h" -#include "Trade/MeshData3D.h" +#include "Magnum/AbstractShaderProgram.h" +#include "Magnum/Buffer.h" +#include "Magnum/Mesh.h" +#include "Magnum/DebugTools/ResourceManager.h" +#include "Magnum/MeshTools/CompressIndices.h" +#include "Magnum/Shaders/Flat.h" +#include "Magnum/Trade/MeshData2D.h" +#include "Magnum/Trade/MeshData3D.h" namespace Magnum { namespace DebugTools { namespace Implementation { diff --git a/src/DebugTools/Implementation/AbstractShapeRenderer.h b/src/Magnum/DebugTools/Implementation/AbstractShapeRenderer.h similarity index 91% rename from src/DebugTools/Implementation/AbstractShapeRenderer.h rename to src/Magnum/DebugTools/Implementation/AbstractShapeRenderer.h index 837724f70..0641f8c7c 100644 --- a/src/DebugTools/Implementation/AbstractShapeRenderer.h +++ b/src/Magnum/DebugTools/Implementation/AbstractShapeRenderer.h @@ -24,12 +24,12 @@ DEALINGS IN THE SOFTWARE. */ -#include "DimensionTraits.h" -#include "Resource.h" -#include "DebugTools/DebugTools.h" -#include "SceneGraph/SceneGraph.h" -#include "Shaders/Shaders.h" -#include "Trade/Trade.h" +#include "Magnum/DimensionTraits.h" +#include "Magnum/Resource.h" +#include "Magnum/DebugTools/DebugTools.h" +#include "Magnum/SceneGraph/SceneGraph.h" +#include "Magnum/Shaders/Shaders.h" +#include "Magnum/Trade/Trade.h" namespace Magnum { diff --git a/src/DebugTools/Implementation/AxisAlignedBoxRenderer.cpp b/src/Magnum/DebugTools/Implementation/AxisAlignedBoxRenderer.cpp similarity index 94% rename from src/DebugTools/Implementation/AxisAlignedBoxRenderer.cpp rename to src/Magnum/DebugTools/Implementation/AxisAlignedBoxRenderer.cpp index dd90f600b..4a84b75f8 100644 --- a/src/DebugTools/Implementation/AxisAlignedBoxRenderer.cpp +++ b/src/Magnum/DebugTools/Implementation/AxisAlignedBoxRenderer.cpp @@ -24,10 +24,10 @@ #include "AxisAlignedBoxRenderer.h" -#include "Mesh.h" -#include "DebugTools/ShapeRenderer.h" -#include "Shapes/AxisAlignedBox.h" -#include "Shaders/Flat.h" +#include "Magnum/Mesh.h" +#include "Magnum/DebugTools/ShapeRenderer.h" +#include "Magnum/Shapes/AxisAlignedBox.h" +#include "Magnum/Shaders/Flat.h" namespace Magnum { namespace DebugTools { namespace Implementation { diff --git a/src/DebugTools/Implementation/AxisAlignedBoxRenderer.h b/src/Magnum/DebugTools/Implementation/AxisAlignedBoxRenderer.h similarity index 96% rename from src/DebugTools/Implementation/AxisAlignedBoxRenderer.h rename to src/Magnum/DebugTools/Implementation/AxisAlignedBoxRenderer.h index 999cc4bf1..479bdb277 100644 --- a/src/DebugTools/Implementation/AxisAlignedBoxRenderer.h +++ b/src/Magnum/DebugTools/Implementation/AxisAlignedBoxRenderer.h @@ -24,11 +24,11 @@ DEALINGS IN THE SOFTWARE. */ -#include "AbstractBoxRenderer.h" +#include -#include "Shapes/Shapes.h" +#include "Magnum/Shapes/Shapes.h" -#include "corradeCompatibility.h" +#include "AbstractBoxRenderer.h" namespace Magnum { namespace DebugTools { namespace Implementation { diff --git a/src/DebugTools/Implementation/BoxRenderer.cpp b/src/Magnum/DebugTools/Implementation/BoxRenderer.cpp similarity index 93% rename from src/DebugTools/Implementation/BoxRenderer.cpp rename to src/Magnum/DebugTools/Implementation/BoxRenderer.cpp index 16ce142ee..539efc60c 100644 --- a/src/DebugTools/Implementation/BoxRenderer.cpp +++ b/src/Magnum/DebugTools/Implementation/BoxRenderer.cpp @@ -24,10 +24,10 @@ #include "BoxRenderer.h" -#include "Mesh.h" -#include "DebugTools/ShapeRenderer.h" -#include "Shapes/Box.h" -#include "Shaders/Flat.h" +#include "Magnum/Mesh.h" +#include "Magnum/DebugTools/ShapeRenderer.h" +#include "Magnum/Shapes/Box.h" +#include "Magnum/Shaders/Flat.h" namespace Magnum { namespace DebugTools { namespace Implementation { diff --git a/src/DebugTools/Implementation/BoxRenderer.h b/src/Magnum/DebugTools/Implementation/BoxRenderer.h similarity index 96% rename from src/DebugTools/Implementation/BoxRenderer.h rename to src/Magnum/DebugTools/Implementation/BoxRenderer.h index 54b00cfd2..55d84a5f0 100644 --- a/src/DebugTools/Implementation/BoxRenderer.h +++ b/src/Magnum/DebugTools/Implementation/BoxRenderer.h @@ -24,11 +24,11 @@ DEALINGS IN THE SOFTWARE. */ -#include "AbstractBoxRenderer.h" +#include -#include "Shapes/Shapes.h" +#include "Magnum/Shapes/Shapes.h" -#include "corradeCompatibility.h" +#include "AbstractBoxRenderer.h" namespace Magnum { namespace DebugTools { namespace Implementation { diff --git a/src/DebugTools/Implementation/CapsuleRenderer.cpp b/src/Magnum/DebugTools/Implementation/CapsuleRenderer.cpp similarity index 93% rename from src/DebugTools/Implementation/CapsuleRenderer.cpp rename to src/Magnum/DebugTools/Implementation/CapsuleRenderer.cpp index a2f3d9568..79485b162 100644 --- a/src/DebugTools/Implementation/CapsuleRenderer.cpp +++ b/src/Magnum/DebugTools/Implementation/CapsuleRenderer.cpp @@ -24,17 +24,17 @@ #include "CapsuleRenderer.h" -#include "Mesh.h" -#include "MeshView.h" -#include "DebugTools/ResourceManager.h" -#include "DebugTools/ShapeRenderer.h" -#include "Primitives/Capsule.h" -#include "Shapes/Capsule.h" -#include "Shaders/Flat.h" -#include "Trade/MeshData2D.h" -#include "Trade/MeshData3D.h" - -#include "DebugTools/Implementation/CapsuleRendererTransformation.h" +#include "Magnum/Mesh.h" +#include "Magnum/MeshView.h" +#include "Magnum/DebugTools/ResourceManager.h" +#include "Magnum/DebugTools/ShapeRenderer.h" +#include "Magnum/Primitives/Capsule.h" +#include "Magnum/Shapes/Capsule.h" +#include "Magnum/Shaders/Flat.h" +#include "Magnum/Trade/MeshData2D.h" +#include "Magnum/Trade/MeshData3D.h" + +#include "CapsuleRendererTransformation.h" namespace Magnum { namespace DebugTools { namespace Implementation { diff --git a/src/DebugTools/Implementation/CapsuleRenderer.h b/src/Magnum/DebugTools/Implementation/CapsuleRenderer.h similarity index 97% rename from src/DebugTools/Implementation/CapsuleRenderer.h rename to src/Magnum/DebugTools/Implementation/CapsuleRenderer.h index 5a2553470..620babf8d 100644 --- a/src/DebugTools/Implementation/CapsuleRenderer.h +++ b/src/Magnum/DebugTools/Implementation/CapsuleRenderer.h @@ -24,11 +24,11 @@ DEALINGS IN THE SOFTWARE. */ -#include "AbstractShapeRenderer.h" +#include -#include "Shapes/Shapes.h" +#include "Magnum/Shapes/Shapes.h" -#include "corradeCompatibility.h" +#include "AbstractShapeRenderer.h" namespace Magnum { namespace DebugTools { namespace Implementation { diff --git a/src/DebugTools/Implementation/CapsuleRendererTransformation.h b/src/Magnum/DebugTools/Implementation/CapsuleRendererTransformation.h similarity index 96% rename from src/DebugTools/Implementation/CapsuleRendererTransformation.h rename to src/Magnum/DebugTools/Implementation/CapsuleRendererTransformation.h index b08bb67a7..cf457f2df 100644 --- a/src/DebugTools/Implementation/CapsuleRendererTransformation.h +++ b/src/Magnum/DebugTools/Implementation/CapsuleRendererTransformation.h @@ -26,11 +26,11 @@ #include -#include "Math/Functions.h" -#include "Math/Matrix3.h" -#include "Math/Matrix4.h" -#include "Magnum.h" -#include "DimensionTraits.h" +#include "Magnum/DimensionTraits.h" +#include "Magnum/Magnum.h" +#include "Magnum/Math/Functions.h" +#include "Magnum/Math/Matrix3.h" +#include "Magnum/Math/Matrix4.h" namespace Magnum { namespace DebugTools { namespace Implementation { diff --git a/src/DebugTools/Implementation/CylinderRenderer.cpp b/src/Magnum/DebugTools/Implementation/CylinderRenderer.cpp similarity index 88% rename from src/DebugTools/Implementation/CylinderRenderer.cpp rename to src/Magnum/DebugTools/Implementation/CylinderRenderer.cpp index f7cfbd1e2..691e0dc95 100644 --- a/src/DebugTools/Implementation/CylinderRenderer.cpp +++ b/src/Magnum/DebugTools/Implementation/CylinderRenderer.cpp @@ -24,16 +24,16 @@ #include "CylinderRenderer.h" -#include "Mesh.h" -#include "DebugTools/ShapeRenderer.h" -#include "Shapes/Cylinder.h" -#include "Primitives/Cylinder.h" -#include "Primitives/Square.h" -#include "Shaders/Flat.h" -#include "Trade/MeshData2D.h" -#include "Trade/MeshData3D.h" - -#include "DebugTools/Implementation/CylinderRendererTransformation.h" +#include "Magnum/Mesh.h" +#include "Magnum/DebugTools/ShapeRenderer.h" +#include "Magnum/Shapes/Cylinder.h" +#include "Magnum/Primitives/Cylinder.h" +#include "Magnum/Primitives/Square.h" +#include "Magnum/Shaders/Flat.h" +#include "Magnum/Trade/MeshData2D.h" +#include "Magnum/Trade/MeshData3D.h" + +#include "CylinderRendererTransformation.h" namespace Magnum { namespace DebugTools { namespace Implementation { diff --git a/src/DebugTools/Implementation/CylinderRenderer.h b/src/Magnum/DebugTools/Implementation/CylinderRenderer.h similarity index 97% rename from src/DebugTools/Implementation/CylinderRenderer.h rename to src/Magnum/DebugTools/Implementation/CylinderRenderer.h index d5a511254..4aadb3d0d 100644 --- a/src/DebugTools/Implementation/CylinderRenderer.h +++ b/src/Magnum/DebugTools/Implementation/CylinderRenderer.h @@ -24,11 +24,11 @@ DEALINGS IN THE SOFTWARE. */ -#include "AbstractShapeRenderer.h" +#include -#include "Shapes/Shapes.h" +#include "Magnum/Shapes/Shapes.h" -#include "corradeCompatibility.h" +#include "AbstractShapeRenderer.h" namespace Magnum { namespace DebugTools { namespace Implementation { diff --git a/src/DebugTools/Implementation/CylinderRendererTransformation.h b/src/Magnum/DebugTools/Implementation/CylinderRendererTransformation.h similarity index 95% rename from src/DebugTools/Implementation/CylinderRendererTransformation.h rename to src/Magnum/DebugTools/Implementation/CylinderRendererTransformation.h index 4caf8c5d6..b24704641 100644 --- a/src/DebugTools/Implementation/CylinderRendererTransformation.h +++ b/src/Magnum/DebugTools/Implementation/CylinderRendererTransformation.h @@ -24,11 +24,11 @@ DEALINGS IN THE SOFTWARE. */ -#include "Math/Functions.h" -#include "Math/Matrix3.h" -#include "Math/Matrix4.h" -#include "Magnum.h" -#include "DimensionTraits.h" +#include "Magnum/DimensionTraits.h" +#include "Magnum/Magnum.h" +#include "Magnum/Math/Functions.h" +#include "Magnum/Math/Matrix3.h" +#include "Magnum/Math/Matrix4.h" namespace Magnum { namespace DebugTools { namespace Implementation { diff --git a/src/DebugTools/Implementation/ForceRendererTransformation.h b/src/Magnum/DebugTools/Implementation/ForceRendererTransformation.h similarity index 94% rename from src/DebugTools/Implementation/ForceRendererTransformation.h rename to src/Magnum/DebugTools/Implementation/ForceRendererTransformation.h index 8674cbafa..11588d60a 100644 --- a/src/DebugTools/Implementation/ForceRendererTransformation.h +++ b/src/Magnum/DebugTools/Implementation/ForceRendererTransformation.h @@ -24,11 +24,11 @@ DEALINGS IN THE SOFTWARE. */ -#include "Math/Functions.h" -#include "Math/Matrix3.h" -#include "Math/Matrix4.h" -#include "Magnum.h" -#include "DimensionTraits.h" +#include "Magnum/DimensionTraits.h" +#include "Magnum/Magnum.h" +#include "Magnum/Math/Functions.h" +#include "Magnum/Math/Matrix3.h" +#include "Magnum/Math/Matrix4.h" namespace Magnum { namespace DebugTools { namespace Implementation { diff --git a/src/DebugTools/Implementation/LineSegmentRenderer.cpp b/src/Magnum/DebugTools/Implementation/LineSegmentRenderer.cpp similarity index 91% rename from src/DebugTools/Implementation/LineSegmentRenderer.cpp rename to src/Magnum/DebugTools/Implementation/LineSegmentRenderer.cpp index 0ed2c53e5..62fc800d0 100644 --- a/src/DebugTools/Implementation/LineSegmentRenderer.cpp +++ b/src/Magnum/DebugTools/Implementation/LineSegmentRenderer.cpp @@ -24,15 +24,15 @@ #include "LineSegmentRenderer.h" -#include "Mesh.h" -#include "DebugTools/ShapeRenderer.h" -#include "Shapes/LineSegment.h" -#include "Primitives/Line.h" -#include "Shaders/Flat.h" -#include "Trade/MeshData2D.h" -#include "Trade/MeshData3D.h" +#include "Magnum/Mesh.h" +#include "Magnum/DebugTools/ShapeRenderer.h" +#include "Magnum/Shapes/LineSegment.h" +#include "Magnum/Primitives/Line.h" +#include "Magnum/Shaders/Flat.h" +#include "Magnum/Trade/MeshData2D.h" +#include "Magnum/Trade/MeshData3D.h" -#include "DebugTools/Implementation/LineSegmentRendererTransformation.h" +#include "LineSegmentRendererTransformation.h" namespace Magnum { namespace DebugTools { namespace Implementation { diff --git a/src/DebugTools/Implementation/LineSegmentRenderer.h b/src/Magnum/DebugTools/Implementation/LineSegmentRenderer.h similarity index 96% rename from src/DebugTools/Implementation/LineSegmentRenderer.h rename to src/Magnum/DebugTools/Implementation/LineSegmentRenderer.h index 556db46ec..13fa095a7 100644 --- a/src/DebugTools/Implementation/LineSegmentRenderer.h +++ b/src/Magnum/DebugTools/Implementation/LineSegmentRenderer.h @@ -24,11 +24,11 @@ DEALINGS IN THE SOFTWARE. */ -#include "AbstractShapeRenderer.h" +#include -#include "Shapes/Shapes.h" +#include "Magnum/Shapes/Shapes.h" -#include "corradeCompatibility.h" +#include "AbstractShapeRenderer.h" namespace Magnum { namespace DebugTools { namespace Implementation { diff --git a/src/DebugTools/Implementation/LineSegmentRendererTransformation.h b/src/Magnum/DebugTools/Implementation/LineSegmentRendererTransformation.h similarity index 98% rename from src/DebugTools/Implementation/LineSegmentRendererTransformation.h rename to src/Magnum/DebugTools/Implementation/LineSegmentRendererTransformation.h index 4d0927cd6..5764229de 100644 --- a/src/DebugTools/Implementation/LineSegmentRendererTransformation.h +++ b/src/Magnum/DebugTools/Implementation/LineSegmentRendererTransformation.h @@ -24,7 +24,7 @@ DEALINGS IN THE SOFTWARE. */ -#include "DimensionTraits.h" +#include "Magnum/DimensionTraits.h" namespace Magnum { namespace DebugTools { namespace Implementation { diff --git a/src/DebugTools/Implementation/PointRenderer.cpp b/src/Magnum/DebugTools/Implementation/PointRenderer.cpp similarity index 93% rename from src/DebugTools/Implementation/PointRenderer.cpp rename to src/Magnum/DebugTools/Implementation/PointRenderer.cpp index 7a5243180..b36f814eb 100644 --- a/src/DebugTools/Implementation/PointRenderer.cpp +++ b/src/Magnum/DebugTools/Implementation/PointRenderer.cpp @@ -24,13 +24,13 @@ #include "PointRenderer.h" -#include "Mesh.h" -#include "DebugTools/ShapeRenderer.h" -#include "Shapes/Point.h" -#include "Primitives/Crosshair.h" -#include "Shaders/Flat.h" -#include "Trade/MeshData2D.h" -#include "Trade/MeshData3D.h" +#include "Magnum/Mesh.h" +#include "Magnum/DebugTools/ShapeRenderer.h" +#include "Magnum/Shapes/Point.h" +#include "Magnum/Primitives/Crosshair.h" +#include "Magnum/Shaders/Flat.h" +#include "Magnum/Trade/MeshData2D.h" +#include "Magnum/Trade/MeshData3D.h" namespace Magnum { namespace DebugTools { namespace Implementation { diff --git a/src/DebugTools/Implementation/PointRenderer.h b/src/Magnum/DebugTools/Implementation/PointRenderer.h similarity index 96% rename from src/DebugTools/Implementation/PointRenderer.h rename to src/Magnum/DebugTools/Implementation/PointRenderer.h index adb88415b..a172d7f77 100644 --- a/src/DebugTools/Implementation/PointRenderer.h +++ b/src/Magnum/DebugTools/Implementation/PointRenderer.h @@ -24,11 +24,11 @@ DEALINGS IN THE SOFTWARE. */ -#include "AbstractShapeRenderer.h" +#include -#include "Shapes/Shapes.h" +#include "Magnum/Shapes/Shapes.h" -#include "corradeCompatibility.h" +#include "AbstractShapeRenderer.h" namespace Magnum { namespace DebugTools { namespace Implementation { diff --git a/src/DebugTools/Implementation/SphereRenderer.cpp b/src/Magnum/DebugTools/Implementation/SphereRenderer.cpp similarity index 90% rename from src/DebugTools/Implementation/SphereRenderer.cpp rename to src/Magnum/DebugTools/Implementation/SphereRenderer.cpp index 59362b226..1b6330925 100644 --- a/src/DebugTools/Implementation/SphereRenderer.cpp +++ b/src/Magnum/DebugTools/Implementation/SphereRenderer.cpp @@ -24,14 +24,14 @@ #include "SphereRenderer.h" -#include "Mesh.h" -#include "DebugTools/ShapeRenderer.h" -#include "Shapes/Sphere.h" -#include "Primitives/Circle.h" -#include "Primitives/UVSphere.h" -#include "Shaders/Flat.h" -#include "Trade/MeshData2D.h" -#include "Trade/MeshData3D.h" +#include "Magnum/Mesh.h" +#include "Magnum/DebugTools/ShapeRenderer.h" +#include "Magnum/Shapes/Sphere.h" +#include "Magnum/Primitives/Circle.h" +#include "Magnum/Primitives/UVSphere.h" +#include "Magnum/Shaders/Flat.h" +#include "Magnum/Trade/MeshData2D.h" +#include "Magnum/Trade/MeshData3D.h" namespace Magnum { namespace DebugTools { namespace Implementation { diff --git a/src/DebugTools/Implementation/SphereRenderer.h b/src/Magnum/DebugTools/Implementation/SphereRenderer.h similarity index 97% rename from src/DebugTools/Implementation/SphereRenderer.h rename to src/Magnum/DebugTools/Implementation/SphereRenderer.h index 14687a6ee..89f35e32d 100644 --- a/src/DebugTools/Implementation/SphereRenderer.h +++ b/src/Magnum/DebugTools/Implementation/SphereRenderer.h @@ -24,11 +24,11 @@ DEALINGS IN THE SOFTWARE. */ -#include "AbstractShapeRenderer.h" +#include -#include "Shapes/Shapes.h" +#include "Magnum/Shapes/Shapes.h" -#include "corradeCompatibility.h" +#include "AbstractShapeRenderer.h" namespace Magnum { namespace DebugTools { namespace Implementation { diff --git a/src/DebugTools/ObjectRenderer.cpp b/src/Magnum/DebugTools/ObjectRenderer.cpp similarity index 97% rename from src/DebugTools/ObjectRenderer.cpp rename to src/Magnum/DebugTools/ObjectRenderer.cpp index dd20e7d8c..a406f2589 100644 --- a/src/DebugTools/ObjectRenderer.cpp +++ b/src/Magnum/DebugTools/ObjectRenderer.cpp @@ -24,11 +24,11 @@ #include "ObjectRenderer.h" -#include "Buffer.h" -#include "DebugTools/ResourceManager.h" -#include "MeshTools/Interleave.h" -#include "SceneGraph/AbstractCamera.h" -#include "Shaders/VertexColor.h" +#include "Magnum/Buffer.h" +#include "Magnum/DebugTools/ResourceManager.h" +#include "Magnum/MeshTools/Interleave.h" +#include "Magnum/SceneGraph/AbstractCamera.h" +#include "Magnum/Shaders/VertexColor.h" namespace Magnum { namespace DebugTools { diff --git a/src/DebugTools/ObjectRenderer.h b/src/Magnum/DebugTools/ObjectRenderer.h similarity index 96% rename from src/DebugTools/ObjectRenderer.h rename to src/Magnum/DebugTools/ObjectRenderer.h index 9110c4030..cd049e441 100644 --- a/src/DebugTools/ObjectRenderer.h +++ b/src/Magnum/DebugTools/ObjectRenderer.h @@ -28,11 +28,10 @@ * @brief Class Magnum::DebugTools::ObjectRenderer, Magnum::DebugTools::ObjectRendererOptions, typedef Magnum::DebugTools::ObjectRenderer2D, Magnum::DebugTools::ObjectRenderer3D */ -#include "Resource.h" -#include "SceneGraph/Drawable.h" -#include "Shaders/Shaders.h" - -#include "magnumDebugToolsVisibility.h" +#include "Magnum/Resource.h" +#include "Magnum/SceneGraph/Drawable.h" +#include "Magnum/Shaders/Shaders.h" +#include "Magnum/DebugTools/visibility.h" namespace Magnum { namespace DebugTools { diff --git a/src/DebugTools/Profiler.cpp b/src/Magnum/DebugTools/Profiler.cpp similarity index 98% rename from src/DebugTools/Profiler.cpp rename to src/Magnum/DebugTools/Profiler.cpp index 5724acf1d..5af2d908c 100644 --- a/src/DebugTools/Profiler.cpp +++ b/src/Magnum/DebugTools/Profiler.cpp @@ -26,9 +26,9 @@ #include #include -#include +#include -#include "Magnum.h" +#include "Magnum/Magnum.h" using namespace std::chrono; diff --git a/src/DebugTools/Profiler.h b/src/Magnum/DebugTools/Profiler.h similarity index 98% rename from src/DebugTools/Profiler.h rename to src/Magnum/DebugTools/Profiler.h index 76eb984bb..b56c9cb32 100644 --- a/src/DebugTools/Profiler.h +++ b/src/Magnum/DebugTools/Profiler.h @@ -32,10 +32,10 @@ #include #include #include -#include +#include -#include "Types.h" -#include "magnumDebugToolsVisibility.h" +#include "Magnum/Types.h" +#include "Magnum/DebugTools/visibility.h" namespace Magnum { namespace DebugTools { diff --git a/src/DebugTools/ResourceManager.cpp b/src/Magnum/DebugTools/ResourceManager.cpp similarity index 89% rename from src/DebugTools/ResourceManager.cpp rename to src/Magnum/DebugTools/ResourceManager.cpp index 94d9f29a4..74fe67698 100644 --- a/src/DebugTools/ResourceManager.cpp +++ b/src/Magnum/DebugTools/ResourceManager.cpp @@ -26,12 +26,12 @@ #include "ResourceManager.h" -#include "Buffer.h" -#include "Mesh.h" -#include "MeshView.h" -#include "DebugTools/ForceRenderer.h" -#include "DebugTools/ObjectRenderer.h" -#include "DebugTools/ShapeRenderer.h" +#include "Magnum/Buffer.h" +#include "Magnum/Mesh.h" +#include "Magnum/MeshView.h" +#include "Magnum/DebugTools/ForceRenderer.h" +#include "Magnum/DebugTools/ObjectRenderer.h" +#include "Magnum/DebugTools/ShapeRenderer.h" namespace Magnum { diff --git a/src/DebugTools/ResourceManager.h b/src/Magnum/DebugTools/ResourceManager.h similarity index 92% rename from src/DebugTools/ResourceManager.h rename to src/Magnum/DebugTools/ResourceManager.h index ae10d147f..b6f3549b5 100644 --- a/src/DebugTools/ResourceManager.h +++ b/src/Magnum/DebugTools/ResourceManager.h @@ -28,18 +28,16 @@ * @brief Class Magnum::DebugTools::ResourceManager */ -#include "Magnum.h" - #ifndef MAGNUM_RESOURCEMANAGER_DEFINE_INTERNALINSTANCE #define MAGNUM_RESOURCEMANAGER_DONT_DEFINE_INTERNALINSTANCE #endif -#include "../ResourceManager.h" - -#include "SceneGraph/SceneGraph.h" -#include "Shapes/Shapes.h" -#include "DebugTools.h" +#include "Magnum/ResourceManager.h" -#include "magnumDebugToolsVisibility.h" +#include "Magnum/Magnum.h" +#include "Magnum/DebugTools/DebugTools.h" +#include "Magnum/DebugTools/visibility.h" +#include "Magnum/SceneGraph/SceneGraph.h" +#include "Magnum/Shapes/Shapes.h" #ifdef CORRADE_MSVC2013_COMPATIBILITY #include "AbstractShaderProgram.h" diff --git a/src/DebugTools/ShapeRenderer.cpp b/src/Magnum/DebugTools/ShapeRenderer.cpp similarity index 97% rename from src/DebugTools/ShapeRenderer.cpp rename to src/Magnum/DebugTools/ShapeRenderer.cpp index 128c5363e..e1b5e07c7 100644 --- a/src/DebugTools/ShapeRenderer.cpp +++ b/src/Magnum/DebugTools/ShapeRenderer.cpp @@ -24,10 +24,10 @@ #include "ShapeRenderer.h" -#include "ResourceManager.h" -#include "Shapes/Composition.h" -#include "Shapes/Shape.h" -#include "SceneGraph/AbstractCamera.h" +#include "Magnum/DebugTools/ResourceManager.h" +#include "Magnum/Shapes/Composition.h" +#include "Magnum/Shapes/Shape.h" +#include "Magnum/SceneGraph/AbstractCamera.h" #include "Implementation/AxisAlignedBoxRenderer.h" #include "Implementation/BoxRenderer.h" diff --git a/src/DebugTools/ShapeRenderer.h b/src/Magnum/DebugTools/ShapeRenderer.h similarity index 96% rename from src/DebugTools/ShapeRenderer.h rename to src/Magnum/DebugTools/ShapeRenderer.h index 937f6b521..9e919f63b 100644 --- a/src/DebugTools/ShapeRenderer.h +++ b/src/Magnum/DebugTools/ShapeRenderer.h @@ -28,13 +28,12 @@ * @brief Class Magnum::DebugTools::ShapeRenderer, Magnum::DebugTools::ShapeRendererOptions, typedef Magnum::DebugTools::ShapeRenderer2D, Magnum::DebugTools::ShapeRenderer3D */ -#include "Color.h" -#include "Resource.h" -#include "SceneGraph/Drawable.h" -#include "Shapes/Shapes.h" -#include "Shapes/shapeImplementation.h" - -#include "magnumDebugToolsVisibility.h" +#include "Magnum/Color.h" +#include "Magnum/Resource.h" +#include "Magnum/SceneGraph/Drawable.h" +#include "Magnum/Shapes/Shapes.h" +#include "Magnum/Shapes/shapeImplementation.h" +#include "Magnum/DebugTools/visibility.h" namespace Magnum { namespace DebugTools { diff --git a/src/DebugTools/Test/CMakeLists.txt b/src/Magnum/DebugTools/Test/CMakeLists.txt similarity index 100% rename from src/DebugTools/Test/CMakeLists.txt rename to src/Magnum/DebugTools/Test/CMakeLists.txt diff --git a/src/DebugTools/Test/CapsuleRendererTest.cpp b/src/Magnum/DebugTools/Test/CapsuleRendererTest.cpp similarity index 98% rename from src/DebugTools/Test/CapsuleRendererTest.cpp rename to src/Magnum/DebugTools/Test/CapsuleRendererTest.cpp index f674bd02f..6c4c9097e 100644 --- a/src/DebugTools/Test/CapsuleRendererTest.cpp +++ b/src/Magnum/DebugTools/Test/CapsuleRendererTest.cpp @@ -22,9 +22,9 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include -#include "DebugTools/Implementation/CapsuleRendererTransformation.h" +#include "../Implementation/CapsuleRendererTransformation.h" namespace Magnum { namespace DebugTools { namespace Test { diff --git a/src/DebugTools/Test/CylinderRendererTest.cpp b/src/Magnum/DebugTools/Test/CylinderRendererTest.cpp similarity index 98% rename from src/DebugTools/Test/CylinderRendererTest.cpp rename to src/Magnum/DebugTools/Test/CylinderRendererTest.cpp index c452e9f7a..4411bf2f8 100644 --- a/src/DebugTools/Test/CylinderRendererTest.cpp +++ b/src/Magnum/DebugTools/Test/CylinderRendererTest.cpp @@ -22,9 +22,9 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include -#include "DebugTools/Implementation/CylinderRendererTransformation.h" +#include "../Implementation/CylinderRendererTransformation.h" namespace Magnum { namespace DebugTools { namespace Test { diff --git a/src/DebugTools/Test/ForceRendererTest.cpp b/src/Magnum/DebugTools/Test/ForceRendererTest.cpp similarity index 97% rename from src/DebugTools/Test/ForceRendererTest.cpp rename to src/Magnum/DebugTools/Test/ForceRendererTest.cpp index 314e60ffd..cb2e3a71f 100644 --- a/src/DebugTools/Test/ForceRendererTest.cpp +++ b/src/Magnum/DebugTools/Test/ForceRendererTest.cpp @@ -22,9 +22,9 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include -#include "DebugTools/Implementation/ForceRendererTransformation.h" +#include "../Implementation/ForceRendererTransformation.h" namespace Magnum { namespace DebugTools { namespace Implementation { namespace Test { diff --git a/src/DebugTools/Test/LineSegmentRendererTest.cpp b/src/Magnum/DebugTools/Test/LineSegmentRendererTest.cpp similarity index 92% rename from src/DebugTools/Test/LineSegmentRendererTest.cpp rename to src/Magnum/DebugTools/Test/LineSegmentRendererTest.cpp index 5ad628301..05856e8c2 100644 --- a/src/DebugTools/Test/LineSegmentRendererTest.cpp +++ b/src/Magnum/DebugTools/Test/LineSegmentRendererTest.cpp @@ -22,12 +22,13 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include -#include "Math/Matrix3.h" -#include "Math/Matrix4.h" -#include "Magnum.h" -#include "DebugTools/Implementation/LineSegmentRendererTransformation.h" +#include "Magnum/Magnum.h" +#include "Magnum/Math/Matrix3.h" +#include "Magnum/Math/Matrix4.h" + +#include "../Implementation/LineSegmentRendererTransformation.h" namespace Magnum { namespace DebugTools { namespace Test { diff --git a/src/DebugTools/magnumDebugToolsVisibility.h b/src/Magnum/DebugTools/visibility.h similarity index 89% rename from src/DebugTools/magnumDebugToolsVisibility.h rename to src/Magnum/DebugTools/visibility.h index 2499c5d24..71077d7ad 100644 --- a/src/DebugTools/magnumDebugToolsVisibility.h +++ b/src/Magnum/DebugTools/visibility.h @@ -1,5 +1,5 @@ -#ifndef Magnum_DebugTools_magnumDebugToolsVisibility_h -#define Magnum_DebugTools_magnumDebugToolsVisibility_h +#ifndef Magnum_DebugTools_visibility_h +#define Magnum_DebugTools_visibility_h /* This file is part of Magnum. @@ -24,9 +24,9 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include -#include "magnumConfigure.h" +#include "Magnum/configure.h" #ifndef MAGNUM_BUILD_STATIC #ifdef MagnumDebugTools_EXPORTS diff --git a/src/DefaultFramebuffer.cpp b/src/Magnum/DefaultFramebuffer.cpp similarity index 95% rename from src/DefaultFramebuffer.cpp rename to src/Magnum/DefaultFramebuffer.cpp index 38c97d059..7d7d2d2d3 100644 --- a/src/DefaultFramebuffer.cpp +++ b/src/Magnum/DefaultFramebuffer.cpp @@ -24,12 +24,12 @@ #include "DefaultFramebuffer.h" -#include +#include -#include "Context.h" -#include "Extensions.h" -#include "Implementation/State.h" -#include "Implementation/FramebufferState.h" +#include "Magnum/Context.h" +#include "Magnum/Extensions.h" +#include "Magnum/Implementation/State.h" +#include "Magnum/Implementation/FramebufferState.h" namespace Magnum { diff --git a/src/DefaultFramebuffer.h b/src/Magnum/DefaultFramebuffer.h similarity index 93% rename from src/DefaultFramebuffer.h rename to src/Magnum/DefaultFramebuffer.h index eb8706cbd..5f27e9136 100644 --- a/src/DefaultFramebuffer.h +++ b/src/Magnum/DefaultFramebuffer.h @@ -25,10 +25,10 @@ */ /** @file - * @brief Class Magnum::DefaultFramebuffer + * @brief Class @ref Magnum::DefaultFramebuffer */ -#include "AbstractFramebuffer.h" +#include "Magnum/AbstractFramebuffer.h" namespace Magnum { @@ -36,8 +36,9 @@ namespace Magnum { @brief Default framebuffer Default framebuffer, i.e. the actual screen surface. It is automatically -created when Context is created and it is available through global variable -@ref defaultFramebuffer. It is by default mapped to whole screen surface. +created when @ref Context is created and it is available through global +variable @ref defaultFramebuffer. It is by default mapped to whole screen +surface. @section DefaultFramebuffer-usage Usage @@ -72,7 +73,7 @@ multiple framebuffers. See also @ref AbstractFramebuffer-performance-optimization "relevant section in AbstractFramebuffer". If extension @extension{EXT,direct_state_access} is available, functions -mapForDraw() and mapForRead() use DSA to avoid unnecessary calls to +@ref mapForDraw() and @ref mapForRead() use DSA to avoid unnecessary calls to @fn_gl{BindFramebuffer}. See their respective documentation for more information. */ @@ -83,7 +84,7 @@ class MAGNUM_EXPORT DefaultFramebuffer: public AbstractFramebuffer { /** * @brief Status * - * @see checkStatus() + * @see @ref checkStatus() * @requires_gl30 %Extension @extension{ARB,framebuffer_object} */ enum class Status: GLenum { @@ -105,7 +106,7 @@ class MAGNUM_EXPORT DefaultFramebuffer: public AbstractFramebuffer { /** * @brief Draw attachment * - * @see mapForDraw() + * @see @ref mapForDraw() * @requires_gles30 Draw attachments for default framebuffer are * available only in OpenGL ES 3.0. */ @@ -166,7 +167,7 @@ class MAGNUM_EXPORT DefaultFramebuffer: public AbstractFramebuffer { /** * @brief Read attachment * - * @see mapForRead() + * @see @ref mapForRead() * @requires_gles30 %Extension @es_extension2{NV,read_buffer,GL_NV_read_buffer} */ enum class ReadAttachment: GLenum { @@ -236,7 +237,7 @@ class MAGNUM_EXPORT DefaultFramebuffer: public AbstractFramebuffer { /** * @brief Invalidation attachment * - * @see invalidate() + * @see @ref invalidate() * @requires_gl43 %Extension @extension{ARB,invalidate_subdata} * @requires_gles30 %Extension @es_extension{EXT,discard_framebuffer} */ @@ -354,8 +355,8 @@ class MAGNUM_EXPORT DefaultFramebuffer: public AbstractFramebuffer { * If @extension{EXT,direct_state_access} is not available and the * framebuffer is not currently bound, it is bound before the * operation. - * @see mapForRead(), @fn_gl{BindFramebuffer}, @fn_gl{DrawBuffer} or - * @fn_gl_extension{FramebufferDrawBuffer,EXT,direct_state_access}, + * @see @ref mapForRead(), @fn_gl{BindFramebuffer}, @fn_gl{DrawBuffer} + * or @fn_gl_extension{FramebufferDrawBuffer,EXT,direct_state_access}, * @fn_gl{DrawBuffers} in OpenGL ES 3.0 * @requires_gles30 Draw attachments for default framebuffer are * available only in OpenGL ES 3.0. @@ -392,9 +393,11 @@ class MAGNUM_EXPORT DefaultFramebuffer: public AbstractFramebuffer { * @see @fn_gl{InvalidateFramebuffer} or @fn_gles_extension{DiscardFramebuffer,EXT,discard_framebuffer} * on OpenGL ES 2.0 * @requires_gl43 %Extension @extension{ARB,invalidate_subdata}. Use - * clear() instead where the extension is not supported. + * @ref Magnum::DefaultFramebuffer::clear() "clear()" instead + * where the extension is not supported. * @requires_gles30 %Extension @es_extension{EXT,discard_framebuffer}. - * Use clear() instead where the extension is not supported. + * Use @ref Magnum::DefaultFramebuffer::clear() "clear()" instead + * where the extension is not supported. */ void invalidate(std::initializer_list attachments); @@ -408,9 +411,11 @@ class MAGNUM_EXPORT DefaultFramebuffer: public AbstractFramebuffer { * @see @fn_gl{InvalidateSubFramebuffer} or @fn_gles_extension{DiscardSubFramebuffer,EXT,discard_framebuffer} * on OpenGL ES 2.0 * @requires_gl43 %Extension @extension{ARB,invalidate_subdata}. Use - * clear() instead where the extension is not supported. + * @ref Magnum::DefaultFramebuffer::clear() "clear()" instead + * where the extension is not supported. * @requires_gles30 %Extension @es_extension{EXT,discard_framebuffer}. - * Use clear() instead where the extension is not supported. + * Use @ref Magnum::DefaultFramebuffer::clear() "clear()" instead + * where the extension is not supported. */ void invalidate(std::initializer_list attachments, const Range2Di& rectangle); diff --git a/src/DimensionTraits.h b/src/Magnum/DimensionTraits.h similarity index 98% rename from src/DimensionTraits.h rename to src/Magnum/DimensionTraits.h index 69eb13a05..290adf35d 100644 --- a/src/DimensionTraits.h +++ b/src/Magnum/DimensionTraits.h @@ -24,8 +24,8 @@ DEALINGS IN THE SOFTWARE. */ -#include "Math/Math.h" -#include "Types.h" +#include "Magnum/Math/Math.h" +#include "Magnum/Types.h" /** @file * @brief Class Magnum::DimensionTraits diff --git a/src/Extensions.h b/src/Magnum/Extensions.h similarity index 96% rename from src/Extensions.h rename to src/Magnum/Extensions.h index a9df50b48..5db79256f 100644 --- a/src/Extensions.h +++ b/src/Magnum/Extensions.h @@ -28,7 +28,7 @@ * @brief Namespace Magnum::Extensions */ -#include "Version.h" +#include "Magnum/Version.h" namespace Magnum { @@ -200,56 +200,83 @@ namespace GL { #else #line 1 namespace ANGLE { + #ifdef MAGNUM_TARGET_GLES2 _extension(GL,ANGLE,framebuffer_blit, GLES200, GLES300) // #83 _extension(GL,ANGLE,framebuffer_multisample, GLES200, GLES300) // #84 _extension(GL,ANGLE,depth_texture, GLES200, GLES300) // #138 + #endif } namespace APPLE { + #ifdef MAGNUM_TARGET_GLES2 _extension(GL,APPLE,framebuffer_multisample, GLES200, GLES300) // #78 + #endif _extension(GL,APPLE,texture_format_BGRA8888, GLES200, None) // #79 } namespace ARM { + #ifdef MAGNUM_TARGET_GLES2 _extension(GL,ARM,rgba8, GLES200, GLES300) // #82 + #endif } namespace CHROMIUM { _extension(GL,CHROMIUM,map_sub, GLES200, None) } namespace EXT { _extension(GL,EXT,texture_filter_anisotropic, GLES200, None) // #41 + #ifdef MAGNUM_TARGET_GLES2 _extension(GL,EXT,texture_type_2_10_10_10_REV, GLES200, GLES300) // #42 + #endif _extension(GL,EXT,texture_format_BGRA8888, GLES200, None) // #51 + #ifdef MAGNUM_TARGET_GLES2 _extension(GL,EXT,discard_framebuffer, GLES200, GLES300) // #64 _extension(GL,EXT,blend_minmax, GLES200, GLES300) // #65 + #endif _extension(GL,EXT,read_format_bgra, GLES200, None) // #66 _extension(GL,EXT,debug_label, GLES200, None) // #98 _extension(GL,EXT,debug_marker, GLES200, None) // #99 + #ifdef MAGNUM_TARGET_GLES2 _extension(GL,EXT,occlusion_query_boolean, GLES200, GLES300) // #100 + #endif _extension(GL,EXT,separate_shader_objects, GLES200, None) // #101 + #ifdef MAGNUM_TARGET_GLES2 _extension(GL,EXT,texture_rg, GLES200, GLES300) // #103 + #endif _extension(GL,EXT,sRGB, GLES200, None) // #105 _extension(GL,EXT,multisampled_render_to_texture, GLES200, None) // #106 _extension(GL,EXT,robustness, GLES200, None) // #107 + #ifdef MAGNUM_TARGET_GLES2 _extension(GL,EXT,texture_storage, GLES200, GLES300) // #108 _extension(GL,EXT,map_buffer_range, GLES200, GLES300) // #121 + #endif _extension(GL,EXT,disjoint_timer_query, GLES200, None) // #150 } namespace KHR { _extension(GL,KHR,debug, GLES200, None) // #118 } namespace NV { + #ifdef MAGNUM_TARGET_GLES2 _extension(GL,NV,draw_buffers, GLES200, GLES300) // #91 _extension(GL,NV,fbo_color_attachments, GLES200, GLES300) // #92 _extension(GL,NV,read_buffer, GLES200, GLES300) // #93 + #endif _extension(GL,NV,read_buffer_front, GLES200, None) // #93 _extension(GL,NV,read_depth, GLES200, None) // #94 _extension(GL,NV,read_stencil, GLES200, None) // #94 _extension(GL,NV,read_depth_stencil, GLES200, None) // #94 + #ifdef MAGNUM_TARGET_GLES2 _extension(GL,NV,framebuffer_blit, GLES200, GLES300) // #142 _extension(GL,NV,framebuffer_multisample, GLES200, GLES300) // #143 + #endif _extension(GL,NV,texture_border_clamp, GLES200, None) // #149 } namespace OES { + #ifdef MAGNUM_TARGET_GLES2 _extension(GL,OES,depth24, GLES200, GLES300) // #24 + #endif _extension(GL,OES,depth32, GLES200, None) // #25 + #ifdef MAGNUM_TARGET_GLES2 _extension(GL,OES,element_index_uint, GLES200, GLES300) // #26 + #endif _extension(GL,OES,mapbuffer, GLES200, None) // #29 + #ifdef MAGNUM_TARGET_GLES2 _extension(GL,OES,rgb8_rgba8, GLES200, GLES300) // #30 + #endif _extension(GL,OES,stencil1, GLES200, None) // #31 _extension(GL,OES,stencil4, GLES200, None) // #32 _extension(GL,OES,texture_3D, GLES200, None) // #34 + #ifdef MAGNUM_TARGET_GLES2 _extension(GL,OES,texture_half_float_linear, GLES200, GLES300) // #35 _extension(GL,OES,texture_float_linear, GLES200, GLES300) // #35 _extension(GL,OES,texture_half_float, GLES200, GLES300) // #36 @@ -261,6 +288,7 @@ namespace GL { _extension(GL,OES,vertex_array_object, GLES200, GLES300) // #71 _extension(GL,OES,required_internalformat, GLES200, GLES300) // #115 _extension(GL,OES,surfaceless_context, GLES200, GLES300) // #116 + #endif } #endif } diff --git a/src/Framebuffer.cpp b/src/Magnum/Framebuffer.cpp similarity index 97% rename from src/Framebuffer.cpp rename to src/Magnum/Framebuffer.cpp index 39d50211b..7e69eca4b 100644 --- a/src/Framebuffer.cpp +++ b/src/Magnum/Framebuffer.cpp @@ -24,12 +24,16 @@ #include "Framebuffer.h" -#include "BufferImage.h" -#include "Context.h" -#include "Extensions.h" -#include "Image.h" -#include "Renderbuffer.h" -#include "Texture.h" +#include + +#ifndef MAGNUM_TARGET_GLES2 +#include "Magnum/BufferImage.h" +#endif +#include "Magnum/Context.h" +#include "Magnum/Extensions.h" +#include "Magnum/Image.h" +#include "Magnum/Renderbuffer.h" +#include "Magnum/Texture.h" #include "Implementation/DebugState.h" #include "Implementation/State.h" diff --git a/src/Framebuffer.h b/src/Magnum/Framebuffer.h similarity index 87% rename from src/Framebuffer.h rename to src/Magnum/Framebuffer.h index fdf5f3e86..435c04e2c 100644 --- a/src/Framebuffer.h +++ b/src/Magnum/Framebuffer.h @@ -25,11 +25,11 @@ */ /** @file - * @brief Class Magnum::Framebuffer + * @brief Class @ref Magnum::Framebuffer */ -#include "AbstractFramebuffer.h" -#include "CubeMapTexture.h" +#include "Magnum/AbstractFramebuffer.h" +#include "Magnum/CubeMapTexture.h" #ifdef _X11_XLIB_H_ /* Xlib.h, I hate you sincerely */ #undef Status @@ -40,9 +40,9 @@ namespace Magnum { /** @brief %Framebuffer -Unlike DefaultFramebuffer, which is used for on-screen rendering, this class -is used for off-screen rendering, usable either in windowless applications, -texture generation or for various post-processing effects. +Unlike @ref DefaultFramebuffer, which is used for on-screen rendering, this +class is used for off-screen rendering, usable either in windowless +applications, texture generation or for various post-processing effects. @section Framebuffer-usage Example usage @@ -71,10 +71,9 @@ framebuffer.mapForDraw({{MyShader::ColorOutput, Framebuffer::ColorAttachment(0)} {MyShader::NormalOutput, Framebuffer::ColorAttachment(1)}}); @endcode -The actual @ref Platform::GlutApplication::drawEvent() "drawEvent()" might -look like this. First you clear all buffers you need, perform drawing to -off-screen framebuffer, then bind the default and render the textures on -screen: +The actual @ref Platform::Sdl2Application::drawEvent() "drawEvent()" might look +like this. First you clear all buffers you need, perform drawing to off-screen +framebuffer, then bind the default and render the textures on screen: @code void drawEvent() { defaultFramebuffer.clear(FramebufferClear::Color) @@ -93,10 +92,10 @@ void drawEvent() { See also @ref AbstractFramebuffer-performance-optimization "relevant section in AbstractFramebuffer". If extension @extension{EXT,direct_state_access} is available, functions -mapForDraw(), mapForRead(), attachRenderbuffer(), attachTexture1D(), -attachTexture2D(), attachCubeMapTexture() and attachTexture3D() use DSA -to avoid unnecessary calls to @fn_gl{BindFramebuffer}. See their respective -documentation for more information. +@ref mapForDraw(), @ref mapForRead(), @ref attachRenderbuffer(), +@ref attachTexture1D(), @ref attachTexture2D(), @ref attachCubeMapTexture() and +@ref attachTexture3D() use DSA to avoid unnecessary calls to @fn_gl{BindFramebuffer}. +See their respective documentation for more information. @requires_gl30 %Extension @extension{ARB,framebuffer_object} @todo `MAX_COLOR_ATTACHMENTS` @@ -108,8 +107,9 @@ class MAGNUM_EXPORT Framebuffer: public AbstractFramebuffer, public AbstractObje /** * @brief Color attachment * - * @see Attachment, attachRenderbuffer(), attachTexture1D(), - * attachTexture2D(), attachCubeMapTexture(), attachTexture3D() + * @see @ref BufferAttachment, @ref attachRenderbuffer(), + * @ref attachTexture1D(), @ref attachTexture2D(), + * @ref attachCubeMapTexture(), @ref attachTexture3D() */ class ColorAttachment { friend class Framebuffer; @@ -117,7 +117,7 @@ class MAGNUM_EXPORT Framebuffer: public AbstractFramebuffer, public AbstractObje public: /** * @brief Constructor - * @param id Color attachment id + * @param id Color attachment ID * * @requires_gles30 %Extension @es_extension{NV,fbo_color_attachments} * is required for @p id greater than 0. @@ -139,7 +139,7 @@ class MAGNUM_EXPORT Framebuffer: public AbstractFramebuffer, public AbstractObje /** * @brief Draw attachment * - * @see mapForDraw() + * @see @ref mapForDraw() */ class DrawAttachment { public: @@ -166,8 +166,9 @@ class MAGNUM_EXPORT Framebuffer: public AbstractFramebuffer, public AbstractObje /** * @brief %Buffer attachment * - * @see attachRenderbuffer(), attachTexture1D(), attachTexture2D(), - * attachCubeMapTexture(), attachTexture3D() + * @see @ref attachRenderbuffer(), @ref attachTexture1D(), + * @ref attachTexture2D(), @ref attachCubeMapTexture(), + * @ref attachTexture3D() */ class MAGNUM_EXPORT BufferAttachment { public: @@ -182,7 +183,11 @@ class MAGNUM_EXPORT Framebuffer: public AbstractFramebuffer, public AbstractObje * @brief Both depth and stencil buffer * * @requires_gles30 Combined depth and stencil attachment is - * not available in OpenGL ES 2.0. + * not available in OpenGL ES 2.0. Attach the same object + * to both @ref Magnum::Framebuffer::BufferAttachment::Depth + * "BufferAttachment::Depth" and @ref Magnum::Framebuffer::BufferAttachment::Stencil + * "BufferAttachment::Stencil" instead. + * @todo Support this in ES2 (bind to both depth and stencil internally) */ static const BufferAttachment DepthStencil; #endif @@ -207,7 +212,7 @@ class MAGNUM_EXPORT Framebuffer: public AbstractFramebuffer, public AbstractObje /** * @brief Invalidation attachment * - * @see invalidate() + * @see @ref invalidate() * @requires_gl43 %Extension @extension{ARB,invalidate_subdata} * @requires_gles30 %Extension @es_extension{EXT,discard_framebuffer} */ @@ -239,7 +244,7 @@ class MAGNUM_EXPORT Framebuffer: public AbstractFramebuffer, public AbstractObje /** * @brief Status * - * @see checkStatus() + * @see @ref checkStatus() */ enum class Status: GLenum { /** The framebuffer is complete */ @@ -287,10 +292,9 @@ class MAGNUM_EXPORT Framebuffer: public AbstractFramebuffer, public AbstractObje #endif #ifndef MAGNUM_TARGET_GLES - /** @todo Why exactly this is not needed? */ /** * Mismatched layered color attachments - * @requires_gl Not available in OpenGL ES. + * @requires_gl Geometry shaders are not available in OpenGL ES. */ IncompleteLayerTargets = GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS #endif @@ -312,7 +316,7 @@ class MAGNUM_EXPORT Framebuffer: public AbstractFramebuffer, public AbstractObje * @brief Constructor * * Generates new OpenGL framebuffer. - * @see setViewport(), @fn_gl{GenFramebuffers} + * @see @ref setViewport(), @fn_gl{GenFramebuffers} */ explicit Framebuffer(const Range2Di& viewport); @@ -385,7 +389,7 @@ class MAGNUM_EXPORT Framebuffer: public AbstractFramebuffer, public AbstractObje * * @p attachments is list of shader outputs mapped to framebuffer * color attachment IDs. %Shader outputs which are not listed are not - * used, you can achieve the same by passing Framebuffer::DrawAttachment::None + * used, you can achieve the same by passing @ref Framebuffer::DrawAttachment::None * as color attachment ID. Example usage: * @code * framebuffer.mapForDraw({{MyShader::ColorOutput, Framebuffer::ColorAttachment(0)}, @@ -425,6 +429,23 @@ class MAGNUM_EXPORT Framebuffer: public AbstractFramebuffer, public AbstractObje return *this; } + /** + * @brief Map given color attachment for reading + * @param attachment Color attachment + * @return Reference to self (for method chaining) + * + * If @extension{EXT,direct_state_access} is not available and the + * framebufferbuffer is not currently bound, it is bound before the + * operation. + * @see @ref mapForDraw(), @fn_gl{BindFramebuffer}, @fn_gl{ReadBuffer} + * or @fn_gl_extension{FramebufferReadBuffer,EXT,direct_state_access} + * @requires_gles30 %Extension @es_extension2{NV,read_buffer,GL_NV_read_buffer} + */ + Framebuffer& mapForRead(ColorAttachment attachment) { + (this->*readBufferImplementation)(GLenum(attachment)); + return *this; + } + /** * @brief Invalidate framebuffer * @param attachments Attachments to invalidate @@ -434,9 +455,11 @@ class MAGNUM_EXPORT Framebuffer: public AbstractFramebuffer, public AbstractObje * @see @fn_gl{InvalidateFramebuffer} or @fn_gles_extension{DiscardFramebuffer,EXT,discard_framebuffer} * on OpenGL ES 2.0 * @requires_gl43 %Extension @extension{ARB,invalidate_subdata}. Use - * clear() instead where the extension is not supported. + * @ref Magnum::Framebuffer::clear() "clear()" instead where the + * extension is not supported. * @requires_gles30 %Extension @es_extension{EXT,discard_framebuffer}. - * Use clear() instead where the extension is not supported. + * Use @ref Magnum::Framebuffer::clear() "clear()" instead where + * the extension is not supported. */ void invalidate(std::initializer_list attachments); @@ -450,29 +473,14 @@ class MAGNUM_EXPORT Framebuffer: public AbstractFramebuffer, public AbstractObje * @see @fn_gl{InvalidateSubFramebuffer} or @fn_gles_extension{DiscardSubFramebuffer,EXT,discard_framebuffer} * on OpenGL ES 2.0 * @requires_gl43 %Extension @extension{ARB,invalidate_subdata}. Use - * clear() instead where the extension is not supported. + * @ref Magnum::Framebuffer::clear() "clear()" instead where the + * extension is not supported. * @requires_gles30 %Extension @es_extension{EXT,discard_framebuffer}. - * Use clear() instead where the extension is not supported. + * Use @ref Magnum::Framebuffer::clear() "clear()" instead where + * the extension is not supported. */ void invalidate(std::initializer_list attachments, const Range2Di& rectangle); - /** - * @brief Map given color attachment for reading - * @param attachment Color attachment - * @return Reference to self (for method chaining) - * - * If @extension{EXT,direct_state_access} is not available and the - * framebufferbuffer is not currently bound, it is bound before the - * operation. - * @see mapForDraw(), @fn_gl{BindFramebuffer}, @fn_gl{ReadBuffer} or - * @fn_gl_extension{FramebufferReadBuffer,EXT,direct_state_access} - * @requires_gles30 %Extension @es_extension2{NV,read_buffer,GL_NV_read_buffer} - */ - Framebuffer& mapForRead(ColorAttachment attachment) { - (this->*readBufferImplementation)(GLenum(attachment)); - return *this; - } - /** * @brief Attach renderbuffer to given buffer * @param attachment %Buffer attachment @@ -501,8 +509,8 @@ class MAGNUM_EXPORT Framebuffer: public AbstractFramebuffer, public AbstractObje * If @extension{EXT,direct_state_access} is not available and the * framebufferbuffer is not currently bound, it is bound before the * operation. - * @see @fn_gl{BindFramebuffer}, @fn_gl{FramebufferTexture} or - * @fn_gl_extension{NamedFramebufferTexture1D,EXT,direct_state_access} + * @see @fn_gl{BindFramebuffer}, @fn_gl2{FramebufferTexture1D,FramebufferTexture} + * or @fn_gl_extension{NamedFramebufferTexture1D,EXT,direct_state_access} * @requires_gl Only 2D and 3D textures are available in OpenGL ES. */ Framebuffer& attachTexture1D(BufferAttachment attachment, Texture1D& texture, Int level) { @@ -521,8 +529,9 @@ class MAGNUM_EXPORT Framebuffer: public AbstractFramebuffer, public AbstractObje * If @extension{EXT,direct_state_access} is not available and the * framebufferbuffer is not currently bound, it is bound before the * operation. - * @see attachCubeMapTexture(), @fn_gl{BindFramebuffer}, @fn_gl{FramebufferTexture} - * or @fn_gl_extension{NamedFramebufferTexture2D,EXT,direct_state_access} + * @see @ref attachCubeMapTexture(), @fn_gl{BindFramebuffer}, + * @fn_gl2{FramebufferTexture2D,FramebufferTexture} or + * @fn_gl_extension{NamedFramebufferTexture2D,EXT,direct_state_access} */ Framebuffer& attachTexture2D(BufferAttachment attachment, Texture2D& texture, Int level); @@ -537,8 +546,9 @@ class MAGNUM_EXPORT Framebuffer: public AbstractFramebuffer, public AbstractObje * If @extension{EXT,direct_state_access} is not available and the * framebufferbuffer is not currently bound, it is bound before the * operation. - * @see attachTexture2D(), @fn_gl{BindFramebuffer}, @fn_gl{FramebufferTexture} - * or @fn_gl_extension{NamedFramebufferTexture2D,EXT,direct_state_access} + * @see @ref attachTexture2D(), @fn_gl{BindFramebuffer}, + * @fn_gl2{FramebufferTexture2D,FramebufferTexture} or + * @fn_gl_extension{NamedFramebufferTexture2D,EXT,direct_state_access} */ Framebuffer& attachCubeMapTexture(BufferAttachment attachment, CubeMapTexture& texture, CubeMapTexture::Coordinate coordinate, Int level) { (this->*texture2DImplementation)(attachment, GLenum(coordinate), texture.id(), level); @@ -556,8 +566,8 @@ class MAGNUM_EXPORT Framebuffer: public AbstractFramebuffer, public AbstractObje * If @extension{EXT,direct_state_access} is not available and the * framebufferbuffer is not currently bound, it is bound before the * operation. - * @see @fn_gl{BindFramebuffer}, @fn_gl{FramebufferTexture} or - * @fn_gl_extension{NamedFramebufferTexture3D,EXT,direct_state_access} + * @see @fn_gl{BindFramebuffer}, @fn_gl2{FramebufferTexture3D,FramebufferTexture} + * or @fn_gl_extension{NamedFramebufferTexture3D,EXT,direct_state_access} * @requires_es_extension %Extension @es_extension{OES,texture_3D} */ Framebuffer& attachTexture3D(BufferAttachment attachment, Texture3D& texture, Int level, Int layer) { @@ -596,7 +606,7 @@ class MAGNUM_EXPORT Framebuffer: public AbstractFramebuffer, public AbstractObje #ifndef MAGNUM_TARGET_GLES void MAGNUM_LOCAL texture2DImplementationDSA(BufferAttachment attachment, GLenum textureTarget, GLuint textureId, GLint level); #endif - static MAGNUM_LOCAL Texture2DImplementation texture2DImplementation; + static Texture2DImplementation texture2DImplementation; typedef void(Framebuffer::*Texture3DImplementation)(BufferAttachment, Texture3D&, GLint, GLint); void MAGNUM_LOCAL texture3DImplementationDefault(BufferAttachment attachment, Texture3D& texture, GLint level, GLint layer); diff --git a/src/Image.cpp b/src/Magnum/Image.cpp similarity index 100% rename from src/Image.cpp rename to src/Magnum/Image.cpp diff --git a/src/Image.h b/src/Magnum/Image.h similarity index 89% rename from src/Image.h rename to src/Magnum/Image.h index 9c9881e86..530349b08 100644 --- a/src/Image.h +++ b/src/Magnum/Image.h @@ -28,7 +28,7 @@ * @brief Class @ref Magnum::Image, typedef @ref Magnum::Image1D, @ref Magnum::Image2D, @ref Magnum::Image3D */ -#include "ImageReference.h" +#include "Magnum/ImageReference.h" namespace Magnum { @@ -96,13 +96,30 @@ template class Image: public AbstractImage { /** @brief %Image size */ typename DimensionTraits::VectorType size() const { return _size; } + /** + * @brief Size of data required to store image of given size + * + * Takes color format, type and row alignment of this image into + * account. + * @see @ref pixelSize() + */ + std::size_t dataSize(const typename DimensionTraits::VectorType& size) const { + return AbstractImage::dataSize(size); + } + /** * @brief Pointer to raw data * * @see @ref release() */ - unsigned char* data() { return _data; } - const unsigned char* data() const { return _data; } /**< @overload */ + template T* data() { + return reinterpret_cast(_data); + } + + /** @overload */ + template const T* data() const { + return reinterpret_cast(_data); + } /** * @brief Set image data diff --git a/src/ImageFormat.h b/src/Magnum/ImageFormat.h similarity index 93% rename from src/ImageFormat.h rename to src/Magnum/ImageFormat.h index 68b65db46..df7597aa3 100644 --- a/src/ImageFormat.h +++ b/src/Magnum/ImageFormat.h @@ -24,12 +24,14 @@ DEALINGS IN THE SOFTWARE. */ +#ifdef MAGNUM_BUILD_DEPRECATED /** @file * @brief Enum @ref Magnum::ImageFormat, @ref Magnum::ImageType * @deprecated Use @ref ColorFormat.h instead. */ +#endif -#include "ColorFormat.h" +#include "Magnum/ColorFormat.h" #ifdef MAGNUM_BUILD_DEPRECATED namespace Magnum { @@ -48,7 +50,7 @@ typedef CORRADE_DEPRECATED("use ColorType instead") ColorType ImageType; } #else -#error +#error this header is available only on deprecated build #endif #endif diff --git a/src/ImageReference.h b/src/Magnum/ImageReference.h similarity index 90% rename from src/ImageReference.h rename to src/Magnum/ImageReference.h index d2f754e16..c785c3a35 100644 --- a/src/ImageReference.h +++ b/src/Magnum/ImageReference.h @@ -28,9 +28,9 @@ * @brief Class @ref Magnum::ImageReference, typedef @ref Magnum::ImageReference1D, @ref Magnum::ImageReference2D, @ref Magnum::ImageReference3D */ -#include "Math/Vector3.h" -#include "AbstractImage.h" -#include "DimensionTraits.h" +#include "Magnum/Math/Vector3.h" +#include "Magnum/AbstractImage.h" +#include "Magnum/DimensionTraits.h" namespace Magnum { @@ -76,9 +76,19 @@ template class ImageReference: public AbstractImage { /** @brief %Image size */ constexpr typename DimensionTraits::VectorType size() const { return _size; } + /** @copydoc Image::dataSize() */ + std::size_t dataSize(const typename DimensionTraits::VectorType& size) const { + return AbstractImage::dataSize(size); + } + /** @brief Pointer to raw data */ constexpr const unsigned char* data() const { return _data; } + /** @overload */ + template const T* data() const { + return reinterpret_cast(_data); + } + /** * @brief Set image data * @param data %Image data diff --git a/src/Implementation/BufferState.cpp b/src/Magnum/Implementation/BufferState.cpp similarity index 98% rename from src/Implementation/BufferState.cpp rename to src/Magnum/Implementation/BufferState.cpp index e844f8991..d34618806 100644 --- a/src/Implementation/BufferState.cpp +++ b/src/Magnum/Implementation/BufferState.cpp @@ -24,7 +24,7 @@ #include "BufferState.h" -#include +#include namespace Magnum { namespace Implementation { diff --git a/src/Implementation/BufferState.h b/src/Magnum/Implementation/BufferState.h similarity index 98% rename from src/Implementation/BufferState.h rename to src/Magnum/Implementation/BufferState.h index 6ca93515e..ab6873c2f 100644 --- a/src/Implementation/BufferState.h +++ b/src/Magnum/Implementation/BufferState.h @@ -24,7 +24,7 @@ DEALINGS IN THE SOFTWARE. */ -#include "Buffer.h" +#include "Magnum/Buffer.h" namespace Magnum { namespace Implementation { diff --git a/src/Implementation/DebugState.cpp b/src/Magnum/Implementation/DebugState.cpp similarity index 96% rename from src/Implementation/DebugState.cpp rename to src/Magnum/Implementation/DebugState.cpp index e00b1bb62..401b256be 100644 --- a/src/Implementation/DebugState.cpp +++ b/src/Magnum/Implementation/DebugState.cpp @@ -24,9 +24,9 @@ #include "DebugState.h" -#include "AbstractObject.h" -#include "Context.h" -#include "Extensions.h" +#include "Magnum/AbstractObject.h" +#include "Magnum/Context.h" +#include "Magnum/Extensions.h" namespace Magnum { namespace Implementation { diff --git a/src/Implementation/DebugState.h b/src/Magnum/Implementation/DebugState.h similarity index 98% rename from src/Implementation/DebugState.h rename to src/Magnum/Implementation/DebugState.h index 0b3ec18f1..bac702475 100644 --- a/src/Implementation/DebugState.h +++ b/src/Magnum/Implementation/DebugState.h @@ -26,7 +26,7 @@ #include -#include "DebugMessage.h" +#include "Magnum/DebugMessage.h" namespace Magnum { namespace Implementation { diff --git a/src/Implementation/FramebufferState.h b/src/Magnum/Implementation/FramebufferState.h similarity index 95% rename from src/Implementation/FramebufferState.h rename to src/Magnum/Implementation/FramebufferState.h index 87f72120d..13470de16 100644 --- a/src/Implementation/FramebufferState.h +++ b/src/Magnum/Implementation/FramebufferState.h @@ -24,9 +24,9 @@ DEALINGS IN THE SOFTWARE. */ -#include "Math/Range.h" -#include "Magnum.h" -#include "OpenGL.h" +#include "Magnum/Magnum.h" +#include "Magnum/OpenGL.h" +#include "Magnum/Math/Range.h" namespace Magnum { namespace Implementation { diff --git a/src/Implementation/MeshState.h b/src/Magnum/Implementation/MeshState.h similarity index 98% rename from src/Implementation/MeshState.h rename to src/Magnum/Implementation/MeshState.h index e9b9f2dfb..a9b10f84f 100644 --- a/src/Implementation/MeshState.h +++ b/src/Magnum/Implementation/MeshState.h @@ -24,7 +24,7 @@ DEALINGS IN THE SOFTWARE. */ -#include "Magnum.h" +#include "Magnum/Magnum.h" namespace Magnum { namespace Implementation { diff --git a/src/Implementation/RendererState.h b/src/Magnum/Implementation/RendererState.h similarity index 98% rename from src/Implementation/RendererState.h rename to src/Magnum/Implementation/RendererState.h index e356c2e82..fea0bbb87 100644 --- a/src/Implementation/RendererState.h +++ b/src/Magnum/Implementation/RendererState.h @@ -24,7 +24,7 @@ DEALINGS IN THE SOFTWARE. */ -#include "Renderer.h" +#include "Magnum/Renderer.h" namespace Magnum { namespace Implementation { diff --git a/src/Implementation/ShaderProgramState.h b/src/Magnum/Implementation/ShaderProgramState.h similarity index 98% rename from src/Implementation/ShaderProgramState.h rename to src/Magnum/Implementation/ShaderProgramState.h index dd3afc347..bc1bab74b 100644 --- a/src/Implementation/ShaderProgramState.h +++ b/src/Magnum/Implementation/ShaderProgramState.h @@ -24,7 +24,7 @@ DEALINGS IN THE SOFTWARE. */ -#include "OpenGL.h" +#include "Magnum/OpenGL.h" namespace Magnum { namespace Implementation { diff --git a/src/Implementation/ShaderState.h b/src/Magnum/Implementation/ShaderState.h similarity index 97% rename from src/Implementation/ShaderState.h rename to src/Magnum/Implementation/ShaderState.h index 678c114c9..345505870 100644 --- a/src/Implementation/ShaderState.h +++ b/src/Magnum/Implementation/ShaderState.h @@ -24,9 +24,9 @@ DEALINGS IN THE SOFTWARE. */ -#include "OpenGL.h" -#include "Types.h" -#include "magnumConfigure.h" +#include "Magnum/OpenGL.h" +#include "Magnum/Types.h" +#include "Magnum/configure.h" namespace Magnum { namespace Implementation { diff --git a/src/Implementation/State.cpp b/src/Magnum/Implementation/State.cpp similarity index 86% rename from src/Implementation/State.cpp rename to src/Magnum/Implementation/State.cpp index ff35e3c64..27cc5d709 100644 --- a/src/Implementation/State.cpp +++ b/src/Magnum/Implementation/State.cpp @@ -24,16 +24,17 @@ #include "State.h" -#include "Context.h" -#include "Extensions.h" -#include "Implementation/BufferState.h" -#include "Implementation/DebugState.h" -#include "Implementation/FramebufferState.h" -#include "Implementation/MeshState.h" -#include "Implementation/RendererState.h" -#include "Implementation/ShaderState.h" -#include "Implementation/ShaderProgramState.h" -#include "Implementation/TextureState.h" +#include "Magnum/Context.h" +#include "Magnum/Extensions.h" + +#include "BufferState.h" +#include "DebugState.h" +#include "FramebufferState.h" +#include "MeshState.h" +#include "RendererState.h" +#include "ShaderState.h" +#include "ShaderProgramState.h" +#include "TextureState.h" namespace Magnum { namespace Implementation { diff --git a/src/Implementation/State.h b/src/Magnum/Implementation/State.h similarity index 98% rename from src/Implementation/State.h rename to src/Magnum/Implementation/State.h index 36570baa3..252f3e07f 100644 --- a/src/Implementation/State.h +++ b/src/Magnum/Implementation/State.h @@ -24,7 +24,7 @@ DEALINGS IN THE SOFTWARE. */ -#include "Magnum.h" +#include "Magnum/Magnum.h" namespace Magnum { namespace Implementation { diff --git a/src/Implementation/TextureState.cpp b/src/Magnum/Implementation/TextureState.cpp similarity index 100% rename from src/Implementation/TextureState.cpp rename to src/Magnum/Implementation/TextureState.cpp diff --git a/src/Implementation/TextureState.h b/src/Magnum/Implementation/TextureState.h similarity index 98% rename from src/Implementation/TextureState.h rename to src/Magnum/Implementation/TextureState.h index ab5d237fa..881a5eafe 100644 --- a/src/Implementation/TextureState.h +++ b/src/Magnum/Implementation/TextureState.h @@ -26,7 +26,7 @@ #include -#include "OpenGL.h" +#include "Magnum/OpenGL.h" namespace Magnum { namespace Implementation { diff --git a/src/Magnum.h b/src/Magnum/Magnum.h similarity index 98% rename from src/Magnum.h rename to src/Magnum/Magnum.h index 1206eb0f9..b2103bcd9 100644 --- a/src/Magnum.h +++ b/src/Magnum/Magnum.h @@ -28,14 +28,13 @@ * @brief Forward declarations for Magnum namespace */ -#include +#include -#include "Math/Math.h" -#include "Types.h" -#include "magnumConfigure.h" +#include "Magnum/Types.h" +#include "Magnum/Math/Math.h" #ifdef MAGNUM_BUILD_DEPRECATED -#include +#include #endif #ifndef DOXYGEN_GENERATING_OUTPUT @@ -553,7 +552,9 @@ enum class BufferTextureFormat: GLenum; template class BasicColor3; template class BasicColor4; typedef BasicColor3 Color3; +typedef BasicColor3 Color3ub; typedef BasicColor4 Color4; +typedef BasicColor4 Color4ub; #ifndef CORRADE_GCC45_COMPATIBILITY enum class ColorFormat: GLenum; diff --git a/src/Math/Algorithms/CMakeLists.txt b/src/Magnum/Math/Algorithms/CMakeLists.txt similarity index 100% rename from src/Math/Algorithms/CMakeLists.txt rename to src/Magnum/Math/Algorithms/CMakeLists.txt diff --git a/src/Math/Algorithms/GaussJordan.h b/src/Magnum/Math/Algorithms/GaussJordan.h similarity index 98% rename from src/Math/Algorithms/GaussJordan.h rename to src/Magnum/Math/Algorithms/GaussJordan.h index 37bacfe51..c7ca79e94 100644 --- a/src/Math/Algorithms/GaussJordan.h +++ b/src/Magnum/Math/Algorithms/GaussJordan.h @@ -28,7 +28,7 @@ * @brief Function Magnum::Math::Algorithms::gaussJordanInPlaceTransposed(), Magnum::Math::Algorithms::gaussJordanInPlace() */ -#include "Math/RectangularMatrix.h" +#include "Magnum/Math/RectangularMatrix.h" namespace Magnum { namespace Math { namespace Algorithms { diff --git a/src/Math/Algorithms/GramSchmidt.h b/src/Magnum/Math/Algorithms/GramSchmidt.h similarity index 98% rename from src/Math/Algorithms/GramSchmidt.h rename to src/Magnum/Math/Algorithms/GramSchmidt.h index 5346fe9ee..8fbe5322d 100644 --- a/src/Math/Algorithms/GramSchmidt.h +++ b/src/Magnum/Math/Algorithms/GramSchmidt.h @@ -28,7 +28,7 @@ * @brief Function Magnum::Math::Algorithms::gramSchmidtOrthogonalizeInPlace(), Magnum::Math::Algorithms::gramSchmidtOrthogonalize(), Magnum::Math::Algorithms::gramSchmidtOrthonormalizeInPlace(), Magnum::Math::Algorithms::gramSchmidtOrthonormalize() */ -#include "Math/RectangularMatrix.h" +#include "Magnum/Math/RectangularMatrix.h" namespace Magnum { namespace Math { namespace Algorithms { diff --git a/src/Math/Algorithms/Svd.h b/src/Magnum/Math/Algorithms/Svd.h similarity index 99% rename from src/Math/Algorithms/Svd.h rename to src/Magnum/Math/Algorithms/Svd.h index 15839bcc8..b31fea63a 100644 --- a/src/Math/Algorithms/Svd.h +++ b/src/Magnum/Math/Algorithms/Svd.h @@ -30,8 +30,8 @@ #include -#include "Math/Functions.h" -#include "Math/Matrix.h" +#include "Magnum/Math/Functions.h" +#include "Magnum/Math/Matrix.h" namespace Magnum { namespace Math { namespace Algorithms { diff --git a/src/Math/Algorithms/Test/CMakeLists.txt b/src/Magnum/Math/Algorithms/Test/CMakeLists.txt similarity index 100% rename from src/Math/Algorithms/Test/CMakeLists.txt rename to src/Magnum/Math/Algorithms/Test/CMakeLists.txt diff --git a/src/Math/Algorithms/Test/GaussJordanTest.cpp b/src/Magnum/Math/Algorithms/Test/GaussJordanTest.cpp similarity index 97% rename from src/Math/Algorithms/Test/GaussJordanTest.cpp rename to src/Magnum/Math/Algorithms/Test/GaussJordanTest.cpp index 20260b9f4..8eec14163 100644 --- a/src/Math/Algorithms/Test/GaussJordanTest.cpp +++ b/src/Magnum/Math/Algorithms/Test/GaussJordanTest.cpp @@ -22,9 +22,9 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include -#include "Math/Algorithms/GaussJordan.h" +#include "Magnum/Math/Algorithms/GaussJordan.h" namespace Magnum { namespace Math { namespace Algorithms { namespace Test { diff --git a/src/Math/Algorithms/Test/GramSchmidtTest.cpp b/src/Magnum/Math/Algorithms/Test/GramSchmidtTest.cpp similarity index 97% rename from src/Math/Algorithms/Test/GramSchmidtTest.cpp rename to src/Magnum/Math/Algorithms/Test/GramSchmidtTest.cpp index 4001b1dd9..7b2552280 100644 --- a/src/Math/Algorithms/Test/GramSchmidtTest.cpp +++ b/src/Magnum/Math/Algorithms/Test/GramSchmidtTest.cpp @@ -22,9 +22,9 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include -#include "Math/Algorithms/GramSchmidt.h" +#include "Magnum/Math/Algorithms/GramSchmidt.h" namespace Magnum { namespace Math { namespace Algorithms { namespace Test { diff --git a/src/Math/Algorithms/Test/SvdTest.cpp b/src/Magnum/Math/Algorithms/Test/SvdTest.cpp similarity index 98% rename from src/Math/Algorithms/Test/SvdTest.cpp rename to src/Magnum/Math/Algorithms/Test/SvdTest.cpp index 32dff9049..774207c22 100644 --- a/src/Math/Algorithms/Test/SvdTest.cpp +++ b/src/Magnum/Math/Algorithms/Test/SvdTest.cpp @@ -22,9 +22,9 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include -#include "Math/Algorithms/Svd.h" +#include "Magnum/Math/Algorithms/Svd.h" namespace Magnum { namespace Math { namespace Algorithms { namespace Test { diff --git a/src/Math/Angle.h b/src/Magnum/Math/Angle.h similarity index 98% rename from src/Math/Angle.h rename to src/Magnum/Math/Angle.h index 7f78bee44..e9b3625bc 100644 --- a/src/Math/Angle.h +++ b/src/Magnum/Math/Angle.h @@ -28,14 +28,13 @@ * @brief Class Magnum::Math::Deg, Magnum::Math::Rad and related operators. */ -#include -#include +#include +#include -#include "Math/Constants.h" -#include "Math/Math.h" -#include "Math/Unit.h" - -#include "magnumVisibility.h" +#include "Magnum/visibility.h" +#include "Magnum/Math/Constants.h" +#include "Magnum/Math/Math.h" +#include "Magnum/Math/Unit.h" namespace Magnum { namespace Math { diff --git a/src/Math/BoolVector.h b/src/Magnum/Math/BoolVector.h similarity index 99% rename from src/Math/BoolVector.h rename to src/Magnum/Math/BoolVector.h index ded6352fa..1efb18c00 100644 --- a/src/Math/BoolVector.h +++ b/src/Magnum/Math/BoolVector.h @@ -28,10 +28,10 @@ * @brief Class Magnum::Math::BoolVector */ -#include -#include +#include +#include -#include "Types.h" +#include "Magnum/Types.h" #ifdef CORRADE_MSVC2013_COMPATIBILITY #include diff --git a/src/Math/CMakeLists.txt b/src/Magnum/Math/CMakeLists.txt similarity index 100% rename from src/Math/CMakeLists.txt rename to src/Magnum/Math/CMakeLists.txt diff --git a/src/Math/Complex.h b/src/Magnum/Math/Complex.h similarity index 99% rename from src/Math/Complex.h rename to src/Magnum/Math/Complex.h index 250774b85..47362b7ad 100644 --- a/src/Math/Complex.h +++ b/src/Magnum/Math/Complex.h @@ -29,11 +29,11 @@ */ #include -#include -#include +#include +#include -#include "Math/Matrix.h" -#include "Math/Vector2.h" +#include "Magnum/Math/Matrix.h" +#include "Magnum/Math/Vector2.h" namespace Magnum { namespace Math { diff --git a/src/Math/Constants.h b/src/Magnum/Math/Constants.h similarity index 98% rename from src/Math/Constants.h rename to src/Magnum/Math/Constants.h index a2bc5a7b6..29f3b07d0 100644 --- a/src/Math/Constants.h +++ b/src/Magnum/Math/Constants.h @@ -28,7 +28,7 @@ * @brief Class Magnum::Math::Constants */ -#include "Types.h" +#include "Magnum/Types.h" namespace Magnum { namespace Math { diff --git a/src/Math/Dual.h b/src/Magnum/Math/Dual.h similarity index 99% rename from src/Math/Dual.h rename to src/Magnum/Math/Dual.h index 5d5e4948a..91ae02d59 100644 --- a/src/Math/Dual.h +++ b/src/Magnum/Math/Dual.h @@ -29,9 +29,9 @@ */ #include -#include +#include -#include "Math/TypeTraits.h" +#include "Magnum/Math/TypeTraits.h" namespace Magnum { namespace Math { diff --git a/src/Math/DualComplex.h b/src/Magnum/Math/DualComplex.h similarity index 99% rename from src/Math/DualComplex.h rename to src/Magnum/Math/DualComplex.h index 5cde5f0ad..eeceefe27 100644 --- a/src/Math/DualComplex.h +++ b/src/Magnum/Math/DualComplex.h @@ -28,9 +28,9 @@ * @brief Class Magnum::Math::DualComplex */ -#include "Math/Dual.h" -#include "Math/Complex.h" -#include "Math/Matrix3.h" +#include "Magnum/Math/Complex.h" +#include "Magnum/Math/Dual.h" +#include "Magnum/Math/Matrix3.h" namespace Magnum { namespace Math { diff --git a/src/Math/DualQuaternion.h b/src/Magnum/Math/DualQuaternion.h similarity index 99% rename from src/Math/DualQuaternion.h rename to src/Magnum/Math/DualQuaternion.h index a1fd0526b..7d3003d4a 100644 --- a/src/Math/DualQuaternion.h +++ b/src/Magnum/Math/DualQuaternion.h @@ -28,9 +28,9 @@ * @brief Class Magnum::Math::DualQuaternion */ -#include "Math/Dual.h" -#include "Math/Matrix4.h" -#include "Math/Quaternion.h" +#include "Magnum/Math/Dual.h" +#include "Magnum/Math/Matrix4.h" +#include "Magnum/Math/Quaternion.h" namespace Magnum { namespace Math { diff --git a/src/Math/Functions.cpp b/src/Magnum/Math/Functions.cpp similarity index 100% rename from src/Math/Functions.cpp rename to src/Magnum/Math/Functions.cpp diff --git a/src/Math/Functions.h b/src/Magnum/Math/Functions.h similarity index 99% rename from src/Math/Functions.h rename to src/Magnum/Math/Functions.h index 3478e06d5..e0e4c310b 100644 --- a/src/Math/Functions.h +++ b/src/Magnum/Math/Functions.h @@ -24,19 +24,18 @@ DEALINGS IN THE SOFTWARE. */ +/** @file + * @brief Functions usable with scalar and vector types + */ + #include #include /* std::max(), needed by MSVC */ #include #include #include -#include "Math/Vector.h" - -#include "magnumVisibility.h" - -/** @file - * @brief Functions usable with scalar and vector types - */ +#include "Magnum/visibility.h" +#include "Magnum/Math/Vector.h" namespace Magnum { namespace Math { diff --git a/src/Math/Geometry/CMakeLists.txt b/src/Magnum/Math/Geometry/CMakeLists.txt similarity index 100% rename from src/Math/Geometry/CMakeLists.txt rename to src/Magnum/Math/Geometry/CMakeLists.txt diff --git a/src/Math/Geometry/Distance.h b/src/Magnum/Math/Geometry/Distance.h similarity index 99% rename from src/Math/Geometry/Distance.h rename to src/Magnum/Math/Geometry/Distance.h index c5aa422a9..dda91a890 100644 --- a/src/Math/Geometry/Distance.h +++ b/src/Magnum/Math/Geometry/Distance.h @@ -28,8 +28,8 @@ * @brief Class Magnum::Math::Geometry::Distance */ -#include "Math/Functions.h" -#include "Math/Vector3.h" +#include "Magnum/Math/Functions.h" +#include "Magnum/Math/Vector3.h" namespace Magnum { namespace Math { namespace Geometry { diff --git a/src/Math/Geometry/Intersection.h b/src/Magnum/Math/Geometry/Intersection.h similarity index 99% rename from src/Math/Geometry/Intersection.h rename to src/Magnum/Math/Geometry/Intersection.h index 35adfe578..4e19b75de 100644 --- a/src/Math/Geometry/Intersection.h +++ b/src/Magnum/Math/Geometry/Intersection.h @@ -28,7 +28,7 @@ * @brief Class Magnum::Math::Geometry::Intersection */ -#include "Math/Vector3.h" +#include "Magnum/Math/Vector3.h" namespace Magnum { namespace Math { namespace Geometry { diff --git a/src/Math/Geometry/Rectangle.h b/src/Magnum/Math/Geometry/Rectangle.h similarity index 96% rename from src/Math/Geometry/Rectangle.h rename to src/Magnum/Math/Geometry/Rectangle.h index c3833fbf4..466afd789 100644 --- a/src/Math/Geometry/Rectangle.h +++ b/src/Magnum/Math/Geometry/Rectangle.h @@ -29,10 +29,10 @@ * @deprecated Use @ref Math/Range.h instead. */ -#include "Math/Range.h" +#include "Magnum/Math/Range.h" #ifdef MAGNUM_BUILD_DEPRECATED -#include +#include namespace Magnum { namespace Math { namespace Geometry { @@ -68,7 +68,7 @@ namespace Corrade { namespace Utility { template struct ConfigurationValue>: public ConfigurationValue> {}; }} #else -#error +#error use Magnum/Math/Range.h instead #endif #endif diff --git a/src/Math/Geometry/Test/CMakeLists.txt b/src/Magnum/Math/Geometry/Test/CMakeLists.txt similarity index 100% rename from src/Math/Geometry/Test/CMakeLists.txt rename to src/Magnum/Math/Geometry/Test/CMakeLists.txt diff --git a/src/Math/Geometry/Test/DistanceTest.cpp b/src/Magnum/Math/Geometry/Test/DistanceTest.cpp similarity index 98% rename from src/Math/Geometry/Test/DistanceTest.cpp rename to src/Magnum/Math/Geometry/Test/DistanceTest.cpp index 136638ec6..f4930a29e 100644 --- a/src/Math/Geometry/Test/DistanceTest.cpp +++ b/src/Magnum/Math/Geometry/Test/DistanceTest.cpp @@ -23,10 +23,10 @@ */ #include -#include +#include -#include "Math/Constants.h" -#include "Math/Geometry/Distance.h" +#include "Magnum/Math/Constants.h" +#include "Magnum/Math/Geometry/Distance.h" namespace Magnum { namespace Math { namespace Geometry { namespace Test { diff --git a/src/Math/Geometry/Test/IntersectionTest.cpp b/src/Magnum/Math/Geometry/Test/IntersectionTest.cpp similarity index 98% rename from src/Math/Geometry/Test/IntersectionTest.cpp rename to src/Magnum/Math/Geometry/Test/IntersectionTest.cpp index 97b65bbe2..cedf110c4 100644 --- a/src/Math/Geometry/Test/IntersectionTest.cpp +++ b/src/Magnum/Math/Geometry/Test/IntersectionTest.cpp @@ -23,9 +23,9 @@ */ #include -#include +#include -#include "Math/Geometry/Intersection.h" +#include "Magnum/Math/Geometry/Intersection.h" namespace Magnum { namespace Math { namespace Geometry { namespace Test { diff --git a/src/Math/Math.h b/src/Magnum/Math/Math.h similarity index 98% rename from src/Math/Math.h rename to src/Magnum/Math/Math.h index 27edab373..10d12bde6 100644 --- a/src/Math/Math.h +++ b/src/Magnum/Math/Math.h @@ -29,9 +29,9 @@ */ #include -#include +#include -#include "Types.h" +#include "Magnum/Types.h" namespace Magnum { namespace Math { diff --git a/src/Math/Matrix.h b/src/Magnum/Math/Matrix.h similarity index 95% rename from src/Math/Matrix.h rename to src/Magnum/Math/Matrix.h index 77ae1f754..60c7b1ca6 100644 --- a/src/Math/Matrix.h +++ b/src/Magnum/Math/Matrix.h @@ -28,7 +28,7 @@ * @brief Class Magnum::Math::Matrix */ -#include "RectangularMatrix.h" +#include "Magnum/Math/RectangularMatrix.h" namespace Magnum { namespace Math { @@ -69,12 +69,15 @@ template class Matrix: public RectangularMatrix(typename Implementation::GenerateSequence::Type(), + /* The original one is not constexpr under GCC 4.6 */ + #ifndef CORRADE_GCC46_COMPATIBILITY + Vector(value) + #else + Vector(typename Implementation::GenerateSequence::Type(), value) + #endif + ) {} /** * @brief %Matrix from column vectors @@ -254,6 +257,7 @@ template inline Corrade::Utility::Debug operator<<(Co } \ \ Type transposed() const { return Matrix::transposed(); } \ + constexpr VectorType diagonal() const { return Matrix::diagonal(); } \ Type inverted() const { return Matrix::inverted(); } \ Type invertedOrthogonal() const { \ return Matrix::invertedOrthogonal(); \ diff --git a/src/Math/Matrix3.h b/src/Magnum/Math/Matrix3.h similarity index 97% rename from src/Math/Matrix3.h rename to src/Magnum/Math/Matrix3.h index 921a92e18..9fab44132 100644 --- a/src/Math/Matrix3.h +++ b/src/Magnum/Math/Matrix3.h @@ -28,8 +28,8 @@ * @brief Class Magnum::Math::Matrix3 */ -#include "Math/Matrix.h" -#include "Math/Vector3.h" +#include "Magnum/Math/Matrix.h" +#include "Magnum/Math/Vector3.h" namespace Magnum { namespace Math { @@ -128,13 +128,8 @@ template class Matrix3: public Matrix<3, T> { * Creates identity matrix. You can also explicitly call this * constructor with `Matrix3 m(Matrix3::Identity);`. Optional parameter * @p value allows you to specify value on diagonal. - * @todo Use constexpr implementation in Matrix, when done */ - constexpr /*implicit*/ Matrix3(typename Matrix<3, T>::IdentityType = (Matrix<3, T>::Identity), T value = T(1)): Matrix<3, T>( - Vector<3, T>(value, T(0), T(0)), - Vector<3, T>( T(0), value, T(0)), - Vector<3, T>( T(0), T(0), value) - ) {} + constexpr /*implicit*/ Matrix3(typename Matrix<3, T>::IdentityType = (Matrix<3, T>::Identity), T value = T(1)): Matrix<3, T>(Matrix<3, T>::Identity, value) {} /** @brief %Matrix from column vectors */ constexpr /*implicit*/ Matrix3(const Vector3& first, const Vector3& second, const Vector3& third): Matrix<3, T>(first, second, third) {} @@ -215,7 +210,7 @@ template class Matrix3: public Matrix<3, T> { * to @ref uniformScaling(), because it doesn't compute the square * root. * @see @ref rotationScaling(), @ref rotation(), - * @ref rotationNormalized(), @ref scaling(const Vector2&), + * @ref rotationNormalized(), @ref scaling(const Vector2&), * @ref Matrix4::uniformScaling() */ T uniformScalingSquared() const { @@ -232,7 +227,7 @@ template class Matrix3: public Matrix<3, T> { * the scaling is the same in all axes. Use faster alternative * @ref uniformScalingSquared() where possible. * @see @ref rotationScaling(), @ref rotation(), - * @ref rotationNormalized(), @ref scaling(const Vector2&), + * @ref rotationNormalized(), @ref scaling(const Vector2&), * @ref Matrix4::uniformScaling() */ T uniformScaling() const { return std::sqrt(uniformScalingSquared()); } diff --git a/src/Math/Matrix4.h b/src/Magnum/Math/Matrix4.h similarity index 98% rename from src/Math/Matrix4.h rename to src/Magnum/Math/Matrix4.h index 2a7abdf1c..bd9c026b2 100644 --- a/src/Math/Matrix4.h +++ b/src/Magnum/Math/Matrix4.h @@ -28,8 +28,8 @@ * @brief Class Magnum::Math::Matrix4 */ -#include "Math/Matrix.h" -#include "Math/Vector4.h" +#include "Magnum/Math/Matrix.h" +#include "Magnum/Math/Vector4.h" #ifdef CORRADE_TARGET_WINDOWS /* I so HATE windef.h */ #undef near @@ -190,14 +190,8 @@ template class Matrix4: public Matrix<4, T> { * Creates identity matrix. You can also explicitly call this * constructor with `Matrix4 m(Matrix4::Identity);`. Optional parameter * @p value allows you to specify value on diagonal. - * @todo Use constexpr implementation in Matrix, when done */ - constexpr /*implicit*/ Matrix4(typename Matrix<4, T>::IdentityType = (Matrix<4, T>::Identity), T value = T(1)): Matrix<4, T>( - Vector<4, T>(value, T(0), T(0), T(0)), - Vector<4, T>( T(0), value, T(0), T(0)), - Vector<4, T>( T(0), T(0), value, T(0)), - Vector<4, T>( T(0), T(0), T(0), value) - ) {} + constexpr /*implicit*/ Matrix4(typename Matrix<4, T>::IdentityType = (Matrix<4, T>::Identity), T value = T(1)): Matrix<4, T>(Matrix<4, T>::Identity, value) {} /** @brief %Matrix from column vectors */ constexpr /*implicit*/ Matrix4(const Vector4& first, const Vector4& second, const Vector4& third, const Vector4& fourth): Matrix<4, T>(first, second, third, fourth) {} @@ -279,7 +273,7 @@ template class Matrix4: public Matrix<4, T> { * to @ref uniformScaling(), because it doesn't compute the square * root. * @see @ref rotationScaling(), @ref rotation(), - * @ref rotationNormalized(), @ref scaling(const Vector3&), + * @ref rotationNormalized(), @ref scaling(const Vector3&), * @ref Matrix3::uniformScaling() */ T uniformScalingSquared() const; @@ -291,7 +285,7 @@ template class Matrix4: public Matrix<4, T> { * the scaling is the same in all axes. Use faster alternative * @ref uniformScalingSquared() where possible. * @see @ref rotationScaling(), @ref rotation(), - * @ref rotationNormalized(), @ref scaling(const Vector3&), + * @ref rotationNormalized(), @ref scaling(const Vector3&), * @ref Matrix3::uniformScaling() */ T uniformScaling() const { return std::sqrt(uniformScalingSquared()); } diff --git a/src/Math/Quaternion.h b/src/Magnum/Math/Quaternion.h similarity index 99% rename from src/Math/Quaternion.h rename to src/Magnum/Math/Quaternion.h index ea7a30ccc..e4e5cb0e3 100644 --- a/src/Math/Quaternion.h +++ b/src/Magnum/Math/Quaternion.h @@ -29,12 +29,12 @@ */ #include -#include -#include +#include +#include -#include "Math/TypeTraits.h" -#include "Math/Matrix.h" -#include "Math/Vector3.h" +#include "Magnum/Math/Matrix.h" +#include "Magnum/Math/TypeTraits.h" +#include "Magnum/Math/Vector3.h" namespace Magnum { namespace Math { diff --git a/src/Math/Range.h b/src/Magnum/Math/Range.h similarity index 99% rename from src/Math/Range.h rename to src/Magnum/Math/Range.h index 7b44fd3d4..2700981a7 100644 --- a/src/Math/Range.h +++ b/src/Magnum/Math/Range.h @@ -28,7 +28,7 @@ * @brief Class @ref Magnum::Math::Range, @ref Magnum::Math::Range2D, @ref Magnum::Math::Range3D, alias @ref Magnum::Math::Range1D */ -#include "Math/Vector3.h" +#include "Magnum/Math/Vector3.h" namespace Magnum { namespace Math { diff --git a/src/Math/RectangularMatrix.h b/src/Magnum/Math/RectangularMatrix.h similarity index 92% rename from src/Math/RectangularMatrix.h rename to src/Magnum/Math/RectangularMatrix.h index f040ed87e..2ebb99b29 100644 --- a/src/Math/RectangularMatrix.h +++ b/src/Magnum/Math/RectangularMatrix.h @@ -28,7 +28,7 @@ * @brief Class Magnum::Math::RectangularMatrix */ -#include "Math/Vector.h" +#include "Magnum/Math/Vector.h" namespace Magnum { namespace Math { @@ -76,22 +76,14 @@ template class RectangularMatrix { * @attention Use with caution, the function doesn't check whether the * array is long enough. */ - constexpr static RectangularMatrix& from(T* data) { + static RectangularMatrix& from(T* data) { return *reinterpret_cast*>(data); } /** @overload */ - constexpr static const RectangularMatrix& from(const T* data) { + static const RectangularMatrix& from(const T* data) { return *reinterpret_cast*>(data); } - /** - * @brief Construct diagonal matrix - * - * @see diagonal() - * @todo make this constexpr - */ - static RectangularMatrix fromDiagonal(const Vector& diagonal); - /** * @brief Construct matrix from vector * @@ -103,6 +95,15 @@ template class RectangularMatrix { return *reinterpret_cast*>(vector.data()); } + /** + * @brief Construct diagonal matrix + * + * @see diagonal() + */ + constexpr static RectangularMatrix fromDiagonal(const Vector& diagonal) { + return RectangularMatrix(typename Implementation::GenerateSequence::Type(), diagonal); + } + /** @brief Construct zero-filled matrix */ constexpr /*implicit*/ RectangularMatrix() {} @@ -363,9 +364,8 @@ template class RectangularMatrix { * @brief Values on diagonal * * @see fromDiagonal() - * @todo constexpr */ - Vector diagonal() const; + constexpr Vector diagonal() const; /** * @brief Convert matrix to vector @@ -380,6 +380,14 @@ template class RectangularMatrix { return *reinterpret_cast*>(data()); } + #ifndef DOXYGEN_GENERATING_OUTPUT + protected: + #else + private: + #endif + /* Implementation for RectangularMatrix::fromDiagonal() and Matrix(T) */ + template constexpr explicit RectangularMatrix(Implementation::Sequence, const Vector& diagonal); + private: /* Implementation for RectangularMatrix::RectangularMatrix(const RectangularMatrix&) */ #ifndef CORRADE_GCC45_COMPATIBILITY @@ -403,6 +411,8 @@ template class RectangularMatrix { } #endif + template constexpr Vector diagonalInternal(Implementation::Sequence) const; + #ifndef CORRADE_MSVC2013_COMPATIBILITY Vector _data[cols]; #else @@ -587,11 +597,14 @@ extern template Corrade::Utility::Debug MAGNUM_EXPORT operator<<(Corrade::Utilit #endif #define MAGNUM_RECTANGULARMATRIX_SUBCLASS_IMPLEMENTATION(cols, rows, ...) \ - constexpr static __VA_ARGS__& from(T* data) { \ + static __VA_ARGS__& from(T* data) { \ return *reinterpret_cast<__VA_ARGS__*>(data); \ } \ - constexpr static const __VA_ARGS__& from(const T* data) { \ + static const __VA_ARGS__& from(const T* data) { \ return *reinterpret_cast(data); \ + } \ + constexpr static __VA_ARGS__ fromDiagonal(const Vector::DiagonalSize, T>& diagonal) { \ + return Math::RectangularMatrix::fromDiagonal(diagonal); \ } \ \ __VA_ARGS__ operator-() const { \ @@ -649,15 +662,17 @@ extern template Corrade::Utility::Debug MAGNUM_EXPORT operator<<(Corrade::Utilit } #endif -template inline RectangularMatrix RectangularMatrix::fromDiagonal(const Vector& diagonal) { - RectangularMatrix out; - - for(std::size_t i = 0; i != DiagonalSize; ++i) - out[i][i] = diagonal[i]; - - return out; +namespace Implementation { + template inline constexpr Vector diagonalMatrixColumn2(Implementation::Sequence, const T& number) { + return {(sequence == i ? number : T(0))...}; + } + template inline constexpr Vector diagonalMatrixColumn(const T& number) { + return diagonalMatrixColumn2(typename Implementation::GenerateSequence::Type(), number); + } } +template template inline constexpr RectangularMatrix::RectangularMatrix(Implementation::Sequence, const Vector& diagonal): _data{Implementation::diagonalMatrixColumn(sequence < DiagonalSize ? diagonal[sequence] : T{})...} {} + template inline Vector RectangularMatrix::row(std::size_t row) const { Vector out; @@ -697,14 +712,13 @@ template inline RectangularMatrix auto RectangularMatrix::diagonal() const -> Vector { - Vector out; - - for(std::size_t i = 0; i != DiagonalSize; ++i) - out[i] = _data[i][i]; +template inline constexpr auto RectangularMatrix::diagonal() const -> Vector { return diagonalInternal(typename Implementation::GenerateSequence::Type()); } - return out; +#ifndef DOXYGEN_GENERATING_OUTPUT +template template inline constexpr auto RectangularMatrix::diagonalInternal(Implementation::Sequence) const -> Vector { + return {(*this)[sequence][sequence]...}; } +#endif }} diff --git a/src/Math/Swizzle.h b/src/Magnum/Math/Swizzle.h similarity index 97% rename from src/Math/Swizzle.h rename to src/Magnum/Math/Swizzle.h index 0a8606ffa..192347a94 100644 --- a/src/Math/Swizzle.h +++ b/src/Magnum/Math/Swizzle.h @@ -28,7 +28,7 @@ * @brief Function Magnum::Math::swizzle() */ -#include "Vector.h" +#include "Magnum/Math/Vector.h" namespace Magnum { namespace Math { @@ -77,7 +77,7 @@ four-component, corresponding @ref Math::Vector2, @ref Math::Vector3, @ref Math::Vector4, @ref Color3 or @ref Color4 specialization is returned. @see @ref matrix-vector-component-access, @ref Vector4::xyz(), - @ref Vector4::xy(), @ref Vector3::xy(), @ref Color4::rgb() + @ref Vector4::xy(), @ref Vector3::xy(), @ref BasicColor4::rgb() */ template constexpr typename Implementation::TypeForSize::Type swizzle(const T& vector) { return {Implementation::Component::value(vector)...}; diff --git a/src/Math/Test/AngleTest.cpp b/src/Magnum/Math/Test/AngleTest.cpp similarity index 98% rename from src/Math/Test/AngleTest.cpp rename to src/Magnum/Math/Test/AngleTest.cpp index 44ec81e78..498fc9b02 100644 --- a/src/Math/Test/AngleTest.cpp +++ b/src/Magnum/Math/Test/AngleTest.cpp @@ -23,9 +23,9 @@ */ #include -#include +#include -#include "Math/Angle.h" +#include "Magnum/Math/Angle.h" namespace Magnum { namespace Math { namespace Test { diff --git a/src/Math/Test/BoolVectorTest.cpp b/src/Magnum/Math/Test/BoolVectorTest.cpp similarity index 98% rename from src/Math/Test/BoolVectorTest.cpp rename to src/Magnum/Math/Test/BoolVectorTest.cpp index a4bf186d5..322a2cb1e 100644 --- a/src/Math/Test/BoolVectorTest.cpp +++ b/src/Magnum/Math/Test/BoolVectorTest.cpp @@ -23,9 +23,9 @@ */ #include -#include +#include -#include "Math/BoolVector.h" +#include "Magnum/Math/BoolVector.h" namespace Magnum { namespace Math { namespace Test { diff --git a/src/Math/Test/CMakeLists.txt b/src/Magnum/Math/Test/CMakeLists.txt similarity index 100% rename from src/Math/Test/CMakeLists.txt rename to src/Magnum/Math/Test/CMakeLists.txt diff --git a/src/Math/Test/ComplexTest.cpp b/src/Magnum/Math/Test/ComplexTest.cpp similarity index 98% rename from src/Math/Test/ComplexTest.cpp rename to src/Magnum/Math/Test/ComplexTest.cpp index 4afc0cf1c..a856a4704 100644 --- a/src/Math/Test/ComplexTest.cpp +++ b/src/Magnum/Math/Test/ComplexTest.cpp @@ -23,10 +23,10 @@ */ #include -#include +#include -#include "Math/Complex.h" -#include "Math/Matrix3.h" +#include "Magnum/Math/Complex.h" +#include "Magnum/Math/Matrix3.h" namespace Magnum { namespace Math { namespace Test { diff --git a/src/Math/Test/ConstantsTest.cpp b/src/Magnum/Math/Test/ConstantsTest.cpp similarity index 95% rename from src/Math/Test/ConstantsTest.cpp rename to src/Magnum/Math/Test/ConstantsTest.cpp index d99d23627..e609a9259 100644 --- a/src/Math/Test/ConstantsTest.cpp +++ b/src/Magnum/Math/Test/ConstantsTest.cpp @@ -22,10 +22,10 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include -#include "Math/Constants.h" -#include "Math/Functions.h" +#include "Magnum/Math/Constants.h" +#include "Magnum/Math/Functions.h" namespace Magnum { namespace Math { namespace Test { diff --git a/src/Math/Test/DualComplexTest.cpp b/src/Magnum/Math/Test/DualComplexTest.cpp similarity index 98% rename from src/Math/Test/DualComplexTest.cpp rename to src/Magnum/Math/Test/DualComplexTest.cpp index 08b213329..abb3d6e0f 100644 --- a/src/Math/Test/DualComplexTest.cpp +++ b/src/Magnum/Math/Test/DualComplexTest.cpp @@ -23,10 +23,10 @@ */ #include -#include +#include -#include "Math/DualComplex.h" -#include "Math/DualQuaternion.h" +#include "Magnum/Math/DualComplex.h" +#include "Magnum/Math/DualQuaternion.h" namespace Magnum { namespace Math { namespace Test { diff --git a/src/Math/Test/DualQuaternionTest.cpp b/src/Magnum/Math/Test/DualQuaternionTest.cpp similarity index 99% rename from src/Math/Test/DualQuaternionTest.cpp rename to src/Magnum/Math/Test/DualQuaternionTest.cpp index caa79560c..ca01c96a9 100644 --- a/src/Math/Test/DualQuaternionTest.cpp +++ b/src/Magnum/Math/Test/DualQuaternionTest.cpp @@ -23,9 +23,9 @@ */ #include -#include +#include -#include "Math/DualQuaternion.h" +#include "Magnum/Math/DualQuaternion.h" namespace Magnum { namespace Math { namespace Test { diff --git a/src/Math/Test/DualTest.cpp b/src/Magnum/Math/Test/DualTest.cpp similarity index 98% rename from src/Math/Test/DualTest.cpp rename to src/Magnum/Math/Test/DualTest.cpp index e4c364aed..1691f1845 100644 --- a/src/Math/Test/DualTest.cpp +++ b/src/Magnum/Math/Test/DualTest.cpp @@ -23,9 +23,9 @@ */ #include -#include +#include -#include "Math/Dual.h" +#include "Magnum/Math/Dual.h" namespace Magnum { namespace Math { namespace Test { diff --git a/src/Math/Test/FunctionsTest.cpp b/src/Magnum/Math/Test/FunctionsTest.cpp similarity index 99% rename from src/Math/Test/FunctionsTest.cpp rename to src/Magnum/Math/Test/FunctionsTest.cpp index 7f05b7f84..021ff5dff 100644 --- a/src/Math/Test/FunctionsTest.cpp +++ b/src/Magnum/Math/Test/FunctionsTest.cpp @@ -22,10 +22,10 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include -#include "Math/Functions.h" -#include "Math/Vector3.h" +#include "Magnum/Math/Functions.h" +#include "Magnum/Math/Vector3.h" namespace Magnum { namespace Math { namespace Test { diff --git a/src/Math/Test/Matrix3Test.cpp b/src/Magnum/Math/Test/Matrix3Test.cpp similarity index 99% rename from src/Math/Test/Matrix3Test.cpp rename to src/Magnum/Math/Test/Matrix3Test.cpp index cfcacf334..f1defbd04 100644 --- a/src/Math/Test/Matrix3Test.cpp +++ b/src/Magnum/Math/Test/Matrix3Test.cpp @@ -23,10 +23,10 @@ */ #include -#include -#include +#include +#include -#include "Math/Matrix3.h" +#include "Magnum/Math/Matrix3.h" struct Mat3 { float a[9]; diff --git a/src/Math/Test/Matrix4Test.cpp b/src/Magnum/Math/Test/Matrix4Test.cpp similarity index 99% rename from src/Math/Test/Matrix4Test.cpp rename to src/Magnum/Math/Test/Matrix4Test.cpp index ad1262ba9..ad50ed1b8 100644 --- a/src/Math/Test/Matrix4Test.cpp +++ b/src/Magnum/Math/Test/Matrix4Test.cpp @@ -23,10 +23,10 @@ */ #include -#include -#include +#include +#include -#include "Math/Matrix4.h" +#include "Magnum/Math/Matrix4.h" struct Mat4 { float a[16]; diff --git a/src/Math/Test/MatrixTest.cpp b/src/Magnum/Math/Test/MatrixTest.cpp similarity index 97% rename from src/Math/Test/MatrixTest.cpp rename to src/Magnum/Math/Test/MatrixTest.cpp index 2551ff159..c553823d2 100644 --- a/src/Math/Test/MatrixTest.cpp +++ b/src/Magnum/Math/Test/MatrixTest.cpp @@ -23,10 +23,10 @@ */ #include -#include -#include +#include +#include -#include "Math/Matrix.h" +#include "Magnum/Math/Matrix.h" struct Mat3 { float a[9]; @@ -134,9 +134,9 @@ void MatrixTest::construct() { } void MatrixTest::constructIdentity() { - Matrix4x4 identity; - Matrix4x4 identity2(Matrix4x4::Identity); - Matrix4x4 identity3(Matrix4x4::Identity, 4.0f); + constexpr Matrix4x4 identity; + constexpr Matrix4x4 identity2(Matrix4x4::Identity); + constexpr Matrix4x4 identity3(Matrix4x4::Identity, 4.0f); Matrix4x4 identityExpected(Vector4(1.0f, 0.0f, 0.0f, 0.0f), Vector4(0.0f, 1.0f, 0.0f, 0.0f), @@ -329,6 +329,7 @@ void MatrixTest::subclassTypes() { CORRADE_VERIFY((std::is_same::value)); CORRADE_VERIFY((std::is_same::value)); + CORRADE_VERIFY((std::is_same::value)); CORRADE_VERIFY((std::is_same::value)); CORRADE_VERIFY((std::is_same::value)); } @@ -348,6 +349,7 @@ void MatrixTest::subclass() { CORRADE_COMPARE(a.transposed(), Mat2(Vec2(2.0f, 3.0f), Vec2(3.5f, 1.0f))); + CORRADE_COMPARE(a.diagonal(), Vec2(2.0f, 1.0f)); Mat2 c(Vec2(Constants::sqrt2()/2.0f, Constants::sqrt2()/2.0f), Vec2(-Constants::sqrt2()/2.0f, Constants::sqrt2()/2.0f)); diff --git a/src/Math/Test/QuaternionTest.cpp b/src/Magnum/Math/Test/QuaternionTest.cpp similarity index 99% rename from src/Math/Test/QuaternionTest.cpp rename to src/Magnum/Math/Test/QuaternionTest.cpp index d565be0b7..70056c930 100644 --- a/src/Math/Test/QuaternionTest.cpp +++ b/src/Magnum/Math/Test/QuaternionTest.cpp @@ -23,10 +23,10 @@ */ #include -#include +#include -#include "Math/Matrix4.h" -#include "Math/Quaternion.h" +#include "Magnum/Math/Matrix4.h" +#include "Magnum/Math/Quaternion.h" namespace Magnum { namespace Math { namespace Test { diff --git a/src/Math/Test/RangeTest.cpp b/src/Magnum/Math/Test/RangeTest.cpp similarity index 98% rename from src/Math/Test/RangeTest.cpp rename to src/Magnum/Math/Test/RangeTest.cpp index 7996c07aa..4e88888c5 100644 --- a/src/Math/Test/RangeTest.cpp +++ b/src/Magnum/Math/Test/RangeTest.cpp @@ -23,13 +23,13 @@ */ #include -#include -#include +#include +#include -#include "Math/Range.h" +#include "Magnum/Math/Range.h" #ifdef MAGNUM_BUILD_DEPRECATED -#include "Math/Geometry/Rectangle.h" +#include "Magnum/Math/Geometry/Rectangle.h" #endif namespace Magnum { namespace Math { namespace Test { diff --git a/src/Math/Test/RectangularMatrixTest.cpp b/src/Magnum/Math/Test/RectangularMatrixTest.cpp similarity index 94% rename from src/Math/Test/RectangularMatrixTest.cpp rename to src/Magnum/Math/Test/RectangularMatrixTest.cpp index 882308155..39420d74a 100644 --- a/src/Math/Test/RectangularMatrixTest.cpp +++ b/src/Magnum/Math/Test/RectangularMatrixTest.cpp @@ -23,10 +23,10 @@ */ #include -#include -#include +#include +#include -#include "Math/RectangularMatrix.h" +#include "Magnum/Math/RectangularMatrix.h" struct Mat2x3 { float a[6]; @@ -181,18 +181,20 @@ void RectangularMatrixTest::constructFromData() { } void RectangularMatrixTest::constructFromDiagonal() { - Vector3 diagonal(-1.0f, 5.0f, 11.0f); + constexpr Vector3 diagonal(-1.0f, 5.0f, 11.0f); + constexpr auto a = Matrix3x4::fromDiagonal(diagonal); Matrix3x4 expectedA(Vector4(-1.0f, 0.0f, 0.0f, 0.0f), Vector4( 0.0f, 5.0f, 0.0f, 0.0f), Vector4( 0.0f, 0.0f, 11.0f, 0.0f)); - CORRADE_COMPARE(Matrix3x4::fromDiagonal(diagonal), expectedA); + CORRADE_COMPARE(a, expectedA); + constexpr auto b = Matrix4x3::fromDiagonal(diagonal); Matrix4x3 expectedB(Vector3(-1.0f, 0.0f, 0.0f), Vector3( 0.0f, 5.0f, 0.0f), Vector3( 0.0f, 0.0f, 11.0f), Vector3( 0.0f, 0.0f, 0.0f)); - CORRADE_COMPARE(Matrix4x3::fromDiagonal(diagonal), expectedB); + CORRADE_COMPARE(b, expectedB); } void RectangularMatrixTest::constructCopy() { @@ -392,16 +394,18 @@ void RectangularMatrixTest::transposed() { void RectangularMatrixTest::diagonal() { Vector3 diagonal(-1.0f, 5.0f, 11.0f); - Matrix4x3 a(Vector3(-1.0f, 1.0f, 3.0f), - Vector3( 4.0f, 5.0f, 7.0f), - Vector3( 8.0f, 9.0f, 11.0f), - Vector3(12.0f, 13.0f, 15.0f)); - CORRADE_COMPARE(a.diagonal(), diagonal); - - Matrix3x4 b(Vector4(-1.0f, 4.0f, 8.0f, 12.0f), - Vector4( 1.0f, 5.0f, 9.0f, 13.0f), - Vector4( 3.0f, 7.0f, 11.0f, 15.0f)); - CORRADE_COMPARE(b.diagonal(), diagonal); + constexpr Matrix4x3 a(Vector3(-1.0f, 1.0f, 3.0f), + Vector3( 4.0f, 5.0f, 7.0f), + Vector3( 8.0f, 9.0f, 11.0f), + Vector3(12.0f, 13.0f, 15.0f)); + constexpr Vector3 aDiagonal = a.diagonal(); + CORRADE_COMPARE(aDiagonal, diagonal); + + constexpr Matrix3x4 b(Vector4(-1.0f, 4.0f, 8.0f, 12.0f), + Vector4( 1.0f, 5.0f, 9.0f, 13.0f), + Vector4( 3.0f, 7.0f, 11.0f, 15.0f)); + constexpr Vector3 bDiagonal = b.diagonal(); + CORRADE_COMPARE(bDiagonal, diagonal); } void RectangularMatrixTest::vector() { @@ -447,6 +451,7 @@ void RectangularMatrixTest::subclassTypes() { const Float* const cdata = nullptr; CORRADE_VERIFY((std::is_same::value)); CORRADE_VERIFY((std::is_same::value)); + CORRADE_VERIFY((std::is_same::value)); /* Const operators */ const Mat2x2 c; @@ -482,6 +487,9 @@ void RectangularMatrixTest::subclass() { CORRADE_COMPARE(Mat2x2::from(cdata), Mat2x2(Vector2(1.0f, -2.0f), Vector2(3.0f, -4.5f))); + CORRADE_COMPARE(Mat2x2::fromDiagonal({1.0f, -2.0f}), Mat2x2(Vector2(1.0f, 0.0f), + Vector2(0.0f, -2.0f))); + const Mat2x2 a(Vector2(1.0f, -3.0f), Vector2(-3.0f, 1.0f)); CORRADE_COMPARE(-a, Mat2x2(Vector2(-1.0f, 3.0f), diff --git a/src/Math/Test/SwizzleTest.cpp b/src/Magnum/Math/Test/SwizzleTest.cpp similarity index 97% rename from src/Math/Test/SwizzleTest.cpp rename to src/Magnum/Math/Test/SwizzleTest.cpp index 854f674a1..c6ea3af08 100644 --- a/src/Math/Test/SwizzleTest.cpp +++ b/src/Magnum/Math/Test/SwizzleTest.cpp @@ -22,9 +22,9 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include -#include "Math/Swizzle.h" +#include "Magnum/Math/Swizzle.h" namespace Magnum { namespace Math { namespace Test { diff --git a/src/Math/Test/TypeTraitsTest.cpp b/src/Magnum/Math/Test/TypeTraitsTest.cpp similarity index 97% rename from src/Math/Test/TypeTraitsTest.cpp rename to src/Magnum/Math/Test/TypeTraitsTest.cpp index 169c66950..685e0ba5d 100644 --- a/src/Math/Test/TypeTraitsTest.cpp +++ b/src/Magnum/Math/Test/TypeTraitsTest.cpp @@ -23,9 +23,9 @@ */ #include -#include +#include -#include "Math/TypeTraits.h" +#include "Magnum/Math/TypeTraits.h" namespace Magnum { namespace Math { namespace Test { diff --git a/src/Math/Test/UnitTest.cpp b/src/Magnum/Math/Test/UnitTest.cpp similarity index 98% rename from src/Math/Test/UnitTest.cpp rename to src/Magnum/Math/Test/UnitTest.cpp index 4029d4b45..fd38c7295 100644 --- a/src/Math/Test/UnitTest.cpp +++ b/src/Magnum/Math/Test/UnitTest.cpp @@ -22,9 +22,9 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include -#include "Math/Unit.h" +#include "Magnum/Math/Unit.h" namespace Magnum { namespace Math { namespace Test { diff --git a/src/Math/Test/Vector2Test.cpp b/src/Magnum/Math/Test/Vector2Test.cpp similarity index 97% rename from src/Math/Test/Vector2Test.cpp rename to src/Magnum/Math/Test/Vector2Test.cpp index e96e9c961..fd68bc1c6 100644 --- a/src/Math/Test/Vector2Test.cpp +++ b/src/Magnum/Math/Test/Vector2Test.cpp @@ -23,10 +23,10 @@ */ #include -#include -#include +#include +#include -#include "Math/Vector3.h" /* Vector3 used in Vector2::cross() */ +#include "Magnum/Math/Vector3.h" /* Vector3 used in Vector2::cross() */ struct Vec2 { float x, y; diff --git a/src/Math/Test/Vector3Test.cpp b/src/Magnum/Math/Test/Vector3Test.cpp similarity index 98% rename from src/Math/Test/Vector3Test.cpp rename to src/Magnum/Math/Test/Vector3Test.cpp index b62707078..c5fb0dd68 100644 --- a/src/Math/Test/Vector3Test.cpp +++ b/src/Magnum/Math/Test/Vector3Test.cpp @@ -23,10 +23,10 @@ */ #include -#include -#include +#include +#include -#include "Math/Vector3.h" +#include "Magnum/Math/Vector3.h" struct Vec3 { float x, y, z; diff --git a/src/Math/Test/Vector4Test.cpp b/src/Magnum/Math/Test/Vector4Test.cpp similarity index 98% rename from src/Math/Test/Vector4Test.cpp rename to src/Magnum/Math/Test/Vector4Test.cpp index 2e6d4abda..fa342f53a 100644 --- a/src/Math/Test/Vector4Test.cpp +++ b/src/Magnum/Math/Test/Vector4Test.cpp @@ -23,10 +23,10 @@ */ #include -#include -#include +#include +#include -#include "Math/Vector4.h" +#include "Magnum/Math/Vector4.h" struct Vec4 { float x, y, z, w; diff --git a/src/Math/Test/VectorTest.cpp b/src/Magnum/Math/Test/VectorTest.cpp similarity index 99% rename from src/Math/Test/VectorTest.cpp rename to src/Magnum/Math/Test/VectorTest.cpp index eb7561e74..e654c8f50 100644 --- a/src/Math/Test/VectorTest.cpp +++ b/src/Magnum/Math/Test/VectorTest.cpp @@ -23,10 +23,10 @@ */ #include -#include -#include +#include +#include -#include "Math/Vector.h" +#include "Magnum/Math/Vector.h" struct Vec3 { float x, y, z; diff --git a/src/Math/TypeTraits.h b/src/Magnum/Math/TypeTraits.h similarity index 99% rename from src/Math/TypeTraits.h rename to src/Magnum/Math/TypeTraits.h index 4318658e7..e4e6351e3 100644 --- a/src/Math/TypeTraits.h +++ b/src/Magnum/Math/TypeTraits.h @@ -29,9 +29,9 @@ */ #include -#include +#include -#include "Types.h" +#include "Magnum/Types.h" /** @brief Precision when testing floats for equality */ #ifndef FLOAT_EQUALITY_PRECISION diff --git a/src/Math/Unit.h b/src/Magnum/Math/Unit.h similarity index 99% rename from src/Math/Unit.h rename to src/Magnum/Math/Unit.h index ad1bbd6d6..233e05d53 100644 --- a/src/Math/Unit.h +++ b/src/Magnum/Math/Unit.h @@ -28,7 +28,7 @@ * @brief Class Magnum::Math::Unit */ -#include "Math/TypeTraits.h" +#include "Magnum/Math/TypeTraits.h" namespace Magnum { namespace Math { diff --git a/src/Math/Vector.h b/src/Magnum/Math/Vector.h similarity index 98% rename from src/Math/Vector.h rename to src/Magnum/Math/Vector.h index 510a083da..8917e5207 100644 --- a/src/Math/Vector.h +++ b/src/Magnum/Math/Vector.h @@ -30,15 +30,14 @@ #include #include -#include -#include -#include +#include +#include +#include -#include "Math/Angle.h" -#include "Math/BoolVector.h" -#include "Math/TypeTraits.h" - -#include "magnumVisibility.h" +#include "Magnum/visibility.h" +#include "Magnum/Math/Angle.h" +#include "Magnum/Math/BoolVector.h" +#include "Magnum/Math/TypeTraits.h" namespace Magnum { namespace Math { @@ -59,6 +58,11 @@ template class Vector { template friend class Vector; + #ifdef CORRADE_GCC46_COMPATIBILITY + /* So it can call internal constexpr constructor from one value */ + template friend class Matrix; + #endif + public: typedef T Type; /**< @brief Underlying data type */ const static std::size_t Size = size; /**< @brief %Vector size */ @@ -71,11 +75,11 @@ template class Vector { * @attention Use with caution, the function doesn't check whether the * array is long enough. */ - constexpr static Vector& from(T* data) { + static Vector& from(T* data) { return *reinterpret_cast*>(data); } /** @overload */ - constexpr static const Vector& from(const T* data) { + static const Vector& from(const T* data) { return *reinterpret_cast*>(data); } @@ -1071,10 +1075,10 @@ extern template Corrade::Utility::Debug MAGNUM_EXPORT operator<<(Corrade::Utilit #ifndef DOXYGEN_GENERATING_OUTPUT #define MAGNUM_VECTOR_SUBCLASS_IMPLEMENTATION(size, Type) \ - constexpr static Type& from(T* data) { \ + static Type& from(T* data) { \ return *reinterpret_cast*>(data); \ } \ - constexpr static const Type& from(const T* data) { \ + static const Type& from(const T* data) { \ return *reinterpret_cast*>(data); \ } \ \ diff --git a/src/Math/Vector2.h b/src/Magnum/Math/Vector2.h similarity index 99% rename from src/Math/Vector2.h rename to src/Magnum/Math/Vector2.h index 030c848fc..c1e37ee89 100644 --- a/src/Math/Vector2.h +++ b/src/Magnum/Math/Vector2.h @@ -28,7 +28,7 @@ * @brief Class Magnum::Math::Vector2 */ -#include "Vector.h" +#include "Magnum/Math/Vector.h" namespace Magnum { namespace Math { diff --git a/src/Math/Vector3.h b/src/Magnum/Math/Vector3.h similarity index 99% rename from src/Math/Vector3.h rename to src/Magnum/Math/Vector3.h index 64043e480..f6361ce17 100644 --- a/src/Math/Vector3.h +++ b/src/Magnum/Math/Vector3.h @@ -28,8 +28,8 @@ * @brief Class Magnum::Math::Vector3 */ -#include "Vector2.h" -#include "Swizzle.h" +#include "Magnum/Math/Vector2.h" +#include "Magnum/Math/Swizzle.h" namespace Magnum { namespace Math { diff --git a/src/Math/Vector4.h b/src/Magnum/Math/Vector4.h similarity index 99% rename from src/Math/Vector4.h rename to src/Magnum/Math/Vector4.h index 8ea29bd86..5a264ed0e 100644 --- a/src/Math/Vector4.h +++ b/src/Magnum/Math/Vector4.h @@ -28,7 +28,7 @@ * @brief Class Magnum::Math::Vector4 */ -#include "Vector3.h" +#include "Magnum/Math/Vector3.h" namespace Magnum { namespace Math { diff --git a/src/Math/instantiation.cpp b/src/Magnum/Math/instantiation.cpp similarity index 99% rename from src/Math/instantiation.cpp rename to src/Magnum/Math/instantiation.cpp index 4c4b899ab..3c0915110 100644 --- a/src/Math/instantiation.cpp +++ b/src/Magnum/Math/instantiation.cpp @@ -22,9 +22,9 @@ DEALINGS IN THE SOFTWARE. */ -#include "Math/DualComplex.h" -#include "Math/DualQuaternion.h" -#include "Math/Range.h" +#include "Magnum/Math/DualComplex.h" +#include "Magnum/Math/DualQuaternion.h" +#include "Magnum/Math/Range.h" namespace Corrade { namespace Utility { diff --git a/src/Mesh.cpp b/src/Magnum/Mesh.cpp similarity index 99% rename from src/Mesh.cpp rename to src/Magnum/Mesh.cpp index 959ed0543..1395b95ba 100644 --- a/src/Mesh.cpp +++ b/src/Magnum/Mesh.cpp @@ -24,11 +24,12 @@ #include "Mesh.h" -#include +#include + +#include "Magnum/Buffer.h" +#include "Magnum/Context.h" +#include "Magnum/Extensions.h" -#include "Buffer.h" -#include "Context.h" -#include "Extensions.h" #include "Implementation/DebugState.h" #include "Implementation/BufferState.h" #include "Implementation/MeshState.h" diff --git a/src/Mesh.h b/src/Magnum/Mesh.h similarity index 95% rename from src/Mesh.h rename to src/Magnum/Mesh.h index 893615125..374553682 100644 --- a/src/Mesh.h +++ b/src/Magnum/Mesh.h @@ -25,13 +25,13 @@ */ /** @file - * @brief Class Magnum::Mesh + * @brief Class @ref Magnum::Mesh */ #include -#include +#include -#include "AbstractShaderProgram.h" +#include "Magnum/AbstractShaderProgram.h" namespace Magnum { @@ -63,12 +63,14 @@ enum class MeshPrimitive: GLenum { /** * Line strip with adjacency information. * @requires_gl32 %Extension @extension{ARB,geometry_shader4} + * @requires_gl Geometry shaders are not available in OpenGL ES. */ LineStripAdjacency = GL_LINE_STRIP_ADJACENCY, /** * Lines with adjacency information. * @requires_gl32 %Extension @extension{ARB,geometry_shader4} + * @requires_gl Geometry shaders are not available in OpenGL ES. */ LinesAdjacency = GL_LINES_ADJACENCY, #endif @@ -92,18 +94,21 @@ enum class MeshPrimitive: GLenum { /** * Triangle strip with adjacency information. * @requires_gl32 %Extension @extension{ARB,geometry_shader4} + * @requires_gl Geometry shaders are not available in OpenGL ES. */ TriangleStripAdjacency = GL_TRIANGLE_STRIP_ADJACENCY, /** * Triangles with adjacency information. * @requires_gl32 %Extension @extension{ARB,geometry_shader4} + * @requires_gl Geometry shaders are not available in OpenGL ES. */ TrianglesAdjacency = GL_TRIANGLES_ADJACENCY, /** * Patches. * @requires_gl40 %Extension @extension{ARB,tessellation_shader} + * @requires_gl Tessellation shaders are not available in OpenGL ES. */ Patches = GL_PATCHES #endif @@ -285,10 +290,10 @@ for more infromation) and call @ref Mesh::draw(). @section Mesh-performance-optimization Performance optimizations -If @extension{APPLE,vertex_array_object}, OpenGL ES 3.0 or +If @extension{APPLE,vertex_array_object} (part of OpenGL 3.0), OpenGL ES 3.0 or @es_extension{OES,vertex_array_object} on OpenGL ES 2.0 is supported, VAOs are used instead of binding the buffers and specifying vertex attribute pointers -in each draw() call. The engine tracks currently bound VAO to avoid +in each @ref draw() call. The engine tracks currently bound VAO to avoid unnecessary calls to @fn_gl{BindVertexArray}. %Mesh limits and implementation-defined values (such as @ref maxVertexAttributes()) are cached, so repeated queries don't result in repeated @fn_gl{Get} calls. @@ -304,7 +309,6 @@ drawing commands are used on desktop OpenGL and OpenGL ES 3.0. See also @todo Support for indirect draw buffer (OpenGL 4.0, @extension{ARB,draw_indirect}) @todo Redo in a way that allows glMultiDrawArrays, glDrawArraysInstanced etc. -@todo test vertex specification & drawing @todo How to glDrawElementsBaseVertex()/vertex offset -- in draw()? */ class MAGNUM_EXPORT Mesh: public AbstractObject { @@ -410,8 +414,8 @@ class MAGNUM_EXPORT Mesh: public AbstractObject { /** * @brief OpenGL mesh ID * - * If @extension{APPLE,vertex_array_object} is not available, returns - * `0`. + * If @extension{APPLE,vertex_array_object} (part of OpenGL 3.0) is not + * available, returns `0`. */ GLuint id() const { return _id; } @@ -552,7 +556,6 @@ class MAGNUM_EXPORT Mesh: public AbstractObject { * @fn_gl_extension{EnableVertexArrayAttrib,EXT,direct_state_access}, * @fn_gl_extension{VertexArrayVertexAttribOffset,EXT,direct_state_access} * if @extension{APPLE,vertex_array_object} is available - * @todoc Add back the *s when Doxygen is sane again */ template inline Mesh& addVertexBuffer(Buffer& buffer, GLintptr offset, const T&... attributes) { addVertexBufferInternal(buffer, offset, strideOfInterleaved(attributes...), attributes...); @@ -591,7 +594,7 @@ class MAGNUM_EXPORT Mesh: public AbstractObject { * * Prefer to use @ref setIndexBuffer(Buffer&, GLintptr, IndexType, UnsignedInt, UnsignedInt) * for better performance. - * @see setIndexCount(), MeshTools::compressIndices(), + * @see @ref setIndexCount(), @ref MeshTools::compressIndices(), * @fn_gl{BindVertexArray}, @fn_gl{BindBuffer} (if * @extension{APPLE,vertex_array_object} is available) */ @@ -657,7 +660,7 @@ class MAGNUM_EXPORT Mesh: public AbstractObject { /* Computing stride of interleaved vertex attributes */ template inline static GLsizei strideOfInterleaved(const AbstractShaderProgram::Attribute& attribute, const U&... attributes) { - return attribute.dataSize() + strideOfInterleaved(attributes...); + return attribute.vectorSize()*AbstractShaderProgram::Attribute::VectorCount + strideOfInterleaved(attributes...); } template inline static GLsizei strideOfInterleaved(GLintptr gap, const T&... attributes) { return gap + strideOfInterleaved(attributes...); @@ -669,7 +672,7 @@ class MAGNUM_EXPORT Mesh: public AbstractObject { addVertexAttribute(buffer, attribute, offset, stride); /* Add size of this attribute to offset for next attribute */ - addVertexBufferInternal(buffer, offset+attribute.dataSize(), stride, attributes...); + addVertexBufferInternal(buffer, offset+attribute.vectorSize()*AbstractShaderProgram::Attribute::VectorCount, stride, attributes...); } template inline void addVertexBufferInternal(Buffer& buffer, GLintptr offset, GLsizei stride, GLintptr gap, const T&... attributes) { /* Add the gap to offset for next attribute */ @@ -678,14 +681,14 @@ class MAGNUM_EXPORT Mesh: public AbstractObject { inline void addVertexBufferInternal(Buffer&, GLsizei, GLintptr) {} template inline void addVertexAttribute(typename std::enable_if::Type, Float>::value, Buffer&>::type buffer, const AbstractShaderProgram::Attribute& attribute, GLintptr offset, GLsizei stride) { - for(UnsignedInt i = 0; i != Implementation::Attribute::vectorCount(); ++i) + for(UnsignedInt i = 0; i != AbstractShaderProgram::Attribute::VectorCount; ++i) (this->*attributePointerImplementation)(Attribute{ &buffer, location+i, GLint(attribute.components()), GLenum(attribute.dataType()), bool(attribute.dataOptions() & AbstractShaderProgram::Attribute::DataOption::Normalized), - offset, + GLintptr(offset+i*attribute.vectorSize()), stride }); } @@ -704,13 +707,13 @@ class MAGNUM_EXPORT Mesh: public AbstractObject { #ifndef MAGNUM_TARGET_GLES template inline void addVertexAttribute(typename std::enable_if::Type, Double>::value, Buffer&>::type buffer, const AbstractShaderProgram::Attribute& attribute, GLintptr offset, GLsizei stride) { - for(UnsignedInt i = 0; i != Implementation::Attribute::vectorCount(); ++i) + for(UnsignedInt i = 0; i != AbstractShaderProgram::Attribute::VectorCount; ++i) (this->*attributeLPointerImplementation)(LongAttribute{ &buffer, location+i, GLint(attribute.components()), GLenum(attribute.dataType()), - offset, + GLintptr(offset+i*attribute.vectorSize()), stride }); } diff --git a/src/MeshTools/CMakeLists.txt b/src/Magnum/MeshTools/CMakeLists.txt similarity index 99% rename from src/MeshTools/CMakeLists.txt rename to src/Magnum/MeshTools/CMakeLists.txt index 8f47e0c20..ab0fe5d66 100644 --- a/src/MeshTools/CMakeLists.txt +++ b/src/Magnum/MeshTools/CMakeLists.txt @@ -46,7 +46,7 @@ set(MagnumMeshTools_HEADERS Tipsify.h Transform.h - magnumMeshToolsVisibility.h) + visibility.h) # 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 diff --git a/src/MeshTools/CombineIndexedArrays.h b/src/Magnum/MeshTools/CombineIndexedArrays.h similarity index 98% rename from src/MeshTools/CombineIndexedArrays.h rename to src/Magnum/MeshTools/CombineIndexedArrays.h index ab56624ec..4c7623b2c 100644 --- a/src/MeshTools/CombineIndexedArrays.h +++ b/src/Magnum/MeshTools/CombineIndexedArrays.h @@ -32,8 +32,8 @@ #include #include -#include "Math/Vector.h" -#include "MeshTools/RemoveDuplicates.h" +#include "Magnum/Math/Vector.h" +#include "Magnum/MeshTools/RemoveDuplicates.h" namespace Magnum { namespace MeshTools { diff --git a/src/MeshTools/CompressIndices.cpp b/src/Magnum/MeshTools/CompressIndices.cpp similarity index 97% rename from src/MeshTools/CompressIndices.cpp rename to src/Magnum/MeshTools/CompressIndices.cpp index ed2886d36..e0a5829e7 100644 --- a/src/MeshTools/CompressIndices.cpp +++ b/src/Magnum/MeshTools/CompressIndices.cpp @@ -26,10 +26,10 @@ #include #include -#include +#include -#include "Math/Functions.h" -#include "Buffer.h" +#include "Magnum/Math/Functions.h" +#include "Magnum/Buffer.h" namespace Magnum { namespace MeshTools { diff --git a/src/MeshTools/CompressIndices.h b/src/Magnum/MeshTools/CompressIndices.h similarity index 96% rename from src/MeshTools/CompressIndices.h rename to src/Magnum/MeshTools/CompressIndices.h index 1aa924063..bc0ad9ee2 100644 --- a/src/MeshTools/CompressIndices.h +++ b/src/Magnum/MeshTools/CompressIndices.h @@ -30,14 +30,13 @@ #include -#include "Mesh.h" +#include "Magnum/Mesh.h" +#include "Magnum/MeshTools/visibility.h" #ifdef CORRADE_GCC45_COMPATIBILITY -#include "Buffer.h" +#include "Magnum/Buffer.h" #endif -#include "magnumMeshToolsVisibility.h" - namespace Magnum { namespace MeshTools { /** diff --git a/src/MeshTools/Duplicate.h b/src/Magnum/MeshTools/Duplicate.h similarity index 98% rename from src/MeshTools/Duplicate.h rename to src/Magnum/MeshTools/Duplicate.h index e86baeed9..1ebbc6982 100644 --- a/src/MeshTools/Duplicate.h +++ b/src/Magnum/MeshTools/Duplicate.h @@ -30,7 +30,7 @@ #include -#include "Types.h" +#include "Magnum/Types.h" namespace Magnum { namespace MeshTools { diff --git a/src/MeshTools/FlipNormals.cpp b/src/Magnum/MeshTools/FlipNormals.cpp similarity index 98% rename from src/MeshTools/FlipNormals.cpp rename to src/Magnum/MeshTools/FlipNormals.cpp index 25776a537..fc5674a17 100644 --- a/src/MeshTools/FlipNormals.cpp +++ b/src/Magnum/MeshTools/FlipNormals.cpp @@ -24,7 +24,7 @@ #include "FlipNormals.h" -#include "Math/Vector3.h" +#include "Magnum/Math/Vector3.h" namespace Magnum { namespace MeshTools { diff --git a/src/MeshTools/FlipNormals.h b/src/Magnum/MeshTools/FlipNormals.h similarity index 97% rename from src/MeshTools/FlipNormals.h rename to src/Magnum/MeshTools/FlipNormals.h index 6bdbe705b..a343cc1a1 100644 --- a/src/MeshTools/FlipNormals.h +++ b/src/Magnum/MeshTools/FlipNormals.h @@ -30,9 +30,8 @@ #include -#include "Magnum.h" - -#include "magnumMeshToolsVisibility.h" +#include "Magnum/Magnum.h" +#include "Magnum/MeshTools/visibility.h" namespace Magnum { namespace MeshTools { diff --git a/src/MeshTools/FullScreenTriangle.cpp b/src/Magnum/MeshTools/FullScreenTriangle.cpp similarity index 75% rename from src/MeshTools/FullScreenTriangle.cpp rename to src/Magnum/MeshTools/FullScreenTriangle.cpp index 14ba470d1..0693836cd 100644 --- a/src/MeshTools/FullScreenTriangle.cpp +++ b/src/Magnum/MeshTools/FullScreenTriangle.cpp @@ -24,32 +24,32 @@ #include "FullScreenTriangle.h" -#include "Math/Vector2.h" -#include "AbstractShaderProgram.h" -#include "Buffer.h" -#include "Context.h" -#include "Mesh.h" -#include "Version.h" +#include "Magnum/AbstractShaderProgram.h" +#include "Magnum/Buffer.h" +#include "Magnum/Context.h" +#include "Magnum/Mesh.h" +#include "Magnum/Version.h" +#include "Magnum/Math/Vector2.h" namespace Magnum { namespace MeshTools { -std::pair fullScreenTriangle() { +std::pair, Mesh> fullScreenTriangle(Version version) { Mesh mesh; mesh.setPrimitive(MeshPrimitive::Triangles) .setVertexCount(3); - Buffer* buffer = nullptr; + std::unique_ptr buffer; #ifndef MAGNUM_TARGET_GLES - if(!Context::current()->isVersionSupported(Version::GL300)) + if(version < Version::GL300) #else - if(!Context::current()->isVersionSupported(Version::GLES300)) + if(version < Version::GLES300) #endif { - buffer = new Buffer; + buffer.reset(new Buffer); constexpr Vector2 triangle[] = { - Vector2(-1.0, 1.0), - Vector2(-1.0, -3.0), - Vector2( 3.0, 1.0) + {-1.0f, 1.0f}, + {-1.0f, -3.0f}, + { 3.0f, 1.0f} }; buffer->setData(triangle, BufferUsage::StaticDraw); /** @todo Is it possible to attach moveable buffer here to avoid heap @@ -60,4 +60,8 @@ std::pair fullScreenTriangle() { return {std::move(buffer), std::move(mesh)}; } +std::pair, Mesh> fullScreenTriangle() { + return fullScreenTriangle(Context::current()->version()); +} + }} diff --git a/src/MeshTools/FullScreenTriangle.h b/src/Magnum/MeshTools/FullScreenTriangle.h similarity index 78% rename from src/MeshTools/FullScreenTriangle.h rename to src/Magnum/MeshTools/FullScreenTriangle.h index 3067719ef..e89fd95b4 100644 --- a/src/MeshTools/FullScreenTriangle.h +++ b/src/Magnum/MeshTools/FullScreenTriangle.h @@ -28,10 +28,11 @@ * @brief Function @ref Magnum::MeshTools::fullScreenTriangle() */ +#include #include -#include "Magnum.h" -#include "MeshTools/magnumMeshToolsVisibility.h" +#include "Magnum/Magnum.h" +#include "Magnum/MeshTools/visibility.h" namespace Magnum { namespace MeshTools { @@ -49,11 +50,11 @@ computed from them. The vertex positions are, in order: \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 `nullptr` is returned instead of -vertex buffer. +Based on @p version parameter, 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 +`nullptr` is returned instead of vertex buffer. 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` @@ -76,11 +77,15 @@ void main() { #endif } @endcode +*/ +std::pair, Mesh> MAGNUM_MESHTOOLS_EXPORT fullScreenTriangle(Version version); + +/** +@overload -@attention The implementation needs to check OpenGL version, so it expects - active context. +This function implicitly uses current context version. */ -std::pair MAGNUM_MESHTOOLS_EXPORT fullScreenTriangle(); +std::pair, Mesh> MAGNUM_MESHTOOLS_EXPORT fullScreenTriangle(); }} diff --git a/src/MeshTools/GenerateFlatNormals.cpp b/src/Magnum/MeshTools/GenerateFlatNormals.cpp similarity index 96% rename from src/MeshTools/GenerateFlatNormals.cpp rename to src/Magnum/MeshTools/GenerateFlatNormals.cpp index e9703b124..0d5b22a2f 100644 --- a/src/MeshTools/GenerateFlatNormals.cpp +++ b/src/Magnum/MeshTools/GenerateFlatNormals.cpp @@ -24,8 +24,8 @@ #include "GenerateFlatNormals.h" -#include "Math/Vector3.h" -#include "MeshTools/RemoveDuplicates.h" +#include "Magnum/Math/Vector3.h" +#include "Magnum/MeshTools/RemoveDuplicates.h" namespace Magnum { namespace MeshTools { diff --git a/src/MeshTools/GenerateFlatNormals.h b/src/Magnum/MeshTools/GenerateFlatNormals.h similarity index 97% rename from src/MeshTools/GenerateFlatNormals.h rename to src/Magnum/MeshTools/GenerateFlatNormals.h index ed0a801ea..0ce4e28b0 100644 --- a/src/MeshTools/GenerateFlatNormals.h +++ b/src/Magnum/MeshTools/GenerateFlatNormals.h @@ -31,9 +31,8 @@ #include #include -#include "Magnum.h" - -#include "magnumMeshToolsVisibility.h" +#include "Magnum/Magnum.h" +#include "Magnum/MeshTools/visibility.h" namespace Magnum { namespace MeshTools { diff --git a/src/MeshTools/Interleave.h b/src/Magnum/MeshTools/Interleave.h similarity index 99% rename from src/MeshTools/Interleave.h rename to src/Magnum/MeshTools/Interleave.h index cb6644162..d85467f7d 100644 --- a/src/MeshTools/Interleave.h +++ b/src/Magnum/MeshTools/Interleave.h @@ -33,8 +33,8 @@ #include #include -#include "Mesh.h" -#include "Buffer.h" +#include "Magnum/Mesh.h" +#include "Magnum/Buffer.h" namespace Magnum { namespace MeshTools { diff --git a/src/MeshTools/RemoveDuplicates.h b/src/Magnum/MeshTools/RemoveDuplicates.h similarity index 98% rename from src/MeshTools/RemoveDuplicates.h rename to src/Magnum/MeshTools/RemoveDuplicates.h index b3c08a809..3c9184ee2 100644 --- a/src/MeshTools/RemoveDuplicates.h +++ b/src/Magnum/MeshTools/RemoveDuplicates.h @@ -31,10 +31,10 @@ #include #include #include -#include +#include -#include "Math/Functions.h" -#include "Magnum.h" +#include "Magnum/Magnum.h" +#include "Magnum/Math/Functions.h" namespace Magnum { namespace MeshTools { diff --git a/src/MeshTools/Subdivide.h b/src/Magnum/MeshTools/Subdivide.h similarity index 99% rename from src/MeshTools/Subdivide.h rename to src/Magnum/MeshTools/Subdivide.h index 33b8f8517..a4c78fd15 100644 --- a/src/MeshTools/Subdivide.h +++ b/src/Magnum/MeshTools/Subdivide.h @@ -29,7 +29,7 @@ */ #include -#include +#include namespace Magnum { namespace MeshTools { diff --git a/src/MeshTools/Test/CMakeLists.txt b/src/Magnum/MeshTools/Test/CMakeLists.txt similarity index 100% rename from src/MeshTools/Test/CMakeLists.txt rename to src/Magnum/MeshTools/Test/CMakeLists.txt diff --git a/src/MeshTools/Test/CombineIndexedArraysTest.cpp b/src/Magnum/MeshTools/Test/CombineIndexedArraysTest.cpp similarity index 96% rename from src/MeshTools/Test/CombineIndexedArraysTest.cpp rename to src/Magnum/MeshTools/Test/CombineIndexedArraysTest.cpp index 33936b458..cccc5803e 100644 --- a/src/MeshTools/Test/CombineIndexedArraysTest.cpp +++ b/src/Magnum/MeshTools/Test/CombineIndexedArraysTest.cpp @@ -24,10 +24,10 @@ #include #include -#include +#include -#include "Types.h" -#include "MeshTools/CombineIndexedArrays.h" +#include "Magnum/Types.h" +#include "Magnum/MeshTools/CombineIndexedArrays.h" namespace Magnum { namespace MeshTools { namespace Test { diff --git a/src/MeshTools/Test/CompressIndicesTest.cpp b/src/Magnum/MeshTools/Test/CompressIndicesTest.cpp similarity index 96% rename from src/MeshTools/Test/CompressIndicesTest.cpp rename to src/Magnum/MeshTools/Test/CompressIndicesTest.cpp index 3f0bac010..20e263db5 100644 --- a/src/MeshTools/Test/CompressIndicesTest.cpp +++ b/src/Magnum/MeshTools/Test/CompressIndicesTest.cpp @@ -22,11 +22,11 @@ DEALINGS IN THE SOFTWARE. */ -#include -#include -#include +#include +#include +#include -#include "MeshTools/CompressIndices.h" +#include "Magnum/MeshTools/CompressIndices.h" namespace Magnum { namespace MeshTools { namespace Test { diff --git a/src/MeshTools/Test/DuplicateTest.cpp b/src/Magnum/MeshTools/Test/DuplicateTest.cpp similarity index 94% rename from src/MeshTools/Test/DuplicateTest.cpp rename to src/Magnum/MeshTools/Test/DuplicateTest.cpp index 2e24969e4..b9be52870 100644 --- a/src/MeshTools/Test/DuplicateTest.cpp +++ b/src/Magnum/MeshTools/Test/DuplicateTest.cpp @@ -22,10 +22,10 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include -#include "MeshTools/Duplicate.h" -#include "Magnum.h" +#include "Magnum/Magnum.h" +#include "Magnum/MeshTools/Duplicate.h" namespace Magnum { namespace MeshTools { namespace Test { diff --git a/src/MeshTools/Test/FlipNormalsTest.cpp b/src/Magnum/MeshTools/Test/FlipNormalsTest.cpp similarity index 96% rename from src/MeshTools/Test/FlipNormalsTest.cpp rename to src/Magnum/MeshTools/Test/FlipNormalsTest.cpp index 9ae53c26f..868dff1a7 100644 --- a/src/MeshTools/Test/FlipNormalsTest.cpp +++ b/src/Magnum/MeshTools/Test/FlipNormalsTest.cpp @@ -23,10 +23,10 @@ */ #include -#include +#include -#include "Math/Vector3.h" -#include "MeshTools/FlipNormals.h" +#include "Magnum/Math/Vector3.h" +#include "Magnum/MeshTools/FlipNormals.h" namespace Magnum { namespace MeshTools { namespace Test { diff --git a/src/MeshTools/Test/GenerateFlatNormalsTest.cpp b/src/Magnum/MeshTools/Test/GenerateFlatNormalsTest.cpp similarity index 95% rename from src/MeshTools/Test/GenerateFlatNormalsTest.cpp rename to src/Magnum/MeshTools/Test/GenerateFlatNormalsTest.cpp index b681bdaa1..a6954329e 100644 --- a/src/MeshTools/Test/GenerateFlatNormalsTest.cpp +++ b/src/Magnum/MeshTools/Test/GenerateFlatNormalsTest.cpp @@ -23,10 +23,10 @@ */ #include -#include +#include -#include "Math/Vector3.h" -#include "MeshTools/GenerateFlatNormals.h" +#include "Magnum/Math/Vector3.h" +#include "Magnum/MeshTools/GenerateFlatNormals.h" namespace Magnum { namespace MeshTools { namespace Test { diff --git a/src/MeshTools/Test/InterleaveTest.cpp b/src/Magnum/MeshTools/Test/InterleaveTest.cpp similarity index 97% rename from src/MeshTools/Test/InterleaveTest.cpp rename to src/Magnum/MeshTools/Test/InterleaveTest.cpp index 6cb9007be..07acb7dc6 100644 --- a/src/MeshTools/Test/InterleaveTest.cpp +++ b/src/Magnum/MeshTools/Test/InterleaveTest.cpp @@ -23,11 +23,11 @@ */ #include -#include +#include +#include +#include -#include "Utility/Endianness.h" -#include "Utility/Debug.h" -#include "MeshTools/Interleave.h" +#include "Magnum/MeshTools/Interleave.h" namespace Magnum { namespace MeshTools { namespace Test { diff --git a/src/MeshTools/Test/RemoveDuplicatesTest.cpp b/src/Magnum/MeshTools/Test/RemoveDuplicatesTest.cpp similarity index 95% rename from src/MeshTools/Test/RemoveDuplicatesTest.cpp rename to src/Magnum/MeshTools/Test/RemoveDuplicatesTest.cpp index 5ac1b5533..0931847f4 100644 --- a/src/MeshTools/Test/RemoveDuplicatesTest.cpp +++ b/src/Magnum/MeshTools/Test/RemoveDuplicatesTest.cpp @@ -22,9 +22,9 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include -#include "MeshTools/RemoveDuplicates.h" +#include "Magnum/MeshTools/RemoveDuplicates.h" namespace Magnum { namespace MeshTools { namespace Test { diff --git a/src/MeshTools/Test/SubdivideRemoveDuplicatesBenchmark.cpp b/src/Magnum/MeshTools/Test/SubdivideRemoveDuplicatesBenchmark.cpp similarity index 96% rename from src/MeshTools/Test/SubdivideRemoveDuplicatesBenchmark.cpp rename to src/Magnum/MeshTools/Test/SubdivideRemoveDuplicatesBenchmark.cpp index 87025a70d..feaa5b384 100644 --- a/src/MeshTools/Test/SubdivideRemoveDuplicatesBenchmark.cpp +++ b/src/Magnum/MeshTools/Test/SubdivideRemoveDuplicatesBenchmark.cpp @@ -26,9 +26,9 @@ #include -#include "Primitives/Icosphere.h" -#include "MeshTools/RemoveDuplicates.h" -#include "MeshTools/Subdivide.h" +#include "Magnum/Primitives/Icosphere.h" +#include "Magnum/MeshTools/RemoveDuplicates.h" +#include "Magnum/MeshTools/Subdivide.h" QTEST_APPLESS_MAIN(Magnum::MeshTools::Test::SubdivideRemoveDuplicatesBenchmark) diff --git a/src/MeshTools/Test/SubdivideRemoveDuplicatesBenchmark.h b/src/Magnum/MeshTools/Test/SubdivideRemoveDuplicatesBenchmark.h similarity index 98% rename from src/MeshTools/Test/SubdivideRemoveDuplicatesBenchmark.h rename to src/Magnum/MeshTools/Test/SubdivideRemoveDuplicatesBenchmark.h index c82cf4ddf..e3a368202 100644 --- a/src/MeshTools/Test/SubdivideRemoveDuplicatesBenchmark.h +++ b/src/Magnum/MeshTools/Test/SubdivideRemoveDuplicatesBenchmark.h @@ -26,7 +26,7 @@ #include -#include "Magnum.h" +#include "Magnum/Magnum.h" namespace Magnum { namespace MeshTools { namespace Test { diff --git a/src/MeshTools/Test/SubdivideTest.cpp b/src/Magnum/MeshTools/Test/SubdivideTest.cpp similarity index 95% rename from src/MeshTools/Test/SubdivideTest.cpp rename to src/Magnum/MeshTools/Test/SubdivideTest.cpp index 2b0dd9f83..7edd55fa9 100644 --- a/src/MeshTools/Test/SubdivideTest.cpp +++ b/src/Magnum/MeshTools/Test/SubdivideTest.cpp @@ -23,10 +23,10 @@ */ #include -#include +#include -#include "MeshTools/RemoveDuplicates.h" -#include "MeshTools/Subdivide.h" +#include "Magnum/MeshTools/RemoveDuplicates.h" +#include "Magnum/MeshTools/Subdivide.h" namespace Magnum { namespace MeshTools { namespace Test { diff --git a/src/MeshTools/Test/TipsifyTest.cpp b/src/Magnum/MeshTools/Test/TipsifyTest.cpp similarity index 97% rename from src/MeshTools/Test/TipsifyTest.cpp rename to src/Magnum/MeshTools/Test/TipsifyTest.cpp index 650b7b536..38e2fc232 100644 --- a/src/MeshTools/Test/TipsifyTest.cpp +++ b/src/Magnum/MeshTools/Test/TipsifyTest.cpp @@ -22,10 +22,10 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include -#include "Magnum.h" -#include "MeshTools/Tipsify.h" +#include "Magnum/Magnum.h" +#include "Magnum/MeshTools/Tipsify.h" namespace Magnum { namespace MeshTools { namespace Test { diff --git a/src/MeshTools/Test/TransformTest.cpp b/src/Magnum/MeshTools/Test/TransformTest.cpp similarity index 96% rename from src/MeshTools/Test/TransformTest.cpp rename to src/Magnum/MeshTools/Test/TransformTest.cpp index 24212e4ae..f53b4a24d 100644 --- a/src/MeshTools/Test/TransformTest.cpp +++ b/src/Magnum/MeshTools/Test/TransformTest.cpp @@ -23,11 +23,11 @@ */ #include -#include +#include -#include "Math/Matrix3.h" -#include "Magnum.h" -#include "MeshTools/Transform.h" +#include "Magnum/Math/Matrix3.h" +#include "Magnum/Magnum.h" +#include "Magnum/MeshTools/Transform.h" namespace Magnum { namespace MeshTools { namespace Test { diff --git a/src/MeshTools/Tipsify.cpp b/src/Magnum/MeshTools/Tipsify.cpp similarity index 100% rename from src/MeshTools/Tipsify.cpp rename to src/Magnum/MeshTools/Tipsify.cpp diff --git a/src/MeshTools/Tipsify.h b/src/Magnum/MeshTools/Tipsify.h similarity index 97% rename from src/MeshTools/Tipsify.h rename to src/Magnum/MeshTools/Tipsify.h index f50ed2a78..fb007c2ed 100644 --- a/src/MeshTools/Tipsify.h +++ b/src/Magnum/MeshTools/Tipsify.h @@ -30,8 +30,8 @@ #include -#include "Types.h" -#include "magnumMeshToolsVisibility.h" +#include "Magnum/Types.h" +#include "Magnum/MeshTools/visibility.h" namespace Magnum { namespace MeshTools { diff --git a/src/MeshTools/Transform.h b/src/Magnum/MeshTools/Transform.h similarity index 98% rename from src/MeshTools/Transform.h rename to src/Magnum/MeshTools/Transform.h index f33498c7b..6109478b5 100644 --- a/src/MeshTools/Transform.h +++ b/src/Magnum/MeshTools/Transform.h @@ -28,8 +28,8 @@ * @brief Function Magnum::MeshTools::transformVectorsInPlace(), Magnum::MeshTools::transformVectors(), Magnum::MeshTools::transformPointsInPlace(), Magnum::MeshTools::transformPoints() */ -#include "Math/DualQuaternion.h" -#include "Math/DualComplex.h" +#include "Magnum/Math/DualQuaternion.h" +#include "Magnum/Math/DualComplex.h" namespace Magnum { namespace MeshTools { diff --git a/src/MeshTools/magnumMeshToolsVisibility.h b/src/Magnum/MeshTools/visibility.h similarity index 90% rename from src/MeshTools/magnumMeshToolsVisibility.h rename to src/Magnum/MeshTools/visibility.h index 476d8f3a5..876020128 100644 --- a/src/MeshTools/magnumMeshToolsVisibility.h +++ b/src/Magnum/MeshTools/visibility.h @@ -1,5 +1,5 @@ -#ifndef Magnum_MeshTools_magnumMeshToolsVisibility_h -#define Magnum_MeshTools_magnumMeshToolsVisibility_h +#ifndef Magnum_MeshTools_visibility_h +#define Magnum_MeshTools_visibility_h /* This file is part of Magnum. @@ -24,9 +24,9 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include -#include "magnumConfigure.h" +#include "Magnum/configure.h" #ifndef MAGNUM_BUILD_STATIC #if defined(MagnumMeshTools_EXPORTS) || defined(MagnumMeshToolsObjects_EXPORTS) diff --git a/src/MeshView.cpp b/src/Magnum/MeshView.cpp similarity index 89% rename from src/MeshView.cpp rename to src/Magnum/MeshView.cpp index 9eed8f255..6214ce279 100644 --- a/src/MeshView.cpp +++ b/src/Magnum/MeshView.cpp @@ -24,7 +24,7 @@ #include "MeshView.h" -#include "Mesh.h" +#include "Magnum/Mesh.h" namespace Magnum { @@ -34,7 +34,7 @@ MeshView& MeshView::setIndexRange(Int first, Int count, UnsignedInt start, Unsig MeshView& MeshView::setIndexRange(Int first, Int count, UnsignedInt, UnsignedInt) #endif { - _indexOffset = first*_original->indexSize(); + _indexOffset = _original->_indexOffset + first*_original->indexSize(); _indexCount = count; #ifndef MAGNUM_TARGET_GLES2 _indexStart = start; @@ -45,7 +45,7 @@ MeshView& MeshView::setIndexRange(Int first, Int count, UnsignedInt, UnsignedInt void MeshView::draw() { #ifndef MAGNUM_TARGET_GLES2 - _original->drawInternal(_firstVertex, _vertexCount, _indexOffset, _indexCount, _indexStart, _indexEnd); + _original->drawInternal(_firstVertex, _vertexCount, _indexOffset, _indexCount, _indexStart, _indexEnd); #else _original->drawInternal(_firstVertex, _vertexCount, _indexOffset, _indexCount); #endif diff --git a/src/MeshView.h b/src/Magnum/MeshView.h similarity index 90% rename from src/MeshView.h rename to src/Magnum/MeshView.h index cc7c38b4e..72d72b83d 100644 --- a/src/MeshView.h +++ b/src/Magnum/MeshView.h @@ -25,12 +25,12 @@ */ /** @file - * @brief Class Magnum::MeshView + * @brief Class @ref Magnum::MeshView */ -#include "Magnum.h" -#include "OpenGL.h" -#include "magnumVisibility.h" +#include "Magnum/Magnum.h" +#include "Magnum/OpenGL.h" +#include "Magnum/visibility.h" namespace Magnum { @@ -42,15 +42,13 @@ index count and offset. It is then possible to reuse one mesh buffer configuration for different views. %Mesh primitive, index type, attribute bindings and attached buffers are reused from original mesh. -The same rules as in Mesh apply, i.e. if the view has non-zero index count, it -is treated as indexed mesh, otherwise it is treated as non-indexed mesh. If -both index and vertex count is zero, the view is treated as empty and no draw -commands are issued when calling draw(). +The same rules as in @ref Mesh apply, i.e. if the view has non-zero index +count, it is treated as indexed mesh, otherwise it is treated as non-indexed +mesh. If both index and vertex count is zero, the view is treated as empty and +no draw commands are issued when calling @ref draw(). You must ensure that the original mesh remains available for whole view lifetime. -@todo Might cause issues when there are more data than just indices in index - buffer (wrongly computed offset) */ class MAGNUM_EXPORT MeshView { public: diff --git a/src/OpenGL.cpp b/src/Magnum/OpenGL.cpp similarity index 97% rename from src/OpenGL.cpp rename to src/Magnum/OpenGL.cpp index 91c48b7a9..fc6502fa8 100644 --- a/src/OpenGL.cpp +++ b/src/Magnum/OpenGL.cpp @@ -24,8 +24,8 @@ #include -#include "OpenGL.h" -#include "Types.h" +#include "Magnum/OpenGL.h" +#include "Magnum/Types.h" namespace Magnum { diff --git a/src/OpenGL.h b/src/Magnum/OpenGL.h similarity index 80% rename from src/OpenGL.h rename to src/Magnum/OpenGL.h index b40af2f11..9cbade659 100644 --- a/src/OpenGL.h +++ b/src/Magnum/OpenGL.h @@ -28,14 +28,15 @@ * @brief OpenGL headers */ -#include -#include "magnumConfigure.h" +#include + +#include "Magnum/configure.h" /** @todo Remove NaCl workaround when not needed */ /* Desktop OpenGL */ #ifndef MAGNUM_TARGET_GLES - #include "OpenGL/GL/gl_magnum.h" + #include "MagnumExternal/OpenGL/GL/gl_magnum.h" /* NaCl has its own gl2.h, the official one causes linker issues. Additionaly to NaCl's gl2ext.h we are including our own to prevent undeclared symbol @@ -53,19 +54,19 @@ typedef std::uint64_t GLuint64; typedef std::int64_t GLint64; #undef __gl2ext_h_ - #include "OpenGL/GLES2/gl2ext.h" + #include "MagnumExternal/OpenGL/GLES2/gl2ext.h" /* Generic OpenGL ES */ #else - #include "OpenGL/KHR/khrplatform.h" + #include "MagnumExternal/OpenGL/KHR/khrplatform.h" #ifndef MAGNUM_TARGET_GLES2 - #include "OpenGL/GLES3/gl3platform.h" - #include "OpenGL/GLES3/gl3.h" + #include "MagnumExternal/OpenGL/GLES3/gl3platform.h" + #include "MagnumExternal/OpenGL/GLES3/gl3.h" #else - #include "OpenGL/GLES2/gl2platform.h" - #include "OpenGL/GLES2/gl2.h" + #include "MagnumExternal/OpenGL/GLES2/gl2platform.h" + #include "MagnumExternal/OpenGL/GLES2/gl2.h" #endif - #include "OpenGL/GLES2/gl2ext.h" + #include "MagnumExternal/OpenGL/GLES2/gl2ext.h" #endif #endif diff --git a/src/Platform/AbstractXApplication.cpp b/src/Magnum/Platform/AbstractXApplication.cpp similarity index 96% rename from src/Platform/AbstractXApplication.cpp rename to src/Magnum/Platform/AbstractXApplication.cpp index f6944bb1f..47f855959 100644 --- a/src/Platform/AbstractXApplication.cpp +++ b/src/Magnum/Platform/AbstractXApplication.cpp @@ -24,12 +24,12 @@ #include "AbstractXApplication.h" -#include +#include -#include "Context.h" -#include "Platform/Implementation/AbstractContextHandler.h" +#include "Magnum/Context.h" +#include "Magnum/Version.h" -#define None 0L // redef Xlib nonsense +#include "Implementation/AbstractContextHandler.h" /* Mask for X events */ #define INPUT_MASK KeyPressMask|KeyReleaseMask|ButtonPressMask|ButtonReleaseMask|PointerMotionMask|StructureNotifyMask @@ -85,7 +85,7 @@ bool AbstractXApplication::tryCreateContext(const Configuration& configuration) attr.event_mask = 0; unsigned long mask = CWBackPixel|CWBorderPixel|CWColormap|CWEventMask; window = XCreateWindow(display, root, 20, 20, configuration.size().x(), configuration.size().y(), 0, visInfo->depth, InputOutput, visInfo->visual, mask, &attr); - XSetStandardProperties(display, window, configuration.title().data(), nullptr, None, nullptr, 0, nullptr); + XSetStandardProperties(display, window, configuration.title().data(), nullptr, 0, nullptr, 0, nullptr); XFree(visInfo); /* Be notified about closing the window */ @@ -181,7 +181,7 @@ void AbstractXApplication::mousePressEvent(MouseEvent&) {} void AbstractXApplication::mouseReleaseEvent(MouseEvent&) {} void AbstractXApplication::mouseMoveEvent(MouseMoveEvent&) {} -AbstractXApplication::Configuration::Configuration(): _title("Magnum X Application"), _size(800, 600) {} +AbstractXApplication::Configuration::Configuration(): _title("Magnum X Application"), _size(800, 600), _version(Version::None) {} AbstractXApplication::Configuration::~Configuration() = default; }} diff --git a/src/Platform/AbstractXApplication.h b/src/Magnum/Platform/AbstractXApplication.h similarity index 99% rename from src/Platform/AbstractXApplication.h rename to src/Magnum/Platform/AbstractXApplication.h index bffe59a99..426ef9a02 100644 --- a/src/Platform/AbstractXApplication.h +++ b/src/Magnum/Platform/AbstractXApplication.h @@ -28,18 +28,18 @@ * @brief Class @ref Magnum::Platform::AbstractXApplication */ -#include - -#include "Magnum.h" +#include #include #include /* undef Xlib nonsense to avoid conflicts */ +#undef Always #undef Complex #undef None -#undef Always +#undef Status -#include "Math/Vector2.h" +#include "Magnum/Magnum.h" +#include "Magnum/Math/Vector2.h" #ifdef CORRADE_GCC45_COMPATIBILITY #include "Version.h" diff --git a/src/Platform/CMakeLists.txt b/src/Magnum/Platform/CMakeLists.txt similarity index 98% rename from src/Platform/CMakeLists.txt rename to src/Magnum/Platform/CMakeLists.txt index 03e14004c..f660f6a0a 100644 --- a/src/Platform/CMakeLists.txt +++ b/src/Magnum/Platform/CMakeLists.txt @@ -177,15 +177,13 @@ endif() # Magnum Info if(WITH_MAGNUMINFO) - if(NOT UNIX AND NOT CORRADE_TARGET_NACL) - message(FATAL_ERROR "magnum-info is not available on this platform. Set WITH_MAGNUMINFO to OFF to skip building it.") - endif() - add_executable(magnum-info magnum-info.cpp) - if(UNIX AND NOT CORRADE_TARGET_NACL) + if(UNIX AND NOT CORRADE_TARGET_NACL AND NOT APPLE) target_link_libraries(magnum-info MagnumWindowlessGlxApplication ${X11_LIBRARIES}) elseif(CORRADE_TARGET_NACL) target_link_libraries(magnum-info MagnumWindowlessNaClApplication ppapi_cpp ppapi) + else() + message(FATAL_ERROR "magnum-info is not available on this platform. Set WITH_MAGNUMINFO to OFF to skip building it.") endif() target_link_libraries(magnum-info Magnum) diff --git a/src/Platform/EmscriptenApplication.js b/src/Magnum/Platform/EmscriptenApplication.js similarity index 100% rename from src/Platform/EmscriptenApplication.js rename to src/Magnum/Platform/EmscriptenApplication.js diff --git a/src/Platform/GlutApplication.cpp b/src/Magnum/Platform/GlutApplication.cpp similarity index 96% rename from src/Platform/GlutApplication.cpp rename to src/Magnum/Platform/GlutApplication.cpp index c4bad545b..aa306560c 100644 --- a/src/Platform/GlutApplication.cpp +++ b/src/Magnum/Platform/GlutApplication.cpp @@ -26,10 +26,9 @@ #include -#include "Context.h" -#include "Version.h" - -#include "Platform/ScreenedApplication.hpp" +#include "Magnum/Context.h" +#include "Magnum/Version.h" +#include "Magnum/Platform/ScreenedApplication.hpp" namespace Magnum { namespace Platform { @@ -139,7 +138,7 @@ void GlutApplication::mousePressEvent(MouseEvent&) {} void GlutApplication::mouseReleaseEvent(MouseEvent&) {} void GlutApplication::mouseMoveEvent(MouseMoveEvent&) {} -GlutApplication::Configuration::Configuration(): _title("Magnum GLUT Application"), _size(800, 600), _sampleCount(0) {} +GlutApplication::Configuration::Configuration(): _title("Magnum GLUT Application"), _size(800, 600), _sampleCount(0), _version(Version::None) {} GlutApplication::Configuration::~Configuration() = default; template class BasicScreen; diff --git a/src/Platform/GlutApplication.h b/src/Magnum/Platform/GlutApplication.h similarity index 99% rename from src/Platform/GlutApplication.h rename to src/Magnum/Platform/GlutApplication.h index 814d86556..9bf424974 100644 --- a/src/Platform/GlutApplication.h +++ b/src/Magnum/Platform/GlutApplication.h @@ -30,12 +30,12 @@ #include -#include "Platform/Platform.h" -#include "Math/Vector2.h" -#include "Magnum.h" +#include "Magnum/Magnum.h" +#include "Magnum/Math/Vector2.h" +#include "Magnum/Platform/Platform.h" /* We must include our own GL headers first to avoid conflicts */ -#include "OpenGL.h" +#include "Magnum/OpenGL.h" #include #ifdef CORRADE_GCC45_COMPATIBILITY diff --git a/src/Platform/GlxApplication.cpp b/src/Magnum/Platform/GlxApplication.cpp similarity index 95% rename from src/Platform/GlxApplication.cpp rename to src/Magnum/Platform/GlxApplication.cpp index 303c16dcf..dd16b44f0 100644 --- a/src/Platform/GlxApplication.cpp +++ b/src/Magnum/Platform/GlxApplication.cpp @@ -24,8 +24,9 @@ #include "GlxApplication.h" -#include "Platform/ScreenedApplication.hpp" -#include "Platform/Implementation/GlxContextHandler.h" +#include "Magnum/Platform/ScreenedApplication.hpp" + +#include "Implementation/GlxContextHandler.h" namespace Magnum { namespace Platform { diff --git a/src/Platform/GlxApplication.h b/src/Magnum/Platform/GlxApplication.h similarity index 98% rename from src/Platform/GlxApplication.h rename to src/Magnum/Platform/GlxApplication.h index 33c240996..745eb3ee8 100644 --- a/src/Platform/GlxApplication.h +++ b/src/Magnum/Platform/GlxApplication.h @@ -28,8 +28,8 @@ * @brief Class @ref Magnum::Platform::GlxApplication */ -#include "Platform/AbstractXApplication.h" -#include "Platform/Platform.h" +#include "Magnum/Platform/AbstractXApplication.h" +#include "Magnum/Platform/Platform.h" namespace Magnum { namespace Platform { diff --git a/src/Platform/Implementation/AbstractContextHandler.h b/src/Magnum/Platform/Implementation/AbstractContextHandler.h similarity index 100% rename from src/Platform/Implementation/AbstractContextHandler.h rename to src/Magnum/Platform/Implementation/AbstractContextHandler.h diff --git a/src/Platform/Implementation/EglContextHandler.cpp b/src/Magnum/Platform/Implementation/EglContextHandler.cpp similarity index 98% rename from src/Platform/Implementation/EglContextHandler.cpp rename to src/Magnum/Platform/Implementation/EglContextHandler.cpp index 121af16f8..2dcfca353 100644 --- a/src/Platform/Implementation/EglContextHandler.cpp +++ b/src/Magnum/Platform/Implementation/EglContextHandler.cpp @@ -26,10 +26,10 @@ #include #include -#include +#include -#include "Context.h" -#include "Version.h" +#include "Magnum/Context.h" +#include "Magnum/Version.h" namespace Magnum { namespace Platform { namespace Implementation { diff --git a/src/Platform/Implementation/EglContextHandler.h b/src/Magnum/Platform/Implementation/EglContextHandler.h similarity index 93% rename from src/Platform/Implementation/EglContextHandler.h rename to src/Magnum/Platform/Implementation/EglContextHandler.h index 94724da66..081e34532 100644 --- a/src/Platform/Implementation/EglContextHandler.h +++ b/src/Magnum/Platform/Implementation/EglContextHandler.h @@ -24,20 +24,18 @@ DEALINGS IN THE SOFTWARE. */ -#include "Magnum.h" - #ifndef SUPPORT_X11 #define SUPPORT_X11 // OpenGL ES on BeagleBoard needs this (?) #endif #include - /* undef Xlib nonsense to avoid conflicts */ #undef None -#include "Platform/AbstractXApplication.h" -#include "Platform/Implementation/AbstractContextHandler.h" +#include -#include "corradeCompatibility.h" +#include "Magnum/Magnum.h" +#include "Magnum/Platform/AbstractXApplication.h" +#include "Magnum/Platform/Implementation/AbstractContextHandler.h" namespace Magnum { namespace Platform { namespace Implementation { diff --git a/src/Platform/Implementation/GlxContextHandler.cpp b/src/Magnum/Platform/Implementation/GlxContextHandler.cpp similarity index 98% rename from src/Platform/Implementation/GlxContextHandler.cpp rename to src/Magnum/Platform/Implementation/GlxContextHandler.cpp index bc90befc3..9657c6775 100644 --- a/src/Platform/Implementation/GlxContextHandler.cpp +++ b/src/Magnum/Platform/Implementation/GlxContextHandler.cpp @@ -27,10 +27,10 @@ #include #include #include -#include +#include -#include "Context.h" -#include "Version.h" +#include "Magnum/Context.h" +#include "Magnum/Version.h" namespace Magnum { namespace Platform { namespace Implementation { diff --git a/src/Platform/Implementation/GlxContextHandler.h b/src/Magnum/Platform/Implementation/GlxContextHandler.h similarity index 91% rename from src/Platform/Implementation/GlxContextHandler.h rename to src/Magnum/Platform/Implementation/GlxContextHandler.h index 036c19e07..0a6093319 100644 --- a/src/Platform/Implementation/GlxContextHandler.h +++ b/src/Magnum/Platform/Implementation/GlxContextHandler.h @@ -24,17 +24,20 @@ DEALINGS IN THE SOFTWARE. */ -#include "OpenGL.h" +#include "Magnum/OpenGL.h" + +#define Status int #include /* undef Xlib nonsense to avoid conflicts */ +#undef Always #undef Complex #undef None -#undef Always +#undef Status -#include "Platform/AbstractXApplication.h" -#include "Platform/Implementation/AbstractContextHandler.h" +#include -#include "corradeCompatibility.h" +#include "Magnum/Platform/AbstractXApplication.h" +#include "Magnum/Platform/Implementation/AbstractContextHandler.h" namespace Magnum { namespace Platform { namespace Implementation { diff --git a/src/Platform/NaClApplication.cpp b/src/Magnum/Platform/NaClApplication.cpp similarity index 98% rename from src/Platform/NaClApplication.cpp rename to src/Magnum/Platform/NaClApplication.cpp index 6a8c28b4c..ac7b2a6a4 100644 --- a/src/Platform/NaClApplication.cpp +++ b/src/Magnum/Platform/NaClApplication.cpp @@ -27,10 +27,10 @@ #include #include #include -#include +#include -#include "Context.h" -#include "Platform/ScreenedApplication.hpp" +#include "Magnum/Context.h" +#include "Magnum/Platform/ScreenedApplication.hpp" namespace Magnum { namespace Platform { diff --git a/src/Platform/NaClApplication.h b/src/Magnum/Platform/NaClApplication.h similarity index 99% rename from src/Platform/NaClApplication.h rename to src/Magnum/Platform/NaClApplication.h index 24668163c..08c4fc433 100644 --- a/src/Platform/NaClApplication.h +++ b/src/Magnum/Platform/NaClApplication.h @@ -29,7 +29,8 @@ */ #include -#include +#include +#include #include #include #include @@ -37,11 +38,9 @@ #include #include -#include "Platform/Platform.h" -#include "Math/Vector2.h" -#include "Magnum.h" - -#include "corradeCompatibility.h" +#include "Magnum/Magnum.h" +#include "Magnum/Math/Vector2.h" +#include "Magnum/Platform/Platform.h" namespace pp { class Graphics3D; diff --git a/src/Platform/NaClApplication.js b/src/Magnum/Platform/NaClApplication.js similarity index 100% rename from src/Platform/NaClApplication.js rename to src/Magnum/Platform/NaClApplication.js diff --git a/src/Platform/Platform.h b/src/Magnum/Platform/Platform.h similarity index 100% rename from src/Platform/Platform.h rename to src/Magnum/Platform/Platform.h diff --git a/src/Platform/Screen.h b/src/Magnum/Platform/Screen.h similarity index 99% rename from src/Platform/Screen.h rename to src/Magnum/Platform/Screen.h index 805fbd2f2..f3599fba4 100644 --- a/src/Platform/Screen.h +++ b/src/Magnum/Platform/Screen.h @@ -28,9 +28,9 @@ * @brief Class @ref Magnum::Platform::BasicScreen */ -#include +#include -#include "Platform/ScreenedApplication.h" +#include "Magnum/Platform/ScreenedApplication.h" namespace Magnum { namespace Platform { diff --git a/src/Platform/ScreenedApplication.h b/src/Magnum/Platform/ScreenedApplication.h similarity index 98% rename from src/Platform/ScreenedApplication.h rename to src/Magnum/Platform/ScreenedApplication.h index 922125a7c..1abd30fc2 100644 --- a/src/Platform/ScreenedApplication.h +++ b/src/Magnum/Platform/ScreenedApplication.h @@ -28,10 +28,10 @@ * @brief Class @ref Magnum::Platform::BasicScreenedApplication */ -#include -#include +#include -#include "Platform/Platform.h" +#include "Magnum/Magnum.h" +#include "Magnum/Platform/Platform.h" namespace Magnum { namespace Platform { diff --git a/src/Platform/ScreenedApplication.hpp b/src/Magnum/Platform/ScreenedApplication.hpp similarity index 98% rename from src/Platform/ScreenedApplication.hpp rename to src/Magnum/Platform/ScreenedApplication.hpp index b01dd9189..9546eb06d 100644 --- a/src/Platform/ScreenedApplication.hpp +++ b/src/Magnum/Platform/ScreenedApplication.hpp @@ -26,9 +26,8 @@ * @brief @ref compilation-speedup-hpp "Template implementation" for @ref ScreenedApplication.h and @ref Screen.h */ -#include "ScreenedApplication.h" - -#include "Platform/Screen.h" +#include "Magnum/Platform/Screen.h" +#include "Magnum/Platform/ScreenedApplication.h" namespace Magnum { namespace Platform { diff --git a/src/Platform/Sdl2Application.cpp b/src/Magnum/Platform/Sdl2Application.cpp similarity index 96% rename from src/Platform/Sdl2Application.cpp rename to src/Magnum/Platform/Sdl2Application.cpp index 9429c839a..cb642ac65 100644 --- a/src/Platform/Sdl2Application.cpp +++ b/src/Magnum/Platform/Sdl2Application.cpp @@ -30,9 +30,9 @@ #include #endif -#include "Context.h" -#include "Version.h" -#include "Platform/ScreenedApplication.hpp" +#include "Magnum/Context.h" +#include "Magnum/Version.h" +#include "Magnum/Platform/ScreenedApplication.hpp" namespace Magnum { namespace Platform { @@ -115,8 +115,8 @@ bool Sdl2Application::tryCreateContext(const Configuration& configuration) { SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, configuration.sampleCount()); /* Flags: if not hidden, set as shown */ - Uint32 flags(configuration.flags()); - if(!(configuration.flags() & Configuration::Flag::Hidden)) flags |= SDL_WINDOW_SHOWN; + Uint32 windowFlags(configuration.windowFlags()); + if(!(configuration.windowFlags() & Configuration::WindowFlag::Hidden)) windowFlags |= SDL_WINDOW_SHOWN; /** @todo Remove when Emscripten has proper SDL2 support */ #ifndef CORRADE_TARGET_EMSCRIPTEN @@ -164,7 +164,7 @@ bool Sdl2Application::tryCreateContext(const Configuration& configuration) { if(!(window = SDL_CreateWindow(configuration.title().data(), SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, configuration.size().x(), configuration.size().y(), - SDL_WINDOW_OPENGL|flags))) + SDL_WINDOW_OPENGL|windowFlags))) { Error() << "Platform::Sdl2Application::tryCreateContext(): cannot create window:" << SDL_GetError(); return false; @@ -334,7 +334,11 @@ Sdl2Application::Configuration::Configuration(): #ifndef CORRADE_TARGET_EMSCRIPTEN _title("Magnum SDL2 Application"), #endif - _size(800, 600), _flags(Flag::Resizable), _sampleCount(0), _version(Version::None) {} + _size(800, 600), _windowFlags(WindowFlag::Resizable), _sampleCount(0) + #ifndef CORRADE_TARGET_EMSCRIPTEN + , _version(Version::None) + #endif + {} Sdl2Application::Configuration::~Configuration() = default; diff --git a/src/Platform/Sdl2Application.h b/src/Magnum/Platform/Sdl2Application.h similarity index 92% rename from src/Platform/Sdl2Application.h rename to src/Magnum/Platform/Sdl2Application.h index a71b9620b..501c2497b 100644 --- a/src/Platform/Sdl2Application.h +++ b/src/Magnum/Platform/Sdl2Application.h @@ -28,12 +28,12 @@ * @brief Class @ref Magnum::Platform::Sdl2Application */ -#include -#include +#include +#include -#include "Platform/Platform.h" -#include "Math/Vector2.h" -#include "Magnum.h" +#include "Magnum/Magnum.h" +#include "Magnum/Math/Vector2.h" +#include "Magnum/Platform/Platform.h" #ifdef CORRADE_TARGET_WINDOWS /* Windows version of SDL2 redefines main(), we don't want that */ #define SDL_MAIN_HANDLED @@ -42,7 +42,11 @@ #include #ifdef CORRADE_GCC45_COMPATIBILITY -#include "Version.h" +#include "Magnum/Version.h" +#endif + +#ifdef MAGNUM_BUILD_DEPRECATED +#include #endif namespace Magnum { @@ -378,9 +382,9 @@ class Sdl2Application::Configuration { /** * @brief Window flag * - * @see @ref Flags, @ref setFlags() + * @see @ref WindowFlags, @ref setWindowFlags() */ - enum class Flag: Uint32 { + enum class WindowFlag: Uint32 { Resizable = SDL_WINDOW_RESIZABLE, /**< Resizable window */ Fullscreen = SDL_WINDOW_FULLSCREEN, /**< Fullscreen window */ Hidden = SDL_WINDOW_HIDDEN, /**< Hidden window */ @@ -389,14 +393,30 @@ class Sdl2Application::Configuration { MouseLocked = SDL_WINDOW_INPUT_GRABBED /**< Window with mouse locked */ }; + #ifdef MAGNUM_BUILD_DEPRECATED + /** + * @copybrief WindowFlag + * @deprecated Use @ref Magnum::Platform::Sdl2Application::Configuration::WindowFlag "WindowFlag" instead. + */ + typedef CORRADE_DEPRECATED("use WindowFlag instead") WindowFlag Flag; + #endif + /** * @brief Window flags * * @see @ref setFlags() */ - typedef Containers::EnumSet Flags; + SDL_WINDOW_MINIMIZED|SDL_WINDOW_INPUT_GRABBED> WindowFlags; + + #ifdef MAGNUM_BUILD_DEPRECATED + /** + * @copybrief WindowFlags + * @deprecated Use @ref Magnum::Platform::Sdl2Application::Configuration::WindowFlags "WindowFlags" instead. + */ + typedef CORRADE_DEPRECATED("use WindowFlags instead") WindowFlags Flags; + #endif /*implicit*/ Configuration(); ~Configuration(); @@ -443,19 +463,39 @@ class Sdl2Application::Configuration { } /** @brief Window flags */ - Flags flags() const { return _flags; } + WindowFlags windowFlags() const { return _windowFlags; } + + #ifdef MAGNUM_BUILD_DEPRECATED + /** + * @copybrief windowFlags() + * @deprecated Use @ref Magnum::Platform::Sdl2Application::Configuration::windowFlags() "windowFlags()" instead. + */ + CORRADE_DEPRECATED("use windowFlags() instead") WindowFlags flags() const { + return windowFlags(); + } + #endif /** * @brief Set window flags * @return Reference to self (for method chaining) * - * Default is @ref Flag::Resizable. + * Default is @ref WindowFlag::Resizable. */ - Configuration& setFlags(const Flags flags) { - _flags = flags; + Configuration& setWindowFlags(WindowFlags flags) { + _windowFlags = flags; return *this; } + #ifdef MAGNUM_BUILD_DEPRECATED + /** + * @copybrief setWindowFlags() + * @deprecated Use @ref Magnum::Platform::Sdl2Application::Configuration::setWindowFlags "setWindowFlags()" instead. + */ + CORRADE_DEPRECATED("use setWindowFlags() instead") Configuration& setFlags(WindowFlags flags) { + return setWindowFlags(flags); + } + #endif + #ifndef CORRADE_TARGET_EMSCRIPTEN /** * @brief Context version @@ -504,12 +544,14 @@ class Sdl2Application::Configuration { std::string _title; #endif Vector2i _size; - Flags _flags; + WindowFlags _windowFlags; Int _sampleCount; + #ifndef CORRADE_TARGET_EMSCRIPTEN Version _version; + #endif }; -CORRADE_ENUMSET_OPERATORS(Sdl2Application::Configuration::Flags) +CORRADE_ENUMSET_OPERATORS(Sdl2Application::Configuration::WindowFlags) /** @brief Base for input events diff --git a/src/Platform/WebApplication.css b/src/Magnum/Platform/WebApplication.css similarity index 100% rename from src/Platform/WebApplication.css rename to src/Magnum/Platform/WebApplication.css diff --git a/src/Platform/WindowlessGlxApplication.cpp b/src/Magnum/Platform/WindowlessGlxApplication.cpp similarity index 97% rename from src/Platform/WindowlessGlxApplication.cpp rename to src/Magnum/Platform/WindowlessGlxApplication.cpp index e95d28032..ca36a1b29 100644 --- a/src/Platform/WindowlessGlxApplication.cpp +++ b/src/Magnum/Platform/WindowlessGlxApplication.cpp @@ -24,10 +24,10 @@ #include "WindowlessGlxApplication.h" -#include -#include +#include +#include -#include "Context.h" +#include "Magnum/Context.h" #define None 0L // redef Xlib nonsense diff --git a/src/Platform/WindowlessGlxApplication.h b/src/Magnum/Platform/WindowlessGlxApplication.h similarity index 99% rename from src/Platform/WindowlessGlxApplication.h rename to src/Magnum/Platform/WindowlessGlxApplication.h index 14e0931d6..129432e83 100644 --- a/src/Platform/WindowlessGlxApplication.h +++ b/src/Magnum/Platform/WindowlessGlxApplication.h @@ -29,16 +29,18 @@ */ #include -#include "OpenGL.h" + +#include "Magnum/OpenGL.h" #include #include #include /* undef Xlib nonsense to avoid conflicts */ +#undef Always #undef Complex #undef None -#undef Always +#undef Status -#include "Magnum.h" +#include "Magnum/Magnum.h" namespace Magnum { namespace Platform { diff --git a/src/Platform/WindowlessNaClApplication.cpp b/src/Magnum/Platform/WindowlessNaClApplication.cpp similarity index 97% rename from src/Platform/WindowlessNaClApplication.cpp rename to src/Magnum/Platform/WindowlessNaClApplication.cpp index 89e3f6f19..ab4a4e0dd 100644 --- a/src/Platform/WindowlessNaClApplication.cpp +++ b/src/Magnum/Platform/WindowlessNaClApplication.cpp @@ -26,10 +26,10 @@ #include #include -#include -#include +#include +#include -#include "Context.h" +#include "Magnum/Context.h" namespace Magnum { namespace Platform { diff --git a/src/Platform/WindowlessNaClApplication.h b/src/Magnum/Platform/WindowlessNaClApplication.h similarity index 98% rename from src/Platform/WindowlessNaClApplication.h rename to src/Magnum/Platform/WindowlessNaClApplication.h index 6f6c88ee5..a1921e7b6 100644 --- a/src/Platform/WindowlessNaClApplication.h +++ b/src/Magnum/Platform/WindowlessNaClApplication.h @@ -29,15 +29,14 @@ */ #include -#include +#include +#include #include #include #include #include -#include "Magnum.h" - -#include "corradeCompatibility.h" +#include "Magnum/Magnum.h" namespace pp { class Graphics3D; diff --git a/src/Platform/XEglApplication.cpp b/src/Magnum/Platform/XEglApplication.cpp similarity index 94% rename from src/Platform/XEglApplication.cpp rename to src/Magnum/Platform/XEglApplication.cpp index 7640cc2f2..3cb656cbb 100644 --- a/src/Platform/XEglApplication.cpp +++ b/src/Magnum/Platform/XEglApplication.cpp @@ -24,8 +24,8 @@ #include "XEglApplication.h" -#include "Platform/ScreenedApplication.hpp" -#include "Platform/Implementation/EglContextHandler.h" +#include "Magnum/Platform/ScreenedApplication.hpp" +#include "Magnum/Platform/Implementation/EglContextHandler.h" namespace Magnum { namespace Platform { diff --git a/src/Platform/XEglApplication.h b/src/Magnum/Platform/XEglApplication.h similarity index 98% rename from src/Platform/XEglApplication.h rename to src/Magnum/Platform/XEglApplication.h index 67cedc268..f22f35e37 100644 --- a/src/Platform/XEglApplication.h +++ b/src/Magnum/Platform/XEglApplication.h @@ -28,8 +28,8 @@ * @brief Class @ref Magnum::Platform::XEglApplication */ -#include "Platform/Platform.h" -#include "Platform/AbstractXApplication.h" +#include "Magnum/Platform/Platform.h" +#include "Magnum/Platform/AbstractXApplication.h" namespace Magnum { namespace Platform { diff --git a/src/Platform/magnum-info-nacl.html b/src/Magnum/Platform/magnum-info-nacl.html similarity index 100% rename from src/Platform/magnum-info-nacl.html rename to src/Magnum/Platform/magnum-info-nacl.html diff --git a/src/Platform/magnum-info-nacl.nmf b/src/Magnum/Platform/magnum-info-nacl.nmf similarity index 100% rename from src/Platform/magnum-info-nacl.nmf rename to src/Magnum/Platform/magnum-info-nacl.nmf diff --git a/src/Platform/magnum-info.cpp b/src/Magnum/Platform/magnum-info.cpp similarity index 96% rename from src/Platform/magnum-info.cpp rename to src/Magnum/Platform/magnum-info.cpp index 0bd047c90..ff83a7f79 100644 --- a/src/Platform/magnum-info.cpp +++ b/src/Magnum/Platform/magnum-info.cpp @@ -22,27 +22,29 @@ DEALINGS IN THE SOFTWARE. */ -#include -#include -#include +#include +#include +#include #ifdef CORRADE_TARGET_NACL -#include +#include #endif -#include "AbstractShaderProgram.h" -#include "Buffer.h" -#include "BufferTexture.h" -#include "Context.h" -#include "DebugMessage.h" -#include "Extensions.h" -#include "Framebuffer.h" -#include "Mesh.h" -#include "Renderbuffer.h" -#include "Shader.h" +#include "Magnum/AbstractShaderProgram.h" +#include "Magnum/Buffer.h" +#ifndef MAGNUM_TARGET_GLES +#include "Magnum/BufferTexture.h" +#endif +#include "Magnum/Context.h" +#include "Magnum/DebugMessage.h" +#include "Magnum/Extensions.h" +#include "Magnum/Framebuffer.h" +#include "Magnum/Mesh.h" +#include "Magnum/Renderbuffer.h" +#include "Magnum/Shader.h" #ifndef CORRADE_TARGET_NACL -#include "Platform/WindowlessGlxApplication.h" +#include "Magnum/Platform/WindowlessGlxApplication.h" #else -#include "Platform/WindowlessNaClApplication.h" +#include "Magnum/Platform/WindowlessNaClApplication.h" #endif namespace Magnum { diff --git a/src/Primitives/CMakeLists.txt b/src/Magnum/Primitives/CMakeLists.txt similarity index 98% rename from src/Primitives/CMakeLists.txt rename to src/Magnum/Primitives/CMakeLists.txt index c58cb02df..2d930edbc 100644 --- a/src/Primitives/CMakeLists.txt +++ b/src/Magnum/Primitives/CMakeLists.txt @@ -49,7 +49,7 @@ set(MagnumPrimitives_HEADERS Square.h UVSphere.h - magnumPrimitivesVisibility.h) + visibility.h) add_library(MagnumPrimitives ${SHARED_OR_STATIC} ${MagnumPrimitives_SRCS}) if(BUILD_STATIC_PIC) diff --git a/src/Primitives/Capsule.cpp b/src/Magnum/Primitives/Capsule.cpp similarity index 95% rename from src/Primitives/Capsule.cpp rename to src/Magnum/Primitives/Capsule.cpp index dffd2fe22..c68e0ce08 100644 --- a/src/Primitives/Capsule.cpp +++ b/src/Magnum/Primitives/Capsule.cpp @@ -24,13 +24,13 @@ #include "Capsule.h" -#include "Math/Vector3.h" -#include "Math/Functions.h" -#include "Mesh.h" -#include "Primitives/Implementation/Spheroid.h" -#include "Primitives/Implementation/WireframeSpheroid.h" -#include "Trade/MeshData2D.h" -#include "Trade/MeshData3D.h" +#include "Magnum/Math/Vector3.h" +#include "Magnum/Math/Functions.h" +#include "Magnum/Mesh.h" +#include "Magnum/Primitives/Implementation/Spheroid.h" +#include "Magnum/Primitives/Implementation/WireframeSpheroid.h" +#include "Magnum/Trade/MeshData2D.h" +#include "Magnum/Trade/MeshData3D.h" namespace Magnum { namespace Primitives { diff --git a/src/Primitives/Capsule.h b/src/Magnum/Primitives/Capsule.h similarity index 98% rename from src/Primitives/Capsule.h rename to src/Magnum/Primitives/Capsule.h index 35508fe9e..42024300c 100644 --- a/src/Primitives/Capsule.h +++ b/src/Magnum/Primitives/Capsule.h @@ -28,8 +28,8 @@ * @brief Class Magnum::Primitives::Capsule */ -#include "Primitives/magnumPrimitivesVisibility.h" -#include "Trade/Trade.h" +#include "Magnum/Primitives/visibility.h" +#include "Magnum/Trade/Trade.h" namespace Magnum { namespace Primitives { diff --git a/src/Primitives/Circle.cpp b/src/Magnum/Primitives/Circle.cpp similarity index 95% rename from src/Primitives/Circle.cpp rename to src/Magnum/Primitives/Circle.cpp index 73ecd5233..40106154c 100644 --- a/src/Primitives/Circle.cpp +++ b/src/Magnum/Primitives/Circle.cpp @@ -24,10 +24,10 @@ #include "Circle.h" -#include "Math/Functions.h" -#include "Math/Vector2.h" -#include "Mesh.h" -#include "Trade/MeshData2D.h" +#include "Magnum/Math/Functions.h" +#include "Magnum/Math/Vector2.h" +#include "Magnum/Mesh.h" +#include "Magnum/Trade/MeshData2D.h" namespace Magnum { namespace Primitives { diff --git a/src/Primitives/Circle.h b/src/Magnum/Primitives/Circle.h similarity index 96% rename from src/Primitives/Circle.h rename to src/Magnum/Primitives/Circle.h index e0829c982..6f0c45247 100644 --- a/src/Primitives/Circle.h +++ b/src/Magnum/Primitives/Circle.h @@ -28,9 +28,8 @@ * @brief Class Magnum::Primitives::Circle */ -#include "Trade/Trade.h" - -#include "Primitives/magnumPrimitivesVisibility.h" +#include "Magnum/Primitives/visibility.h" +#include "Magnum/Trade/Trade.h" namespace Magnum { namespace Primitives { diff --git a/src/Primitives/Crosshair.cpp b/src/Magnum/Primitives/Crosshair.cpp similarity index 93% rename from src/Primitives/Crosshair.cpp rename to src/Magnum/Primitives/Crosshair.cpp index 332c205f0..3114f4d51 100644 --- a/src/Primitives/Crosshair.cpp +++ b/src/Magnum/Primitives/Crosshair.cpp @@ -24,10 +24,10 @@ #include "Crosshair.h" -#include "Math/Vector3.h" -#include "Mesh.h" -#include "Trade/MeshData2D.h" -#include "Trade/MeshData3D.h" +#include "Magnum/Mesh.h" +#include "Magnum/Math/Vector3.h" +#include "Magnum/Trade/MeshData2D.h" +#include "Magnum/Trade/MeshData3D.h" namespace Magnum { namespace Primitives { diff --git a/src/Primitives/Crosshair.h b/src/Magnum/Primitives/Crosshair.h similarity index 96% rename from src/Primitives/Crosshair.h rename to src/Magnum/Primitives/Crosshair.h index eae905e2e..3c48354f1 100644 --- a/src/Primitives/Crosshair.h +++ b/src/Magnum/Primitives/Crosshair.h @@ -28,9 +28,8 @@ * @brief Class Magnum::Primitives::Crosshair2D, Magnum::Primitives::Crosshair3D */ -#include "Trade/Trade.h" - -#include "Primitives/magnumPrimitivesVisibility.h" +#include "Magnum/Primitives/visibility.h" +#include "Magnum/Trade/Trade.h" namespace Magnum { namespace Primitives { diff --git a/src/Primitives/Cube.cpp b/src/Magnum/Primitives/Cube.cpp similarity index 97% rename from src/Primitives/Cube.cpp rename to src/Magnum/Primitives/Cube.cpp index 7008fc125..fe2d2313d 100644 --- a/src/Primitives/Cube.cpp +++ b/src/Magnum/Primitives/Cube.cpp @@ -24,9 +24,9 @@ #include "Cube.h" -#include "Math/Vector3.h" -#include "Mesh.h" -#include "Trade/MeshData3D.h" +#include "Magnum/Mesh.h" +#include "Magnum/Math/Vector3.h" +#include "Magnum/Trade/MeshData3D.h" namespace Magnum { namespace Primitives { diff --git a/src/Primitives/Cube.h b/src/Magnum/Primitives/Cube.h similarity index 95% rename from src/Primitives/Cube.h rename to src/Magnum/Primitives/Cube.h index 653db9e9a..a1bc9681f 100644 --- a/src/Primitives/Cube.h +++ b/src/Magnum/Primitives/Cube.h @@ -28,9 +28,8 @@ * @brief Class Magnum::Primitives::Cube */ -#include "Trade/Trade.h" - -#include "Primitives/magnumPrimitivesVisibility.h" +#include "Magnum/Primitives/visibility.h" +#include "Magnum/Trade/Trade.h" namespace Magnum { namespace Primitives { diff --git a/src/Primitives/Cylinder.cpp b/src/Magnum/Primitives/Cylinder.cpp similarity index 94% rename from src/Primitives/Cylinder.cpp rename to src/Magnum/Primitives/Cylinder.cpp index 90212132a..77ff9f69f 100644 --- a/src/Primitives/Cylinder.cpp +++ b/src/Magnum/Primitives/Cylinder.cpp @@ -24,11 +24,11 @@ #include "Cylinder.h" -#include "Math/Vector3.h" -#include "Mesh.h" -#include "Primitives/Implementation/Spheroid.h" -#include "Primitives/Implementation/WireframeSpheroid.h" -#include "Trade/MeshData3D.h" +#include "Magnum/Mesh.h" +#include "Magnum/Math/Vector3.h" +#include "Magnum/Primitives/Implementation/Spheroid.h" +#include "Magnum/Primitives/Implementation/WireframeSpheroid.h" +#include "Magnum/Trade/MeshData3D.h" namespace Magnum { namespace Primitives { diff --git a/src/Primitives/Cylinder.h b/src/Magnum/Primitives/Cylinder.h similarity index 95% rename from src/Primitives/Cylinder.h rename to src/Magnum/Primitives/Cylinder.h index bc95ad19a..5e696f166 100644 --- a/src/Primitives/Cylinder.h +++ b/src/Magnum/Primitives/Cylinder.h @@ -28,11 +28,11 @@ * @brief Class Magnum::Primitives::Cylinder */ -#include +#include -#include "Magnum.h" -#include "Primitives/magnumPrimitivesVisibility.h" -#include "Trade/Trade.h" +#include "Magnum/Magnum.h" +#include "Magnum/Primitives/visibility.h" +#include "Magnum/Trade/Trade.h" namespace Magnum { namespace Primitives { diff --git a/src/Primitives/Icosphere.cpp b/src/Magnum/Primitives/Icosphere.cpp similarity index 93% rename from src/Primitives/Icosphere.cpp rename to src/Magnum/Primitives/Icosphere.cpp index e888969a5..d0988da0e 100644 --- a/src/Primitives/Icosphere.cpp +++ b/src/Magnum/Primitives/Icosphere.cpp @@ -24,11 +24,11 @@ #include "Icosphere.h" -#include "Math/Vector3.h" -#include "Mesh.h" -#include "MeshTools/Subdivide.h" -#include "MeshTools/RemoveDuplicates.h" -#include "Trade/MeshData3D.h" +#include "Magnum/Mesh.h" +#include "Magnum/Math/Vector3.h" +#include "Magnum/MeshTools/Subdivide.h" +#include "Magnum/MeshTools/RemoveDuplicates.h" +#include "Magnum/Trade/MeshData3D.h" namespace Magnum { namespace Primitives { diff --git a/src/Primitives/Icosphere.h b/src/Magnum/Primitives/Icosphere.h similarity index 95% rename from src/Primitives/Icosphere.h rename to src/Magnum/Primitives/Icosphere.h index 7ac15e4a2..72eee9fa1 100644 --- a/src/Primitives/Icosphere.h +++ b/src/Magnum/Primitives/Icosphere.h @@ -28,9 +28,8 @@ * @brief Class Magnum::Primitives::Icosphere */ -#include "Trade/Trade.h" - -#include "Primitives/magnumPrimitivesVisibility.h" +#include "Magnum/Primitives/visibility.h" +#include "Magnum/Trade/Trade.h" namespace Magnum { namespace Primitives { diff --git a/src/Primitives/Implementation/Spheroid.cpp b/src/Magnum/Primitives/Implementation/Spheroid.cpp similarity index 98% rename from src/Primitives/Implementation/Spheroid.cpp rename to src/Magnum/Primitives/Implementation/Spheroid.cpp index 05d2e50a7..3b97429a2 100644 --- a/src/Primitives/Implementation/Spheroid.cpp +++ b/src/Magnum/Primitives/Implementation/Spheroid.cpp @@ -24,10 +24,10 @@ #include "Spheroid.h" -#include "Math/Functions.h" -#include "Math/Vector3.h" -#include "Mesh.h" -#include "Trade/MeshData3D.h" +#include "Magnum/Math/Functions.h" +#include "Magnum/Math/Vector3.h" +#include "Magnum/Mesh.h" +#include "Magnum/Trade/MeshData3D.h" namespace Magnum { namespace Primitives { namespace Implementation { diff --git a/src/Primitives/Implementation/Spheroid.h b/src/Magnum/Primitives/Implementation/Spheroid.h similarity index 97% rename from src/Primitives/Implementation/Spheroid.h rename to src/Magnum/Primitives/Implementation/Spheroid.h index 16921141e..fd31112d8 100644 --- a/src/Primitives/Implementation/Spheroid.h +++ b/src/Magnum/Primitives/Implementation/Spheroid.h @@ -26,8 +26,8 @@ #include -#include "Magnum.h" -#include "Trade/Trade.h" +#include "Magnum/Magnum.h" +#include "Magnum/Trade/Trade.h" namespace Magnum { namespace Primitives { namespace Implementation { diff --git a/src/Primitives/Implementation/WireframeSpheroid.cpp b/src/Magnum/Primitives/Implementation/WireframeSpheroid.cpp similarity index 97% rename from src/Primitives/Implementation/WireframeSpheroid.cpp rename to src/Magnum/Primitives/Implementation/WireframeSpheroid.cpp index 4b242ac76..4045f3ff4 100644 --- a/src/Primitives/Implementation/WireframeSpheroid.cpp +++ b/src/Magnum/Primitives/Implementation/WireframeSpheroid.cpp @@ -24,10 +24,10 @@ #include "WireframeSpheroid.h" -#include "Math/Functions.h" -#include "Math/Vector3.h" -#include "Mesh.h" -#include "Trade/MeshData3D.h" +#include "Magnum/Math/Functions.h" +#include "Magnum/Math/Vector3.h" +#include "Magnum/Mesh.h" +#include "Magnum/Trade/MeshData3D.h" namespace Magnum { namespace Primitives { namespace Implementation { diff --git a/src/Primitives/Implementation/WireframeSpheroid.h b/src/Magnum/Primitives/Implementation/WireframeSpheroid.h similarity index 96% rename from src/Primitives/Implementation/WireframeSpheroid.h rename to src/Magnum/Primitives/Implementation/WireframeSpheroid.h index 04f40fc5f..6b1ea0f74 100644 --- a/src/Primitives/Implementation/WireframeSpheroid.h +++ b/src/Magnum/Primitives/Implementation/WireframeSpheroid.h @@ -26,8 +26,8 @@ #include -#include "Magnum.h" -#include "Trade/Trade.h" +#include "Magnum/Magnum.h" +#include "Magnum/Trade/Trade.h" namespace Magnum { namespace Primitives { namespace Implementation { diff --git a/src/Primitives/Line.cpp b/src/Magnum/Primitives/Line.cpp similarity index 93% rename from src/Primitives/Line.cpp rename to src/Magnum/Primitives/Line.cpp index 13ac87f52..e33eb502f 100644 --- a/src/Primitives/Line.cpp +++ b/src/Magnum/Primitives/Line.cpp @@ -24,10 +24,10 @@ #include "Line.h" -#include "Math/Vector3.h" -#include "Mesh.h" -#include "Trade/MeshData2D.h" -#include "Trade/MeshData3D.h" +#include "Magnum/Mesh.h" +#include "Magnum/Math/Vector3.h" +#include "Magnum/Trade/MeshData2D.h" +#include "Magnum/Trade/MeshData3D.h" namespace Magnum { namespace Primitives { diff --git a/src/Primitives/Line.h b/src/Magnum/Primitives/Line.h similarity index 96% rename from src/Primitives/Line.h rename to src/Magnum/Primitives/Line.h index 868e963bd..a82a8d682 100644 --- a/src/Primitives/Line.h +++ b/src/Magnum/Primitives/Line.h @@ -28,9 +28,8 @@ * @brief Class Magnum::Primitives::Line2D, Magnum::Primitives::Line3D */ -#include "Trade/Trade.h" - -#include "Primitives/magnumPrimitivesVisibility.h" +#include "Magnum/Primitives/visibility.h" +#include "Magnum/Trade/Trade.h" namespace Magnum { namespace Primitives { diff --git a/src/Primitives/Plane.cpp b/src/Magnum/Primitives/Plane.cpp similarity index 96% rename from src/Primitives/Plane.cpp rename to src/Magnum/Primitives/Plane.cpp index 7df2642f6..e3f565e9d 100644 --- a/src/Primitives/Plane.cpp +++ b/src/Magnum/Primitives/Plane.cpp @@ -24,9 +24,9 @@ #include "Plane.h" -#include "Math/Vector3.h" -#include "Mesh.h" -#include "Trade/MeshData3D.h" +#include "Magnum/Math/Vector3.h" +#include "Magnum/Mesh.h" +#include "Magnum/Trade/MeshData3D.h" namespace Magnum { namespace Primitives { diff --git a/src/Primitives/Plane.h b/src/Magnum/Primitives/Plane.h similarity index 96% rename from src/Primitives/Plane.h rename to src/Magnum/Primitives/Plane.h index efdc08d02..20abc3ce6 100644 --- a/src/Primitives/Plane.h +++ b/src/Magnum/Primitives/Plane.h @@ -28,9 +28,8 @@ * @brief Class Magnum::Primitives::Plane */ -#include "Trade/Trade.h" - -#include "Primitives/magnumPrimitivesVisibility.h" +#include "Magnum/Trade/Trade.h" +#include "Magnum/Primitives/visibility.h" namespace Magnum { namespace Primitives { diff --git a/src/Primitives/Square.cpp b/src/Magnum/Primitives/Square.cpp similarity index 95% rename from src/Primitives/Square.cpp rename to src/Magnum/Primitives/Square.cpp index 4e48010f7..e20dbcb8d 100644 --- a/src/Primitives/Square.cpp +++ b/src/Magnum/Primitives/Square.cpp @@ -24,9 +24,9 @@ #include "Square.h" -#include "Math/Vector2.h" -#include "Mesh.h" -#include "Trade/MeshData2D.h" +#include "Magnum/Mesh.h" +#include "Magnum/Math/Vector2.h" +#include "Magnum/Trade/MeshData2D.h" namespace Magnum { namespace Primitives { diff --git a/src/Primitives/Square.h b/src/Magnum/Primitives/Square.h similarity index 96% rename from src/Primitives/Square.h rename to src/Magnum/Primitives/Square.h index 85993082a..eb88743e4 100644 --- a/src/Primitives/Square.h +++ b/src/Magnum/Primitives/Square.h @@ -28,9 +28,8 @@ * @brief Class Magnum::Primitives::Square */ -#include "Trade/Trade.h" - -#include "Primitives/magnumPrimitivesVisibility.h" +#include "Magnum/Primitives/visibility.h" +#include "Magnum/Trade/Trade.h" namespace Magnum { namespace Primitives { diff --git a/src/Primitives/Test/CMakeLists.txt b/src/Magnum/Primitives/Test/CMakeLists.txt similarity index 100% rename from src/Primitives/Test/CMakeLists.txt rename to src/Magnum/Primitives/Test/CMakeLists.txt diff --git a/src/Primitives/Test/CapsuleTest.cpp b/src/Magnum/Primitives/Test/CapsuleTest.cpp similarity index 97% rename from src/Primitives/Test/CapsuleTest.cpp rename to src/Magnum/Primitives/Test/CapsuleTest.cpp index bfeb02f75..ce34dc991 100644 --- a/src/Primitives/Test/CapsuleTest.cpp +++ b/src/Magnum/Primitives/Test/CapsuleTest.cpp @@ -25,13 +25,13 @@ /* Less precision */ #define FLOAT_EQUALITY_PRECISION 1.0e-5 -#include -#include +#include +#include -#include "Math/Vector3.h" -#include "Trade/MeshData2D.h" -#include "Trade/MeshData3D.h" -#include "Primitives/Capsule.h" +#include "Magnum/Math/Vector3.h" +#include "Magnum/Trade/MeshData2D.h" +#include "Magnum/Trade/MeshData3D.h" +#include "Magnum/Primitives/Capsule.h" namespace Magnum { namespace Primitives { namespace Test { diff --git a/src/Primitives/Test/CircleTest.cpp b/src/Magnum/Primitives/Test/CircleTest.cpp similarity index 94% rename from src/Primitives/Test/CircleTest.cpp rename to src/Magnum/Primitives/Test/CircleTest.cpp index 0817261d9..19953f8d1 100644 --- a/src/Primitives/Test/CircleTest.cpp +++ b/src/Magnum/Primitives/Test/CircleTest.cpp @@ -22,11 +22,11 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include -#include "Math/Vector2.h" -#include "Primitives/Circle.h" -#include "Trade/MeshData2D.h" +#include "Magnum/Math/Vector2.h" +#include "Magnum/Primitives/Circle.h" +#include "Magnum/Trade/MeshData2D.h" namespace Magnum { namespace Primitives { namespace Test { diff --git a/src/Primitives/Test/CylinderTest.cpp b/src/Magnum/Primitives/Test/CylinderTest.cpp similarity index 97% rename from src/Primitives/Test/CylinderTest.cpp rename to src/Magnum/Primitives/Test/CylinderTest.cpp index 545ec3780..1d1215225 100644 --- a/src/Primitives/Test/CylinderTest.cpp +++ b/src/Magnum/Primitives/Test/CylinderTest.cpp @@ -22,12 +22,12 @@ DEALINGS IN THE SOFTWARE. */ -#include -#include +#include +#include -#include "Math/Vector3.h" -#include "Primitives/Cylinder.h" -#include "Trade/MeshData3D.h" +#include "Magnum/Math/Vector3.h" +#include "Magnum/Primitives/Cylinder.h" +#include "Magnum/Trade/MeshData3D.h" namespace Magnum { namespace Primitives { namespace Test { diff --git a/src/Primitives/Test/IcosphereTest.cpp b/src/Magnum/Primitives/Test/IcosphereTest.cpp similarity index 92% rename from src/Primitives/Test/IcosphereTest.cpp rename to src/Magnum/Primitives/Test/IcosphereTest.cpp index e3cbd9ca9..597b7ac74 100644 --- a/src/Primitives/Test/IcosphereTest.cpp +++ b/src/Magnum/Primitives/Test/IcosphereTest.cpp @@ -22,11 +22,11 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include -#include "Math/Vector3.h" -#include "Primitives/Icosphere.h" -#include "Trade/MeshData3D.h" +#include "Magnum/Math/Vector3.h" +#include "Magnum/Primitives/Icosphere.h" +#include "Magnum/Trade/MeshData3D.h" namespace Magnum { namespace Primitives { namespace Test { diff --git a/src/Primitives/Test/UVSphereTest.cpp b/src/Magnum/Primitives/Test/UVSphereTest.cpp similarity index 96% rename from src/Primitives/Test/UVSphereTest.cpp rename to src/Magnum/Primitives/Test/UVSphereTest.cpp index 831d1bfef..c6855b3b5 100644 --- a/src/Primitives/Test/UVSphereTest.cpp +++ b/src/Magnum/Primitives/Test/UVSphereTest.cpp @@ -22,12 +22,12 @@ DEALINGS IN THE SOFTWARE. */ -#include -#include +#include +#include -#include "Math/Vector3.h" -#include "Primitives/UVSphere.h" -#include "Trade/MeshData3D.h" +#include "Magnum/Math/Vector3.h" +#include "Magnum/Primitives/UVSphere.h" +#include "Magnum/Trade/MeshData3D.h" namespace Magnum { namespace Primitives { namespace Test { diff --git a/src/Primitives/UVSphere.cpp b/src/Magnum/Primitives/UVSphere.cpp similarity index 93% rename from src/Primitives/UVSphere.cpp rename to src/Magnum/Primitives/UVSphere.cpp index 16d91bf10..33dd232d2 100644 --- a/src/Primitives/UVSphere.cpp +++ b/src/Magnum/Primitives/UVSphere.cpp @@ -24,11 +24,11 @@ #include "UVSphere.h" -#include "Math/Vector3.h" -#include "Mesh.h" -#include "Primitives/Implementation/Spheroid.h" -#include "Primitives/Implementation/WireframeSpheroid.h" -#include "Trade/MeshData3D.h" +#include "Magnum/Mesh.h" +#include "Magnum/Math/Vector3.h" +#include "Magnum/Primitives/Implementation/Spheroid.h" +#include "Magnum/Primitives/Implementation/WireframeSpheroid.h" +#include "Magnum/Trade/MeshData3D.h" namespace Magnum { namespace Primitives { diff --git a/src/Primitives/UVSphere.h b/src/Magnum/Primitives/UVSphere.h similarity index 97% rename from src/Primitives/UVSphere.h rename to src/Magnum/Primitives/UVSphere.h index fee053691..1238527cc 100644 --- a/src/Primitives/UVSphere.h +++ b/src/Magnum/Primitives/UVSphere.h @@ -28,8 +28,8 @@ * @brief Class Magnum::Primitives::UVSphere */ -#include "Primitives/magnumPrimitivesVisibility.h" -#include "Trade/Trade.h" +#include "Magnum/Trade/Trade.h" +#include "Magnum/Primitives/visibility.h" namespace Magnum { namespace Primitives { diff --git a/src/Primitives/magnumPrimitivesVisibility.h b/src/Magnum/Primitives/visibility.h similarity index 89% rename from src/Primitives/magnumPrimitivesVisibility.h rename to src/Magnum/Primitives/visibility.h index 770730353..8dca7d5cb 100644 --- a/src/Primitives/magnumPrimitivesVisibility.h +++ b/src/Magnum/Primitives/visibility.h @@ -1,5 +1,5 @@ -#ifndef Magnum_Primitives_magnumPrimitivesVisibility_h -#define Magnum_Primitives_magnumPrimitivesVisibility_h +#ifndef Magnum_Primitives_visibility_h +#define Magnum_Primitives_visibility_h /* This file is part of Magnum. @@ -24,9 +24,9 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include -#include "magnumConfigure.h" +#include "Magnum/configure.h" #ifndef MAGNUM_BUILD_STATIC #ifdef MagnumPrimitives_EXPORTS diff --git a/src/Query.cpp b/src/Magnum/Query.cpp similarity index 90% rename from src/Query.cpp rename to src/Magnum/Query.cpp index 1e3adfa56..f1233c222 100644 --- a/src/Query.cpp +++ b/src/Magnum/Query.cpp @@ -24,11 +24,11 @@ #include "Query.h" -#include +#include -#include "Context.h" -#include "Implementation/DebugState.h" -#include "Implementation/State.h" +#include "Magnum/Context.h" +#include "Magnum/Implementation/DebugState.h" +#include "Magnum/Implementation/State.h" namespace Magnum { @@ -90,21 +90,6 @@ bool AbstractQuery::resultAvailable() { } #ifndef DOXYGEN_GENERATING_OUTPUT -template<> bool AbstractQuery::result() { - CORRADE_ASSERT(!target, "AbstractQuery::result(): the query is currently running", {}); - - /** @todo Re-enable when extension loader is available for ES */ - GLuint result; - #ifndef MAGNUM_TARGET_GLES2 - glGetQueryObjectuiv(_id, GL_QUERY_RESULT, &result); - #elif defined(CORRADE_TARGET_NACL) - glGetQueryObjectuivEXT(_id, GL_QUERY_RESULT, &result); - #else - CORRADE_INTERNAL_ASSERT(false); - #endif - return result == GL_TRUE; -} - template<> UnsignedInt AbstractQuery::result() { CORRADE_ASSERT(!target, "AbstractQuery::result(): the query is currently running", {}); @@ -120,6 +105,8 @@ template<> UnsignedInt AbstractQuery::result() { return result; } +template<> bool AbstractQuery::result() { return result() != 0; } + template<> Int AbstractQuery::result() { CORRADE_ASSERT(!target, "AbstractQuery::result(): the query is currently running", {}); diff --git a/src/Query.h b/src/Magnum/Query.h similarity index 98% rename from src/Query.h rename to src/Magnum/Query.h index 2935cd942..2720a8b17 100644 --- a/src/Query.h +++ b/src/Magnum/Query.h @@ -28,10 +28,10 @@ * @brief Class @ref Magnum::AbstractQuery, @ref Magnum::PrimitiveQuery, @ref Magnum::SampleQuery, @ref Magnum::TimeQuery */ -#include +#include -#include "AbstractObject.h" -#include "magnumConfigure.h" +#include "Magnum/AbstractObject.h" +#include "Magnum/configure.h" namespace Magnum { @@ -41,6 +41,7 @@ namespace Magnum { See @ref PrimitiveQuery, @ref SampleQuery and @ref TimeQuery documentation for more information. @todo Support for AMD's query buffer (@extension{AMD,query_buffer_object}) +@todo `QUERY_COUNTER_BITS` (not sure since when this is supported) */ class MAGNUM_EXPORT AbstractQuery: public AbstractObject { public: @@ -172,6 +173,8 @@ UnsignedInt primitiveCount = q.result(); @endcode @requires_gl30 %Extension @extension{EXT,transform_feedback} @requires_gles30 Only sample queries are available on OpenGL ES 2.0. + +@see @ref SampleQuery, @ref TimeQuery @todo glBeginQueryIndexed */ class PrimitiveQuery: public AbstractQuery { @@ -259,6 +262,8 @@ q.beginConditionalRender(SampleQuery::ConditionalRenderMode::Wait); q.endConditionalRender(); @endcode @requires_gles30 %Extension @es_extension{EXT,occlusion_query_boolean} + +@see @ref PrimitiveQuery, @ref TimeQuery */ class SampleQuery: public AbstractQuery { public: @@ -411,6 +416,8 @@ UnsignedInt timeElapsed2 = q3.result()-tmp; Using the latter results in fewer OpenGL calls when doing more measures. @requires_gl33 %Extension @extension{ARB,timer_query} @requires_es_extension %Extension @es_extension{EXT,disjoint_timer_query} + +@see @ref PrimitiveQuery, @ref SampleQuery @todo timestamp with glGet + example usage @todo @es_extension{EXT,disjoint_timer_query} -- GL_GPU_DISJOINT_EXT support? where? */ @@ -467,7 +474,6 @@ class TimeQuery: public AbstractQuery { #endif }; - inline AbstractQuery::AbstractQuery(AbstractQuery&& other) noexcept: _id(other._id), target(other.target) { other._id = 0; } diff --git a/src/Renderbuffer.cpp b/src/Magnum/Renderbuffer.cpp similarity index 99% rename from src/Renderbuffer.cpp rename to src/Magnum/Renderbuffer.cpp index 2ec609d99..c7e56e306 100644 --- a/src/Renderbuffer.cpp +++ b/src/Magnum/Renderbuffer.cpp @@ -24,8 +24,8 @@ #include "Renderbuffer.h" -#include "Context.h" -#include "Extensions.h" +#include "Magnum/Context.h" +#include "Magnum/Extensions.h" #include "Implementation/DebugState.h" #include "Implementation/FramebufferState.h" diff --git a/src/Renderbuffer.h b/src/Magnum/Renderbuffer.h similarity index 96% rename from src/Renderbuffer.h rename to src/Magnum/Renderbuffer.h index 3807f8ffe..79d84e2ef 100644 --- a/src/Renderbuffer.h +++ b/src/Magnum/Renderbuffer.h @@ -25,12 +25,11 @@ */ /** @file - * @brief Class Magnum::Renderbuffer + * @brief Class @ref Magnum::Renderbuffer */ -#include "AbstractObject.h" -#include "Magnum.h" -#include "magnumVisibility.h" +#include "Magnum/AbstractObject.h" +#include "Magnum/Magnum.h" #ifdef CORRADE_GCC45_COMPATIBILITY #include "RenderbufferFormat.h" @@ -41,18 +40,18 @@ namespace Magnum { /** @brief %Renderbuffer -Attachable to framebuffer as render target, see Framebuffer documentation +Attachable to framebuffer as render target, see @ref Framebuffer documentation for more information. @section Renderbuffer-performance-optimization Performance optimizations The engine tracks currently bound renderbuffer to avoid unnecessary calls to -@fn_gl{BindRenderbuffer} in setStorage(). %Renderbuffer limits and +@fn_gl{BindRenderbuffer} in @ref setStorage(). %Renderbuffer limits and implementation-defined values (such as @ref maxSize()) are cached, so repeated queries don't result in repeated @fn_gl{Get} calls. If extension @extension{EXT,direct_state_access} is available, function -setStorage() uses DSA to avoid unnecessary calls to @fn_gl{BindRenderbuffer}. +@ref setStorage() uses DSA to avoid unnecessary calls to @fn_gl{BindRenderbuffer}. See its documentation for more information. @requires_gl30 %Extension @extension{ARB,framebuffer_object} diff --git a/src/RenderbufferFormat.h b/src/Magnum/RenderbufferFormat.h similarity index 99% rename from src/RenderbufferFormat.h rename to src/Magnum/RenderbufferFormat.h index 9ba15e5eb..af722e8e5 100644 --- a/src/RenderbufferFormat.h +++ b/src/Magnum/RenderbufferFormat.h @@ -25,17 +25,17 @@ */ /** @file - * @brief Enum Magnum::RenderbufferFormat + * @brief Enum @ref Magnum::RenderbufferFormat */ -#include "OpenGL.h" +#include "Magnum/OpenGL.h" namespace Magnum { /** @brief Internal renderbuffer format -@see Renderbuffer +@see @ref Renderbuffer @requires_gl30 %Extension @extension{ARB,framebuffer_object} @todo RGB, RGB8 ES only (ES3 + @es_extension{OES,rgb8_rgba8}) */ diff --git a/src/Renderer.cpp b/src/Magnum/Renderer.cpp similarity index 98% rename from src/Renderer.cpp rename to src/Magnum/Renderer.cpp index 55675d6dc..881812fc2 100644 --- a/src/Renderer.cpp +++ b/src/Magnum/Renderer.cpp @@ -24,10 +24,11 @@ #include "Renderer.h" -#include "Math/Range.h" -#include "Color.h" -#include "Context.h" -#include "Extensions.h" +#include "Magnum/Math/Range.h" +#include "Magnum/Color.h" +#include "Magnum/Context.h" +#include "Magnum/Extensions.h" + #include "Implementation/State.h" #include "Implementation/RendererState.h" diff --git a/src/Renderer.h b/src/Magnum/Renderer.h similarity index 99% rename from src/Renderer.h rename to src/Magnum/Renderer.h index f9254b114..5cf2d4be6 100644 --- a/src/Renderer.h +++ b/src/Magnum/Renderer.h @@ -24,15 +24,15 @@ DEALINGS IN THE SOFTWARE. */ -/** @file /Renderer.h +/** @file * @brief Class Magnum::Renderer */ -#include +#include -#include "Magnum.h" -#include "OpenGL.h" -#include "magnumVisibility.h" +#include "Magnum/Magnum.h" +#include "Magnum/OpenGL.h" +#include "Magnum/visibility.h" namespace Magnum { @@ -223,6 +223,7 @@ class MAGNUM_EXPORT Renderer { * @brief Hint * * @see setHint() + * @todo other hints */ enum class Hint: GLenum { /** diff --git a/src/Resource.cpp b/src/Magnum/Resource.cpp similarity index 100% rename from src/Resource.cpp rename to src/Magnum/Resource.cpp diff --git a/src/Resource.h b/src/Magnum/Resource.h similarity index 98% rename from src/Resource.h rename to src/Magnum/Resource.h index d284049d0..a6a0c9b13 100644 --- a/src/Resource.h +++ b/src/Magnum/Resource.h @@ -24,18 +24,17 @@ DEALINGS IN THE SOFTWARE. */ -/** @file /Resource.h +/** @file * @brief Class Magnum::ResourceKey, Magnum::Resource, enum Magnum::ResourceState */ #include -#include -#include -#include +#include +#include +#include -#include "Magnum.h" - -#include "magnumVisibility.h" +#include "Magnum/Magnum.h" +#include "Magnum/visibility.h" namespace Magnum { diff --git a/src/ResourceManager.h b/src/Magnum/ResourceManager.h similarity index 99% rename from src/ResourceManager.h rename to src/Magnum/ResourceManager.h index 0c57655fa..13c9320a0 100644 --- a/src/ResourceManager.h +++ b/src/Magnum/ResourceManager.h @@ -24,13 +24,13 @@ DEALINGS IN THE SOFTWARE. */ -/** @file /ResourceManager.h +/** @file * @brief Class Magnum::ResourceManager, enum Magnum::ResourceDataState, Magnum::ResourcePolicy */ #include -#include "Resource.h" +#include "Magnum/Resource.h" namespace Magnum { diff --git a/src/Sampler.cpp b/src/Magnum/Sampler.cpp similarity index 95% rename from src/Sampler.cpp rename to src/Magnum/Sampler.cpp index 9e6a9311e..edcd91ad0 100644 --- a/src/Sampler.cpp +++ b/src/Magnum/Sampler.cpp @@ -24,12 +24,12 @@ #include "Sampler.h" -#include +#include -#include "Context.h" -#include "Implementation/State.h" -#include "Implementation/TextureState.h" -#include "Extensions.h" +#include "Magnum/Context.h" +#include "Magnum/Implementation/State.h" +#include "Magnum/Implementation/TextureState.h" +#include "Magnum/Extensions.h" namespace Magnum { diff --git a/src/Sampler.h b/src/Magnum/Sampler.h similarity index 98% rename from src/Sampler.h rename to src/Magnum/Sampler.h index 974d60c2e..b1d0e74e3 100644 --- a/src/Sampler.h +++ b/src/Magnum/Sampler.h @@ -28,9 +28,9 @@ * @brief Class Magnum::Sampler */ -#include "Magnum.h" -#include "OpenGL.h" -#include "magnumVisibility.h" +#include "Magnum/Magnum.h" +#include "Magnum/OpenGL.h" +#include "Magnum/visibility.h" namespace Magnum { diff --git a/src/SceneGraph/AbstractCamera.h b/src/Magnum/SceneGraph/AbstractCamera.h similarity index 95% rename from src/SceneGraph/AbstractCamera.h rename to src/Magnum/SceneGraph/AbstractCamera.h index d9d118081..b5331339f 100644 --- a/src/SceneGraph/AbstractCamera.h +++ b/src/Magnum/SceneGraph/AbstractCamera.h @@ -28,11 +28,10 @@ * @brief Class @ref Magnum::SceneGraph::AbstractCamera, enum @ref Magnum::SceneGraph::AspectRatioPolicy, alias @ref Magnum::SceneGraph::AbstractBasicCamera2D, @ref Magnum::SceneGraph::AbstractBasicCamera3D, typedef @ref Magnum::SceneGraph::AbstractCamera2D, @ref Magnum::SceneGraph::AbstractCamera3D */ -#include "Math/Matrix3.h" -#include "Math/Matrix4.h" -#include "AbstractFeature.h" - -#include "magnumSceneGraphVisibility.h" +#include "Magnum/Math/Matrix3.h" +#include "Magnum/Math/Matrix4.h" +#include "Magnum/SceneGraph/AbstractFeature.h" +#include "Magnum/SceneGraph/visibility.h" namespace Magnum { namespace SceneGraph { @@ -167,8 +166,8 @@ template class AbstractCamera: public AbstractF /** @brief Base camera for two-dimensional scenes -Convenience alternative to %AbstractCamera<2, T>. See AbstractCamera -for more information. +Convenience alternative to %AbstractCamera<2, T>. See +@ref AbstractCamera for more information. @note Not available on GCC < 4.7. Use %AbstractCamera<2, T> instead. @see @ref AbstractCamera2D, @ref AbstractBasicCamera3D */ @@ -194,8 +193,8 @@ typedef AbstractCamera<2, Float> AbstractCamera2D; /** @brief Base camera for three-dimensional scenes -Convenience alternative to %AbstractCamera<3, T>. See AbstractCamera -for more information. +Convenience alternative to %AbstractCamera<3, T>. See +@ref AbstractCamera for more information. @note Not available on GCC < 4.7. Use %AbstractCamera<3, T> instead. @see @ref AbstractCamera3D, @ref AbstractBasicCamera2D */ diff --git a/src/SceneGraph/AbstractCamera.hpp b/src/Magnum/SceneGraph/AbstractCamera.hpp similarity index 97% rename from src/SceneGraph/AbstractCamera.hpp rename to src/Magnum/SceneGraph/AbstractCamera.hpp index b8ac05658..26f33a316 100644 --- a/src/SceneGraph/AbstractCamera.hpp +++ b/src/Magnum/SceneGraph/AbstractCamera.hpp @@ -25,12 +25,11 @@ */ /** @file - * @brief @ref compilation-speedup-hpp "Template implementation" for AbstractCamera.h + * @brief @ref compilation-speedup-hpp "Template implementation" for @ref AbstractCamera.h */ -#include "AbstractCamera.h" - -#include "Drawable.h" +#include "Magnum/SceneGraph/AbstractCamera.h" +#include "Magnum/SceneGraph/Drawable.h" namespace Magnum { namespace SceneGraph { diff --git a/src/SceneGraph/AbstractFeature.h b/src/Magnum/SceneGraph/AbstractFeature.h similarity index 83% rename from src/SceneGraph/AbstractFeature.h rename to src/Magnum/SceneGraph/AbstractFeature.h index 2502ca322..fef99516e 100644 --- a/src/SceneGraph/AbstractFeature.h +++ b/src/Magnum/SceneGraph/AbstractFeature.h @@ -25,23 +25,23 @@ */ /** @file - * @brief Class Magnum::SceneGraph::AbstractFeature, alias Magnum::SceneGraph::BasicAbstractFeature2D, Magnum::SceneGraph::BasicAbstractFeature3D, typedef Magnum::SceneGraph::AbstractFeature2D, Magnum::SceneGraph::AbstractFeature3D, enum Magnum::SceneGraph::CachedTransformation, enum set Magnum::SceneGraph::CachedTransformations + * @brief Class @ref Magnum::SceneGraph::AbstractFeature, alias @ref Magnum::SceneGraph::AbstractBasicFeature2D, @ref Magnum::SceneGraph::AbstractBasicFeature3D, typedef @ref Magnum::SceneGraph::AbstractFeature2D, @ref Magnum::SceneGraph::AbstractFeature3D, enum @ref Magnum::SceneGraph::CachedTransformation, enum set @ref Magnum::SceneGraph::CachedTransformations */ -#include -#include +#include +#include -#include "Magnum.h" -#include "SceneGraph/AbstractObject.h" +#include "Magnum/Magnum.h" +#include "Magnum/SceneGraph/AbstractObject.h" namespace Magnum { namespace SceneGraph { /** @brief Which transformation to cache in given feature -@see @ref scenegraph-caching, CachedTransformations, - AbstractFeature::setCachedTransformations(), AbstractFeature::clean(), - AbstractFeature::cleanInverted() +@see @ref scenegraph-caching, @ref CachedTransformations, + @ref AbstractFeature::setCachedTransformations(), @ref AbstractFeature::clean(), + @ref AbstractFeature::cleanInverted() @todo Provide also simpler representations from which could benefit other transformation implementations, as they won't need to e.g. create transformation matrix from quaternion? @@ -50,14 +50,16 @@ enum class CachedTransformation: UnsignedByte { /** * Absolute transformation is cached. * - * If enabled, clean() is called when cleaning object. + * If enabled, @ref AbstractFeature::clean() is called when cleaning + * object. */ Absolute = 1 << 0, /** * Inverted absolute transformation is cached. * - * If enabled, cleanInverted() is called when cleaning object. + * If enabled, @ref AbstractFeature::cleanInverted() is called when + * cleaning object. */ InvertedAbsolute = 1 << 1 }; @@ -65,8 +67,8 @@ enum class CachedTransformation: UnsignedByte { /** @brief Which transformations to cache in this feature -@see @ref scenegraph-caching, AbstractFeature::setCachedTransformations(), - AbstractFeature::clean(), AbstractFeature::cleanInverted() +@see @ref scenegraph-caching, @ref AbstractFeature::setCachedTransformations(), + @ref AbstractFeature::clean(), @ref AbstractFeature::cleanInverted() */ typedef Containers::EnumSet CachedTransformations; @@ -75,11 +77,11 @@ CORRADE_ENUMSET_OPERATORS(CachedTransformations) /** @brief Base for object features -Contained in Object, takes care of transformation caching. See @ref scenegraph -for introduction. +Contained in @ref Object, takes care of transformation caching. See +@ref scenegraph for introduction. -Uses Corrade::Containers::LinkedList for accessing holder object and sibling -features. +Uses @ref Corrade::Containers::LinkedList for accessing holder object and +sibling features. @section AbstractFeature-subclassing Subclassing @@ -94,9 +96,9 @@ it from scratch every time to achieve better performance. See @ref scenegraph-caching for introduction. In order to have caching, you must enable it first, because by default the -caching is disabled. You can enable it using setCachedTransformations() and -then implement corresponding cleaning function(s) -- either clean(), -cleanInverted() or both. Example: +caching is disabled. You can enable it using @ref setCachedTransformations() +and then implement corresponding cleaning function(s) -- either @ref clean(), +@ref cleanInverted() or both. Example: @code class CachingFeature: public SceneGraph::AbstractFeature3D { public: @@ -119,16 +121,16 @@ Before using the cached value explicitly request object cleaning by calling @subsection AbstractFeature-subclassing-transformation Accessing object transformation -Features has by default access only to AbstractObject, which is base of Object -not depending on any particular transformation implementation. This has the -advantage that features doesn't have to be implemented for all possible +Features has by default access only to @ref AbstractObject, which is base of +@ref Object not depending on any particular transformation implementation. This +has the advantage that features doesn't have to be implemented for all possible transformation implementations, thus preventing code duplication. However it -is impossible to transform the object using only pointer to AbstractObject. +is impossible to transform the object using only pointer to @ref AbstractObject. The transformations have interfaces for common functionality, so the feature can use that interface instead of being specialized for all relevant transformation implementations. Using small trick we are able to get pointer -to both AbstractObject and needed transformation from one constructor +to both @ref AbstractObject and needed transformation from one constructor parameter: @code class TransformingFeature: public SceneGraph::AbstractFeature3D { @@ -231,7 +233,7 @@ template class AbstractFeature /** * @brief Which transformations are cached * - * @see @ref scenegraph-caching, clean(), cleanInverted() + * @see @ref scenegraph-caching, @ref clean(), @ref cleanInverted() */ CachedTransformations cachedTransformations() const { return _cachedTransformations; @@ -241,8 +243,8 @@ template class AbstractFeature /** * @brief Set transformations to be cached * - * Based on which transformation types are enabled, clean() or - * cleanInverted() is called when cleaning absolute object + * Based on which transformation types are enabled, @ref clean() or + * @ref cleanInverted() is called when cleaning absolute object * transformation. * * Nothing is enabled by default. @@ -257,7 +259,7 @@ template class AbstractFeature * * Reimplement only if you want to invalidate some external data when * object is marked as dirty. All expensive computations should be - * done in clean() and cleanInverted(). + * done in @ref clean() and @ref cleanInverted(). * * Default implementation does nothing. * @see @ref scenegraph-caching @@ -299,8 +301,8 @@ template class AbstractFeature /** @brief Base feature for two-dimensional scenes -Convenience alternative to %AbstractFeature<2, T>. See AbstractFeature -for more information. +Convenience alternative to %AbstractFeature<2, T>. See +@ref AbstractFeature for more information. @note Not available on GCC < 4.7. Use %AbstractFeature<2, T> instead. @see @ref AbstractFeature2D, @ref AbstractBasicFeature3D */ @@ -326,8 +328,8 @@ typedef AbstractFeature<2, Float> AbstractFeature2D; /** @brief Base feature for three-dimensional scenes -Convenience alternative to %AbstractFeature<3, T>. See AbstractFeature -for more information. +Convenience alternative to %AbstractFeature<3, T>. See +@ref AbstractFeature for more information. @note Not available on GCC < 4.7. Use %AbstractFeature<3, T> instead. @see AbstractFeature2D */ diff --git a/src/SceneGraph/AbstractFeature.hpp b/src/Magnum/SceneGraph/AbstractFeature.hpp similarity index 97% rename from src/SceneGraph/AbstractFeature.hpp rename to src/Magnum/SceneGraph/AbstractFeature.hpp index df750adb7..f201eee25 100644 --- a/src/SceneGraph/AbstractFeature.hpp +++ b/src/Magnum/SceneGraph/AbstractFeature.hpp @@ -28,7 +28,7 @@ * @brief @ref compilation-speedup-hpp "Template implementation" for @ref AbstractFeature.h */ -#include "AbstractFeature.h" +#include "Magnum/SceneGraph/AbstractFeature.h" namespace Magnum { namespace SceneGraph { diff --git a/src/SceneGraph/AbstractGroupedFeature.h b/src/Magnum/SceneGraph/AbstractGroupedFeature.h similarity index 88% rename from src/SceneGraph/AbstractGroupedFeature.h rename to src/Magnum/SceneGraph/AbstractGroupedFeature.h index 4bd2239ad..d4c4b6932 100644 --- a/src/SceneGraph/AbstractGroupedFeature.h +++ b/src/Magnum/SceneGraph/AbstractGroupedFeature.h @@ -25,25 +25,25 @@ */ /** @file - * @brief Class Magnum::SceneGraph::AbstractGroupedFeature, alias Magnum::SceneGraph::AbstractBasicGroupedFeature2D, Magnum::SceneGraph::AbstractBasicGroupedFeature3D, Magnum::SceneGraph::AbstractGroupedFeature2D, Magnum::SceneGraph::AbstractGroupedFeature3D + * @brief Class @ref Magnum::SceneGraph::AbstractGroupedFeature, alias @ref Magnum::SceneGraph::AbstractBasicGroupedFeature2D, @ref Magnum::SceneGraph::AbstractBasicGroupedFeature3D, @ref Magnum::SceneGraph::AbstractGroupedFeature2D, @ref Magnum::SceneGraph::AbstractGroupedFeature3D */ #include -#include "AbstractFeature.h" -#include "FeatureGroup.h" +#include "Magnum/SceneGraph/AbstractFeature.h" +#include "Magnum/SceneGraph/FeatureGroup.h" namespace Magnum { namespace SceneGraph { /** @brief Base for grouped features -Used together with FeatureGroup. +Used together with @ref FeatureGroup. @section AbstractGroupedFeature-subclassing Subclassing Usage is via subclassing the feature using [CRTP](http://en.wikipedia.org/wiki/Curiously_recurring_template_pattern) -and typedef'ing FeatureGroup to accept only given type, e.g.: +and typedef'ing @ref FeatureGroup to accept only given type, e.g.: @code class Drawable: public SceneGraph::AbstractGroupedFeature3D { // ... @@ -76,7 +76,7 @@ template class AbstractGroupedFe * @param group Group this feature belongs to * * Adds the feature to the object and to group, if specified. - * @see FeatureGroup::add() + * @see @ref FeatureGroup::add() */ explicit AbstractGroupedFeature(AbstractObject& object, FeatureGroup* group = nullptr): AbstractFeature(object), _group(nullptr) { if(group) group->add(static_cast(*this)); @@ -111,7 +111,7 @@ template class AbstractGroupedFe @brief Base grouped feature for two-dimensional scenes Convenience alternative to %AbstractGroupedFeature<2, Derived, T>. See -AbstractGroupedFeature for more information. +@ref AbstractGroupedFeature for more information. @note Not available on GCC < 4.7. Use %AbstractGroupedFeature<2, Derived, T> instead. @see @ref AbstractGroupedFeature2D, @ref AbstractBasicGroupedFeature3D @@ -124,7 +124,7 @@ template using AbstractBasicGroupedFeature2D = AbstractG @brief Base grouped feature for two-dimensional float scenes Convenience alternative to %AbstractBasicGroupedFeature2D. -See AbstractGroupedFeature for more information. +See @ref AbstractGroupedFeature for more information. @note Not available on GCC < 4.7. Use %AbstractGroupedFeature<2, Derived, Float> instead. @see @ref AbstractGroupedFeature3D @@ -137,7 +137,7 @@ template using AbstractGroupedFeature2D = AbstractBasicGroupedFea @brief Base grouped feature for three-dimensional scenes Convenience alternative to %AbstractGroupedFeature<3, Derived, T>. See -AbstractGroupedFeature for more information. +@ref AbstractGroupedFeature for more information. @note Not available on GCC < 4.7. Use %AbstractGroupedFeature<3, Derived, T> instead. @see @ref AbstractGroupedFeature3D, @ref AbstractBasicGroupedFeature2D @@ -150,7 +150,7 @@ template using AbstractBasicGroupedFeature3D = AbstractG @brief Base grouped feature for three-dimensional float scenes Convenience alternative to %AbstractBasicGroupedFeature3D. -See AbstractGroupedFeature for more information. +See @ref AbstractGroupedFeature for more information. @note Not available on GCC < 4.7. Use %AbstractGroupedFeature<3, Derived, Float> instead. @see @ref AbstractGroupedFeature2D diff --git a/src/SceneGraph/AbstractObject.h b/src/Magnum/SceneGraph/AbstractObject.h similarity index 98% rename from src/SceneGraph/AbstractObject.h rename to src/Magnum/SceneGraph/AbstractObject.h index e15679519..b5cde4952 100644 --- a/src/SceneGraph/AbstractObject.h +++ b/src/Magnum/SceneGraph/AbstractObject.h @@ -29,12 +29,11 @@ */ #include -#include +#include -#include "DimensionTraits.h" -#include "SceneGraph.h" - -#include "SceneGraph/magnumSceneGraphVisibility.h" +#include "Magnum/DimensionTraits.h" +#include "Magnum/SceneGraph/SceneGraph.h" +#include "Magnum/SceneGraph/visibility.h" namespace Magnum { namespace SceneGraph { diff --git a/src/SceneGraph/AbstractTransformation.h b/src/Magnum/SceneGraph/AbstractTransformation.h similarity index 98% rename from src/SceneGraph/AbstractTransformation.h rename to src/Magnum/SceneGraph/AbstractTransformation.h index 64e76a967..fced66f49 100644 --- a/src/SceneGraph/AbstractTransformation.h +++ b/src/Magnum/SceneGraph/AbstractTransformation.h @@ -28,8 +28,8 @@ * @brief Class Magnum::SceneGraph::AbstractTransformation, alias Magnum::SceneGraph::AbstractBasicTransformation2D, Magnum::SceneGraph::AbstractBasicTransformation3D, typedef Magnum::SceneGraph::AbstractTransformation2D, Magnum::SceneGraph::AbstractTransformation3D, enum Magnum::SceneGraph::TransformationType */ -#include "SceneGraph/SceneGraph.h" -#include "SceneGraph/magnumSceneGraphVisibility.h" +#include "Magnum/SceneGraph/SceneGraph.h" +#include "Magnum/SceneGraph/visibility.h" namespace Magnum { namespace SceneGraph { diff --git a/src/SceneGraph/AbstractTranslation.h b/src/Magnum/SceneGraph/AbstractTranslation.h similarity index 97% rename from src/SceneGraph/AbstractTranslation.h rename to src/Magnum/SceneGraph/AbstractTranslation.h index d1422438a..c310c36d6 100644 --- a/src/SceneGraph/AbstractTranslation.h +++ b/src/Magnum/SceneGraph/AbstractTranslation.h @@ -28,9 +28,9 @@ * @brief Class @ref Magnum::SceneGraph::AbstractTranslation, alias @ref Magnum::SceneGraph::AbstractBasicTranslation2D, @ref Magnum::SceneGraph::AbstractBasicTranslation3D, typedef @ref Magnum::SceneGraph::AbstractTranslation2D, @ref Magnum::SceneGraph::AbstractBasicTranslation3D */ -#include "Math/Vector3.h" -#include "DimensionTraits.h" -#include "SceneGraph/AbstractTransformation.h" +#include "Magnum/DimensionTraits.h" +#include "Magnum/Math/Vector3.h" +#include "Magnum/SceneGraph/AbstractTransformation.h" namespace Magnum { namespace SceneGraph { diff --git a/src/SceneGraph/AbstractTranslationRotation2D.h b/src/Magnum/SceneGraph/AbstractTranslationRotation2D.h similarity index 98% rename from src/SceneGraph/AbstractTranslationRotation2D.h rename to src/Magnum/SceneGraph/AbstractTranslationRotation2D.h index 045379bcd..b9f309fed 100644 --- a/src/SceneGraph/AbstractTranslationRotation2D.h +++ b/src/Magnum/SceneGraph/AbstractTranslationRotation2D.h @@ -28,7 +28,7 @@ * @brief Class Magnum::SceneGraph::AbstractBasicTranslationRotation2D, typedef Magnum::SceneGraph::AbstractTranslationRotation2D */ -#include "SceneGraph/AbstractTranslation.h" +#include "Magnum/SceneGraph/AbstractTranslation.h" namespace Magnum { namespace SceneGraph { diff --git a/src/SceneGraph/AbstractTranslationRotation3D.h b/src/Magnum/SceneGraph/AbstractTranslationRotation3D.h similarity index 99% rename from src/SceneGraph/AbstractTranslationRotation3D.h rename to src/Magnum/SceneGraph/AbstractTranslationRotation3D.h index 66e494567..1f435b0a3 100644 --- a/src/SceneGraph/AbstractTranslationRotation3D.h +++ b/src/Magnum/SceneGraph/AbstractTranslationRotation3D.h @@ -28,7 +28,7 @@ * @brief Class Magnum::SceneGraph::AbstractBasicTranslationRotation3D, typedef Magnum::SceneGraph::AbstractTranslationRotation3D */ -#include "SceneGraph/AbstractTranslation.h" +#include "Magnum/SceneGraph/AbstractTranslation.h" namespace Magnum { namespace SceneGraph { diff --git a/src/SceneGraph/AbstractTranslationRotationScaling2D.h b/src/Magnum/SceneGraph/AbstractTranslationRotationScaling2D.h similarity index 98% rename from src/SceneGraph/AbstractTranslationRotationScaling2D.h rename to src/Magnum/SceneGraph/AbstractTranslationRotationScaling2D.h index f943d8fd7..365e94078 100644 --- a/src/SceneGraph/AbstractTranslationRotationScaling2D.h +++ b/src/Magnum/SceneGraph/AbstractTranslationRotationScaling2D.h @@ -28,7 +28,7 @@ * @brief Class Magnum::SceneGraph::AbstractBasicTranslationRotationScaling2D, typedef Magnum::SceneGraph::AbstractTranslationRotationScaling2D */ -#include "AbstractTranslationRotation2D.h" +#include "Magnum/SceneGraph/AbstractTranslationRotation2D.h" namespace Magnum { namespace SceneGraph { diff --git a/src/SceneGraph/AbstractTranslationRotationScaling3D.h b/src/Magnum/SceneGraph/AbstractTranslationRotationScaling3D.h similarity index 98% rename from src/SceneGraph/AbstractTranslationRotationScaling3D.h rename to src/Magnum/SceneGraph/AbstractTranslationRotationScaling3D.h index 4de595214..ca9c2e322 100644 --- a/src/SceneGraph/AbstractTranslationRotationScaling3D.h +++ b/src/Magnum/SceneGraph/AbstractTranslationRotationScaling3D.h @@ -28,7 +28,7 @@ * @brief Class Magnum::SceneGraph::AbstractBasicTranslationRotationScaling3D, typedef Magnum::SceneGraph::AbstractTranslationRotationScaling3D */ -#include "AbstractTranslationRotation3D.h" +#include "Magnum/SceneGraph/AbstractTranslationRotation3D.h" namespace Magnum { namespace SceneGraph { diff --git a/src/SceneGraph/Animable.cpp b/src/Magnum/SceneGraph/Animable.cpp similarity index 100% rename from src/SceneGraph/Animable.cpp rename to src/Magnum/SceneGraph/Animable.cpp diff --git a/src/SceneGraph/Animable.h b/src/Magnum/SceneGraph/Animable.h similarity index 87% rename from src/SceneGraph/Animable.h rename to src/Magnum/SceneGraph/Animable.h index 77f2bafd6..e18a5fa1a 100644 --- a/src/SceneGraph/Animable.h +++ b/src/Magnum/SceneGraph/Animable.h @@ -25,19 +25,18 @@ */ /** @file - * @brief Class Magnum::SceneGraph::Animable, alias Magnum::SceneGraph::BasicAnimable2D, Magnum::SceneGraph::BasicAnimable3D, typedef Magnum::SceneGraph::Animable2D, Magnum::SceneGraph::Animable3D, enum Magnum::SceneGraph::AnimationState + * @brief Class @ref Magnum::SceneGraph::Animable, alias @ref Magnum::SceneGraph::BasicAnimable2D, @ref Magnum::SceneGraph::BasicAnimable3D, typedef @ref Magnum::SceneGraph::Animable2D, @ref Magnum::SceneGraph::Animable3D, enum @ref Magnum::SceneGraph::AnimationState */ -#include "AbstractGroupedFeature.h" - -#include "magnumSceneGraphVisibility.h" +#include "Magnum/SceneGraph/AbstractGroupedFeature.h" +#include "Magnum/SceneGraph/visibility.h" namespace Magnum { namespace SceneGraph { /** @brief Animation state -@see Animable::setState() +@see @ref Animable::setState() */ enum class AnimationState: UnsignedByte { /** @@ -62,14 +61,14 @@ Debug MAGNUM_SCENEGRAPH_EXPORT operator<<(Debug debug, AnimationState value); /** @brief %Animable -Adds animation feature to object. Each %Animable is part of some AnimableGroup, -which takes care of running the animations. +Adds animation feature to object. Each %Animable is part of some +@ref AnimableGroup, which takes care of running the animations. @section Animable-usage Usage -First thing is add Animable feature to some object and implement +First thing is to add @ref Animable feature to some object and implement animationStep(). You can do it conveniently using multiple inheritance (see -@ref scenegraph-features for introduction). Override animationStep() to +@ref scenegraph-features for introduction). Override @ref animationStep() to implement your animation, the function provides both absolute animation time and time delta. Example: @code @@ -90,9 +89,10 @@ class AnimableObject: public Object3D, SceneGraph::Animable3D { @endcode Then add the object to your scene and some animation group. You can also use -AnimableGroup::add() and AnimableGroup::remove() instead of passing the group -in the constructor. The animation is initially in stopped state and without -repeat, see setState(), setRepeated() and setRepeatCount() for more information. +@ref AnimableGroup::add() and @ref AnimableGroup::remove() instead of passing +the group in the constructor. The animation is initially in stopped state and +without repeat, see @ref setState(), @ref setRepeated() and @ref setRepeatCount() +for more information. @code Scene3D scene; SceneGraph::AnimableGroup3D animables; @@ -102,10 +102,10 @@ SceneGraph::AnimableGroup3D animables; // ... @endcode -Animation step is performed by calling AnimableGroup::step() in your draw event -implementation. The function expects absolute time from relative to some fixed -point in the past and time delta (i.e. duration of the frame). You can use -Timeline for that, see its documentation for more information. +Animation step is performed by calling @ref AnimableGroup::step() in your draw +event implementation. The function expects absolute time from relative to some +fixed point in the past and time delta (i.e. duration of the frame). You can +use @ref Timeline for that, see its documentation for more information. @code Timeline timeline; timeline.start(); @@ -121,15 +121,15 @@ void MyApplication::drawEvent() { @section Animable-performance Using animable groups to improve performance -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 +@ref AnimableGroup is optimized for case when no animation is running -- it +just puts itself to rest and waits until some animation changes its state to @ref AnimationState::Running again. If you put animations which are not pernamently running to separate group, they will not be always traversed when calling @ref AnimableGroup::step(), saving precious frame time. @section Animable-explicit-specializations Explicit template specializations -The following specialization are explicitly compiled into @ref SceneGraph +The following specializations are explicitly compiled into @ref SceneGraph library. For other specializations (e.g. using @ref Double type) you have to use @ref Animable.hpp implementation file to avoid linker errors. See also @ref compilation-speedup-hpp for more information. @@ -151,7 +151,8 @@ template class Animable: public AbstractGrouped * * Creates stopped non-repeating animation with infinite duration, * adds the feature to the object and also to group, if specified. - * @see setDuration(), setState(), setRepeated(), AnimableGroup::add() + * @see @ref setDuration(), @ref setState(), @ref setRepeated(), + * @ref AnimableGroup::add() */ explicit Animable(AbstractObject& object, AnimableGroup* group = nullptr); @@ -179,7 +180,7 @@ template class Animable: public AbstractGrouped /** * @brief Whether the animation is repeated * - * @see repeatCount() + * @see @ref repeatCount() */ bool isRepeated() const { return _repeated; } @@ -188,7 +189,7 @@ template class Animable: public AbstractGrouped * @return Reference to self (for method chaining) * * Default is `false`. - * @see setRepeatCount() + * @see @ref setRepeatCount() */ Animable& setRepeated(bool repeated) { _repeated = repeated; @@ -198,7 +199,7 @@ template class Animable: public AbstractGrouped /** * @brief Repeat count * - * @see isRepeated() + * @see @ref isRepeated() */ UnsignedShort repeatCount() const { return _repeatCount; } @@ -208,7 +209,7 @@ template class Animable: public AbstractGrouped * * Has effect only if repeated animation is enabled. `0` means * infinitely repeated animation. Default is `0`. - * @see setRepeated() + * @see @ref setRepeated() */ Animable& setRepeatCount(UnsignedShort count) { _repeatCount = count; @@ -338,7 +339,7 @@ template class Animable: public AbstractGrouped /** @brief %Animable for two-dimensional scenes -Convenience alternative to %Animable<2, T>. See Animable for more +Convenience alternative to %Animable<2, T>. See @ref Animable for more information. @note Not available on GCC < 4.7. Use %Animable<2, T> instead. @see @ref Animable2D, @ref BasicAnimable3D @@ -365,7 +366,7 @@ typedef Animable<2, Float> Animable2D; /** @brief %Animable for three-dimensional scenes -Convenience alternative to %Animable<3, T>. See Animable for more +Convenience alternative to %Animable<3, T>. See @ref Animable for more information. @note Not available on GCC < 4.7. Use %Animable<3, T> instead. @see @ref Animable3D, @ref BasicAnimable2D diff --git a/src/SceneGraph/Animable.hpp b/src/Magnum/SceneGraph/Animable.hpp similarity index 98% rename from src/SceneGraph/Animable.hpp rename to src/Magnum/SceneGraph/Animable.hpp index ddb6c5b9e..db874dc72 100644 --- a/src/SceneGraph/Animable.hpp +++ b/src/Magnum/SceneGraph/Animable.hpp @@ -28,10 +28,9 @@ * @brief @ref compilation-speedup-hpp "Template implementation" for @ref Animable.h and @ref AnimableGroup.h */ -#include "AnimableGroup.h" -#include "Animable.h" - -#include "Timeline.h" +#include "Magnum/Timeline.h" +#include "Magnum/SceneGraph/AnimableGroup.h" +#include "Magnum/SceneGraph/Animable.h" namespace Magnum { namespace SceneGraph { diff --git a/src/SceneGraph/AnimableGroup.h b/src/Magnum/SceneGraph/AnimableGroup.h similarity index 85% rename from src/SceneGraph/AnimableGroup.h rename to src/Magnum/SceneGraph/AnimableGroup.h index 531d5c820..8149b187d 100644 --- a/src/SceneGraph/AnimableGroup.h +++ b/src/Magnum/SceneGraph/AnimableGroup.h @@ -25,19 +25,18 @@ */ /** @file - * @brief Class Magnum::SceneGraph::AnimableGroup, alias Magnum::SceneGraph::BasicAnimableGroup2D, Magnum::SceneGraph::BasicAnimableGroup3D, typedef Magnum::SceneGraph::AnimableGroup2D, Magnum::SceneGraph::AnimableGroup3D + * @brief Class @ref Magnum::SceneGraph::AnimableGroup, alias @ref Magnum::SceneGraph::BasicAnimableGroup2D, @ref Magnum::SceneGraph::BasicAnimableGroup3D, typedef @ref Magnum::SceneGraph::AnimableGroup2D, @ref Magnum::SceneGraph::AnimableGroup3D */ -#include "FeatureGroup.h" - -#include "magnumSceneGraphVisibility.h" +#include "Magnum/SceneGraph/FeatureGroup.h" +#include "Magnum/SceneGraph/visibility.h" namespace Magnum { namespace SceneGraph { /** @brief Group of animables -See Animable for more information. +See @ref Animable for more information. @see @ref scenegraph, @ref BasicAnimableGroup2D, @ref BasicAnimableGroup3D, @ref AnimableGroup2D, @ref AnimableGroup3D */ @@ -53,19 +52,19 @@ template class AnimableGroup: public FeatureGro /** * @brief Count of running animations * - * @see step() + * @see @ref step() */ std::size_t runningCount() const { return _runningCount; } /** * @brief Perform animation step - * @param time Absolute time (e.g. Timeline::previousFrameTime()) - * @param delta Time delta for current frame (e.g. Timeline::previousFrameDuration()) + * @param time Absolute time (e.g. @ref Timeline::previousFrameTime()) + * @param delta Time delta for current frame (e.g. @ref Timeline::previousFrameDuration()) * * If there are no running animations the function does nothing. - * @see runningCount() + * @see @ref runningCount() */ - void step(const Float time, const Float delta); + void step(Float time, Float delta); private: std::size_t _runningCount; diff --git a/src/SceneGraph/CMakeLists.txt b/src/Magnum/SceneGraph/CMakeLists.txt similarity index 99% rename from src/SceneGraph/CMakeLists.txt rename to src/Magnum/SceneGraph/CMakeLists.txt index 32b018ceb..347668e6c 100644 --- a/src/SceneGraph/CMakeLists.txt +++ b/src/Magnum/SceneGraph/CMakeLists.txt @@ -51,6 +51,7 @@ set(MagnumSceneGraph_HEADERS Camera3D.h Camera3D.hpp Drawable.h + Drawable.hpp DualComplexTransformation.h DualQuaternionTransformation.h RigidMatrixTransformation2D.h @@ -65,7 +66,7 @@ set(MagnumSceneGraph_HEADERS SceneGraph.h TranslationTransformation.h - magnumSceneGraphVisibility.h) + visibility.h) # 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 diff --git a/src/SceneGraph/Camera2D.h b/src/Magnum/SceneGraph/Camera2D.h similarity index 94% rename from src/SceneGraph/Camera2D.h rename to src/Magnum/SceneGraph/Camera2D.h index 610af6419..f495d69b5 100644 --- a/src/SceneGraph/Camera2D.h +++ b/src/Magnum/SceneGraph/Camera2D.h @@ -25,10 +25,10 @@ */ /** @file - * @brief Class Magnum::SceneGraph::BasicCamera2D, typedef Magnum::SceneGraph::Camera2D + * @brief Class @ref Magnum::SceneGraph::BasicCamera2D, typedef @ref Magnum::SceneGraph::Camera2D */ -#include "AbstractCamera.h" +#include "Magnum/SceneGraph/AbstractCamera.h" namespace Magnum { namespace SceneGraph { @@ -64,7 +64,7 @@ template class BasicCamera2D: public AbstractCamera<2, T> { * @param object %Object holding this feature * * Sets orthographic projection to the default OpenGL cube (range @f$ [-1; 1] @f$ in all directions). - * @see setProjection() + * @see @ref setProjection() */ explicit BasicCamera2D(AbstractObject<2, T>& object); @@ -85,7 +85,7 @@ template class BasicCamera2D: public AbstractCamera<2, T> { * @param size Size of the view * @return Reference to self (for method chaining) * - * @see Matrix3::projection() + * @see @ref Matrix3::projection() */ BasicCamera2D& setProjection(const Math::Vector2& size); diff --git a/src/SceneGraph/Camera2D.hpp b/src/Magnum/SceneGraph/Camera2D.hpp similarity index 94% rename from src/SceneGraph/Camera2D.hpp rename to src/Magnum/SceneGraph/Camera2D.hpp index 302d74e9b..52a1af9c6 100644 --- a/src/SceneGraph/Camera2D.hpp +++ b/src/Magnum/SceneGraph/Camera2D.hpp @@ -25,11 +25,11 @@ */ /** @file - * @brief @ref compilation-speedup-hpp "Template implementation" for Camera2D.h + * @brief @ref compilation-speedup-hpp "Template implementation" for @ref Camera2D.h */ -#include "AbstractCamera.hpp" -#include "Camera2D.h" +#include "Magnum/SceneGraph/AbstractCamera.hpp" +#include "Magnum/SceneGraph/Camera2D.h" /** @todo Use AbstractBasicCamera2D when support for GCC 4.6 is dropped (also in header) */ diff --git a/src/SceneGraph/Camera3D.h b/src/Magnum/SceneGraph/Camera3D.h similarity index 93% rename from src/SceneGraph/Camera3D.h rename to src/Magnum/SceneGraph/Camera3D.h index d6744d953..10be6d426 100644 --- a/src/SceneGraph/Camera3D.h +++ b/src/Magnum/SceneGraph/Camera3D.h @@ -25,10 +25,10 @@ */ /** @file - * @brief Class Magnum::SceneGraph::BasicCamera3D, typedef Magnum::SceneGraph::Camera3D + * @brief Class @ref Magnum::SceneGraph::BasicCamera3D, typedef @ref Magnum::SceneGraph::Camera3D */ -#include "AbstractCamera.h" +#include "Magnum/SceneGraph/AbstractCamera.h" #ifdef CORRADE_TARGET_WINDOWS /* I so HATE windef.h */ #undef near @@ -89,7 +89,7 @@ template class BasicCamera3D: public AbstractCamera<3, T> { * @param far Far clipping plane * @return Reference to self (for method chaining) * - * @see setPerspective(), Matrix4::orthographicProjection() + * @see @ref setPerspective(), @ref Matrix4::orthographicProjection() */ BasicCamera3D& setOrthographic(const Math::Vector2& size, T near, T far); @@ -100,7 +100,7 @@ template class BasicCamera3D: public AbstractCamera<3, T> { * @param far Far clipping plane * @return Reference to self (for method chaining) * - * @see setOrthographic(), Matrix4::perspectiveProjection() + * @see @ref setOrthographic(), @ref Matrix4::perspectiveProjection() */ BasicCamera3D& setPerspective(const Math::Vector2& size, T near, T far); @@ -112,7 +112,7 @@ template class BasicCamera3D: public AbstractCamera<3, T> { * @param far Far clipping plane * @return Reference to self (for method chaining) * - * @see setOrthographic(), Matrix4::perspectiveProjection() + * @see @ref setOrthographic(), @ref Matrix4::perspectiveProjection() */ BasicCamera3D& setPerspective(Math::Rad fov, T aspectRatio, T near, T far); diff --git a/src/SceneGraph/Camera3D.hpp b/src/Magnum/SceneGraph/Camera3D.hpp similarity index 96% rename from src/SceneGraph/Camera3D.hpp rename to src/Magnum/SceneGraph/Camera3D.hpp index bef3b77e9..40cfd2bbe 100644 --- a/src/SceneGraph/Camera3D.hpp +++ b/src/Magnum/SceneGraph/Camera3D.hpp @@ -25,11 +25,11 @@ */ /** @file - * @brief @ref compilation-speedup-hpp "Template implementation" for Camera3D.h + * @brief @ref compilation-speedup-hpp "Template implementation" for @ref Camera3D.h */ -#include "AbstractCamera.hpp" -#include "Camera3D.h" +#include "Magnum/SceneGraph/AbstractCamera.hpp" +#include "Magnum/SceneGraph/Camera3D.h" /** @todo Use AbstractBasicCamera3D when support for GCC 4.6 is dropped (also in header) */ diff --git a/src/SceneGraph/Drawable.h b/src/Magnum/SceneGraph/Drawable.h similarity index 72% rename from src/SceneGraph/Drawable.h rename to src/Magnum/SceneGraph/Drawable.h index ee1fbfe9d..46c153533 100644 --- a/src/SceneGraph/Drawable.h +++ b/src/Magnum/SceneGraph/Drawable.h @@ -25,24 +25,25 @@ */ /** @file - * @brief Class Magnum::SceneGraph::Drawable, Magnum::SceneGraph::DrawableGroup, alias Magnum::SceneGraph::BasicDrawable2D, Magnum::SceneGraph::BasicDrawable3D, Magnum::SceneGraph::BasicDrawableGroup2D, Magnum::SceneGraph::BasicDrawableGroup3D, typedef Magnum::SceneGraph::Drawable2D, Magnum::SceneGraph::Drawable3D, Magnum::SceneGraph::DrawableGroup2D, Magnum::SceneGraph::DrawableGroup3D + * @brief Class @ref Magnum::SceneGraph::Drawable, @ref Magnum::SceneGraph::DrawableGroup, alias @ref Magnum::SceneGraph::BasicDrawable2D, @ref Magnum::SceneGraph::BasicDrawable3D, @ref Magnum::SceneGraph::BasicDrawableGroup2D, @ref Magnum::SceneGraph::BasicDrawableGroup3D, typedef @ref Magnum::SceneGraph::Drawable2D, @ref Magnum::SceneGraph::Drawable3D, @ref Magnum::SceneGraph::DrawableGroup2D, @ref Magnum::SceneGraph::DrawableGroup3D */ -#include "AbstractGroupedFeature.h" +#include "Magnum/SceneGraph/AbstractGroupedFeature.h" namespace Magnum { namespace SceneGraph { /** @brief %Drawable -Adds drawing function to the object. Each %Drawable is part of some DrawableGroup -and the whole group is drawn with particular camera using AbstractCamera::draw(). +Adds drawing function to the object. Each %Drawable is part of some +@ref DrawableGroup and the whole group is drawn with particular camera using +@ref AbstractCamera::draw(). @section Drawable-usage Usage -First thing is add Drawable feature to some object and implement draw(). You -can do it conveniently using multiple inheritance (see @ref scenegraph-features -for introduction). Example: +First thing is to add @ref Drawable feature to some object and implement +@ref draw(). You can do it conveniently using multiple inheritance (see +@ref scenegraph-features for introduction). Example: @code typedef SceneGraph::Object Object3D; typedef SceneGraph::Scene Scene3D; @@ -60,8 +61,8 @@ class DrawableObject: public Object3D, SceneGraph::Drawable3D { @endcode Then you add these objects to your scene and some drawable group and transform -them as you like. You can also use DrawableGroup::add() and -DrawableGroup::remove(). +them as you like. You can also use @ref DrawableGroup::add() and +@ref DrawableGroup::remove(). @code Scene3D scene; SceneGraph::DrawableGroup3D drawables; @@ -74,9 +75,10 @@ SceneGraph::DrawableGroup3D drawables; // ... @endcode -The last thing you need is Camera attached to some object (thus using its +The last thing you need is camera attached to some object (thus using its transformation) and with it you can perform drawing in your draw event -implementation. See Camera2D and Camera3D documentation for more information. +implementation. See @ref Camera2D and @ref Camera3D documentation for more +information. @code Camera3D camera(&cameraObject); @@ -91,10 +93,10 @@ void MyApplication::drawEvent() { @section Drawable-performance Using drawable groups to improve performance You can organize your drawables to multiple groups to minimize OpenGL state -changes - for example put all objects using the same shader, the same light +changes -- for example put all objects using the same shader, the same light setup etc into one group, then put all transparent into another and set common -parameters once for whole group instead of setting them again in each draw() -implementation. Example: +parameters once for whole group instead of setting them again in each +@ref draw() implementation. Example: @code Shaders::PhongShader shader; SceneGraph::DrawableGroup3D phongObjects, transparentObjects; @@ -114,6 +116,16 @@ void MyApplication::drawEvent() { } @endcode +@section Drawable-explicit-specializations Explicit template specializations + +The following specializations are explicitly compiled into @ref SceneGraph +library. For other specializations (e.g. using @ref Double type) you have to +use @ref Drawable.hpp implementation file to avoid linker errors. See also +@ref compilation-speedup-hpp for more information. + +- @ref Drawable2D +- @ref Drawable3D + @see @ref scenegraph, @ref BasicDrawable2D, @ref BasicDrawable3D, @ref Drawable2D, @ref Drawable3D, @ref DrawableGroup */ @@ -125,9 +137,9 @@ template class Drawable: public AbstractGrouped * @param drawables Group this drawable belongs to * * Adds the feature to the object and also to the group, if specified. - * Otherwise you can use DrawableGroup::add(). + * Otherwise you can use @ref DrawableGroup::add(). */ - explicit Drawable(AbstractObject& object, DrawableGroup* drawables = nullptr): AbstractGroupedFeature, T>(object, drawables) {} + explicit Drawable(AbstractObject& object, DrawableGroup* drawables = nullptr); /** * @brief Group containing this drawable @@ -135,12 +147,20 @@ template class Drawable: public AbstractGrouped * If the drawable doesn't belong to any group, returns `nullptr`. */ DrawableGroup* drawables() { + #ifndef CORRADE_GCC46_COMPATIBILITY return AbstractGroupedFeature, T>::group(); + #else + return static_cast*>(AbstractGroupedFeature, T>::group()); + #endif } /** @overload */ const DrawableGroup* drawables() const { + #ifndef CORRADE_GCC46_COMPATIBILITY return AbstractGroupedFeature, T>::group(); + #else + return static_cast*>(AbstractGroupedFeature, T>::group()); + #endif } /** @@ -149,7 +169,8 @@ template class Drawable: public AbstractGrouped * to camera * @param camera Camera * - * Projection matrix can be retrieved from AbstractCamera::projectionMatrix(). + * Projection matrix can be retrieved from + * @ref SceneGraph::AbstractCamera::projectionMatrix() "AbstractCamera::projectionMatrix()". */ virtual void draw(const typename DimensionTraits::MatrixType& transformationMatrix, AbstractCamera& camera) = 0; }; @@ -158,7 +179,7 @@ template class Drawable: public AbstractGrouped /** @brief %Drawable for two-dimensional scenes -Convenience alternative to %Drawable<2, T>. See Drawable for more +Convenience alternative to %Drawable<2, T>. See @ref Drawable for more information. @note Not available on GCC < 4.7. Use %Drawable<2, T> instead. @see @ref Drawable2D, @ref BasicDrawable3D @@ -183,7 +204,7 @@ typedef Drawable<2, Float> Drawable2D; /** @brief %Drawable for three-dimensional scenes -Convenience alternative to %Drawable<3, T>. See Drawable for more +Convenience alternative to %Drawable<3, T>. See @ref Drawable for more information. @note Not available on GCC < 4.7. Use %Drawable<3, T> instead. @see @ref Drawable3D, @ref BasicDrawable3D @@ -223,9 +244,9 @@ template class DrawableGroup: public FeatureGro /** @brief Group of drawables for two-dimensional scenes -Convenience alternative to %DrawableGroup<2, T>. See Drawable for +Convenience alternative to %DrawableGroup<2, T>. See @ref Drawable for more information. -@note Not available on GCC < 4.7. Use %Drawable<2, T> instead. +@note Not available on GCC < 4.7. Use %DrawableGroup<2, T> instead. @see @ref DrawableGroup2D, @ref BasicDrawableGroup3D */ #ifndef CORRADE_MSVC2013_COMPATIBILITY /* Apparently cannot have multiply defined aliases */ @@ -248,9 +269,9 @@ typedef DrawableGroup<2, Float> DrawableGroup2D; /** @brief Group of drawables for three-dimensional scenes -Convenience alternative to %DrawableGroup<3, T>. See Drawable for +Convenience alternative to %DrawableGroup<3, T>. See @ref Drawable for more information. -@note Not available on GCC < 4.7. Use %Drawable<3, T> instead. +@note Not available on GCC < 4.7. Use %DrawableGroup<3, T> instead. @see @ref DrawableGroup3D, @ref BasicDrawableGroup2D */ #ifndef CORRADE_MSVC2013_COMPATIBILITY /* Apparently cannot have multiply defined aliases */ @@ -269,6 +290,10 @@ typedef BasicDrawableGroup3D DrawableGroup3D; typedef DrawableGroup<3, Float> DrawableGroup3D; #endif +#ifdef CORRADE_TARGET_WINDOWS +extern template class MAGNUM_SCENEGRAPH_EXPORT Drawable<2, Float>; +extern template class MAGNUM_SCENEGRAPH_EXPORT Drawable<3, Float>; +#endif }} #endif diff --git a/src/Magnum/SceneGraph/Drawable.hpp b/src/Magnum/SceneGraph/Drawable.hpp new file mode 100644 index 000000000..11c3eec02 --- /dev/null +++ b/src/Magnum/SceneGraph/Drawable.hpp @@ -0,0 +1,39 @@ +#ifndef Magnum_SceneGraph_Drawable_hpp +#define Magnum_SceneGraph_Drawable_hpp +/* + This file is part of Magnum. + + Copyright © 2010, 2011, 2012, 2013 Vladimír Vondruš + + 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 @ref compilation-speedup-hpp "Template implementation" for @ref Drawable.h + */ + +#include "Magnum/SceneGraph/Drawable.h" + +namespace Magnum { namespace SceneGraph { + +template Drawable::Drawable(AbstractObject& object, DrawableGroup* drawables): AbstractGroupedFeature, T>(object, drawables) {} + +}} + +#endif diff --git a/src/SceneGraph/DualComplexTransformation.h b/src/Magnum/SceneGraph/DualComplexTransformation.h similarity index 98% rename from src/SceneGraph/DualComplexTransformation.h rename to src/Magnum/SceneGraph/DualComplexTransformation.h index a9a960a38..4d55c0e6b 100644 --- a/src/SceneGraph/DualComplexTransformation.h +++ b/src/Magnum/SceneGraph/DualComplexTransformation.h @@ -28,9 +28,9 @@ * @brief Class Magnum::SceneGraph::BasicDualComplexTransformation, typedef Magnum::SceneGraph::DualComplexTransformation */ -#include "Math/DualComplex.h" -#include "AbstractTranslationRotation2D.h" -#include "Object.h" +#include "Magnum/Math/DualComplex.h" +#include "Magnum/SceneGraph/AbstractTranslationRotation2D.h" +#include "Magnum/SceneGraph/Object.h" namespace Magnum { namespace SceneGraph { diff --git a/src/SceneGraph/DualQuaternionTransformation.h b/src/Magnum/SceneGraph/DualQuaternionTransformation.h similarity index 98% rename from src/SceneGraph/DualQuaternionTransformation.h rename to src/Magnum/SceneGraph/DualQuaternionTransformation.h index d6826f4ba..4f454f620 100644 --- a/src/SceneGraph/DualQuaternionTransformation.h +++ b/src/Magnum/SceneGraph/DualQuaternionTransformation.h @@ -28,9 +28,9 @@ * @brief Class Magnum::SceneGraph::BasicDualQuaternionTransformation, typedef Magnum::SceneGraph::DualQuaternionTransformation */ -#include "Math/DualQuaternion.h" -#include "AbstractTranslationRotation3D.h" -#include "Object.h" +#include "Magnum/Math/DualQuaternion.h" +#include "Magnum/SceneGraph/AbstractTranslationRotation3D.h" +#include "Magnum/SceneGraph/Object.h" namespace Magnum { namespace SceneGraph { diff --git a/src/SceneGraph/FeatureGroup.h b/src/Magnum/SceneGraph/FeatureGroup.h similarity index 90% rename from src/SceneGraph/FeatureGroup.h rename to src/Magnum/SceneGraph/FeatureGroup.h index 2d725118f..a6aa7a661 100644 --- a/src/SceneGraph/FeatureGroup.h +++ b/src/Magnum/SceneGraph/FeatureGroup.h @@ -25,14 +25,14 @@ */ /** @file - * @brief Class Magnum::SceneGraph::AbstractFeatureGroup, Magnum::SceneGraph::FeatureGroup, alias Magnum::SceneGraph::BasicFeatureGroup2D, Magnum::SceneGraph::BasicFeatureGroup3D, Magnum::SceneGraph::FeatureGroup2D, Magnum::SceneGraph::FeatureGroup3D + * @brief Class @ref Magnum::SceneGraph::AbstractFeatureGroup, @ref Magnum::SceneGraph::FeatureGroup, alias @ref Magnum::SceneGraph::BasicFeatureGroup2D, @ref Magnum::SceneGraph::BasicFeatureGroup3D, @ref Magnum::SceneGraph::FeatureGroup2D, @ref Magnum::SceneGraph::FeatureGroup3D */ #include -#include +#include -#include "SceneGraph/SceneGraph.h" -#include "SceneGraph/magnumSceneGraphVisibility.h" +#include "Magnum/SceneGraph/SceneGraph.h" +#include "Magnum/SceneGraph/visibility.h" namespace Magnum { namespace SceneGraph { @@ -98,7 +98,7 @@ template class FeatureGroup: pub * @return Reference to self (for method chaining) * * If the features is part of another group, it is removed from it. - * @see remove(), AbstractGroupedFeature::AbstractGroupedFeature() + * @see @ref remove(), @ref AbstractGroupedFeature::AbstractGroupedFeature() */ FeatureGroup& add(Feature& feature); @@ -107,7 +107,7 @@ template class FeatureGroup: pub * @return Reference to self (for method chaining) * * The feature must be part of the group. - * @see add() + * @see @ref add() */ FeatureGroup& remove(Feature& feature); }; @@ -119,7 +119,7 @@ template inline FeatureGroup%FeatureGroup<2, Feature, T>. See -AbstractGroupedFeature for more information. +@ref AbstractGroupedFeature for more information. @note Not available on GCC < 4.7. Use %FeatureGroup<2, Feature, T> instead. @see @ref FeatureGroup2D, @ref BasicFeatureGroup3D @@ -132,7 +132,7 @@ template using BasicFeatureGroup2D = FeatureGroup<2, Fea @brief Base feature group for two-dimensional float scenes Convenience alternative to %BasicFeatureGroup2D. See -AbstractGroupedFeature for more information. +@ref AbstractGroupedFeature for more information. @note Not available on GCC < 4.7. Use %FeatureGroup<2, Feature, Float> instead. @see @ref FeatureGroup3D @@ -145,7 +145,7 @@ template using FeatureGroup2D = BasicFeatureGroup2D%FeatureGroup<3, Feature, T>. See -AbstractGroupedFeature for more information. +@ref AbstractGroupedFeature for more information. @note Not available on GCC < 4.7. Use %FeatureGroup<3, Feature, T> instead. @see @ref FeatureGroup3D, @ref BasicFeatureGroup2D @@ -158,7 +158,7 @@ template using BasicFeatureGroup3D = FeatureGroup<3, Fea @brief Base feature group for three-dimensional float scenes Convenience alternative to %BasicFeatureGroup3D. See -AbstractGroupedFeature for more information. +@ref AbstractGroupedFeature for more information. @note Not available on GCC < 4.7. Use %FeatureGroup<3, Feature, Float> instead. @see @ref FeatureGroup2D diff --git a/src/SceneGraph/FeatureGroup.hpp b/src/Magnum/SceneGraph/FeatureGroup.hpp similarity index 98% rename from src/SceneGraph/FeatureGroup.hpp rename to src/Magnum/SceneGraph/FeatureGroup.hpp index 53af15bec..a16a4efca 100644 --- a/src/SceneGraph/FeatureGroup.hpp +++ b/src/Magnum/SceneGraph/FeatureGroup.hpp @@ -28,10 +28,10 @@ * @brief @ref compilation-speedup-hpp "Template implementation" for @ref FeatureGroup.h */ -#include "FeatureGroup.h" - #include +#include "Magnum/SceneGraph/FeatureGroup.h" + namespace Magnum { namespace SceneGraph { /* `= default` causes linker errors in GCC 4.5 */ diff --git a/src/SceneGraph/MatrixTransformation2D.h b/src/Magnum/SceneGraph/MatrixTransformation2D.h similarity index 98% rename from src/SceneGraph/MatrixTransformation2D.h rename to src/Magnum/SceneGraph/MatrixTransformation2D.h index 9be34f7ce..60b7fd5ec 100644 --- a/src/SceneGraph/MatrixTransformation2D.h +++ b/src/Magnum/SceneGraph/MatrixTransformation2D.h @@ -28,9 +28,9 @@ * @brief Class Magnum::SceneGraph::BasicMatrixTransformation2D, typedef Magnum::SceneGraph::MatrixTransformation2D */ -#include "Math/Matrix3.h" -#include "AbstractTranslationRotationScaling2D.h" -#include "Object.h" +#include "Magnum/Math/Matrix3.h" +#include "Magnum/SceneGraph/AbstractTranslationRotationScaling2D.h" +#include "Magnum/SceneGraph/Object.h" namespace Magnum { namespace SceneGraph { diff --git a/src/SceneGraph/MatrixTransformation3D.h b/src/Magnum/SceneGraph/MatrixTransformation3D.h similarity index 98% rename from src/SceneGraph/MatrixTransformation3D.h rename to src/Magnum/SceneGraph/MatrixTransformation3D.h index b3acdb6b5..1dba5f49f 100644 --- a/src/SceneGraph/MatrixTransformation3D.h +++ b/src/Magnum/SceneGraph/MatrixTransformation3D.h @@ -28,9 +28,9 @@ * @brief Class Magnum::SceneGraph::BasicMatrixTransformation3D, typedef Magnum::SceneGraph::MatrixTransformation3D */ -#include "Math/Matrix4.h" -#include "AbstractTranslationRotationScaling3D.h" -#include "Object.h" +#include "Magnum/Math/Matrix4.h" +#include "Magnum/SceneGraph/AbstractTranslationRotationScaling3D.h" +#include "Magnum/SceneGraph/Object.h" namespace Magnum { namespace SceneGraph { diff --git a/src/SceneGraph/Object.h b/src/Magnum/SceneGraph/Object.h similarity index 98% rename from src/SceneGraph/Object.h rename to src/Magnum/SceneGraph/Object.h index f83d06aee..8a367fc29 100644 --- a/src/SceneGraph/Object.h +++ b/src/Magnum/SceneGraph/Object.h @@ -28,12 +28,11 @@ * @brief Class Magnum::SceneGraph::Object */ -#include +#include -#include "AbstractFeature.h" -#include "AbstractObject.h" - -#include "magnumSceneGraphVisibility.h" +#include "Magnum/SceneGraph/AbstractFeature.h" +#include "Magnum/SceneGraph/AbstractObject.h" +#include "Magnum/SceneGraph/visibility.h" namespace Magnum { namespace SceneGraph { diff --git a/src/SceneGraph/Object.hpp b/src/Magnum/SceneGraph/Object.hpp similarity index 99% rename from src/SceneGraph/Object.hpp rename to src/Magnum/SceneGraph/Object.hpp index abff06550..174b2929e 100644 --- a/src/SceneGraph/Object.hpp +++ b/src/Magnum/SceneGraph/Object.hpp @@ -28,13 +28,12 @@ * @brief @ref compilation-speedup-hpp "Template implementation" for @ref AbstractObject.h, @ref AbstractTransformation.h and @ref Object.h */ -#include "AbstractTransformation.h" -#include "Object.h" - #include #include -#include "Scene.h" +#include "Magnum/SceneGraph/AbstractTransformation.h" +#include "Magnum/SceneGraph/Object.h" +#include "Magnum/SceneGraph/Scene.h" namespace Magnum { namespace SceneGraph { diff --git a/src/SceneGraph/RigidMatrixTransformation2D.h b/src/Magnum/SceneGraph/RigidMatrixTransformation2D.h similarity index 98% rename from src/SceneGraph/RigidMatrixTransformation2D.h rename to src/Magnum/SceneGraph/RigidMatrixTransformation2D.h index 16df48896..5ba00efec 100644 --- a/src/SceneGraph/RigidMatrixTransformation2D.h +++ b/src/Magnum/SceneGraph/RigidMatrixTransformation2D.h @@ -28,10 +28,10 @@ * @brief Class Magnum::SceneGraph::BasicRigidMatrixTransformation2D, typedef Magnum::SceneGraph::RigidMatrixTransformation2D */ -#include "Math/Matrix3.h" -#include "Math/Algorithms/GramSchmidt.h" -#include "AbstractTranslationRotation2D.h" -#include "Object.h" +#include "Magnum/Math/Matrix3.h" +#include "Magnum/Math/Algorithms/GramSchmidt.h" +#include "Magnum/SceneGraph/AbstractTranslationRotation2D.h" +#include "Magnum/SceneGraph/Object.h" namespace Magnum { namespace SceneGraph { diff --git a/src/SceneGraph/RigidMatrixTransformation3D.h b/src/Magnum/SceneGraph/RigidMatrixTransformation3D.h similarity index 98% rename from src/SceneGraph/RigidMatrixTransformation3D.h rename to src/Magnum/SceneGraph/RigidMatrixTransformation3D.h index 37f3f275a..22da7c2ab 100644 --- a/src/SceneGraph/RigidMatrixTransformation3D.h +++ b/src/Magnum/SceneGraph/RigidMatrixTransformation3D.h @@ -28,10 +28,10 @@ * @brief Class Magnum::SceneGraph::BasicRigidMatrixTransformation3D, typedef Magnum::SceneGraph::RigidMatrixTransformation3D */ -#include "Math/Matrix4.h" -#include "Math/Algorithms/GramSchmidt.h" -#include "AbstractTranslationRotation3D.h" -#include "Object.h" +#include "Magnum/Math/Matrix4.h" +#include "Magnum/Math/Algorithms/GramSchmidt.h" +#include "Magnum/SceneGraph/AbstractTranslationRotation3D.h" +#include "Magnum/SceneGraph/Object.h" namespace Magnum { namespace SceneGraph { diff --git a/src/SceneGraph/Scene.h b/src/Magnum/SceneGraph/Scene.h similarity index 97% rename from src/SceneGraph/Scene.h rename to src/Magnum/SceneGraph/Scene.h index 1f5689d64..88fcb871e 100644 --- a/src/SceneGraph/Scene.h +++ b/src/Magnum/SceneGraph/Scene.h @@ -28,7 +28,7 @@ * @brief Class Magnum::SceneGraph::Scene */ -#include "Object.h" +#include "Magnum/SceneGraph/Object.h" namespace Magnum { namespace SceneGraph { diff --git a/src/SceneGraph/SceneGraph.h b/src/Magnum/SceneGraph/SceneGraph.h similarity index 99% rename from src/SceneGraph/SceneGraph.h rename to src/Magnum/SceneGraph/SceneGraph.h index d39a282e4..1c994ba72 100644 --- a/src/SceneGraph/SceneGraph.h +++ b/src/Magnum/SceneGraph/SceneGraph.h @@ -28,9 +28,9 @@ * @brief Forward declarations for Magnum::SceneGraph namespace */ -#include "Types.h" +#include -#include "corradeCompatibility.h" +#include "Magnum/Types.h" namespace Magnum { namespace SceneGraph { diff --git a/src/SceneGraph/Test/AnimableTest.cpp b/src/Magnum/SceneGraph/Test/AnimableTest.cpp similarity index 98% rename from src/SceneGraph/Test/AnimableTest.cpp rename to src/Magnum/SceneGraph/Test/AnimableTest.cpp index 55b9eb761..db364c2ea 100644 --- a/src/SceneGraph/Test/AnimableTest.cpp +++ b/src/Magnum/SceneGraph/Test/AnimableTest.cpp @@ -23,11 +23,11 @@ */ #include -#include +#include -#include "SceneGraph/Animable.h" -#include "SceneGraph/AnimableGroup.h" -#include "SceneGraph/MatrixTransformation3D.h" +#include "Magnum/SceneGraph/Animable.h" +#include "Magnum/SceneGraph/AnimableGroup.h" +#include "Magnum/SceneGraph/MatrixTransformation3D.h" namespace Magnum { namespace SceneGraph { namespace Test { diff --git a/src/SceneGraph/Test/CMakeLists.txt b/src/Magnum/SceneGraph/Test/CMakeLists.txt similarity index 100% rename from src/SceneGraph/Test/CMakeLists.txt rename to src/Magnum/SceneGraph/Test/CMakeLists.txt diff --git a/src/SceneGraph/Test/CameraTest.cpp b/src/Magnum/SceneGraph/Test/CameraTest.cpp similarity index 94% rename from src/SceneGraph/Test/CameraTest.cpp rename to src/Magnum/SceneGraph/Test/CameraTest.cpp index 6c816d62c..97ca82054 100644 --- a/src/SceneGraph/Test/CameraTest.cpp +++ b/src/Magnum/SceneGraph/Test/CameraTest.cpp @@ -22,15 +22,15 @@ DEALINGS IN THE SOFTWARE. */ -#include - -#include "SceneGraph/AbstractCamera.hpp" /* only for aspectRatioFix(), so it doesn't have to be exported */ -#include "SceneGraph/Camera2D.h" -#include "SceneGraph/Camera3D.h" -#include "SceneGraph/Drawable.h" -#include "SceneGraph/MatrixTransformation2D.h" -#include "SceneGraph/MatrixTransformation3D.h" -#include "SceneGraph/Scene.h" +#include + +#include "Magnum/SceneGraph/AbstractCamera.hpp" /* only for aspectRatioFix(), so it doesn't have to be exported */ +#include "Magnum/SceneGraph/Camera2D.h" +#include "Magnum/SceneGraph/Camera3D.h" +#include "Magnum/SceneGraph/Drawable.h" +#include "Magnum/SceneGraph/MatrixTransformation2D.h" +#include "Magnum/SceneGraph/MatrixTransformation3D.h" +#include "Magnum/SceneGraph/Scene.h" namespace Magnum { namespace SceneGraph { namespace Test { diff --git a/src/SceneGraph/Test/DualComplexTransformationTest.cpp b/src/Magnum/SceneGraph/Test/DualComplexTransformationTest.cpp similarity index 98% rename from src/SceneGraph/Test/DualComplexTransformationTest.cpp rename to src/Magnum/SceneGraph/Test/DualComplexTransformationTest.cpp index 0b4f18088..e09f6d868 100644 --- a/src/SceneGraph/Test/DualComplexTransformationTest.cpp +++ b/src/Magnum/SceneGraph/Test/DualComplexTransformationTest.cpp @@ -23,10 +23,10 @@ */ #include -#include +#include -#include "SceneGraph/DualComplexTransformation.h" -#include "SceneGraph/Scene.h" +#include "Magnum/SceneGraph/DualComplexTransformation.h" +#include "Magnum/SceneGraph/Scene.h" namespace Magnum { namespace SceneGraph { namespace Test { diff --git a/src/SceneGraph/Test/DualQuaternionTransformationTest.cpp b/src/Magnum/SceneGraph/Test/DualQuaternionTransformationTest.cpp similarity index 98% rename from src/SceneGraph/Test/DualQuaternionTransformationTest.cpp rename to src/Magnum/SceneGraph/Test/DualQuaternionTransformationTest.cpp index 1e0d0535e..0943ccb3d 100644 --- a/src/SceneGraph/Test/DualQuaternionTransformationTest.cpp +++ b/src/Magnum/SceneGraph/Test/DualQuaternionTransformationTest.cpp @@ -23,10 +23,10 @@ */ #include -#include +#include -#include "SceneGraph/DualQuaternionTransformation.h" -#include "SceneGraph/Scene.h" +#include "Magnum/SceneGraph/DualQuaternionTransformation.h" +#include "Magnum/SceneGraph/Scene.h" namespace Magnum { namespace SceneGraph { namespace Test { diff --git a/src/SceneGraph/Test/MatrixTransformation2DTest.cpp b/src/Magnum/SceneGraph/Test/MatrixTransformation2DTest.cpp similarity index 98% rename from src/SceneGraph/Test/MatrixTransformation2DTest.cpp rename to src/Magnum/SceneGraph/Test/MatrixTransformation2DTest.cpp index 3ef781249..5a614b13e 100644 --- a/src/SceneGraph/Test/MatrixTransformation2DTest.cpp +++ b/src/Magnum/SceneGraph/Test/MatrixTransformation2DTest.cpp @@ -22,10 +22,10 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include -#include "SceneGraph/MatrixTransformation2D.h" -#include "SceneGraph/Scene.h" +#include "Magnum/SceneGraph/MatrixTransformation2D.h" +#include "Magnum/SceneGraph/Scene.h" namespace Magnum { namespace SceneGraph { namespace Test { diff --git a/src/SceneGraph/Test/MatrixTransformation3DTest.cpp b/src/Magnum/SceneGraph/Test/MatrixTransformation3DTest.cpp similarity index 98% rename from src/SceneGraph/Test/MatrixTransformation3DTest.cpp rename to src/Magnum/SceneGraph/Test/MatrixTransformation3DTest.cpp index 0a250d44c..9363af882 100644 --- a/src/SceneGraph/Test/MatrixTransformation3DTest.cpp +++ b/src/Magnum/SceneGraph/Test/MatrixTransformation3DTest.cpp @@ -22,10 +22,10 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include -#include "SceneGraph/MatrixTransformation3D.h" -#include "SceneGraph/Scene.h" +#include "Magnum/SceneGraph/MatrixTransformation3D.h" +#include "Magnum/SceneGraph/Scene.h" namespace Magnum { namespace SceneGraph { namespace Test { diff --git a/src/SceneGraph/Test/ObjectTest.cpp b/src/Magnum/SceneGraph/Test/ObjectTest.cpp similarity index 99% rename from src/SceneGraph/Test/ObjectTest.cpp rename to src/Magnum/SceneGraph/Test/ObjectTest.cpp index 2b4fea880..ccee1a77e 100644 --- a/src/SceneGraph/Test/ObjectTest.cpp +++ b/src/Magnum/SceneGraph/Test/ObjectTest.cpp @@ -23,10 +23,10 @@ */ #include -#include +#include -#include "SceneGraph/MatrixTransformation3D.h" -#include "SceneGraph/Scene.h" +#include "Magnum/SceneGraph/MatrixTransformation3D.h" +#include "Magnum/SceneGraph/Scene.h" namespace Magnum { namespace SceneGraph { namespace Test { diff --git a/src/SceneGraph/Test/RigidMatrixTransformation2DTest.cpp b/src/Magnum/SceneGraph/Test/RigidMatrixTransformation2DTest.cpp similarity index 98% rename from src/SceneGraph/Test/RigidMatrixTransformation2DTest.cpp rename to src/Magnum/SceneGraph/Test/RigidMatrixTransformation2DTest.cpp index c16831f35..5a9357820 100644 --- a/src/SceneGraph/Test/RigidMatrixTransformation2DTest.cpp +++ b/src/Magnum/SceneGraph/Test/RigidMatrixTransformation2DTest.cpp @@ -23,10 +23,10 @@ */ #include -#include +#include -#include "SceneGraph/RigidMatrixTransformation2D.h" -#include "SceneGraph/Scene.h" +#include "Magnum/SceneGraph/RigidMatrixTransformation2D.h" +#include "Magnum/SceneGraph/Scene.h" namespace Magnum { namespace SceneGraph { namespace Test { diff --git a/src/SceneGraph/Test/RigidMatrixTransformation3DTest.cpp b/src/Magnum/SceneGraph/Test/RigidMatrixTransformation3DTest.cpp similarity index 98% rename from src/SceneGraph/Test/RigidMatrixTransformation3DTest.cpp rename to src/Magnum/SceneGraph/Test/RigidMatrixTransformation3DTest.cpp index 89a0df1ad..00415f4df 100644 --- a/src/SceneGraph/Test/RigidMatrixTransformation3DTest.cpp +++ b/src/Magnum/SceneGraph/Test/RigidMatrixTransformation3DTest.cpp @@ -23,10 +23,10 @@ */ #include -#include +#include -#include "SceneGraph/RigidMatrixTransformation3D.h" -#include "SceneGraph/Scene.h" +#include "Magnum/SceneGraph/RigidMatrixTransformation3D.h" +#include "Magnum/SceneGraph/Scene.h" namespace Magnum { namespace SceneGraph { namespace Test { diff --git a/src/SceneGraph/Test/SceneTest.cpp b/src/Magnum/SceneGraph/Test/SceneTest.cpp similarity index 94% rename from src/SceneGraph/Test/SceneTest.cpp rename to src/Magnum/SceneGraph/Test/SceneTest.cpp index e242df54a..e376162fb 100644 --- a/src/SceneGraph/Test/SceneTest.cpp +++ b/src/Magnum/SceneGraph/Test/SceneTest.cpp @@ -22,10 +22,10 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include -#include "SceneGraph/MatrixTransformation3D.h" -#include "SceneGraph/Scene.h" +#include "Magnum/SceneGraph/MatrixTransformation3D.h" +#include "Magnum/SceneGraph/Scene.h" namespace Magnum { namespace SceneGraph { namespace Test { diff --git a/src/SceneGraph/Test/TranslationTransformationTest.cpp b/src/Magnum/SceneGraph/Test/TranslationTransformationTest.cpp similarity index 96% rename from src/SceneGraph/Test/TranslationTransformationTest.cpp rename to src/Magnum/SceneGraph/Test/TranslationTransformationTest.cpp index 1fe7dd5e4..b774fb8ba 100644 --- a/src/SceneGraph/Test/TranslationTransformationTest.cpp +++ b/src/Magnum/SceneGraph/Test/TranslationTransformationTest.cpp @@ -23,11 +23,11 @@ */ #include -#include +#include -#include "SceneGraph/Object.hpp" -#include "SceneGraph/TranslationTransformation.h" -#include "SceneGraph/Scene.h" +#include "Magnum/SceneGraph/Object.hpp" +#include "Magnum/SceneGraph/TranslationTransformation.h" +#include "Magnum/SceneGraph/Scene.h" namespace Magnum { namespace SceneGraph { namespace Test { diff --git a/src/SceneGraph/TranslationTransformation.h b/src/Magnum/SceneGraph/TranslationTransformation.h similarity index 98% rename from src/SceneGraph/TranslationTransformation.h rename to src/Magnum/SceneGraph/TranslationTransformation.h index 6c2423542..82ffb53bc 100644 --- a/src/SceneGraph/TranslationTransformation.h +++ b/src/Magnum/SceneGraph/TranslationTransformation.h @@ -28,10 +28,10 @@ * @brief Class @ref Magnum::SceneGraph::TranslationTransformation, alias @ref Magnum::SceneGraph::BasicTranslationTransformation2D, @ref Magnum::SceneGraph::BasicTranslationTransformation3D, typedef @ref Magnum::SceneGraph::TranslationTransformation2D, @ref Magnum::SceneGraph::BasicTranslationTransformation3D */ -#include "Math/Matrix3.h" -#include "Math/Matrix4.h" -#include "SceneGraph/AbstractTranslation.h" -#include "SceneGraph/Object.h" +#include "Magnum/Math/Matrix3.h" +#include "Magnum/Math/Matrix4.h" +#include "Magnum/SceneGraph/AbstractTranslation.h" +#include "Magnum/SceneGraph/Object.h" namespace Magnum { namespace SceneGraph { diff --git a/src/SceneGraph/instantiation.cpp b/src/Magnum/SceneGraph/instantiation.cpp similarity index 80% rename from src/SceneGraph/instantiation.cpp rename to src/Magnum/SceneGraph/instantiation.cpp index 079199ddc..3d854a867 100644 --- a/src/SceneGraph/instantiation.cpp +++ b/src/Magnum/SceneGraph/instantiation.cpp @@ -22,19 +22,20 @@ DEALINGS IN THE SOFTWARE. */ -#include "SceneGraph/AbstractFeature.hpp" -#include "SceneGraph/Animable.hpp" -#include "SceneGraph/Camera2D.hpp" -#include "SceneGraph/Camera3D.hpp" -#include "SceneGraph/DualComplexTransformation.h" -#include "SceneGraph/DualQuaternionTransformation.h" -#include "SceneGraph/FeatureGroup.hpp" -#include "SceneGraph/MatrixTransformation2D.h" -#include "SceneGraph/MatrixTransformation3D.h" -#include "SceneGraph/Object.hpp" -#include "SceneGraph/RigidMatrixTransformation2D.h" -#include "SceneGraph/RigidMatrixTransformation3D.h" -#include "SceneGraph/TranslationTransformation.h" +#include "Magnum/SceneGraph/AbstractFeature.hpp" +#include "Magnum/SceneGraph/Animable.hpp" +#include "Magnum/SceneGraph/Camera2D.hpp" +#include "Magnum/SceneGraph/Camera3D.hpp" +#include "Magnum/SceneGraph/Drawable.hpp" +#include "Magnum/SceneGraph/DualComplexTransformation.h" +#include "Magnum/SceneGraph/DualQuaternionTransformation.h" +#include "Magnum/SceneGraph/FeatureGroup.hpp" +#include "Magnum/SceneGraph/MatrixTransformation2D.h" +#include "Magnum/SceneGraph/MatrixTransformation3D.h" +#include "Magnum/SceneGraph/Object.hpp" +#include "Magnum/SceneGraph/RigidMatrixTransformation2D.h" +#include "Magnum/SceneGraph/RigidMatrixTransformation3D.h" +#include "Magnum/SceneGraph/TranslationTransformation.h" namespace Magnum { namespace SceneGraph { @@ -66,6 +67,9 @@ template class MAGNUM_SCENEGRAPH_EXPORT_HPP AbstractCamera<3, Float>; template class MAGNUM_SCENEGRAPH_EXPORT_HPP BasicCamera2D; template class MAGNUM_SCENEGRAPH_EXPORT_HPP BasicCamera3D; +template class MAGNUM_SCENEGRAPH_EXPORT_HPP Drawable<2, Float>; +template class MAGNUM_SCENEGRAPH_EXPORT_HPP Drawable<3, Float>; + template class MAGNUM_SCENEGRAPH_EXPORT_HPP Object>; template class MAGNUM_SCENEGRAPH_EXPORT_HPP Object>; template class MAGNUM_SCENEGRAPH_EXPORT_HPP Object>; diff --git a/src/SceneGraph/magnumSceneGraphVisibility.h b/src/Magnum/SceneGraph/visibility.h similarity index 90% rename from src/SceneGraph/magnumSceneGraphVisibility.h rename to src/Magnum/SceneGraph/visibility.h index 9ffc7422c..9845594a5 100644 --- a/src/SceneGraph/magnumSceneGraphVisibility.h +++ b/src/Magnum/SceneGraph/visibility.h @@ -1,5 +1,5 @@ -#ifndef Magnum_SceneGraph_magnumSceneGraphVisibility_h -#define Magnum_SceneGraph_magnumSceneGraphVisibility_h +#ifndef Magnum_SceneGraph_visibility_h +#define Magnum_SceneGraph_visibility_h /* This file is part of Magnum. @@ -24,9 +24,9 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include -#include "magnumConfigure.h" +#include "Magnum/configure.h" #ifndef MAGNUM_BUILD_STATIC #if defined(MagnumSceneGraph_EXPORTS) || defined(MagnumSceneGraphObjects_EXPORTS) diff --git a/src/Shader.cpp b/src/Magnum/Shader.cpp similarity index 99% rename from src/Shader.cpp rename to src/Magnum/Shader.cpp index 8e7480472..98e5c894d 100644 --- a/src/Shader.cpp +++ b/src/Magnum/Shader.cpp @@ -25,13 +25,13 @@ #include "Shader.h" #include /* std::max(), needed by MSVC */ +#include +#include +#include -#include -#include -#include +#include "Magnum/Context.h" +#include "Magnum/Extensions.h" -#include "Context.h" -#include "Extensions.h" #include "Implementation/DebugState.h" #include "Implementation/State.h" #include "Implementation/ShaderState.h" diff --git a/src/Shader.h b/src/Magnum/Shader.h similarity index 97% rename from src/Shader.h rename to src/Magnum/Shader.h index ec8b0b33f..db0818cde 100644 --- a/src/Shader.h +++ b/src/Magnum/Shader.h @@ -25,15 +25,14 @@ */ /** @file - * @brief Class Magnum::Shader + * @brief Class @ref Magnum::Shader */ #include #include -#include "AbstractObject.h" -#include "Magnum.h" -#include "magnumVisibility.h" +#include "Magnum/AbstractObject.h" +#include "Magnum/Magnum.h" #ifdef CORRADE_GCC45_COMPATIBILITY #include "Version.h" @@ -44,7 +43,14 @@ namespace Magnum { /** @brief %Shader -See AbstractShaderProgram for more information. +See @ref AbstractShaderProgram for more information. + +@todoc Usage... + +@section Shader-performance-optimization Performance optimizations + +%Shader limits and implementation-defined values (such as @ref maxUniformComponents()) +are cached, so repeated queries don't result in repeated @fn_gl{Get} calls. */ class MAGNUM_EXPORT Shader: public AbstractObject { public: @@ -434,7 +440,7 @@ class MAGNUM_EXPORT Shader: public AbstractObject { * @param type %Shader type * * Creates empty OpenGL shader and adds @c \#version directive at the - * beginning. Sources can be added with addSource() or addFile(). + * beginning. * @see @fn_gl{CreateShader} */ explicit Shader(Version version, Type type); @@ -502,7 +508,7 @@ class MAGNUM_EXPORT Shader: public AbstractObject { * Adds given source to source list, preceeded with @c \#line directive * marking first line of the source as `n(1)` where n is number of * added source. If passed string is empty, the function does nothing. - * @see addFile() + * @see @ref addFile() */ Shader& addSource(std::string source); @@ -511,8 +517,8 @@ class MAGNUM_EXPORT Shader: public AbstractObject { * @param filename Name of source file to read from * @return Reference to self (for method chaining) * - * The file must exist and must be readable. Calls addSource() with - * the contents. + * The file must exist and must be readable. Calls @ref addSource() + * with the contents. */ Shader& addFile(const std::string& filename); diff --git a/src/Shaders/AbstractVector.h b/src/Magnum/Shaders/AbstractVector.h similarity index 98% rename from src/Shaders/AbstractVector.h rename to src/Magnum/Shaders/AbstractVector.h index c04cb9568..53482b3f7 100644 --- a/src/Shaders/AbstractVector.h +++ b/src/Magnum/Shaders/AbstractVector.h @@ -28,7 +28,7 @@ * @brief Class Magnum::Shaders::AbstractVector, typedef Magnum::Shaders::AbstractVector2D, Magnum::Shaders::AbstractVector3D */ -#include "Shaders/Generic.h" +#include "Magnum/Shaders/Generic.h" namespace Magnum { namespace Shaders { diff --git a/src/Shaders/AbstractVector2D.vert b/src/Magnum/Shaders/AbstractVector2D.vert similarity index 100% rename from src/Shaders/AbstractVector2D.vert rename to src/Magnum/Shaders/AbstractVector2D.vert diff --git a/src/Shaders/AbstractVector3D.vert b/src/Magnum/Shaders/AbstractVector3D.vert similarity index 100% rename from src/Shaders/AbstractVector3D.vert rename to src/Magnum/Shaders/AbstractVector3D.vert diff --git a/src/Shaders/CMakeLists.txt b/src/Magnum/Shaders/CMakeLists.txt similarity index 91% rename from src/Shaders/CMakeLists.txt rename to src/Magnum/Shaders/CMakeLists.txt index cd66e8b93..6ce657365 100644 --- a/src/Shaders/CMakeLists.txt +++ b/src/Magnum/Shaders/CMakeLists.txt @@ -44,10 +44,14 @@ set(MagnumShaders_HEADERS Vector.h VertexColor.h - magnumShadersVisibility.h) + visibility.h) if(BUILD_STATIC) - set(MagnumShaders_HEADERS ${MagnumShaders_HEADERS} magnumShadersResourceImport.hpp) + set(MagnumShaders_HEADERS ${MagnumShaders_HEADERS} resourceImport.hpp) + + if(BUILD_DEPRECATED) + set(MagnumShaders_HEADERS ${MagnumShaders_HEADERS} magnumShadersResourceImport.hpp) + endif() endif() add_library(MagnumShaders ${SHARED_OR_STATIC} ${MagnumShaders_SRCS}) diff --git a/src/Shaders/DistanceFieldVector.cpp b/src/Magnum/Shaders/DistanceFieldVector.cpp similarity index 97% rename from src/Shaders/DistanceFieldVector.cpp rename to src/Magnum/Shaders/DistanceFieldVector.cpp index 9cb3769c0..2af1089bc 100644 --- a/src/Shaders/DistanceFieldVector.cpp +++ b/src/Magnum/Shaders/DistanceFieldVector.cpp @@ -24,11 +24,11 @@ #include "DistanceFieldVector.h" -#include +#include -#include "Context.h" -#include "Extensions.h" -#include "Shader.h" +#include "Magnum/Context.h" +#include "Magnum/Extensions.h" +#include "Magnum/Shader.h" namespace Magnum { namespace Shaders { diff --git a/src/Shaders/DistanceFieldVector.frag b/src/Magnum/Shaders/DistanceFieldVector.frag similarity index 100% rename from src/Shaders/DistanceFieldVector.frag rename to src/Magnum/Shaders/DistanceFieldVector.frag diff --git a/src/Shaders/DistanceFieldVector.h b/src/Magnum/Shaders/DistanceFieldVector.h similarity index 95% rename from src/Shaders/DistanceFieldVector.h rename to src/Magnum/Shaders/DistanceFieldVector.h index 9c61647de..335d3aec6 100644 --- a/src/Shaders/DistanceFieldVector.h +++ b/src/Magnum/Shaders/DistanceFieldVector.h @@ -28,13 +28,12 @@ * @brief Class Magnum::Shaders::DistanceFieldVector, typedef Magnum::Shaders::DistanceFieldVector2D, Magnum::Shaders::DistanceFieldVector3D */ -#include "Math/Matrix3.h" -#include "Math/Matrix4.h" -#include "Color.h" -#include "DimensionTraits.h" -#include "AbstractVector.h" - -#include "magnumShadersVisibility.h" +#include "Magnum/Color.h" +#include "Magnum/DimensionTraits.h" +#include "Magnum/Math/Matrix3.h" +#include "Magnum/Math/Matrix4.h" +#include "Magnum/Shaders/AbstractVector.h" +#include "Magnum/Shaders/visibility.h" namespace Magnum { namespace Shaders { diff --git a/src/Shaders/Flat.cpp b/src/Magnum/Shaders/Flat.cpp similarity index 97% rename from src/Shaders/Flat.cpp rename to src/Magnum/Shaders/Flat.cpp index f552058e0..cbb3284ad 100644 --- a/src/Shaders/Flat.cpp +++ b/src/Magnum/Shaders/Flat.cpp @@ -24,11 +24,11 @@ #include "Flat.h" -#include +#include -#include "Context.h" -#include "Extensions.h" -#include "Shader.h" +#include "Magnum/Context.h" +#include "Magnum/Extensions.h" +#include "Magnum/Shader.h" namespace Magnum { namespace Shaders { diff --git a/src/Shaders/Flat.frag b/src/Magnum/Shaders/Flat.frag similarity index 100% rename from src/Shaders/Flat.frag rename to src/Magnum/Shaders/Flat.frag diff --git a/src/Shaders/Flat.h b/src/Magnum/Shaders/Flat.h similarity index 95% rename from src/Shaders/Flat.h rename to src/Magnum/Shaders/Flat.h index 00740ddae..0fc86d603 100644 --- a/src/Shaders/Flat.h +++ b/src/Magnum/Shaders/Flat.h @@ -28,13 +28,12 @@ * @brief Class @ref Magnum::Shaders::Flat, typedef @ref Magnum::Shaders::Flat2D, @ref Magnum::Shaders::Flat3D */ -#include "Math/Matrix3.h" -#include "Math/Matrix4.h" -#include "Color.h" -#include "DimensionTraits.h" -#include "Shaders/Generic.h" - -#include "magnumShadersVisibility.h" +#include "Magnum/Color.h" +#include "Magnum/DimensionTraits.h" +#include "Magnum/Math/Matrix3.h" +#include "Magnum/Math/Matrix4.h" +#include "Magnum/Shaders/Generic.h" +#include "Magnum/Shaders/visibility.h" namespace Magnum { namespace Shaders { diff --git a/src/Shaders/Flat2D.vert b/src/Magnum/Shaders/Flat2D.vert similarity index 100% rename from src/Shaders/Flat2D.vert rename to src/Magnum/Shaders/Flat2D.vert diff --git a/src/Shaders/Flat3D.vert b/src/Magnum/Shaders/Flat3D.vert similarity index 100% rename from src/Shaders/Flat3D.vert rename to src/Magnum/Shaders/Flat3D.vert diff --git a/src/Shaders/FullScreenTriangle.glsl b/src/Magnum/Shaders/FullScreenTriangle.glsl similarity index 100% rename from src/Shaders/FullScreenTriangle.glsl rename to src/Magnum/Shaders/FullScreenTriangle.glsl diff --git a/src/Shaders/Generic.h b/src/Magnum/Shaders/Generic.h similarity index 98% rename from src/Shaders/Generic.h rename to src/Magnum/Shaders/Generic.h index 5676cbd0c..247de1559 100644 --- a/src/Shaders/Generic.h +++ b/src/Magnum/Shaders/Generic.h @@ -28,7 +28,7 @@ * @brief Struct @ref Magnum::Shaders::Generic, typedef @ref Magnum::Shaders::Generic2D, @ref Magnum::Shaders::Generic3D */ -#include "AbstractShaderProgram.h" +#include "Magnum/AbstractShaderProgram.h" namespace Magnum { namespace Shaders { diff --git a/src/Shaders/MeshVisualizer.cpp b/src/Magnum/Shaders/MeshVisualizer.cpp similarity index 97% rename from src/Shaders/MeshVisualizer.cpp rename to src/Magnum/Shaders/MeshVisualizer.cpp index bc7dcbbac..7eabe272f 100644 --- a/src/Shaders/MeshVisualizer.cpp +++ b/src/Magnum/Shaders/MeshVisualizer.cpp @@ -24,11 +24,11 @@ #include "MeshVisualizer.h" -#include +#include -#include "Context.h" -#include "Extensions.h" -#include "Shader.h" +#include "Magnum/Context.h" +#include "Magnum/Extensions.h" +#include "Magnum/Shader.h" namespace Magnum { namespace Shaders { diff --git a/src/Shaders/MeshVisualizer.frag b/src/Magnum/Shaders/MeshVisualizer.frag similarity index 100% rename from src/Shaders/MeshVisualizer.frag rename to src/Magnum/Shaders/MeshVisualizer.frag diff --git a/src/Shaders/MeshVisualizer.geom b/src/Magnum/Shaders/MeshVisualizer.geom similarity index 100% rename from src/Shaders/MeshVisualizer.geom rename to src/Magnum/Shaders/MeshVisualizer.geom diff --git a/src/Shaders/MeshVisualizer.h b/src/Magnum/Shaders/MeshVisualizer.h similarity index 98% rename from src/Shaders/MeshVisualizer.h rename to src/Magnum/Shaders/MeshVisualizer.h index b7289410b..76f006653 100644 --- a/src/Shaders/MeshVisualizer.h +++ b/src/Magnum/Shaders/MeshVisualizer.h @@ -28,11 +28,11 @@ * @brief Class Magnum::Shaders::MeshVisualizer */ -#include "Math/Matrix4.h" -#include "AbstractShaderProgram.h" -#include "Color.h" +#include "Magnum/Math/Matrix4.h" +#include "Magnum/AbstractShaderProgram.h" +#include "Magnum/Color.h" -#include "Shaders/magnumShadersVisibility.h" +#include "Magnum/Shaders/visibility.h" namespace Magnum { namespace Shaders { diff --git a/src/Shaders/MeshVisualizer.vert b/src/Magnum/Shaders/MeshVisualizer.vert similarity index 100% rename from src/Shaders/MeshVisualizer.vert rename to src/Magnum/Shaders/MeshVisualizer.vert diff --git a/src/Shaders/Phong.cpp b/src/Magnum/Shaders/Phong.cpp similarity index 97% rename from src/Shaders/Phong.cpp rename to src/Magnum/Shaders/Phong.cpp index 78f0f844f..c8f20253d 100644 --- a/src/Shaders/Phong.cpp +++ b/src/Magnum/Shaders/Phong.cpp @@ -24,11 +24,11 @@ #include "Phong.h" -#include +#include -#include "Context.h" -#include "Extensions.h" -#include "Shader.h" +#include "Magnum/Context.h" +#include "Magnum/Extensions.h" +#include "Magnum/Shader.h" namespace Magnum { namespace Shaders { diff --git a/src/Shaders/Phong.frag b/src/Magnum/Shaders/Phong.frag similarity index 100% rename from src/Shaders/Phong.frag rename to src/Magnum/Shaders/Phong.frag diff --git a/src/Shaders/Phong.h b/src/Magnum/Shaders/Phong.h similarity index 98% rename from src/Shaders/Phong.h rename to src/Magnum/Shaders/Phong.h index 2d380a7d7..83b20160e 100644 --- a/src/Shaders/Phong.h +++ b/src/Magnum/Shaders/Phong.h @@ -28,11 +28,10 @@ * @brief Class Magnum::Shaders::Phong */ -#include "Math/Matrix4.h" -#include "Color.h" -#include "Shaders/Generic.h" - -#include "magnumShadersVisibility.h" +#include "Magnum/Color.h" +#include "Magnum/Math/Matrix4.h" +#include "Magnum/Shaders/Generic.h" +#include "Magnum/Shaders/visibility.h" namespace Magnum { namespace Shaders { diff --git a/src/Shaders/Phong.vert b/src/Magnum/Shaders/Phong.vert similarity index 100% rename from src/Shaders/Phong.vert rename to src/Magnum/Shaders/Phong.vert diff --git a/src/Shaders/Shaders.h b/src/Magnum/Shaders/Shaders.h similarity index 98% rename from src/Shaders/Shaders.h rename to src/Magnum/Shaders/Shaders.h index 95d259f1d..09b21ca3d 100644 --- a/src/Shaders/Shaders.h +++ b/src/Magnum/Shaders/Shaders.h @@ -28,7 +28,7 @@ * @brief Forward declarations for Magnum::Shaders namespace */ -#include "Types.h" +#include "Magnum/Types.h" namespace Magnum { namespace Shaders { diff --git a/src/Shaders/Test/CMakeLists.txt b/src/Magnum/Shaders/Test/CMakeLists.txt similarity index 100% rename from src/Shaders/Test/CMakeLists.txt rename to src/Magnum/Shaders/Test/CMakeLists.txt diff --git a/src/Shaders/Test/DistanceFieldVectorGLTest.cpp b/src/Magnum/Shaders/Test/DistanceFieldVectorGLTest.cpp similarity index 93% rename from src/Shaders/Test/DistanceFieldVectorGLTest.cpp rename to src/Magnum/Shaders/Test/DistanceFieldVectorGLTest.cpp index 6616f2fab..0250b34c9 100644 --- a/src/Shaders/Test/DistanceFieldVectorGLTest.cpp +++ b/src/Magnum/Shaders/Test/DistanceFieldVectorGLTest.cpp @@ -22,11 +22,11 @@ DEALINGS IN THE SOFTWARE. */ -#include "Shaders/DistanceFieldVector.h" -#include "Test/AbstractOpenGLTester.h" +#include "Magnum/Shaders/DistanceFieldVector.h" +#include "Magnum/Test/AbstractOpenGLTester.h" #ifdef MAGNUM_BUILD_STATIC -#include "Shaders/magnumShadersResourceImport.hpp" +#include "Magnum/Shaders/resourceImport.hpp" #endif namespace Magnum { namespace Shaders { namespace Test { diff --git a/src/Shaders/Test/FlatGLTest.cpp b/src/Magnum/Shaders/Test/FlatGLTest.cpp similarity index 94% rename from src/Shaders/Test/FlatGLTest.cpp rename to src/Magnum/Shaders/Test/FlatGLTest.cpp index f0a47d5e2..403bfc51b 100644 --- a/src/Shaders/Test/FlatGLTest.cpp +++ b/src/Magnum/Shaders/Test/FlatGLTest.cpp @@ -22,11 +22,11 @@ DEALINGS IN THE SOFTWARE. */ -#include "Shaders/Flat.h" -#include "Test/AbstractOpenGLTester.h" +#include "Magnum/Shaders/Flat.h" +#include "Magnum/Test/AbstractOpenGLTester.h" #ifdef MAGNUM_BUILD_STATIC -#include "Shaders/magnumShadersResourceImport.hpp" +#include "Magnum/Shaders/resourceImport.hpp" #endif namespace Magnum { namespace Shaders { namespace Test { diff --git a/src/Shaders/Test/MeshVisualizerGLTest.cpp b/src/Magnum/Shaders/Test/MeshVisualizerGLTest.cpp similarity index 93% rename from src/Shaders/Test/MeshVisualizerGLTest.cpp rename to src/Magnum/Shaders/Test/MeshVisualizerGLTest.cpp index 1a28c3a57..736a53c6d 100644 --- a/src/Shaders/Test/MeshVisualizerGLTest.cpp +++ b/src/Magnum/Shaders/Test/MeshVisualizerGLTest.cpp @@ -22,13 +22,13 @@ DEALINGS IN THE SOFTWARE. */ -#include "Context.h" -#include "Extensions.h" -#include "Shaders/MeshVisualizer.h" -#include "Test/AbstractOpenGLTester.h" +#include "Magnum/Context.h" +#include "Magnum/Extensions.h" +#include "Magnum/Shaders/MeshVisualizer.h" +#include "Magnum/Test/AbstractOpenGLTester.h" #ifdef MAGNUM_BUILD_STATIC -#include "Shaders/magnumShadersResourceImport.hpp" +#include "Magnum/Shaders/resourceImport.hpp" #endif namespace Magnum { namespace Shaders { namespace Test { diff --git a/src/Shaders/Test/PhongGLTest.cpp b/src/Magnum/Shaders/Test/PhongGLTest.cpp similarity index 96% rename from src/Shaders/Test/PhongGLTest.cpp rename to src/Magnum/Shaders/Test/PhongGLTest.cpp index 87c1ffbca..373c6d099 100644 --- a/src/Shaders/Test/PhongGLTest.cpp +++ b/src/Magnum/Shaders/Test/PhongGLTest.cpp @@ -22,11 +22,11 @@ DEALINGS IN THE SOFTWARE. */ -#include "Shaders/Phong.h" -#include "Test/AbstractOpenGLTester.h" +#include "Magnum/Shaders/Phong.h" +#include "Magnum/Test/AbstractOpenGLTester.h" #ifdef MAGNUM_BUILD_STATIC -#include "Shaders/magnumShadersResourceImport.hpp" +#include "Magnum/Shaders/resourceImport.hpp" #endif namespace Magnum { namespace Shaders { namespace Test { diff --git a/src/Shaders/Test/VectorGLTest.cpp b/src/Magnum/Shaders/Test/VectorGLTest.cpp similarity index 93% rename from src/Shaders/Test/VectorGLTest.cpp rename to src/Magnum/Shaders/Test/VectorGLTest.cpp index c69d706de..ad49686ef 100644 --- a/src/Shaders/Test/VectorGLTest.cpp +++ b/src/Magnum/Shaders/Test/VectorGLTest.cpp @@ -22,11 +22,11 @@ DEALINGS IN THE SOFTWARE. */ -#include "Shaders/Vector.h" -#include "Test/AbstractOpenGLTester.h" +#include "Magnum/Shaders/Vector.h" +#include "Magnum/Test/AbstractOpenGLTester.h" #ifdef MAGNUM_BUILD_STATIC -#include "Shaders/magnumShadersResourceImport.hpp" +#include "Magnum/Shaders/resourceImport.hpp" #endif namespace Magnum { namespace Shaders { namespace Test { diff --git a/src/Shaders/Test/VertexColorGLTest.cpp b/src/Magnum/Shaders/Test/VertexColorGLTest.cpp similarity index 93% rename from src/Shaders/Test/VertexColorGLTest.cpp rename to src/Magnum/Shaders/Test/VertexColorGLTest.cpp index 971fd555a..e31e171c5 100644 --- a/src/Shaders/Test/VertexColorGLTest.cpp +++ b/src/Magnum/Shaders/Test/VertexColorGLTest.cpp @@ -22,11 +22,11 @@ DEALINGS IN THE SOFTWARE. */ -#include "Shaders/VertexColor.h" -#include "Test/AbstractOpenGLTester.h" +#include "Magnum/Shaders/VertexColor.h" +#include "Magnum/Test/AbstractOpenGLTester.h" #ifdef MAGNUM_BUILD_STATIC -#include "Shaders/magnumShadersResourceImport.hpp" +#include "Magnum/Shaders/resourceImport.hpp" #endif namespace Magnum { namespace Shaders { namespace Test { diff --git a/src/Shaders/Vector.cpp b/src/Magnum/Shaders/Vector.cpp similarity index 97% rename from src/Shaders/Vector.cpp rename to src/Magnum/Shaders/Vector.cpp index a466e384d..5920a2e84 100644 --- a/src/Shaders/Vector.cpp +++ b/src/Magnum/Shaders/Vector.cpp @@ -24,11 +24,11 @@ #include "Vector.h" -#include +#include -#include "Context.h" -#include "Extensions.h" -#include "Shader.h" +#include "Magnum/Context.h" +#include "Magnum/Extensions.h" +#include "Magnum/Shader.h" namespace Magnum { namespace Shaders { diff --git a/src/Shaders/Vector.frag b/src/Magnum/Shaders/Vector.frag similarity index 100% rename from src/Shaders/Vector.frag rename to src/Magnum/Shaders/Vector.frag diff --git a/src/Shaders/Vector.h b/src/Magnum/Shaders/Vector.h similarity index 93% rename from src/Shaders/Vector.h rename to src/Magnum/Shaders/Vector.h index 4f0ab789d..fac824290 100644 --- a/src/Shaders/Vector.h +++ b/src/Magnum/Shaders/Vector.h @@ -28,13 +28,12 @@ * @brief Class @ref Magnum::Shaders::Vector, typedef @ref Magnum::Shaders::Vector2D, @ref Magnum::Shaders::Vector3D */ -#include "Math/Matrix3.h" -#include "Math/Matrix4.h" -#include "Color.h" -#include "DimensionTraits.h" -#include "Shaders/AbstractVector.h" - -#include "magnumShadersVisibility.h" +#include "Magnum/Color.h" +#include "Magnum/DimensionTraits.h" +#include "Magnum/Math/Matrix3.h" +#include "Magnum/Math/Matrix4.h" +#include "Magnum/Shaders/AbstractVector.h" +#include "Magnum/Shaders/visibility.h" namespace Magnum { namespace Shaders { diff --git a/src/Shaders/VertexColor.cpp b/src/Magnum/Shaders/VertexColor.cpp similarity index 96% rename from src/Shaders/VertexColor.cpp rename to src/Magnum/Shaders/VertexColor.cpp index b65b5991b..e59a2b57d 100644 --- a/src/Shaders/VertexColor.cpp +++ b/src/Magnum/Shaders/VertexColor.cpp @@ -24,11 +24,11 @@ #include "VertexColor.h" -#include +#include -#include "Context.h" -#include "Extensions.h" -#include "Shader.h" +#include "Magnum/Context.h" +#include "Magnum/Extensions.h" +#include "Magnum/Shader.h" namespace Magnum { namespace Shaders { diff --git a/src/Shaders/VertexColor.frag b/src/Magnum/Shaders/VertexColor.frag similarity index 100% rename from src/Shaders/VertexColor.frag rename to src/Magnum/Shaders/VertexColor.frag diff --git a/src/Shaders/VertexColor.h b/src/Magnum/Shaders/VertexColor.h similarity index 92% rename from src/Shaders/VertexColor.h rename to src/Magnum/Shaders/VertexColor.h index 067e859f9..c80330da4 100644 --- a/src/Shaders/VertexColor.h +++ b/src/Magnum/Shaders/VertexColor.h @@ -28,13 +28,12 @@ * @brief Class Magnum::Shaders::VertexColor */ -#include "Math/Matrix3.h" -#include "Math/Matrix4.h" -#include "Color.h" -#include "DimensionTraits.h" -#include "Shaders/Generic.h" - -#include "magnumShadersVisibility.h" +#include "Magnum/Color.h" +#include "Magnum/DimensionTraits.h" +#include "Magnum/Math/Matrix3.h" +#include "Magnum/Math/Matrix4.h" +#include "Magnum/Shaders/Generic.h" +#include "Magnum/Shaders/visibility.h" namespace Magnum { namespace Shaders { diff --git a/src/Shaders/VertexColor2D.vert b/src/Magnum/Shaders/VertexColor2D.vert similarity index 100% rename from src/Shaders/VertexColor2D.vert rename to src/Magnum/Shaders/VertexColor2D.vert diff --git a/src/Shaders/VertexColor3D.vert b/src/Magnum/Shaders/VertexColor3D.vert similarity index 100% rename from src/Shaders/VertexColor3D.vert rename to src/Magnum/Shaders/VertexColor3D.vert diff --git a/src/Shaders/compatibility.glsl b/src/Magnum/Shaders/compatibility.glsl similarity index 100% rename from src/Shaders/compatibility.glsl rename to src/Magnum/Shaders/compatibility.glsl diff --git a/src/Shaders/generic.glsl b/src/Magnum/Shaders/generic.glsl similarity index 100% rename from src/Shaders/generic.glsl rename to src/Magnum/Shaders/generic.glsl diff --git a/src/Shaders/magnumShadersResourceImport.hpp b/src/Magnum/Shaders/magnumShadersResourceImport.hpp similarity index 84% rename from src/Shaders/magnumShadersResourceImport.hpp rename to src/Magnum/Shaders/magnumShadersResourceImport.hpp index 419601905..3aa3a1c90 100644 --- a/src/Shaders/magnumShadersResourceImport.hpp +++ b/src/Magnum/Shaders/magnumShadersResourceImport.hpp @@ -24,16 +24,16 @@ DEALINGS IN THE SOFTWARE. */ -#include "magnumConfigure.h" +#include "Magnum/configure.h" #ifdef MAGNUM_BUILD_STATIC -#include -#include - -static int magnumShadersResourceImport() { - CORRADE_RESOURCE_INITIALIZE(MagnumShaders_RCS) - return 0; -} CORRADE_AUTOMATIC_INITIALIZER(magnumShadersResourceImport) +#ifdef MAGNUM_BUILD_DEPRECATED +#include "Magnum/Shaders/resourceImport.h" +#else +#error use Magnum/Shaders/resourceImport.h instead +#endif +#else +#error this header is available only in static build #endif #endif diff --git a/src/Magnum/Shaders/resourceImport.hpp b/src/Magnum/Shaders/resourceImport.hpp new file mode 100644 index 000000000..87fdb771d --- /dev/null +++ b/src/Magnum/Shaders/resourceImport.hpp @@ -0,0 +1,41 @@ +#ifndef Magnum_Shaders_resourceImport_hpp +#define Magnum_Shaders_resourceImport_hpp +/* + This file is part of Magnum. + + Copyright © 2010, 2011, 2012, 2013 Vladimír Vondruš + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. +*/ + +#include "Magnum/configure.h" + +#ifdef MAGNUM_BUILD_STATIC +#include +#include + +static int magnumShadersResourceImport() { + CORRADE_RESOURCE_INITIALIZE(MagnumShaders_RCS) + return 0; +} CORRADE_AUTOMATIC_INITIALIZER(magnumShadersResourceImport) +#else +#error this header is available only in static build +#endif + +#endif diff --git a/src/Shaders/resources.conf b/src/Magnum/Shaders/resources.conf similarity index 100% rename from src/Shaders/resources.conf rename to src/Magnum/Shaders/resources.conf diff --git a/src/Shaders/magnumShadersVisibility.h b/src/Magnum/Shaders/visibility.h similarity index 95% rename from src/Shaders/magnumShadersVisibility.h rename to src/Magnum/Shaders/visibility.h index a42810511..6a9400db4 100644 --- a/src/Shaders/magnumShadersVisibility.h +++ b/src/Magnum/Shaders/visibility.h @@ -24,9 +24,9 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include -#include "magnumConfigure.h" +#include "Magnum/configure.h" #ifndef MAGNUM_BUILD_STATIC #ifdef MagnumShaders_EXPORTS diff --git a/src/Shapes/AbstractShape.cpp b/src/Magnum/Shapes/AbstractShape.cpp similarity index 95% rename from src/Shapes/AbstractShape.cpp rename to src/Magnum/Shapes/AbstractShape.cpp index f6cee4d27..6e2b2401c 100644 --- a/src/Shapes/AbstractShape.cpp +++ b/src/Magnum/Shapes/AbstractShape.cpp @@ -24,10 +24,10 @@ #include "AbstractShape.h" -#include +#include -#include "Shapes/ShapeGroup.h" -#include "Shapes/Implementation/CollisionDispatch.h" +#include "Magnum/Shapes/ShapeGroup.h" +#include "Magnum/Shapes/Implementation/CollisionDispatch.h" namespace Magnum { namespace Shapes { diff --git a/src/Shapes/AbstractShape.h b/src/Magnum/Shapes/AbstractShape.h similarity index 95% rename from src/Shapes/AbstractShape.h rename to src/Magnum/Shapes/AbstractShape.h index 8371093f8..568aee553 100644 --- a/src/Shapes/AbstractShape.h +++ b/src/Magnum/Shapes/AbstractShape.h @@ -28,11 +28,11 @@ * @brief Class Magnum::Shapes::AbstractShape, typedef Magnum::Shapes::AbstractShape2D, Magnum::Shapes::AbstractShape3D */ -#include "Magnum.h" -#include "DimensionTraits.h" -#include "Shapes/magnumShapesVisibility.h" -#include "Shapes/shapeImplementation.h" -#include "SceneGraph/AbstractGroupedFeature.h" +#include "Magnum/Magnum.h" +#include "Magnum/DimensionTraits.h" +#include "Magnum/SceneGraph/AbstractGroupedFeature.h" +#include "Magnum/Shapes/shapeImplementation.h" +#include "Magnum/Shapes/visibility.h" namespace Magnum { namespace Shapes { diff --git a/src/Shapes/AxisAlignedBox.cpp b/src/Magnum/Shapes/AxisAlignedBox.cpp similarity index 95% rename from src/Shapes/AxisAlignedBox.cpp rename to src/Magnum/Shapes/AxisAlignedBox.cpp index 75c7df465..00318b8df 100644 --- a/src/Shapes/AxisAlignedBox.cpp +++ b/src/Magnum/Shapes/AxisAlignedBox.cpp @@ -24,9 +24,9 @@ #include "AxisAlignedBox.h" -#include "Math/Matrix3.h" -#include "Math/Matrix4.h" -#include "Shapes/Point.h" +#include "Magnum/Math/Matrix3.h" +#include "Magnum/Math/Matrix4.h" +#include "Magnum/Shapes/Point.h" namespace Magnum { namespace Shapes { diff --git a/src/Shapes/AxisAlignedBox.h b/src/Magnum/Shapes/AxisAlignedBox.h similarity index 96% rename from src/Shapes/AxisAlignedBox.h rename to src/Magnum/Shapes/AxisAlignedBox.h index 50aa7210f..f9e1574db 100644 --- a/src/Shapes/AxisAlignedBox.h +++ b/src/Magnum/Shapes/AxisAlignedBox.h @@ -28,10 +28,10 @@ * @brief Class Magnum::Shapes::AxisAlignedBox, typedef Magnum::Shapes::AxisAlignedBox2D, Magnum::Shapes.:AxisAlignedBox3D */ -#include "Math/Vector3.h" -#include "DimensionTraits.h" -#include "Shapes/Shapes.h" -#include "Shapes/magnumShapesVisibility.h" +#include "Magnum/DimensionTraits.h" +#include "Magnum/Math/Vector3.h" +#include "Magnum/Shapes/Shapes.h" +#include "Magnum/Shapes/visibility.h" namespace Magnum { namespace Shapes { diff --git a/src/Shapes/Box.cpp b/src/Magnum/Shapes/Box.cpp similarity index 100% rename from src/Shapes/Box.cpp rename to src/Magnum/Shapes/Box.cpp diff --git a/src/Shapes/Box.h b/src/Magnum/Shapes/Box.h similarity index 95% rename from src/Shapes/Box.h rename to src/Magnum/Shapes/Box.h index f7abec1d2..84ba50c58 100644 --- a/src/Shapes/Box.h +++ b/src/Magnum/Shapes/Box.h @@ -28,10 +28,10 @@ * @brief Class Magnum::Shapes::Box, typedef Magnum::Shapes::Box2D, Magnum::Shapes::Box3D */ -#include "Math/Matrix3.h" -#include "Math/Matrix4.h" -#include "DimensionTraits.h" -#include "Shapes/magnumShapesVisibility.h" +#include "Magnum/DimensionTraits.h" +#include "Magnum/Math/Matrix3.h" +#include "Magnum/Math/Matrix4.h" +#include "Magnum/Shapes/visibility.h" namespace Magnum { namespace Shapes { diff --git a/src/Shapes/CMakeLists.txt b/src/Magnum/Shapes/CMakeLists.txt similarity index 97% rename from src/Shapes/CMakeLists.txt rename to src/Magnum/Shapes/CMakeLists.txt index 992639f60..1528ad5d6 100644 --- a/src/Shapes/CMakeLists.txt +++ b/src/Magnum/Shapes/CMakeLists.txt @@ -57,8 +57,8 @@ set(MagnumShapes_HEADERS Point.h Sphere.h - magnumShapesVisibility.h - shapeImplementation.h) + shapeImplementation.h + visibility.h) add_library(MagnumShapes ${SHARED_OR_STATIC} ${MagnumShapes_SRCS}) if(BUILD_STATIC_PIC) diff --git a/src/Shapes/Capsule.cpp b/src/Magnum/Shapes/Capsule.cpp similarity index 90% rename from src/Shapes/Capsule.cpp rename to src/Magnum/Shapes/Capsule.cpp index d0df89afa..e53e6c59c 100644 --- a/src/Shapes/Capsule.cpp +++ b/src/Magnum/Shapes/Capsule.cpp @@ -24,13 +24,13 @@ #include "Capsule.h" -#include "Math/Functions.h" -#include "Math/Matrix3.h" -#include "Math/Matrix4.h" -#include "Math/Geometry/Distance.h" -#include "Magnum.h" -#include "Shapes/Point.h" -#include "Shapes/Sphere.h" +#include "Magnum/Magnum.h" +#include "Magnum/Math/Functions.h" +#include "Magnum/Math/Matrix3.h" +#include "Magnum/Math/Matrix4.h" +#include "Magnum/Math/Geometry/Distance.h" +#include "Magnum/Shapes/Point.h" +#include "Magnum/Shapes/Sphere.h" using namespace Magnum::Math::Geometry; diff --git a/src/Shapes/Capsule.h b/src/Magnum/Shapes/Capsule.h similarity index 96% rename from src/Shapes/Capsule.h rename to src/Magnum/Shapes/Capsule.h index d73f506d1..e67ea1be2 100644 --- a/src/Shapes/Capsule.h +++ b/src/Magnum/Shapes/Capsule.h @@ -28,10 +28,10 @@ * @brief Class Magnum::Shapes::Capsule, typedef Magnum::Shapes::Capsule2D, Magnum::Shapes::Capsule3D */ -#include "Math/Vector3.h" -#include "DimensionTraits.h" -#include "Shapes/Shapes.h" -#include "Shapes/magnumShapesVisibility.h" +#include "Magnum/DimensionTraits.h" +#include "Magnum/Math/Vector3.h" +#include "Magnum/Shapes/Shapes.h" +#include "Magnum/Shapes/visibility.h" namespace Magnum { namespace Shapes { diff --git a/src/Shapes/Collision.h b/src/Magnum/Shapes/Collision.h similarity index 97% rename from src/Shapes/Collision.h rename to src/Magnum/Shapes/Collision.h index c1f3731ce..6ebf94ef5 100644 --- a/src/Shapes/Collision.h +++ b/src/Magnum/Shapes/Collision.h @@ -28,9 +28,9 @@ * @brief Class @ref Magnum::Shapes::Collision */ -#include "Math/Vector2.h" -#include "Math/Vector3.h" -#include "DimensionTraits.h" +#include "Magnum/DimensionTraits.h" +#include "Magnum/Math/Vector2.h" +#include "Magnum/Math/Vector3.h" namespace Magnum { namespace Shapes { diff --git a/src/Shapes/Composition.cpp b/src/Magnum/Shapes/Composition.cpp similarity index 98% rename from src/Shapes/Composition.cpp rename to src/Magnum/Shapes/Composition.cpp index 83dced0d6..8fc0e6b90 100644 --- a/src/Shapes/Composition.cpp +++ b/src/Magnum/Shapes/Composition.cpp @@ -25,9 +25,9 @@ #include "Composition.h" #include -#include +#include -#include "Shapes/Implementation/CollisionDispatch.h" +#include "Magnum/Shapes/Implementation/CollisionDispatch.h" namespace Magnum { namespace Shapes { diff --git a/src/Shapes/Composition.h b/src/Magnum/Shapes/Composition.h similarity index 98% rename from src/Shapes/Composition.h rename to src/Magnum/Shapes/Composition.h index 14bb76f6b..c94b91cef 100644 --- a/src/Shapes/Composition.h +++ b/src/Magnum/Shapes/Composition.h @@ -30,13 +30,13 @@ #include #include -#include -#include +#include +#include -#include "DimensionTraits.h" -#include "Shapes/Shapes.h" -#include "Shapes/magnumShapesVisibility.h" -#include "Shapes/shapeImplementation.h" +#include "Magnum/DimensionTraits.h" +#include "Magnum/Shapes/Shapes.h" +#include "Magnum/Shapes/shapeImplementation.h" +#include "Magnum/Shapes/visibility.h" namespace Magnum { namespace Shapes { diff --git a/src/Shapes/Cylinder.cpp b/src/Magnum/Shapes/Cylinder.cpp similarity index 90% rename from src/Shapes/Cylinder.cpp rename to src/Magnum/Shapes/Cylinder.cpp index b24cc43f0..96aa8b1b8 100644 --- a/src/Shapes/Cylinder.cpp +++ b/src/Magnum/Shapes/Cylinder.cpp @@ -24,13 +24,13 @@ #include "Cylinder.h" -#include "Math/Functions.h" -#include "Math/Matrix3.h" -#include "Math/Matrix4.h" -#include "Math/Geometry/Distance.h" -#include "Magnum.h" -#include "Shapes/Point.h" -#include "Shapes/Sphere.h" +#include "Magnum/Magnum.h" +#include "Magnum/Math/Functions.h" +#include "Magnum/Math/Matrix3.h" +#include "Magnum/Math/Matrix4.h" +#include "Magnum/Math/Geometry/Distance.h" +#include "Magnum/Shapes/Point.h" +#include "Magnum/Shapes/Sphere.h" using namespace Magnum::Math::Geometry; diff --git a/src/Shapes/Cylinder.h b/src/Magnum/Shapes/Cylinder.h similarity index 96% rename from src/Shapes/Cylinder.h rename to src/Magnum/Shapes/Cylinder.h index 22ff553a1..b19dedf2a 100644 --- a/src/Shapes/Cylinder.h +++ b/src/Magnum/Shapes/Cylinder.h @@ -28,10 +28,10 @@ * @brief Class Magnum::Shapes::Cylinder, typedef Magnum::Shapes::Cylinder2D, Magnum::Shapes::Cylinder3D */ -#include "Math/Vector3.h" -#include "DimensionTraits.h" -#include "Shapes/Shapes.h" -#include "Shapes/magnumShapesVisibility.h" +#include "Magnum/DimensionTraits.h" +#include "Magnum/Math/Vector3.h" +#include "Magnum/Shapes/Shapes.h" +#include "Magnum/Shapes/visibility.h" namespace Magnum { namespace Shapes { diff --git a/src/Shapes/Implementation/CollisionDispatch.cpp b/src/Magnum/Shapes/Implementation/CollisionDispatch.cpp similarity index 92% rename from src/Shapes/Implementation/CollisionDispatch.cpp rename to src/Magnum/Shapes/Implementation/CollisionDispatch.cpp index 79ceb7ee3..3b3b2cd71 100644 --- a/src/Shapes/Implementation/CollisionDispatch.cpp +++ b/src/Magnum/Shapes/Implementation/CollisionDispatch.cpp @@ -24,15 +24,15 @@ #include "CollisionDispatch.h" -#include "Shapes/AxisAlignedBox.h" -#include "Shapes/Box.h" -#include "Shapes/Capsule.h" -#include "Shapes/Cylinder.h" -#include "Shapes/LineSegment.h" -#include "Shapes/Plane.h" -#include "Shapes/Point.h" -#include "Shapes/Sphere.h" -#include "Shapes/shapeImplementation.h" +#include "Magnum/Shapes/AxisAlignedBox.h" +#include "Magnum/Shapes/Box.h" +#include "Magnum/Shapes/Capsule.h" +#include "Magnum/Shapes/Cylinder.h" +#include "Magnum/Shapes/LineSegment.h" +#include "Magnum/Shapes/Plane.h" +#include "Magnum/Shapes/Point.h" +#include "Magnum/Shapes/Sphere.h" +#include "Magnum/Shapes/shapeImplementation.h" namespace Magnum { namespace Shapes { namespace Implementation { diff --git a/src/Shapes/Implementation/CollisionDispatch.h b/src/Magnum/Shapes/Implementation/CollisionDispatch.h similarity index 98% rename from src/Shapes/Implementation/CollisionDispatch.h rename to src/Magnum/Shapes/Implementation/CollisionDispatch.h index a226e822c..21e2a83d6 100644 --- a/src/Shapes/Implementation/CollisionDispatch.h +++ b/src/Magnum/Shapes/Implementation/CollisionDispatch.h @@ -24,7 +24,7 @@ DEALINGS IN THE SOFTWARE. */ -#include "Types.h" +#include "Magnum/Types.h" namespace Magnum { namespace Shapes { namespace Implementation { diff --git a/src/Shapes/Line.cpp b/src/Magnum/Shapes/Line.cpp similarity index 96% rename from src/Shapes/Line.cpp rename to src/Magnum/Shapes/Line.cpp index 9a39dbf94..4ba6b3c9f 100644 --- a/src/Shapes/Line.cpp +++ b/src/Magnum/Shapes/Line.cpp @@ -24,8 +24,8 @@ #include "Line.h" -#include "Math/Matrix3.h" -#include "Math/Matrix4.h" +#include "Magnum/Math/Matrix3.h" +#include "Magnum/Math/Matrix4.h" namespace Magnum { namespace Shapes { diff --git a/src/Shapes/Line.h b/src/Magnum/Shapes/Line.h similarity index 96% rename from src/Shapes/Line.h rename to src/Magnum/Shapes/Line.h index f908860fc..4c9e9f391 100644 --- a/src/Shapes/Line.h +++ b/src/Magnum/Shapes/Line.h @@ -28,9 +28,9 @@ * @brief Class Magnum::Shapes::Line, typedef Magnum::Shapes::Line2D, Magnum::Shapes::Line3D */ -#include "Math/Vector3.h" -#include "DimensionTraits.h" -#include "Shapes/magnumShapesVisibility.h" +#include "Magnum/DimensionTraits.h" +#include "Magnum/Math/Vector3.h" +#include "Magnum/Shapes/visibility.h" namespace Magnum { namespace Shapes { diff --git a/src/Shapes/LineSegment.h b/src/Magnum/Shapes/LineSegment.h similarity index 98% rename from src/Shapes/LineSegment.h rename to src/Magnum/Shapes/LineSegment.h index ee0f22dbc..5f9553462 100644 --- a/src/Shapes/LineSegment.h +++ b/src/Magnum/Shapes/LineSegment.h @@ -28,7 +28,7 @@ * @brief Class Magnum::Shapes::LineSegment, typedef Magnum::Shapes::LineSegment2D, Magnum::Shapes::LineSegment3D */ -#include "Line.h" +#include "Magnum/Shapes/Line.h" namespace Magnum { namespace Shapes { diff --git a/src/Shapes/Plane.cpp b/src/Magnum/Shapes/Plane.cpp similarity index 94% rename from src/Shapes/Plane.cpp rename to src/Magnum/Shapes/Plane.cpp index 7c2ef4fc0..32fa8aab8 100644 --- a/src/Shapes/Plane.cpp +++ b/src/Magnum/Shapes/Plane.cpp @@ -26,9 +26,9 @@ #include -#include "Math/Matrix4.h" -#include "Math/Geometry/Intersection.h" -#include "Shapes/LineSegment.h" +#include "Magnum/Math/Matrix4.h" +#include "Magnum/Math/Geometry/Intersection.h" +#include "Magnum/Shapes/LineSegment.h" using namespace Magnum::Math::Geometry; diff --git a/src/Shapes/Plane.h b/src/Magnum/Shapes/Plane.h similarity index 95% rename from src/Shapes/Plane.h rename to src/Magnum/Shapes/Plane.h index c3a4d6a7c..1b2e5e7d7 100644 --- a/src/Shapes/Plane.h +++ b/src/Magnum/Shapes/Plane.h @@ -28,10 +28,10 @@ * @brief Class Magnum::Shapes::Plane */ -#include "Math/Vector3.h" -#include "Magnum.h" -#include "Shapes/Shapes.h" -#include "Shapes/magnumShapesVisibility.h" +#include "Magnum/Magnum.h" +#include "Magnum/Math/Vector3.h" +#include "Magnum/Shapes/Shapes.h" +#include "Magnum/Shapes/visibility.h" namespace Magnum { namespace Shapes { diff --git a/src/Shapes/Point.cpp b/src/Magnum/Shapes/Point.cpp similarity index 95% rename from src/Shapes/Point.cpp rename to src/Magnum/Shapes/Point.cpp index 4badc0565..f1cc429d5 100644 --- a/src/Shapes/Point.cpp +++ b/src/Magnum/Shapes/Point.cpp @@ -24,8 +24,8 @@ #include "Point.h" -#include "Math/Matrix3.h" -#include "Math/Matrix4.h" +#include "Magnum/Math/Matrix3.h" +#include "Magnum/Math/Matrix4.h" namespace Magnum { namespace Shapes { diff --git a/src/Shapes/Point.h b/src/Magnum/Shapes/Point.h similarity index 96% rename from src/Shapes/Point.h rename to src/Magnum/Shapes/Point.h index 47cdb89e0..380b6ceda 100644 --- a/src/Shapes/Point.h +++ b/src/Magnum/Shapes/Point.h @@ -28,9 +28,9 @@ * @brief Class Magnum::Shapes::Point, typedef Magnum::Shapes::Point2D, Magnum::Shapes::Point3D */ -#include "Math/Vector3.h" -#include "DimensionTraits.h" -#include "Shapes/magnumShapesVisibility.h" +#include "Magnum/DimensionTraits.h" +#include "Magnum/Math/Vector3.h" +#include "Magnum/Shapes/visibility.h" namespace Magnum { namespace Shapes { diff --git a/src/Shapes/Shape.cpp b/src/Magnum/Shapes/Shape.cpp similarity index 98% rename from src/Shapes/Shape.cpp rename to src/Magnum/Shapes/Shape.cpp index a302db9aa..519d20514 100644 --- a/src/Shapes/Shape.cpp +++ b/src/Magnum/Shapes/Shape.cpp @@ -24,7 +24,7 @@ #include "Shape.h" -#include "Shapes/Composition.h" +#include "Magnum/Shapes/Composition.h" namespace Magnum { namespace Shapes { namespace Implementation { diff --git a/src/Shapes/Shape.h b/src/Magnum/Shapes/Shape.h similarity index 98% rename from src/Shapes/Shape.h rename to src/Magnum/Shapes/Shape.h index e4ac03523..6314e63da 100644 --- a/src/Shapes/Shape.h +++ b/src/Magnum/Shapes/Shape.h @@ -28,10 +28,9 @@ * @brief Class Magnum::Shapes::Shape */ -#include "Shapes/AbstractShape.h" -#include "Shapes/Shapes.h" - -#include "magnumShapesVisibility.h" +#include "Magnum/Shapes/AbstractShape.h" +#include "Magnum/Shapes/Shapes.h" +#include "Magnum/Shapes/visibility.h" namespace Magnum { namespace Shapes { diff --git a/src/Shapes/ShapeGroup.cpp b/src/Magnum/Shapes/ShapeGroup.cpp similarity index 98% rename from src/Shapes/ShapeGroup.cpp rename to src/Magnum/Shapes/ShapeGroup.cpp index a44d06480..016e2eba1 100644 --- a/src/Shapes/ShapeGroup.cpp +++ b/src/Magnum/Shapes/ShapeGroup.cpp @@ -24,7 +24,7 @@ #include "ShapeGroup.h" -#include "Shapes/AbstractShape.h" +#include "Magnum/Shapes/AbstractShape.h" namespace Magnum { namespace Shapes { diff --git a/src/Shapes/ShapeGroup.h b/src/Magnum/Shapes/ShapeGroup.h similarity index 96% rename from src/Shapes/ShapeGroup.h rename to src/Magnum/Shapes/ShapeGroup.h index fb683650c..c52419b27 100644 --- a/src/Shapes/ShapeGroup.h +++ b/src/Magnum/Shapes/ShapeGroup.h @@ -30,10 +30,9 @@ #include -#include "Shapes/AbstractShape.h" -#include "SceneGraph/FeatureGroup.h" - -#include "magnumShapesVisibility.h" +#include "Magnum/SceneGraph/FeatureGroup.h" +#include "Magnum/Shapes/AbstractShape.h" +#include "Magnum/Shapes/visibility.h" namespace Magnum { namespace Shapes { diff --git a/src/Shapes/Shapes.h b/src/Magnum/Shapes/Shapes.h similarity index 99% rename from src/Shapes/Shapes.h rename to src/Magnum/Shapes/Shapes.h index dcb300193..6cf7a3669 100644 --- a/src/Shapes/Shapes.h +++ b/src/Magnum/Shapes/Shapes.h @@ -28,7 +28,7 @@ * @brief Forward declarations for Magnum::Shapes namespace */ -#include "Types.h" +#include "Magnum/Types.h" namespace Magnum { namespace Shapes { diff --git a/src/Shapes/Sphere.cpp b/src/Magnum/Shapes/Sphere.cpp similarity index 96% rename from src/Shapes/Sphere.cpp rename to src/Magnum/Shapes/Sphere.cpp index 8b86fa3ad..5025d2416 100644 --- a/src/Shapes/Sphere.cpp +++ b/src/Magnum/Shapes/Sphere.cpp @@ -24,13 +24,13 @@ #include "Sphere.h" -#include "Math/Functions.h" -#include "Math/Matrix3.h" -#include "Math/Matrix4.h" -#include "Math/Geometry/Distance.h" -#include "Magnum.h" -#include "Shapes/LineSegment.h" -#include "Shapes/Point.h" +#include "Magnum/Magnum.h" +#include "Magnum/Math/Functions.h" +#include "Magnum/Math/Matrix3.h" +#include "Magnum/Math/Matrix4.h" +#include "Magnum/Math/Geometry/Distance.h" +#include "Magnum/Shapes/LineSegment.h" +#include "Magnum/Shapes/Point.h" using namespace Magnum::Math::Geometry; diff --git a/src/Shapes/Sphere.h b/src/Magnum/Shapes/Sphere.h similarity index 97% rename from src/Shapes/Sphere.h rename to src/Magnum/Shapes/Sphere.h index 64ec6e2c6..2223b4799 100644 --- a/src/Shapes/Sphere.h +++ b/src/Magnum/Shapes/Sphere.h @@ -28,11 +28,11 @@ * @brief Class Magnum::Shapes::Sphere, typedef Magnum::Shapes::Sphere2D, Magnum::Shapes::Sphere3D */ -#include "Math/Vector3.h" -#include "DimensionTraits.h" -#include "Shapes/Collision.h" -#include "Shapes/Shapes.h" -#include "Shapes/magnumShapesVisibility.h" +#include "Magnum/DimensionTraits.h" +#include "Magnum/Math/Vector3.h" +#include "Magnum/Shapes/Collision.h" +#include "Magnum/Shapes/Shapes.h" +#include "Magnum/Shapes/visibility.h" namespace Magnum { namespace Shapes { diff --git a/src/Shapes/Test/AxisAlignedBoxTest.cpp b/src/Magnum/Shapes/Test/AxisAlignedBoxTest.cpp similarity index 94% rename from src/Shapes/Test/AxisAlignedBoxTest.cpp rename to src/Magnum/Shapes/Test/AxisAlignedBoxTest.cpp index 2f91bf277..6034715ab 100644 --- a/src/Shapes/Test/AxisAlignedBoxTest.cpp +++ b/src/Magnum/Shapes/Test/AxisAlignedBoxTest.cpp @@ -22,10 +22,10 @@ DEALINGS IN THE SOFTWARE. */ -#include "Math/Matrix4.h" -#include "Magnum.h" -#include "Shapes/AxisAlignedBox.h" -#include "Shapes/Point.h" +#include "Magnum/Math/Matrix4.h" +#include "Magnum/Magnum.h" +#include "Magnum/Shapes/AxisAlignedBox.h" +#include "Magnum/Shapes/Point.h" #include "ShapeTestBase.h" diff --git a/src/Shapes/Test/BoxTest.cpp b/src/Magnum/Shapes/Test/BoxTest.cpp similarity index 93% rename from src/Shapes/Test/BoxTest.cpp rename to src/Magnum/Shapes/Test/BoxTest.cpp index 6867bc7e7..8413b7387 100644 --- a/src/Shapes/Test/BoxTest.cpp +++ b/src/Magnum/Shapes/Test/BoxTest.cpp @@ -22,11 +22,11 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include -#include "Math/Matrix4.h" -#include "Magnum.h" -#include "Shapes/Box.h" +#include "Magnum/Magnum.h" +#include "Magnum/Math/Matrix4.h" +#include "Magnum/Shapes/Box.h" namespace Magnum { namespace Shapes { namespace Test { diff --git a/src/Shapes/Test/CMakeLists.txt b/src/Magnum/Shapes/Test/CMakeLists.txt similarity index 100% rename from src/Shapes/Test/CMakeLists.txt rename to src/Magnum/Shapes/Test/CMakeLists.txt diff --git a/src/Shapes/Test/CapsuleTest.cpp b/src/Magnum/Shapes/Test/CapsuleTest.cpp similarity index 93% rename from src/Shapes/Test/CapsuleTest.cpp rename to src/Magnum/Shapes/Test/CapsuleTest.cpp index 4e2d70386..613737a88 100644 --- a/src/Shapes/Test/CapsuleTest.cpp +++ b/src/Magnum/Shapes/Test/CapsuleTest.cpp @@ -22,12 +22,12 @@ DEALINGS IN THE SOFTWARE. */ -#include "Math/Matrix3.h" -#include "Math/Matrix4.h" -#include "Magnum.h" -#include "Shapes/Capsule.h" -#include "Shapes/Point.h" -#include "Shapes/Sphere.h" +#include "Magnum/Magnum.h" +#include "Magnum/Math/Matrix3.h" +#include "Magnum/Math/Matrix4.h" +#include "Magnum/Shapes/Capsule.h" +#include "Magnum/Shapes/Point.h" +#include "Magnum/Shapes/Sphere.h" #include "ShapeTestBase.h" diff --git a/src/Shapes/Test/CollisionTest.cpp b/src/Magnum/Shapes/Test/CollisionTest.cpp similarity index 95% rename from src/Shapes/Test/CollisionTest.cpp rename to src/Magnum/Shapes/Test/CollisionTest.cpp index 51719be46..b88a65174 100644 --- a/src/Shapes/Test/CollisionTest.cpp +++ b/src/Magnum/Shapes/Test/CollisionTest.cpp @@ -22,10 +22,10 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include -#include "Shapes/Collision.h" -#include "Magnum.h" +#include "Magnum/Magnum.h" +#include "Magnum/Shapes/Collision.h" namespace Magnum { namespace Shapes { namespace Test { diff --git a/src/Shapes/Test/CompositionTest.cpp b/src/Magnum/Shapes/Test/CompositionTest.cpp similarity index 97% rename from src/Shapes/Test/CompositionTest.cpp rename to src/Magnum/Shapes/Test/CompositionTest.cpp index f639f774e..54e615ab7 100644 --- a/src/Shapes/Test/CompositionTest.cpp +++ b/src/Magnum/Shapes/Test/CompositionTest.cpp @@ -22,14 +22,12 @@ DEALINGS IN THE SOFTWARE. */ -#include - -#include "Math/Matrix3.h" -#include "Math/Matrix4.h" -#include "Shapes/Point.h" -#include "Shapes/AxisAlignedBox.h" -#include "Shapes/Composition.h" -#include "Shapes/Sphere.h" +#include "Magnum/Math/Matrix3.h" +#include "Magnum/Math/Matrix4.h" +#include "Magnum/Shapes/Point.h" +#include "Magnum/Shapes/AxisAlignedBox.h" +#include "Magnum/Shapes/Composition.h" +#include "Magnum/Shapes/Sphere.h" #include "ShapeTestBase.h" diff --git a/src/Shapes/Test/CylinderTest.cpp b/src/Magnum/Shapes/Test/CylinderTest.cpp similarity index 93% rename from src/Shapes/Test/CylinderTest.cpp rename to src/Magnum/Shapes/Test/CylinderTest.cpp index acfe209a8..b772cddcb 100644 --- a/src/Shapes/Test/CylinderTest.cpp +++ b/src/Magnum/Shapes/Test/CylinderTest.cpp @@ -22,12 +22,12 @@ DEALINGS IN THE SOFTWARE. */ -#include "Math/Matrix3.h" -#include "Math/Matrix4.h" -#include "Magnum.h" -#include "Shapes/Cylinder.h" -#include "Shapes/Point.h" -#include "Shapes/Sphere.h" +#include "Magnum/Magnum.h" +#include "Magnum/Math/Matrix3.h" +#include "Magnum/Math/Matrix4.h" +#include "Magnum/Shapes/Cylinder.h" +#include "Magnum/Shapes/Point.h" +#include "Magnum/Shapes/Sphere.h" #include "ShapeTestBase.h" diff --git a/src/Shapes/Test/LineTest.cpp b/src/Magnum/Shapes/Test/LineTest.cpp similarity index 93% rename from src/Shapes/Test/LineTest.cpp rename to src/Magnum/Shapes/Test/LineTest.cpp index 0c9c661cc..7d594cadb 100644 --- a/src/Shapes/Test/LineTest.cpp +++ b/src/Magnum/Shapes/Test/LineTest.cpp @@ -22,11 +22,11 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include -#include "Math/Matrix4.h" -#include "Magnum.h" -#include "Shapes/Line.h" +#include "Magnum/Magnum.h" +#include "Magnum/Math/Matrix4.h" +#include "Magnum/Shapes/Line.h" namespace Magnum { namespace Shapes { namespace Test { diff --git a/src/Shapes/Test/PlaneTest.cpp b/src/Magnum/Shapes/Test/PlaneTest.cpp similarity index 95% rename from src/Shapes/Test/PlaneTest.cpp rename to src/Magnum/Shapes/Test/PlaneTest.cpp index 36f648675..4b8b3d4a4 100644 --- a/src/Shapes/Test/PlaneTest.cpp +++ b/src/Magnum/Shapes/Test/PlaneTest.cpp @@ -22,10 +22,10 @@ DEALINGS IN THE SOFTWARE. */ -#include "Math/Matrix4.h" -#include "Shapes/LineSegment.h" -#include "Shapes/Point.h" -#include "Shapes/Plane.h" +#include "Magnum/Math/Matrix4.h" +#include "Magnum/Shapes/LineSegment.h" +#include "Magnum/Shapes/Point.h" +#include "Magnum/Shapes/Plane.h" #include "ShapeTestBase.h" diff --git a/src/Shapes/Test/PointTest.cpp b/src/Magnum/Shapes/Test/PointTest.cpp similarity index 92% rename from src/Shapes/Test/PointTest.cpp rename to src/Magnum/Shapes/Test/PointTest.cpp index 1e21bebc6..9db3afa32 100644 --- a/src/Shapes/Test/PointTest.cpp +++ b/src/Magnum/Shapes/Test/PointTest.cpp @@ -22,11 +22,11 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include -#include "Math/Matrix4.h" -#include "Magnum.h" -#include "Shapes/Point.h" +#include "Magnum/Magnum.h" +#include "Magnum/Math/Matrix4.h" +#include "Magnum/Shapes/Point.h" namespace Magnum { namespace Shapes { namespace Test { diff --git a/src/Shapes/Test/ShapeImplementationTest.cpp b/src/Magnum/Shapes/Test/ShapeImplementationTest.cpp similarity index 95% rename from src/Shapes/Test/ShapeImplementationTest.cpp rename to src/Magnum/Shapes/Test/ShapeImplementationTest.cpp index 17ffb2518..feb3980a5 100644 --- a/src/Shapes/Test/ShapeImplementationTest.cpp +++ b/src/Magnum/Shapes/Test/ShapeImplementationTest.cpp @@ -23,9 +23,9 @@ */ #include -#include +#include -#include "Shapes/shapeImplementation.h" +#include "Magnum/Shapes/shapeImplementation.h" namespace Magnum { namespace Shapes { namespace Test { diff --git a/src/Shapes/Test/ShapeTest.cpp b/src/Magnum/Shapes/Test/ShapeTest.cpp similarity index 92% rename from src/Shapes/Test/ShapeTest.cpp rename to src/Magnum/Shapes/Test/ShapeTest.cpp index e1ff5737c..35a54fed8 100644 --- a/src/Shapes/Test/ShapeTest.cpp +++ b/src/Magnum/Shapes/Test/ShapeTest.cpp @@ -22,16 +22,16 @@ DEALINGS IN THE SOFTWARE. */ -#include - -#include "Shapes/ShapeGroup.h" -#include "Shapes/Shape.h" -#include "Shapes/Point.h" -#include "Shapes/Composition.h" -#include "Shapes/Sphere.h" -#include "SceneGraph/MatrixTransformation2D.h" -#include "SceneGraph/MatrixTransformation3D.h" -#include "SceneGraph/Scene.h" +#include + +#include "Magnum/Shapes/Composition.h" +#include "Magnum/Shapes/Point.h" +#include "Magnum/Shapes/Shape.h" +#include "Magnum/Shapes/ShapeGroup.h" +#include "Magnum/Shapes/Sphere.h" +#include "Magnum/SceneGraph/MatrixTransformation2D.h" +#include "Magnum/SceneGraph/MatrixTransformation3D.h" +#include "Magnum/SceneGraph/Scene.h" namespace Magnum { namespace Shapes { namespace Test { diff --git a/src/Shapes/Test/ShapeTestBase.h b/src/Magnum/Shapes/Test/ShapeTestBase.h similarity index 97% rename from src/Shapes/Test/ShapeTestBase.h rename to src/Magnum/Shapes/Test/ShapeTestBase.h index 348cc3ee7..bb5cff964 100644 --- a/src/Shapes/Test/ShapeTestBase.h +++ b/src/Magnum/Shapes/Test/ShapeTestBase.h @@ -24,7 +24,7 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include namespace Magnum { namespace Shapes { namespace Test { diff --git a/src/Shapes/Test/SphereTest.cpp b/src/Magnum/Shapes/Test/SphereTest.cpp similarity index 97% rename from src/Shapes/Test/SphereTest.cpp rename to src/Magnum/Shapes/Test/SphereTest.cpp index 991e88a7a..95465ac06 100644 --- a/src/Shapes/Test/SphereTest.cpp +++ b/src/Magnum/Shapes/Test/SphereTest.cpp @@ -22,12 +22,12 @@ DEALINGS IN THE SOFTWARE. */ -#include "Math/Matrix3.h" -#include "Math/Matrix4.h" -#include "Magnum.h" -#include "Shapes/LineSegment.h" -#include "Shapes/Point.h" -#include "Shapes/Sphere.h" +#include "Magnum/Magnum.h" +#include "Magnum/Math/Matrix3.h" +#include "Magnum/Math/Matrix4.h" +#include "Magnum/Shapes/LineSegment.h" +#include "Magnum/Shapes/Point.h" +#include "Magnum/Shapes/Sphere.h" #include "ShapeTestBase.h" diff --git a/src/Shapes/shapeImplementation.cpp b/src/Magnum/Shapes/shapeImplementation.cpp similarity index 98% rename from src/Shapes/shapeImplementation.cpp rename to src/Magnum/Shapes/shapeImplementation.cpp index f9e57d22f..96f145dc1 100644 --- a/src/Shapes/shapeImplementation.cpp +++ b/src/Magnum/Shapes/shapeImplementation.cpp @@ -24,7 +24,7 @@ #include "shapeImplementation.h" -#include +#include namespace Magnum { namespace Shapes { namespace Implementation { diff --git a/src/Shapes/shapeImplementation.h b/src/Magnum/Shapes/shapeImplementation.h similarity index 97% rename from src/Shapes/shapeImplementation.h rename to src/Magnum/Shapes/shapeImplementation.h index 7b88fbc36..dda6f6de2 100644 --- a/src/Shapes/shapeImplementation.h +++ b/src/Magnum/Shapes/shapeImplementation.h @@ -25,13 +25,13 @@ */ #include -#include -#include +#include +#include -#include "DimensionTraits.h" -#include "Magnum.h" -#include "Shapes/Shapes.h" -#include "Shapes/magnumShapesVisibility.h" +#include "Magnum/DimensionTraits.h" +#include "Magnum/Magnum.h" +#include "Magnum/Shapes/Shapes.h" +#include "Magnum/Shapes/visibility.h" namespace Magnum { namespace Shapes { namespace Implementation { diff --git a/src/Shapes/magnumShapesVisibility.h b/src/Magnum/Shapes/visibility.h similarity index 90% rename from src/Shapes/magnumShapesVisibility.h rename to src/Magnum/Shapes/visibility.h index 2af59f9b8..c0ae3226f 100644 --- a/src/Shapes/magnumShapesVisibility.h +++ b/src/Magnum/Shapes/visibility.h @@ -1,5 +1,5 @@ -#ifndef Magnum_Shapes_magnumShapesVisibility_h -#define Magnum_Shapes_magnumShapesVisibility_h +#ifndef Magnum_Shapes_visibility_h +#define Magnum_Shapes_visibility_h /* This file is part of Magnum. @@ -24,9 +24,9 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include -#include "magnumConfigure.h" +#include "Magnum/configure.h" #ifndef MAGNUM_BUILD_STATIC #ifdef MagnumShapes_EXPORTS diff --git a/src/Swizzle.h b/src/Magnum/Swizzle.h similarity index 91% rename from src/Swizzle.h rename to src/Magnum/Swizzle.h index 84b176aff..01fa066a0 100644 --- a/src/Swizzle.h +++ b/src/Magnum/Swizzle.h @@ -24,16 +24,17 @@ DEALINGS IN THE SOFTWARE. */ -/** @file /Swizzle.h +#ifdef MAGNUM_BUILD_DEPRECATED +/** @file * @brief Function @ref Magnum::swizzle() * @deprecated Use @ref Math/Swizzle.h instead. */ +#endif -#include "Math/Swizzle.h" +#include "Magnum/Math/Swizzle.h" +#include "Magnum/Color.h" #ifdef MAGNUM_BUILD_DEPRECATED -#include "Color.h" - namespace Magnum { /** @@ -48,7 +49,7 @@ using Math::swizzle; } #else -#error +#error this header is available only on deprecated build #endif #endif diff --git a/src/Test/AbstractImageTest.cpp b/src/Magnum/Test/AbstractImageTest.cpp similarity index 58% rename from src/Test/AbstractImageTest.cpp rename to src/Magnum/Test/AbstractImageTest.cpp index a5a87373a..224431571 100644 --- a/src/Test/AbstractImageTest.cpp +++ b/src/Magnum/Test/AbstractImageTest.cpp @@ -23,10 +23,11 @@ */ #include -#include +#include -#include "AbstractImage.h" -#include "ColorFormat.h" +#include "Magnum/AbstractImage.h" +#include "Magnum/Image.h" +#include "Magnum/ColorFormat.h" namespace Magnum { namespace Test { @@ -34,15 +35,39 @@ class AbstractImageTest: public TestSuite::Tester { public: explicit AbstractImageTest(); + void pixelSize(); + void dataSize(); + void debugFormat(); void debugType(); }; AbstractImageTest::AbstractImageTest() { - addTests({&AbstractImageTest::debugFormat, + addTests({&AbstractImageTest::pixelSize, + &AbstractImageTest::dataSize, + + &AbstractImageTest::debugFormat, &AbstractImageTest::debugType}); } +void AbstractImageTest::pixelSize() { + CORRADE_COMPARE(AbstractImage::pixelSize(ColorFormat::RGBA, ColorType::UnsignedInt), 4*4); + CORRADE_COMPARE(AbstractImage::pixelSize(ColorFormat::DepthComponent, ColorType::UnsignedShort), 2); + CORRADE_COMPARE(AbstractImage::pixelSize(ColorFormat::StencilIndex, ColorType::UnsignedByte), 1); + CORRADE_COMPARE(AbstractImage::pixelSize(ColorFormat::DepthStencil, ColorType::UnsignedInt248), 4); +} + +void AbstractImageTest::dataSize() { + /* Verify that row size is properly rounded */ + CORRADE_COMPARE(Image2D(ColorFormat::RGBA, ColorType::UnsignedByte).dataSize({}), 0); + CORRADE_COMPARE(Image2D(ColorFormat::Red, ColorType::UnsignedByte).dataSize({4, 2}), 8); + CORRADE_COMPARE(Image2D(ColorFormat::Red, ColorType::UnsignedByte).dataSize({2, 4}), 16); + CORRADE_COMPARE(Image2D(ColorFormat::RGBA, ColorType::UnsignedByte).dataSize(Vector2i(1)), 4); + + CORRADE_COMPARE(Image2D(ColorFormat::RGBA, ColorType::UnsignedShort).dataSize({16, 8}), + 4*2*16*8); +} + void AbstractImageTest::debugFormat() { std::ostringstream o; Debug(&o) << ColorFormat::RGBA; diff --git a/src/Test/AbstractObjectGLTest.cpp b/src/Magnum/Test/AbstractObjectGLTest.cpp similarity index 93% rename from src/Test/AbstractObjectGLTest.cpp rename to src/Magnum/Test/AbstractObjectGLTest.cpp index fe27d3973..10adfe59d 100644 --- a/src/Test/AbstractObjectGLTest.cpp +++ b/src/Magnum/Test/AbstractObjectGLTest.cpp @@ -22,10 +22,10 @@ DEALINGS IN THE SOFTWARE. */ -#include "Buffer.h" -#include "Context.h" -#include "Extensions.h" -#include "Test/AbstractOpenGLTester.h" +#include "Magnum/Buffer.h" +#include "Magnum/Context.h" +#include "Magnum/Extensions.h" +#include "Magnum/Test/AbstractOpenGLTester.h" namespace Magnum { namespace Test { diff --git a/src/Test/AbstractOpenGLTester.h b/src/Magnum/Test/AbstractOpenGLTester.h similarity index 90% rename from src/Test/AbstractOpenGLTester.h rename to src/Magnum/Test/AbstractOpenGLTester.h index ef1c7c0be..0a0725966 100644 --- a/src/Test/AbstractOpenGLTester.h +++ b/src/Magnum/Test/AbstractOpenGLTester.h @@ -24,16 +24,16 @@ DEALINGS IN THE SOFTWARE. */ -#include -#include +#include +#include -#include "Context.h" -#include "Extensions.h" -#include "DebugMessage.h" -#include "Renderer.h" +#include "Magnum/Context.h" +#include "Magnum/Extensions.h" +#include "Magnum/DebugMessage.h" +#include "Magnum/Renderer.h" #if !defined(MAGNUM_TARGET_GLES) || defined(MAGNUM_TARGET_DESKTOP_GLES) -#include "Platform/WindowlessGlxApplication.h" +#include "Magnum/Platform/WindowlessGlxApplication.h" #else #error Cannot run OpenGL tests on this platform #endif diff --git a/src/Test/AbstractQueryGLTest.cpp b/src/Magnum/Test/AbstractQueryGLTest.cpp similarity index 97% rename from src/Test/AbstractQueryGLTest.cpp rename to src/Magnum/Test/AbstractQueryGLTest.cpp index 9a58304cd..d20790b85 100644 --- a/src/Test/AbstractQueryGLTest.cpp +++ b/src/Magnum/Test/AbstractQueryGLTest.cpp @@ -22,10 +22,8 @@ DEALINGS IN THE SOFTWARE. */ -#include "Context.h" -#include "Extensions.h" -#include "Query.h" -#include "Test/AbstractOpenGLTester.h" +#include "Magnum/Query.h" +#include "Magnum/Test/AbstractOpenGLTester.h" namespace Magnum { namespace Test { diff --git a/src/Magnum/Test/AbstractShaderProgramGLTest.cpp b/src/Magnum/Test/AbstractShaderProgramGLTest.cpp new file mode 100644 index 000000000..4ebda946d --- /dev/null +++ b/src/Magnum/Test/AbstractShaderProgramGLTest.cpp @@ -0,0 +1,393 @@ +/* + This file is part of Magnum. + + Copyright © 2010, 2011, 2012, 2013 Vladimír Vondruš + + 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 + +#include "Magnum/AbstractShaderProgram.h" +#include "Magnum/Context.h" +#include "Magnum/Extensions.h" +#include "Magnum/Shader.h" +#include "Magnum/Math/Matrix.h" +#include "Magnum/Math/Vector4.h" +#include "Magnum/Test/AbstractOpenGLTester.h" + +namespace Magnum { namespace Test { + +class AbstractShaderProgramGLTest: public AbstractOpenGLTester { + public: + explicit AbstractShaderProgramGLTest(); + + void construct(); + void constructCopy(); + void constructMove(); + + void label(); + + void create(); + void createMultipleOutputs(); + #ifndef MAGNUM_TARGET_GLES + void createMultipleOutputsIndexed(); + #endif + + void uniform(); + void uniformVector(); + void uniformMatrix(); + void uniformArray(); +}; + +AbstractShaderProgramGLTest::AbstractShaderProgramGLTest() { + addTests({&AbstractShaderProgramGLTest::construct, + &AbstractShaderProgramGLTest::constructCopy, + &AbstractShaderProgramGLTest::constructMove, + + &AbstractShaderProgramGLTest::label, + + &AbstractShaderProgramGLTest::create, + &AbstractShaderProgramGLTest::createMultipleOutputs, + #ifndef MAGNUM_TARGET_GLES + &AbstractShaderProgramGLTest::createMultipleOutputsIndexed, + #endif + + &AbstractShaderProgramGLTest::uniform, + &AbstractShaderProgramGLTest::uniformVector, + &AbstractShaderProgramGLTest::uniformMatrix, + &AbstractShaderProgramGLTest::uniformArray}); +} + +namespace { + class DummyShader: public AbstractShaderProgram { + public: + explicit DummyShader() {} + + #ifdef CORRADE_GCC45_COMPATIBILITY + DummyShader(const DummyShader&) = delete; + DummyShader(DummyShader&& other): AbstractShaderProgram(std::move(other)) {} + DummyShader& operator=(const DummyShader&) = delete; + DummyShader& operator=(DummyShader&& other) { + AbstractShaderProgram::operator=(std::move(other)); + return *this; + } + #endif + }; +} + +void AbstractShaderProgramGLTest::construct() { + { + const DummyShader shader; + + MAGNUM_VERIFY_NO_ERROR(); + CORRADE_VERIFY(shader.id() > 0); + } + + MAGNUM_VERIFY_NO_ERROR(); +} + +void AbstractShaderProgramGLTest::constructCopy() { + #ifndef CORRADE_GCC44_COMPATIBILITY + CORRADE_VERIFY(!(std::is_constructible{})); + /* GCC 4.6 doesn't have std::is_assignable */ + #ifndef CORRADE_GCC46_COMPATIBILITY + CORRADE_VERIFY(!(std::is_assignable{})); + #endif + #else + CORRADE_SKIP("Type traits needed to test this are not available on GCC 4.4."); + #endif +} + +void AbstractShaderProgramGLTest::constructMove() { + DummyShader a; + const Int id = a.id(); + + MAGNUM_VERIFY_NO_ERROR(); + CORRADE_VERIFY(id > 0); + + DummyShader b(std::move(a)); + + CORRADE_COMPARE(a.id(), 0); + CORRADE_COMPARE(b.id(), id); + + DummyShader c; + const Int cId = c.id(); + c = std::move(b); + + MAGNUM_VERIFY_NO_ERROR(); + CORRADE_VERIFY(cId > 0); + CORRADE_COMPARE(b.id(), cId); + CORRADE_COMPARE(c.id(), id); +} + +void AbstractShaderProgramGLTest::label() { + /* No-Op version is tested in AbstractObjectGLTest */ + if(!Context::current()->isExtensionSupported() && + !Context::current()->isExtensionSupported()) + CORRADE_SKIP("Required extension is not available"); + + DummyShader shader; + CORRADE_COMPARE(shader.label(), ""); + + shader.setLabel("DummyShader"); + CORRADE_COMPARE(shader.label(), "DummyShader"); + + MAGNUM_VERIFY_NO_ERROR(); +} + +namespace { + struct MyPublicShader: AbstractShaderProgram { + using AbstractShaderProgram::attachShader; + using AbstractShaderProgram::bindAttributeLocation; + #ifndef MAGNUM_TARGET_GLES + using AbstractShaderProgram::bindFragmentDataLocationIndexed; + using AbstractShaderProgram::bindFragmentDataLocation; + #endif + using AbstractShaderProgram::link; + using AbstractShaderProgram::uniformLocation; + }; +} + +void AbstractShaderProgramGLTest::create() { + Utility::Resource rs("AbstractShaderProgramGLTest"); + + #ifndef MAGNUM_TARGET_GLES + Shader vert(Version::GL210, Shader::Type::Vertex); + #else + Shader vert(Version::GLES200, Shader::Type::Vertex); + #endif + vert.addSource(rs.get("MyShader.vert")); + const bool vertCompiled = vert.compile(); + + #ifndef MAGNUM_TARGET_GLES + Shader frag(Version::GL210, Shader::Type::Fragment); + #else + Shader frag(Version::GLES200, Shader::Type::Fragment); + #endif + frag.addSource(rs.get("MyShader.frag")); + const bool fragCompiled = frag.compile(); + + MAGNUM_VERIFY_NO_ERROR(); + CORRADE_VERIFY(vertCompiled); + CORRADE_VERIFY(fragCompiled); + + MyPublicShader program; + program.attachShader(vert); + program.attachShader(frag); + + MAGNUM_VERIFY_NO_ERROR(); + + program.bindAttributeLocation(0, "position"); + const bool linked = program.link(); + const bool valid = program.validate().first; + + MAGNUM_VERIFY_NO_ERROR(); + CORRADE_VERIFY(linked); + CORRADE_VERIFY(valid); + + const Int matrixUniform = program.uniformLocation("matrix"); + const Int multiplierUniform = program.uniformLocation("multiplier"); + const Int colorUniform = program.uniformLocation("color"); + const Int additionsUniform = program.uniformLocation("additions"); + + MAGNUM_VERIFY_NO_ERROR(); + CORRADE_VERIFY(matrixUniform >= 0); + CORRADE_VERIFY(multiplierUniform >= 0); + CORRADE_VERIFY(colorUniform >= 0); + CORRADE_VERIFY(additionsUniform >= 0); + + program.use(); + + MAGNUM_VERIFY_NO_ERROR(); +} + +void AbstractShaderProgramGLTest::createMultipleOutputs() { + #ifndef MAGNUM_TARGET_GLES + Utility::Resource rs("AbstractShaderProgramGLTest"); + + Shader vert(Version::GL210, Shader::Type::Vertex); + vert.addSource(rs.get("MyShader.vert")); + const bool vertCompiled = vert.compile(); + + Shader frag(Version::GL300, Shader::Type::Fragment); + frag.addSource(rs.get("MyShaderFragmentOutputs.frag")); + const bool fragCompiled = frag.compile(); + + MAGNUM_VERIFY_NO_ERROR(); + CORRADE_VERIFY(vertCompiled); + CORRADE_VERIFY(fragCompiled); + + MyPublicShader program; + program.attachShader(vert); + program.attachShader(frag); + + MAGNUM_VERIFY_NO_ERROR(); + + program.bindAttributeLocation(0, "position"); + program.bindFragmentDataLocation(0, "first"); + program.bindFragmentDataLocation(1, "second"); + const bool linked = program.link(); + const bool valid = program.validate().first; + + MAGNUM_VERIFY_NO_ERROR(); + CORRADE_VERIFY(linked); + CORRADE_VERIFY(valid); + + program.use(); + + MAGNUM_VERIFY_NO_ERROR(); + #elif !defined(MAGNUM_TARGET_GLES2) + CORRADE_SKIP("Only explicit location specification supported in ES 3.0."); + #else + CORRADE_SKIP("Only gl_FragData[n] supported in ES 2.0."); + #endif +} + +#ifndef MAGNUM_TARGET_GLES +void AbstractShaderProgramGLTest::createMultipleOutputsIndexed() { + Utility::Resource rs("AbstractShaderProgramGLTest"); + + Shader vert(Version::GL210, Shader::Type::Vertex); + vert.addSource(rs.get("MyShader.vert")); + const bool vertCompiled = vert.compile(); + + Shader frag(Version::GL300, Shader::Type::Fragment); + frag.addSource(rs.get("MyShaderFragmentOutputs.frag")); + const bool fragCompiled = frag.compile(); + + MAGNUM_VERIFY_NO_ERROR(); + CORRADE_VERIFY(vertCompiled); + CORRADE_VERIFY(fragCompiled); + + MyPublicShader program; + program.attachShader(vert); + program.attachShader(frag); + + MAGNUM_VERIFY_NO_ERROR(); + + program.bindAttributeLocation(0, "position"); + program.bindFragmentDataLocationIndexed(0, 0, "first"); + program.bindFragmentDataLocationIndexed(0, 1, "second"); + const bool linked = program.link(); + const bool valid = program.validate().first; + + MAGNUM_VERIFY_NO_ERROR(); + CORRADE_VERIFY(linked); + CORRADE_VERIFY(valid); + + program.use(); + + MAGNUM_VERIFY_NO_ERROR(); +} +#endif + +namespace { + struct MyShader: AbstractShaderProgram { + explicit MyShader(); + + using AbstractShaderProgram::setUniform; + + Int matrixUniform, + multiplierUniform, + colorUniform, + additionsUniform; + }; +} + +#ifndef DOXYGEN_GENERATING_OUTPUT +MyShader::MyShader() { + Utility::Resource rs("AbstractShaderProgramGLTest"); + + #ifndef MAGNUM_TARGET_GLES + Shader vert(Version::GL210, Shader::Type::Vertex); + #else + Shader vert(Version::GLES200, Shader::Type::Vertex); + #endif + vert.addSource(rs.get("MyShader.vert")) + .compile(); + attachShader(vert); + + #ifndef MAGNUM_TARGET_GLES + Shader frag(Version::GL210, Shader::Type::Fragment); + #else + Shader frag(Version::GLES200, Shader::Type::Fragment); + #endif + frag.addSource(rs.get("MyShader.frag")) + .compile(); + attachShader(frag); + + bindAttributeLocation(0, "position"); + link(); + + matrixUniform = uniformLocation("matrix"); + multiplierUniform = uniformLocation("multiplier"); + colorUniform = uniformLocation("color"); + additionsUniform = uniformLocation("additions"); +} +#endif + +void AbstractShaderProgramGLTest::uniform() { + MyShader shader; + + MAGNUM_VERIFY_NO_ERROR(); + + shader.setUniform(shader.multiplierUniform, 0.35f); + + MAGNUM_VERIFY_NO_ERROR(); +} + +void AbstractShaderProgramGLTest::uniformVector() { + MyShader shader; + + MAGNUM_VERIFY_NO_ERROR(); + + shader.setUniform(shader.colorUniform, Vector4(0.3f, 0.7f, 1.0f, 0.25f)); + + MAGNUM_VERIFY_NO_ERROR(); +} + +void AbstractShaderProgramGLTest::uniformMatrix() { + MyShader shader; + + MAGNUM_VERIFY_NO_ERROR(); + + shader.setUniform(shader.matrixUniform, Matrix4x4::fromDiagonal({0.3f, 0.7f, 1.0f, 0.25f})); + + MAGNUM_VERIFY_NO_ERROR(); +} + +void AbstractShaderProgramGLTest::uniformArray() { + MyShader shader; + + MAGNUM_VERIFY_NO_ERROR(); + + constexpr Vector4 values[] = { + {0.5f, 1.0f, 0.4f, 0.0f}, + {0.0f, 0.1f, 0.7f, 0.3f}, + {0.9f, 0.8f, 0.3f, 0.1f} + }; + shader.setUniform(shader.additionsUniform, 3, values); + + MAGNUM_VERIFY_NO_ERROR(); +} + +}} + +CORRADE_TEST_MAIN(Magnum::Test::AbstractShaderProgramGLTest) diff --git a/src/Magnum/Test/AbstractShaderProgramGLTestFiles/MyShader.frag b/src/Magnum/Test/AbstractShaderProgramGLTestFiles/MyShader.frag new file mode 100644 index 000000000..39b15b1a2 --- /dev/null +++ b/src/Magnum/Test/AbstractShaderProgramGLTestFiles/MyShader.frag @@ -0,0 +1,7 @@ +uniform lowp float multiplier; +uniform lowp vec4 color; +uniform lowp vec4 additions[3]; + +void main() { + gl_FragColor = color*multiplier + additions[0] + additions[1] + additions[2]; +} diff --git a/src/Magnum/Test/AbstractShaderProgramGLTestFiles/MyShader.vert b/src/Magnum/Test/AbstractShaderProgramGLTestFiles/MyShader.vert new file mode 100644 index 000000000..3d2907e68 --- /dev/null +++ b/src/Magnum/Test/AbstractShaderProgramGLTestFiles/MyShader.vert @@ -0,0 +1,7 @@ +attribute mediump vec4 position; + +uniform mediump mat4 matrix; + +void main() { + gl_Position = matrix*position; +} diff --git a/src/Magnum/Test/AbstractShaderProgramGLTestFiles/MyShaderFragmentOutputs.frag b/src/Magnum/Test/AbstractShaderProgramGLTestFiles/MyShaderFragmentOutputs.frag new file mode 100644 index 000000000..ae85b17ba --- /dev/null +++ b/src/Magnum/Test/AbstractShaderProgramGLTestFiles/MyShaderFragmentOutputs.frag @@ -0,0 +1,7 @@ +out vec4 first; +out vec3 second; + +void main() { + first = vec4(1.0, 0.3, 0.5, 0.1); + second = vec3(0.5, 0.7, 0.4); +} diff --git a/src/Magnum/Test/AbstractShaderProgramGLTestFiles/resources.conf b/src/Magnum/Test/AbstractShaderProgramGLTestFiles/resources.conf new file mode 100644 index 000000000..80d20b68e --- /dev/null +++ b/src/Magnum/Test/AbstractShaderProgramGLTestFiles/resources.conf @@ -0,0 +1,10 @@ +group=AbstractShaderProgramGLTest + +[file] +filename=MyShader.frag + +[file] +filename=MyShader.vert + +[file] +filename=MyShaderFragmentOutputs.frag diff --git a/src/Test/AbstractShaderProgramTest.cpp b/src/Magnum/Test/AbstractShaderProgramTest.cpp similarity index 71% rename from src/Test/AbstractShaderProgramTest.cpp rename to src/Magnum/Test/AbstractShaderProgramTest.cpp index 6ca72d2dc..589a3c576 100644 --- a/src/Test/AbstractShaderProgramTest.cpp +++ b/src/Magnum/Test/AbstractShaderProgramTest.cpp @@ -22,9 +22,9 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include -#include "AbstractShaderProgram.h" +#include "Magnum/AbstractShaderProgram.h" namespace Magnum { namespace Test { @@ -44,8 +44,12 @@ class AbstractShaderProgramTest: public TestSuite::Tester { void attributeVector4(); void attributeVectorBGRA(); - void attributeMatrix(); - void attributeMatrixDouble(); + void attributeMatrixNxN(); + #ifndef MAGNUM_TARGET_GLES2 + void attributeMatrixMxN(); + #endif + void attributeMatrixNxNd(); + void attributeMatrixMxNd(); }; AbstractShaderProgramTest::AbstractShaderProgramTest() { @@ -61,38 +65,44 @@ AbstractShaderProgramTest::AbstractShaderProgramTest() { &AbstractShaderProgramTest::attributeVector4, &AbstractShaderProgramTest::attributeVectorBGRA, - &AbstractShaderProgramTest::attributeMatrix, - &AbstractShaderProgramTest::attributeMatrixDouble}); + &AbstractShaderProgramTest::attributeMatrixNxN, + #ifndef MAGNUM_TARGET_GLES2 + &AbstractShaderProgramTest::attributeMatrixMxN, + #endif + &AbstractShaderProgramTest::attributeMatrixNxNd, + &AbstractShaderProgramTest::attributeMatrixMxNd}); } void AbstractShaderProgramTest::attributeScalar() { typedef AbstractShaderProgram::Attribute<3, Float> Attribute; CORRADE_COMPARE(Int(Attribute::Location), 3); + CORRADE_COMPARE(Attribute::VectorCount, 1); /* Default constructor */ Attribute a; CORRADE_COMPARE(a.components(), Attribute::Components::One); CORRADE_VERIFY(!a.dataOptions()); - CORRADE_COMPARE(a.dataSize(), 4); + CORRADE_COMPARE(a.vectorSize(), 4); CORRADE_COMPARE(a.dataType(), Attribute::DataType::Float); /* Options */ Attribute b(Attribute::DataType::UnsignedShort, Attribute::DataOption::Normalized); - CORRADE_COMPARE(b.dataSize(), 2); + CORRADE_COMPARE(b.vectorSize(), 2); CORRADE_VERIFY(b.dataOptions() <= Attribute::DataOption::Normalized); } void AbstractShaderProgramTest::attributeScalarInt() { #ifndef MAGNUM_TARGET_GLES2 typedef AbstractShaderProgram::Attribute<3, Int> Attribute; + CORRADE_COMPARE(Attribute::VectorCount, 1); /* Default constructor */ Attribute a; - CORRADE_COMPARE(a.dataSize(), 4); + CORRADE_COMPARE(a.vectorSize(), 4); /* Options */ Attribute b(Attribute::DataType::Short); - CORRADE_COMPARE(b.dataSize(), 2); + CORRADE_COMPARE(b.vectorSize(), 2); #else CORRADE_SKIP("Integer attributes are not available in OpenGL ES 2."); #endif @@ -101,14 +111,15 @@ void AbstractShaderProgramTest::attributeScalarInt() { void AbstractShaderProgramTest::attributeScalarUnsignedInt() { #ifndef MAGNUM_TARGET_GLES2 typedef AbstractShaderProgram::Attribute<3, UnsignedInt> Attribute; + CORRADE_COMPARE(Attribute::VectorCount, 1); /* Default constructor */ Attribute a; - CORRADE_COMPARE(a.dataSize(), 4); + CORRADE_COMPARE(a.vectorSize(), 4); /* Options */ Attribute b(Attribute::DataType::UnsignedByte); - CORRADE_COMPARE(b.dataSize(), 1); + CORRADE_COMPARE(b.vectorSize(), 1); #else CORRADE_SKIP("Integer attributes are not available in OpenGL ES 2."); #endif @@ -117,10 +128,11 @@ void AbstractShaderProgramTest::attributeScalarUnsignedInt() { void AbstractShaderProgramTest::attributeScalarDouble() { #ifndef MAGNUM_TARGET_GLES typedef AbstractShaderProgram::Attribute<3, Double> Attribute; + CORRADE_COMPARE(Attribute::VectorCount, 1); /* Default constructor */ Attribute a; - CORRADE_COMPARE(a.dataSize(), 8); + CORRADE_COMPARE(a.vectorSize(), 8); #else CORRADE_SKIP("Double attributes are not available in OpenGL ES."); #endif @@ -128,38 +140,40 @@ void AbstractShaderProgramTest::attributeScalarDouble() { void AbstractShaderProgramTest::attributeVector() { typedef AbstractShaderProgram::Attribute<3, Vector3> Attribute; + CORRADE_COMPARE(Attribute::VectorCount, 1); /* Default constructor */ Attribute a; CORRADE_COMPARE(a.components(), Attribute::Components::Three); - CORRADE_COMPARE(a.dataSize(), 3*4); + CORRADE_COMPARE(a.vectorSize(), 3*4); CORRADE_COMPARE(a.dataType(), Attribute::DataType::Float); /* Options */ #ifndef MAGNUM_TARGET_GLES Attribute b(Attribute::Components::Two, Attribute::DataType::Double); CORRADE_COMPARE(b.components(), Attribute::Components::Two); - CORRADE_COMPARE(b.dataSize(), 2*8); + CORRADE_COMPARE(b.vectorSize(), 2*8); #else Attribute b(Attribute::Components::Two, Attribute::DataType::Float); CORRADE_COMPARE(b.components(), Attribute::Components::Two); - CORRADE_COMPARE(b.dataSize(), 2*4); + CORRADE_COMPARE(b.vectorSize(), 2*4); #endif } void AbstractShaderProgramTest::attributeVectorInt() { #ifndef MAGNUM_TARGET_GLES2 typedef AbstractShaderProgram::Attribute<3, Vector2i> Attribute; + CORRADE_COMPARE(Attribute::VectorCount, 1); /* Default constructor */ Attribute a; CORRADE_COMPARE(a.components(), Attribute::Components::Two); - CORRADE_COMPARE(a.dataSize(), 2*4); + CORRADE_COMPARE(a.vectorSize(), 2*4); CORRADE_COMPARE(a.dataType(), Attribute::DataType::Int); /* Options */ Attribute b(Attribute::Components::One, Attribute::DataType::Int); - CORRADE_COMPARE(b.dataSize(), 4); + CORRADE_COMPARE(b.vectorSize(), 4); #else CORRADE_SKIP("Integer attributes are not available in OpenGL ES 2."); #endif @@ -168,16 +182,17 @@ void AbstractShaderProgramTest::attributeVectorInt() { void AbstractShaderProgramTest::attributeVectorUnsignedInt() { #ifndef MAGNUM_TARGET_GLES2 typedef AbstractShaderProgram::Attribute<3, Vector4ui> Attribute; + CORRADE_COMPARE(Attribute::VectorCount, 1); /* Default constructor */ Attribute a; CORRADE_COMPARE(a.components(), Attribute::Components::Four); - CORRADE_COMPARE(a.dataSize(), 4*4); + CORRADE_COMPARE(a.vectorSize(), 4*4); CORRADE_COMPARE(a.dataType(), Attribute::DataType::UnsignedInt); /* Options */ Attribute b(Attribute::Components::Three, Attribute::DataType::UnsignedShort); - CORRADE_COMPARE(b.dataSize(), 3*2); + CORRADE_COMPARE(b.vectorSize(), 3*2); #else CORRADE_SKIP("Integer attributes are not available in OpenGL ES 2."); #endif @@ -186,16 +201,17 @@ void AbstractShaderProgramTest::attributeVectorUnsignedInt() { void AbstractShaderProgramTest::attributeVectorDouble() { #ifndef MAGNUM_TARGET_GLES typedef AbstractShaderProgram::Attribute<3, Vector2d> Attribute; + CORRADE_COMPARE(Attribute::VectorCount, 1); /* Default constructor */ Attribute a; CORRADE_COMPARE(a.components(), Attribute::Components::Two); - CORRADE_COMPARE(a.dataSize(), 2*8); + CORRADE_COMPARE(a.vectorSize(), 2*8); CORRADE_COMPARE(a.dataType(), Attribute::DataType::Double); /* Options */ Attribute b(Attribute::Components::One); - CORRADE_COMPARE(b.dataSize(), 8); + CORRADE_COMPARE(b.vectorSize(), 8); #else CORRADE_SKIP("Double attributes are not available in OpenGL ES."); #endif @@ -203,47 +219,79 @@ void AbstractShaderProgramTest::attributeVectorDouble() { void AbstractShaderProgramTest::attributeVector4() { typedef AbstractShaderProgram::Attribute<3, Vector4> Attribute; + CORRADE_COMPARE(Attribute::VectorCount, 1); /* Custom type */ #ifndef MAGNUM_TARGET_GLES Attribute a(Attribute::DataType::UnsignedInt2101010Rev); - CORRADE_COMPARE(a.dataSize(), 4); + CORRADE_COMPARE(a.vectorSize(), 4); #else Attribute a(Attribute::DataType::HalfFloat); - CORRADE_COMPARE(a.dataSize(), 8); + CORRADE_COMPARE(a.vectorSize(), 8); #endif } void AbstractShaderProgramTest::attributeVectorBGRA() { #ifndef MAGNUM_TARGET_GLES typedef AbstractShaderProgram::Attribute<3, Vector4> Attribute; + CORRADE_COMPARE(Attribute::VectorCount, 1); /* BGRA */ Attribute a(Attribute::Components::BGRA); - CORRADE_COMPARE(a.dataSize(), 4*4); + CORRADE_COMPARE(a.vectorSize(), 4*4); #else CORRADE_SKIP("BGRA attribute component ordering is not available in OpenGL ES."); #endif } -void AbstractShaderProgramTest::attributeMatrix() { +void AbstractShaderProgramTest::attributeMatrixNxN() { typedef AbstractShaderProgram::Attribute<3, Matrix3> Attribute; + CORRADE_COMPARE(Attribute::VectorCount, 3); /* Default constructor */ Attribute a; CORRADE_COMPARE(a.components(), Attribute::Components::Three); - CORRADE_COMPARE(a.dataSize(), 3*3*4); + CORRADE_COMPARE(a.vectorSize(), 3*4); CORRADE_COMPARE(a.dataType(), Attribute::DataType::Float); } -void AbstractShaderProgramTest::attributeMatrixDouble() { +#ifndef MAGNUM_TARGET_GLES2 +void AbstractShaderProgramTest::attributeMatrixMxN() { + typedef AbstractShaderProgram::Attribute<3, Matrix3x4> Attribute; + CORRADE_COMPARE(Attribute::VectorCount, 3); + + /* Default constructor */ + Attribute a; + CORRADE_COMPARE(a.components(), Attribute::Components::Four); + CORRADE_COMPARE(a.vectorSize(), 4*4); + CORRADE_COMPARE(a.dataType(), Attribute::DataType::Float); +} +#endif + +void AbstractShaderProgramTest::attributeMatrixNxNd() { #ifndef MAGNUM_TARGET_GLES typedef AbstractShaderProgram::Attribute<3, Matrix4d> Attribute; + CORRADE_COMPARE(Attribute::VectorCount, 4); /* Default constructor */ Attribute a; CORRADE_COMPARE(a.components(), Attribute::Components::Four); - CORRADE_COMPARE(a.dataSize(), 4*4*8); + CORRADE_COMPARE(a.vectorSize(), 4*8); + CORRADE_COMPARE(a.dataType(), Attribute::DataType::Double); + #else + CORRADE_SKIP("Double attributes are not available in OpenGL ES."); + #endif +} + +void AbstractShaderProgramTest::attributeMatrixMxNd() { + #ifndef MAGNUM_TARGET_GLES + typedef AbstractShaderProgram::Attribute<3, Matrix4x2d> Attribute; + CORRADE_COMPARE(Attribute::VectorCount, 4); + + /* Default constructor */ + Attribute a; + CORRADE_COMPARE(a.components(), Attribute::Components::Two); + CORRADE_COMPARE(a.vectorSize(), 2*8); CORRADE_COMPARE(a.dataType(), Attribute::DataType::Double); #else CORRADE_SKIP("Double attributes are not available in OpenGL ES."); diff --git a/src/Test/AbstractTextureGLTest.cpp b/src/Magnum/Test/AbstractTextureGLTest.cpp similarity index 96% rename from src/Test/AbstractTextureGLTest.cpp rename to src/Magnum/Test/AbstractTextureGLTest.cpp index 94e72c258..c7fa0ffd0 100644 --- a/src/Test/AbstractTextureGLTest.cpp +++ b/src/Magnum/Test/AbstractTextureGLTest.cpp @@ -22,10 +22,10 @@ DEALINGS IN THE SOFTWARE. */ -#include "Context.h" -#include "Extensions.h" -#include "Texture.h" -#include "Test/AbstractOpenGLTester.h" +#include "Magnum/Context.h" +#include "Magnum/Extensions.h" +#include "Magnum/Texture.h" +#include "Magnum/Test/AbstractOpenGLTester.h" namespace Magnum { namespace Test { diff --git a/src/Test/ArrayTest.cpp b/src/Magnum/Test/ArrayTest.cpp similarity index 98% rename from src/Test/ArrayTest.cpp rename to src/Magnum/Test/ArrayTest.cpp index 0b9d51536..07e220184 100644 --- a/src/Test/ArrayTest.cpp +++ b/src/Magnum/Test/ArrayTest.cpp @@ -22,9 +22,9 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include -#include "Array.h" +#include "Magnum/Array.h" namespace Magnum { namespace Test { diff --git a/src/Test/BufferGLTest.cpp b/src/Magnum/Test/BufferGLTest.cpp similarity index 98% rename from src/Test/BufferGLTest.cpp rename to src/Magnum/Test/BufferGLTest.cpp index 39671226d..b066fea43 100644 --- a/src/Test/BufferGLTest.cpp +++ b/src/Magnum/Test/BufferGLTest.cpp @@ -24,12 +24,12 @@ #include #include -#include +#include -#include "Buffer.h" -#include "Context.h" -#include "Extensions.h" -#include "Test/AbstractOpenGLTester.h" +#include "Magnum/Buffer.h" +#include "Magnum/Context.h" +#include "Magnum/Extensions.h" +#include "Magnum/Test/AbstractOpenGLTester.h" namespace Magnum { namespace Test { diff --git a/src/Test/BufferImageGLTest.cpp b/src/Magnum/Test/BufferImageGLTest.cpp similarity index 96% rename from src/Test/BufferImageGLTest.cpp rename to src/Magnum/Test/BufferImageGLTest.cpp index abcab4fa4..0bacd1688 100644 --- a/src/Test/BufferImageGLTest.cpp +++ b/src/Magnum/Test/BufferImageGLTest.cpp @@ -22,11 +22,11 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include -#include "BufferImage.h" -#include "ColorFormat.h" -#include "Test/AbstractOpenGLTester.h" +#include "Magnum/BufferImage.h" +#include "Magnum/ColorFormat.h" +#include "Magnum/Test/AbstractOpenGLTester.h" namespace Magnum { namespace Test { diff --git a/src/Test/BufferTextureGLTest.cpp b/src/Magnum/Test/BufferTextureGLTest.cpp similarity index 95% rename from src/Test/BufferTextureGLTest.cpp rename to src/Magnum/Test/BufferTextureGLTest.cpp index e7029f69f..f8336d7ef 100644 --- a/src/Test/BufferTextureGLTest.cpp +++ b/src/Magnum/Test/BufferTextureGLTest.cpp @@ -22,11 +22,11 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include -#include "Buffer.h" -#include "BufferTexture.h" -#include "Test/AbstractOpenGLTester.h" +#include "Magnum/Buffer.h" +#include "Magnum/BufferTexture.h" +#include "Magnum/Test/AbstractOpenGLTester.h" namespace Magnum { namespace Test { diff --git a/src/Test/CMakeLists.txt b/src/Magnum/Test/CMakeLists.txt similarity index 80% rename from src/Test/CMakeLists.txt rename to src/Magnum/Test/CMakeLists.txt index d747f50b1..8beda53b4 100644 --- a/src/Test/CMakeLists.txt +++ b/src/Magnum/Test/CMakeLists.txt @@ -33,7 +33,7 @@ corrade_add_test(ImageTest ImageTest.cpp LIBRARIES Magnum) corrade_add_test(ImageReferenceTest ImageReferenceTest.cpp LIBRARIES Magnum) corrade_add_test(MeshTest MeshTest.cpp LIBRARIES Magnum) corrade_add_test(RendererTest RendererTest.cpp LIBRARIES Magnum) -corrade_add_test(ResourceManagerTest ResourceManagerTest.cpp LIBRARIES MagnumTestLib) +corrade_add_test(ResourceManagerTest ResourceManagerTest.cpp LIBRARIES Magnum) corrade_add_test(SamplerTest SamplerTest.cpp LIBRARIES Magnum) corrade_add_test(ShaderTest ShaderTest.cpp LIBRARIES Magnum) corrade_add_test(VersionTest VersionTest.cpp LIBRARIES Magnum) @@ -41,7 +41,6 @@ corrade_add_test(VersionTest VersionTest.cpp LIBRARIES Magnum) if(BUILD_GL_TESTS) corrade_add_test(AbstractObjectGLTest AbstractObjectGLTest.cpp LIBRARIES ${GL_TEST_LIBRARIES}) corrade_add_test(AbstractQueryGLTest AbstractQueryGLTest.cpp LIBRARIES ${GL_TEST_LIBRARIES}) - corrade_add_test(AbstractShaderProgramGLTest AbstractShaderProgramGLTest.cpp LIBRARIES ${GL_TEST_LIBRARIES}) corrade_add_test(AbstractTextureGLTest AbstractTextureGLTest.cpp LIBRARIES ${GL_TEST_LIBRARIES}) corrade_add_test(BufferGLTest BufferGLTest.cpp LIBRARIES ${GL_TEST_LIBRARIES}) corrade_add_test(ContextGLTest ContextGLTest.cpp LIBRARIES ${GL_TEST_LIBRARIES}) @@ -50,8 +49,31 @@ if(BUILD_GL_TESTS) corrade_add_test(FramebufferGLTest FramebufferGLTest.cpp LIBRARIES ${GL_TEST_LIBRARIES}) corrade_add_test(MeshGLTest MeshGLTest.cpp LIBRARIES ${GL_TEST_LIBRARIES}) corrade_add_test(RenderbufferGLTest RenderbufferGLTest.cpp LIBRARIES ${GL_TEST_LIBRARIES}) - corrade_add_test(ShaderGLTest ShaderGLTest.cpp LIBRARIES ${GL_TEST_LIBRARIES}) corrade_add_test(TextureGLTest TextureGLTest.cpp LIBRARIES ${GL_TEST_LIBRARIES}) + corrade_add_test(TimeQueryGLTest TimeQueryGLTest.cpp LIBRARIES ${GL_TEST_LIBRARIES}) + + corrade_add_resource(AbstractShaderProgramGLTest_RES AbstractShaderProgramGLTestFiles/resources.conf) + corrade_add_test(AbstractShaderProgramGLTest + AbstractShaderProgramGLTest.cpp + ${AbstractShaderProgramGLTest_RES} + LIBRARIES ${GL_TEST_LIBRARIES}) + + corrade_add_resource(QueryGLTest_RES QueryGLTestFiles/resources.conf) + if(NOT MAGNUM_TARGET_GLES2) + corrade_add_test(PrimitiveQueryGLTest + PrimitiveQueryGLTest.cpp + ${QueryGLTest_RES} + LIBRARIES ${GL_TEST_LIBRARIES}) + endif() + corrade_add_test(SampleQueryGLTest + SampleQueryGLTest.cpp + ${QueryGLTest_RES} + LIBRARIES ${GL_TEST_LIBRARIES}) + + configure_file(${CMAKE_CURRENT_SOURCE_DIR}/configure.h.cmake + ${CMAKE_CURRENT_BINARY_DIR}/configure.h) + include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR}) + corrade_add_test(ShaderGLTest ShaderGLTest.cpp LIBRARIES ${GL_TEST_LIBRARIES}) if(NOT MAGNUM_TARGET_GLES2) corrade_add_test(BufferImageGLTest BufferImageGLTest.cpp LIBRARIES ${GL_TEST_LIBRARIES}) diff --git a/src/Test/ColorTest.cpp b/src/Magnum/Test/ColorTest.cpp similarity index 97% rename from src/Test/ColorTest.cpp rename to src/Magnum/Test/ColorTest.cpp index 3f99723df..60ffb859b 100644 --- a/src/Test/ColorTest.cpp +++ b/src/Magnum/Test/ColorTest.cpp @@ -23,10 +23,10 @@ */ #include -#include -#include +#include +#include -#include "Color.h" +#include "Magnum/Color.h" namespace Magnum { namespace Test { @@ -61,9 +61,6 @@ class ColorTest: public TestSuite::Tester { void configuration(); }; -typedef BasicColor3 Color3ub; -typedef BasicColor4 Color4ub; - ColorTest::ColorTest() { addTests({&ColorTest::construct, &ColorTest::constructDefault, @@ -167,9 +164,6 @@ void ColorTest::constructParts() { } void ColorTest::constructConversion() { - typedef BasicColor3 Color3ub; - typedef BasicColor4 Color4ub; - constexpr Color3 a(10.1f, 12.5f, 0.75f); #ifndef CORRADE_GCC46_COMPATIBILITY constexpr /* Not constexpr under GCC < 4.7 */ diff --git a/src/Test/ContextGLTest.cpp b/src/Magnum/Test/ContextGLTest.cpp similarity index 91% rename from src/Test/ContextGLTest.cpp rename to src/Magnum/Test/ContextGLTest.cpp index 74c74d49d..5c2f1d5ac 100644 --- a/src/Test/ContextGLTest.cpp +++ b/src/Magnum/Test/ContextGLTest.cpp @@ -22,9 +22,9 @@ DEALINGS IN THE SOFTWARE. */ -#include "Context.h" -#include "Extensions.h" -#include "Test/AbstractOpenGLTester.h" +#include "Magnum/Context.h" +#include "Magnum/Extensions.h" +#include "Magnum/Test/AbstractOpenGLTester.h" namespace Magnum { namespace Test { @@ -101,18 +101,15 @@ void ContextGLTest::unsupportedExtension() { void ContextGLTest::pastExtension() { #ifndef MAGNUM_TARGET_GLES if(!Context::current()->isVersionSupported(Version::GL300)) - CORRADE_SKIP("No already supported extensions exist in OpenGL 2.1"); + CORRADE_SKIP("No already supported extensions are listed for OpenGL 2.1"); CORRADE_VERIFY(Context::current()->isExtensionSupported()); /* No assertion should be fired */ MAGNUM_ASSERT_EXTENSION_SUPPORTED(Extensions::GL::APPLE::vertex_array_object); + #elif defined(MAGNUM_TARGET_GLES2) + CORRADE_SKIP("No already supported extensions are listed for OpenGL ES 2.0"); #else - if(!Context::current()->isVersionSupported(Version::GLES300)) - CORRADE_SKIP("No already supported extensions exist in OpenGL ES 2.0"); - - CORRADE_VERIFY(Context::current()->isExtensionSupported()); - /* No assertion should be fired */ - MAGNUM_ASSERT_EXTENSION_SUPPORTED(Extensions::GL::EXT::texture_rg); + CORRADE_SKIP("No already supported extensions are listed for OpenGL ES 3.0"); #endif } diff --git a/src/Test/CubeMapTextureArrayGLTest.cpp b/src/Magnum/Test/CubeMapTextureArrayGLTest.cpp similarity index 98% rename from src/Test/CubeMapTextureArrayGLTest.cpp rename to src/Magnum/Test/CubeMapTextureArrayGLTest.cpp index 455f24cfe..a17a6b936 100644 --- a/src/Test/CubeMapTextureArrayGLTest.cpp +++ b/src/Magnum/Test/CubeMapTextureArrayGLTest.cpp @@ -22,14 +22,14 @@ DEALINGS IN THE SOFTWARE. */ -#include - -#include "BufferImage.h" -#include "ColorFormat.h" -#include "Image.h" -#include "CubeMapTextureArray.h" -#include "TextureFormat.h" -#include "Test/AbstractOpenGLTester.h" +#include + +#include "Magnum/BufferImage.h" +#include "Magnum/ColorFormat.h" +#include "Magnum/Image.h" +#include "Magnum/CubeMapTextureArray.h" +#include "Magnum/TextureFormat.h" +#include "Magnum/Test/AbstractOpenGLTester.h" namespace Magnum { namespace Test { diff --git a/src/Test/CubeMapTextureGLTest.cpp b/src/Magnum/Test/CubeMapTextureGLTest.cpp similarity index 97% rename from src/Test/CubeMapTextureGLTest.cpp rename to src/Magnum/Test/CubeMapTextureGLTest.cpp index d72978e72..c3e382ad3 100644 --- a/src/Test/CubeMapTextureGLTest.cpp +++ b/src/Magnum/Test/CubeMapTextureGLTest.cpp @@ -22,14 +22,17 @@ DEALINGS IN THE SOFTWARE. */ -#include - -#include "BufferImage.h" -#include "ColorFormat.h" -#include "Image.h" -#include "CubeMapTexture.h" -#include "TextureFormat.h" -#include "Test/AbstractOpenGLTester.h" +#include + +#include "Magnum/configure.h" +#ifndef MAGNUM_TARGET_GLES2 +#include "Magnum/BufferImage.h" +#endif +#include "Magnum/ColorFormat.h" +#include "Magnum/Image.h" +#include "Magnum/CubeMapTexture.h" +#include "Magnum/TextureFormat.h" +#include "Magnum/Test/AbstractOpenGLTester.h" namespace Magnum { namespace Test { diff --git a/src/Test/DebugGLTest.cpp b/src/Magnum/Test/DebugGLTest.cpp similarity index 96% rename from src/Test/DebugGLTest.cpp rename to src/Magnum/Test/DebugGLTest.cpp index ea21aef3e..fae9969e0 100644 --- a/src/Test/DebugGLTest.cpp +++ b/src/Magnum/Test/DebugGLTest.cpp @@ -22,16 +22,15 @@ DEALINGS IN THE SOFTWARE. */ -#include "Test/AbstractOpenGLTester.h" - #include -#include "Context.h" -#include "DebugMessage.h" -#include "Extensions.h" +#include "Magnum/Context.h" +#include "Magnum/DebugMessage.h" +#include "Magnum/Extensions.h" +#include "Magnum/Test/AbstractOpenGLTester.h" #ifdef MAGNUM_BUILD_DEPRECATED -#include "DebugMarker.h" +#include "Magnum/DebugMarker.h" #endif namespace Magnum { namespace Test { diff --git a/src/Test/DebugMessageTest.cpp b/src/Magnum/Test/DebugMessageTest.cpp similarity index 96% rename from src/Test/DebugMessageTest.cpp rename to src/Magnum/Test/DebugMessageTest.cpp index 868c6178d..c323eadf7 100644 --- a/src/Test/DebugMessageTest.cpp +++ b/src/Magnum/Test/DebugMessageTest.cpp @@ -23,9 +23,9 @@ */ #include -#include +#include -#include "DebugMessage.h" +#include "Magnum/DebugMessage.h" namespace Magnum { namespace Test { diff --git a/src/Test/DefaultFramebufferTest.cpp b/src/Magnum/Test/DefaultFramebufferTest.cpp similarity index 95% rename from src/Test/DefaultFramebufferTest.cpp rename to src/Magnum/Test/DefaultFramebufferTest.cpp index a3862d6fa..dc97d0ba2 100644 --- a/src/Test/DefaultFramebufferTest.cpp +++ b/src/Magnum/Test/DefaultFramebufferTest.cpp @@ -23,9 +23,9 @@ */ #include -#include +#include -#include "DefaultFramebuffer.h" +#include "Magnum/DefaultFramebuffer.h" namespace Magnum { namespace Test { diff --git a/src/Magnum/Test/FramebufferGLTest.cpp b/src/Magnum/Test/FramebufferGLTest.cpp new file mode 100644 index 000000000..3ba5e7c90 --- /dev/null +++ b/src/Magnum/Test/FramebufferGLTest.cpp @@ -0,0 +1,874 @@ +/* + This file is part of Magnum. + + Copyright © 2010, 2011, 2012, 2013 Vladimír Vondruš + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. +*/ + +#include "Magnum/configure.h" +#ifndef MAGNUM_TARGET_GLES2 +#include "Magnum/BufferImage.h" +#endif +#include "Magnum/ColorFormat.h" +#include "Magnum/Context.h" +#include "Magnum/Extensions.h" +#include "Magnum/Framebuffer.h" +#include "Magnum/Image.h" +#include "Magnum/Renderbuffer.h" +#include "Magnum/RenderbufferFormat.h" +#include "Magnum/Texture.h" +#include "Magnum/TextureFormat.h" +#include "Magnum/Test/AbstractOpenGLTester.h" + +namespace Magnum { namespace Test { + +class FramebufferGLTest: public AbstractOpenGLTester { + public: + explicit FramebufferGLTest(); + + void construct(); + void constructCopy(); + void constructMove(); + + void label(); + + void attachRenderbuffer(); + void attachRenderbufferMultisample(); + + #ifndef MAGNUM_TARGET_GLES + void attachTexture1D(); + #endif + void attachTexture2D(); + void attachTexture3D(); + #ifndef MAGNUM_TARGET_GLES + void attachTexture1DArray(); + #endif + #ifndef MAGNUM_TARGET_GLES2 + void attachTexture2DArray(); + #endif + #ifndef MAGNUM_TARGET_GLES + void attachTexture2DMultisample(); + void attachTexture2DMultisampleArray(); + void attachRectangleTexture(); + #endif + void attachCubeMapTexture(); + #ifndef MAGNUM_TARGET_GLES + void attachCubeMapTextureArray(); + #endif + + void multipleColorOutputs(); + + void clear(); + void invalidate(); + void invalidateSub(); + void read(); + #ifndef MAGNUM_TARGET_GLES2 + void readBuffer(); + #endif + void blit(); +}; + +FramebufferGLTest::FramebufferGLTest() { + addTests({&FramebufferGLTest::construct, + &FramebufferGLTest::constructCopy, + &FramebufferGLTest::constructMove, + + &FramebufferGLTest::label, + + &FramebufferGLTest::attachRenderbuffer, + &FramebufferGLTest::attachRenderbufferMultisample, + + #ifndef MAGNUM_TARGET_GLES + &FramebufferGLTest::attachTexture1D, + #endif + &FramebufferGLTest::attachTexture2D, + &FramebufferGLTest::attachTexture3D, + #ifndef MAGNUM_TARGET_GLES + &FramebufferGLTest::attachTexture1DArray, + #endif + #ifndef MAGNUM_TARGET_GLES2 + &FramebufferGLTest::attachTexture2DArray, + #endif + #ifndef MAGNUM_TARGET_GLES + &FramebufferGLTest::attachTexture2DMultisample, + &FramebufferGLTest::attachTexture2DMultisampleArray, + &FramebufferGLTest::attachRectangleTexture, + #endif + &FramebufferGLTest::attachCubeMapTexture, + #ifndef MAGNUM_TARGET_GLES + &FramebufferGLTest::attachCubeMapTextureArray, + #endif + + &FramebufferGLTest::multipleColorOutputs, + + &FramebufferGLTest::clear, + &FramebufferGLTest::invalidate, + &FramebufferGLTest::invalidateSub, + &FramebufferGLTest::read, + #ifndef MAGNUM_TARGET_GLES2 + &FramebufferGLTest::readBuffer, + #endif + &FramebufferGLTest::blit}); +} + +void FramebufferGLTest::construct() { + #ifndef MAGNUM_TARGET_GLES + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::ARB::framebuffer_object::string() + std::string(" is not available.")); + #endif + + { + const Framebuffer framebuffer({{32, 16}, {128, 256}}); + + MAGNUM_VERIFY_NO_ERROR(); + CORRADE_VERIFY(framebuffer.id() > 0); + CORRADE_COMPARE(framebuffer.viewport(), Range2Di({32, 16}, {128, 256})); + } + + MAGNUM_VERIFY_NO_ERROR(); +} + +void FramebufferGLTest::constructCopy() { + #ifndef CORRADE_GCC44_COMPATIBILITY + CORRADE_VERIFY(!(std::is_constructible{})); + /* GCC 4.6 doesn't have std::is_assignable */ + #ifndef CORRADE_GCC46_COMPATIBILITY + CORRADE_VERIFY(!(std::is_assignable{})); + #endif + #else + CORRADE_SKIP("Type traits needed to test this are not available on GCC 4.4."); + #endif +} + +void FramebufferGLTest::constructMove() { + #ifndef MAGNUM_TARGET_GLES + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::ARB::framebuffer_object::string() + std::string(" is not available.")); + #endif + + Framebuffer a({{32, 16}, {128, 256}}); + const Int id = a.id(); + + MAGNUM_VERIFY_NO_ERROR(); + CORRADE_VERIFY(id > 0); + + Framebuffer b(std::move(a)); + + CORRADE_COMPARE(a.id(), 0); + CORRADE_COMPARE(b.id(), id); + CORRADE_COMPARE(b.viewport(), Range2Di({32, 16}, {128, 256})); + + Framebuffer c({{128, 256}, {32, 16}}); + const Int cId = c.id(); + c = std::move(b); + + MAGNUM_VERIFY_NO_ERROR(); + CORRADE_VERIFY(cId > 0); + CORRADE_COMPARE(b.id(), cId); + CORRADE_COMPARE(c.id(), id); + CORRADE_COMPARE(c.viewport(), Range2Di({32, 16}, {128, 256})); +} + +void FramebufferGLTest::label() { + #ifndef MAGNUM_TARGET_GLES + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::ARB::framebuffer_object::string() + std::string(" is not available.")); + #endif + + /* No-Op version is tested in AbstractObjectGLTest */ + if(!Context::current()->isExtensionSupported() && + !Context::current()->isExtensionSupported()) + CORRADE_SKIP("Required extension is not available"); + + Framebuffer framebuffer({{}, Vector2i(32)}); + + CORRADE_COMPARE(framebuffer.label(), ""); + MAGNUM_VERIFY_NO_ERROR(); + + framebuffer.setLabel("MyFramebuffer"); + MAGNUM_VERIFY_NO_ERROR(); + + CORRADE_COMPARE(framebuffer.label(), "MyFramebuffer"); +} + +void FramebufferGLTest::attachRenderbuffer() { + #ifndef MAGNUM_TARGET_GLES + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::ARB::framebuffer_object::string() + std::string(" is not available.")); + #endif + + Renderbuffer color; + #ifndef MAGNUM_TARGET_GLES2 + color.setStorage(RenderbufferFormat::RGBA8, Vector2i(128)); + #else + color.setStorage(RenderbufferFormat::RGBA4, Vector2i(128)); + #endif + + /* Separate depth and stencil renderbuffers are not supported (or at least + on my NVidia, thus we need to do this juggling with one renderbuffer */ + Renderbuffer depthStencil; + #ifdef MAGNUM_TARGET_GLES2 + if(Context::current()->isExtensionSupported()) + #endif + { + #ifdef MAGNUM_TARGET_GLES2 + Debug() << "Using" << Extensions::GL::OES::packed_depth_stencil::string(); + #endif + depthStencil.setStorage(RenderbufferFormat::Depth24Stencil8, Vector2i(128)); + } + #ifdef MAGNUM_TARGET_GLES2 + else depthStencil.setStorage(RenderbufferFormat::DepthComponent16, Vector2i(128)); + #endif + + Framebuffer framebuffer({{}, Vector2i(128)}); + framebuffer.attachRenderbuffer(Framebuffer::ColorAttachment(0), color) + .attachRenderbuffer(Framebuffer::BufferAttachment::Depth, depthStencil); + + #ifdef MAGNUM_TARGET_GLES2 + if(Context::current()->isExtensionSupported()) + #endif + { + framebuffer.attachRenderbuffer(Framebuffer::BufferAttachment::Stencil, depthStencil); + } + + MAGNUM_VERIFY_NO_ERROR(); + CORRADE_COMPARE(framebuffer.checkStatus(FramebufferTarget::ReadDraw), Framebuffer::Status::Complete); +} + +void FramebufferGLTest::attachRenderbufferMultisample() { + #ifndef MAGNUM_TARGET_GLES + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::ARB::framebuffer_object::string() + std::string(" is not available.")); + #elif defined(MAGNUM_TARGET_GLES2) + if(!Context::current()->isExtensionSupported() && + !Context::current()->isExtensionSupported()) + CORRADE_SKIP("Required extension is not available."); + #endif + + Renderbuffer color; + #ifndef MAGNUM_TARGET_GLES2 + color.setStorageMultisample(Renderbuffer::maxSamples(), RenderbufferFormat::RGBA8, Vector2i(128)); + #else + color.setStorageMultisample(Renderbuffer::maxSamples(), RenderbufferFormat::RGBA4, Vector2i(128)); + #endif + + #ifdef MAGNUM_TARGET_GLES2 + MAGNUM_ASSERT_EXTENSION_SUPPORTED(Extensions::GL::OES::packed_depth_stencil); + #endif + + Renderbuffer depthStencil; + depthStencil.setStorageMultisample(Renderbuffer::maxSamples(), RenderbufferFormat::Depth24Stencil8, Vector2i(128)); + + Framebuffer framebuffer({{}, Vector2i(128)}); + framebuffer.attachRenderbuffer(Framebuffer::ColorAttachment(0), color) + #ifndef MAGNUM_TARGET_GLES2 + .attachRenderbuffer(Framebuffer::BufferAttachment::DepthStencil, depthStencil); + #else + .attachRenderbuffer(Framebuffer::BufferAttachment::Depth, depthStencil) + .attachRenderbuffer(Framebuffer::BufferAttachment::Stencil, depthStencil); + #endif + + MAGNUM_VERIFY_NO_ERROR(); + CORRADE_COMPARE(framebuffer.checkStatus(FramebufferTarget::ReadDraw), Framebuffer::Status::Complete); +} + +#ifndef MAGNUM_TARGET_GLES +void FramebufferGLTest::attachTexture1D() { + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::ARB::framebuffer_object::string() + std::string(" is not available.")); + + Texture1D color; + color.setStorage(1, TextureFormat::RGBA8, 128); + + Texture1D depthStencil; + depthStencil.setStorage(1, TextureFormat::Depth24Stencil8, 128); + + Framebuffer framebuffer({{}, {128, 1}}); + framebuffer.attachTexture1D(Framebuffer::ColorAttachment(0), color, 0) + .attachTexture1D(Framebuffer::BufferAttachment::DepthStencil, depthStencil, 0); + + MAGNUM_VERIFY_NO_ERROR(); + CORRADE_COMPARE(framebuffer.checkStatus(FramebufferTarget::ReadDraw), Framebuffer::Status::Complete); +} +#endif + +void FramebufferGLTest::attachTexture2D() { + #ifndef MAGNUM_TARGET_GLES + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::ARB::framebuffer_object::string() + std::string(" is not available.")); + #endif + + MAGNUM_VERIFY_NO_ERROR(); + + Framebuffer framebuffer({{}, Vector2i(128)}); + + MAGNUM_VERIFY_NO_ERROR(); + + Texture2D color; + #ifndef MAGNUM_TARGET_GLES2 + color.setStorage(1, TextureFormat::RGBA8, Vector2i(128)); + #else + color.setStorage(1, TextureFormat::RGBA, Vector2i(128)); + #endif + + MAGNUM_VERIFY_NO_ERROR(); + + framebuffer.attachTexture2D(Framebuffer::ColorAttachment(0), color, 0); + + MAGNUM_VERIFY_NO_ERROR(); + + #ifdef MAGNUM_TARGET_GLES2 + if(Context::current()->isExtensionSupported()) + #endif + { + #ifdef MAGNUM_TARGET_GLES2 + Debug() << "Using" << Extensions::GL::OES::packed_depth_stencil::string(); + #endif + + Texture2D depthStencil; + #ifndef MAGNUM_TARGET_GLES2 + depthStencil.setStorage(1, TextureFormat::Depth24Stencil8, Vector2i(128)); + framebuffer.attachTexture2D(Framebuffer::BufferAttachment::DepthStencil, depthStencil, 0); + #else + depthStencil.setStorage(1, TextureFormat::DepthStencil, Vector2i(128)); + framebuffer.attachTexture2D(Framebuffer::BufferAttachment::Depth, depthStencil, 0) + .attachTexture2D(Framebuffer::BufferAttachment::Stencil, depthStencil, 0); + #endif + } + + #ifdef MAGNUM_TARGET_GLES2 + else if(Context::current()->isExtensionSupported()) { + Debug() << "Using" << Extensions::GL::OES::depth_texture::string(); + + Texture2D depth; + depth.setStorage(1, TextureFormat::DepthComponent16, Vector2i(128)); + framebuffer.attachTexture2D(Framebuffer::BufferAttachment::Depth, depth, 0); + } + #endif + + MAGNUM_VERIFY_NO_ERROR(); + CORRADE_COMPARE(framebuffer.checkStatus(FramebufferTarget::ReadDraw), Framebuffer::Status::Complete); +} + +void FramebufferGLTest::attachTexture3D() { + #ifndef MAGNUM_TARGET_GLES + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::ARB::framebuffer_object::string() + std::string(" is not available.")); + #elif defined(MAGNUM_TARGET_GLES2) + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::OES::texture_3D::string() + std::string(" is not available.")); + #else + CORRADE_SKIP("Not properly implemented yet."); + #endif + + Texture3D color; + #ifndef MAGNUM_TARGET_GLES2 + color.setStorage(1, TextureFormat::RGBA8, Vector3i(128)); + #else + color.setStorage(1, TextureFormat::RGBA4, Vector3i(128)); + #endif + + Framebuffer framebuffer({{}, Vector2i(128)}); + framebuffer.attachTexture3D(Framebuffer::ColorAttachment(0), color, 0, 0); + + MAGNUM_VERIFY_NO_ERROR(); + CORRADE_COMPARE(framebuffer.checkStatus(FramebufferTarget::ReadDraw), Framebuffer::Status::Complete); +} + +#ifndef MAGNUM_TARGET_GLES +void FramebufferGLTest::attachTexture1DArray() { + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::ARB::framebuffer_object::string() + std::string(" is not available.")); + + Texture2D color(Texture2D::Target::Texture1DArray); + color.setStorage(1, TextureFormat::RGBA8, {128, 8}); + + Texture2D depthStencil(Texture2D::Target::Texture1DArray); + depthStencil.setStorage(1, TextureFormat::Depth24Stencil8, {128, 8}); + + Framebuffer framebuffer({{}, {128, 1}}); + framebuffer.attachTexture2D(Framebuffer::ColorAttachment(0), color, 0) + .attachTexture2D(Framebuffer::BufferAttachment::DepthStencil, depthStencil, 0); + + CORRADE_EXPECT_FAIL("Not properly implemented yet."); + MAGNUM_VERIFY_NO_ERROR(); + CORRADE_COMPARE(framebuffer.checkStatus(FramebufferTarget::ReadDraw), Framebuffer::Status::Complete); +} +#endif + +#ifndef MAGNUM_TARGET_GLES2 +void FramebufferGLTest::attachTexture2DArray() { + #ifndef MAGNUM_TARGET_GLES + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::ARB::framebuffer_object::string() + std::string(" is not available.")); + #else + CORRADE_SKIP("Not properly implemented yet."); + #endif + + Texture3D color(Texture3D::Target::Texture2DArray); + color.setStorage(1, TextureFormat::RGBA8, {128, 128, 8}); + + Texture3D depthStencil(Texture3D::Target::Texture2DArray); + depthStencil.setStorage(1, TextureFormat::Depth24Stencil8, {128, 128, 8}); + + Framebuffer framebuffer({{}, Vector2i(128)}); + framebuffer.attachTexture3D(Framebuffer::ColorAttachment(0), color, 0, 0) + .attachTexture3D(Framebuffer::BufferAttachment::DepthStencil, depthStencil, 0, 0); + + CORRADE_EXPECT_FAIL("Not properly implemented yet."); + MAGNUM_VERIFY_NO_ERROR(); + CORRADE_COMPARE(framebuffer.checkStatus(FramebufferTarget::ReadDraw), Framebuffer::Status::Complete); +} +#endif + +#ifndef MAGNUM_TARGET_GLES +void FramebufferGLTest::attachTexture2DMultisample() { + CORRADE_SKIP("Multisample textures are not implemented yet."); +} + +void FramebufferGLTest::attachTexture2DMultisampleArray() { + CORRADE_SKIP("Multisample textures are not implemented yet."); +} + +void FramebufferGLTest::attachRectangleTexture() { + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::ARB::framebuffer_object::string() + std::string(" is not available.")); + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::ARB::texture_rectangle::string() + std::string(" is not available.")); + + Texture2D color(Texture2D::Target::Rectangle); + color.setStorage(1, TextureFormat::RGBA8, Vector2i(128)); + + Texture2D depthStencil(Texture2D::Target::Rectangle); + depthStencil.setStorage(1, TextureFormat::Depth24Stencil8, Vector2i(128)); + + Framebuffer framebuffer({{}, Vector2i(128)}); + framebuffer.attachTexture2D(Framebuffer::ColorAttachment(0), color, 0) + .attachTexture2D(Framebuffer::BufferAttachment::DepthStencil, depthStencil, 0); + + MAGNUM_VERIFY_NO_ERROR(); + CORRADE_COMPARE(framebuffer.checkStatus(FramebufferTarget::ReadDraw), Framebuffer::Status::Complete); +} +#endif + +void FramebufferGLTest::attachCubeMapTexture() { + #ifndef MAGNUM_TARGET_GLES + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::ARB::framebuffer_object::string() + std::string(" is not available.")); + #endif + + Framebuffer framebuffer({{}, Vector2i(128)}); + + CubeMapTexture color; + #ifndef MAGNUM_TARGET_GLES2 + color.setStorage(1, TextureFormat::RGBA8, Vector2i(128)); + #else + color.setStorage(1, TextureFormat::RGBA, Vector2i(128)); + #endif + framebuffer.attachCubeMapTexture(Framebuffer::ColorAttachment(0), color, CubeMapTexture::Coordinate::NegativeZ, 0); + + CubeMapTexture depthStencil; + + #ifdef MAGNUM_TARGET_GLES2 + if(Context::current()->isExtensionSupported()) + #endif + { + #ifdef MAGNUM_TARGET_GLES2 + Debug() << "Using" << Extensions::GL::OES::packed_depth_stencil::string(); + #endif + + #ifndef MAGNUM_TARGET_GLES2 + depthStencil.setStorage(1, TextureFormat::Depth24Stencil8, Vector2i(128)); + framebuffer.attachCubeMapTexture(Framebuffer::BufferAttachment::DepthStencil, depthStencil, CubeMapTexture::Coordinate::NegativeZ, 0); + #else + depthStencil.setStorage(1, TextureFormat::DepthStencil, Vector2i(128)); + framebuffer.attachCubeMapTexture(Framebuffer::BufferAttachment::Depth, depthStencil, CubeMapTexture::Coordinate::NegativeZ, 0) + .attachCubeMapTexture(Framebuffer::BufferAttachment::Stencil, depthStencil, CubeMapTexture::Coordinate::NegativeZ, 0); + #endif + } + + #ifdef MAGNUM_TARGET_GLES2 + else if(Context::current()->isExtensionSupported()) { + Debug() << "Using" << Extensions::GL::OES::depth_texture::string(); + + depthStencil.setStorage(1, TextureFormat::DepthComponent16, Vector2i(128)); + framebuffer.attachCubeMapTexture(Framebuffer::BufferAttachment::Depth, depthStencil, CubeMapTexture::Coordinate::NegativeZ, 0); + } + #endif + + MAGNUM_VERIFY_NO_ERROR(); + CORRADE_COMPARE(framebuffer.checkStatus(FramebufferTarget::ReadDraw), Framebuffer::Status::Complete); +} + +#ifndef MAGNUM_TARGET_GLES +void FramebufferGLTest::attachCubeMapTextureArray() { + CORRADE_SKIP("Not implemented yet."); +} +#endif + +void FramebufferGLTest::multipleColorOutputs() { + #ifndef MAGNUM_TARGET_GLES + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::ARB::framebuffer_object::string() + std::string(" is not available.")); + #elif defined(MAGNUM_TARGET_GLES2) + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::NV::draw_buffers::string() + std::string(" is not available.")); + #endif + + Texture2D color1; + #ifndef MAGNUM_TARGET_GLES2 + color1.setStorage(1, TextureFormat::RGBA8, Vector2i(128)); + #else + color1.setStorage(1, TextureFormat::RGBA, Vector2i(128)); + #endif + + Texture2D color2; + #ifndef MAGNUM_TARGET_GLES2 + color2.setStorage(1, TextureFormat::RGBA8, Vector2i(128)); + #else + color2.setStorage(1, TextureFormat::RGBA, Vector2i(128)); + #endif + + Renderbuffer depth; + depth.setStorage(RenderbufferFormat::DepthComponent16, Vector2i(128)); + + Framebuffer framebuffer({{}, Vector2i(128)}); + framebuffer.attachTexture2D(Framebuffer::ColorAttachment(0), color1, 0) + .attachTexture2D(Framebuffer::ColorAttachment(1), color2, 0) + .attachRenderbuffer(Framebuffer::BufferAttachment::Depth, depth) + .mapForDraw({{0, Framebuffer::ColorAttachment(1)}, + {1, Framebuffer::ColorAttachment(0)}}); + + #ifdef MAGNUM_TARGET_GLES2 + if(Context::current()->isExtensionSupported()) + #endif + { + #ifdef MAGNUM_TARGET_GLES2 + Debug() << "Using" << Extensions::GL::NV::read_buffer::string(); + #endif + framebuffer.mapForRead(Framebuffer::ColorAttachment(1)); + } + + MAGNUM_VERIFY_NO_ERROR(); + CORRADE_COMPARE(framebuffer.checkStatus(FramebufferTarget::ReadDraw), Framebuffer::Status::Complete); +} + +void FramebufferGLTest::clear() { + Renderbuffer color; + #ifndef MAGNUM_TARGET_GLES2 + color.setStorage(RenderbufferFormat::RGBA8, Vector2i(128)); + #else + color.setStorage(RenderbufferFormat::RGBA4, Vector2i(128)); + #endif + + /* Separate depth and stencil renderbuffers are not supported (or at least + on my NVidia, thus we need to do this juggling with one renderbuffer */ + Renderbuffer depthStencil; + #ifdef MAGNUM_TARGET_GLES2 + if(Context::current()->isExtensionSupported()) + #endif + { + #ifdef MAGNUM_TARGET_GLES2 + Debug() << "Using" << Extensions::GL::OES::packed_depth_stencil::string(); + #endif + depthStencil.setStorage(RenderbufferFormat::Depth24Stencil8, Vector2i(128)); + } + #ifdef MAGNUM_TARGET_GLES2 + else depthStencil.setStorage(RenderbufferFormat::DepthComponent16, Vector2i(128)); + #endif + + Framebuffer framebuffer({{}, Vector2i(128)}); + framebuffer.attachRenderbuffer(Framebuffer::ColorAttachment(0), color) + .attachRenderbuffer(Framebuffer::BufferAttachment::Depth, depthStencil); + + #ifdef MAGNUM_TARGET_GLES2 + if(Context::current()->isExtensionSupported()) + #endif + { + framebuffer.attachRenderbuffer(Framebuffer::BufferAttachment::Stencil, depthStencil); + } + + MAGNUM_VERIFY_NO_ERROR(); + CORRADE_COMPARE(framebuffer.checkStatus(FramebufferTarget::Draw), Framebuffer::Status::Complete); + + framebuffer.clear(FramebufferClear::Color|FramebufferClear::Depth|FramebufferClear::Stencil); + + MAGNUM_VERIFY_NO_ERROR(); +} + +void FramebufferGLTest::invalidate() { + #ifndef MAGNUM_TARGET_GLES + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::ARB::framebuffer_object::string() + std::string(" is not available.")); + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::ARB::invalidate_subdata::string() + std::string(" is not available.")); + #elif defined(MAGNUM_TARGET_GLES2) + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::EXT::discard_framebuffer::string() + std::string(" is not available.")); + #endif + + Renderbuffer color; + #ifndef MAGNUM_TARGET_GLES2 + color.setStorage(RenderbufferFormat::RGBA8, Vector2i(128)); + #else + color.setStorage(RenderbufferFormat::RGBA4, Vector2i(128)); + #endif + + Renderbuffer stencil; + stencil.setStorage(RenderbufferFormat::StencilIndex8, Vector2i(128)); + + Framebuffer framebuffer({{}, Vector2i(128)}); + framebuffer.attachRenderbuffer(Framebuffer::ColorAttachment(0), color) + .attachRenderbuffer(Framebuffer::BufferAttachment::Stencil, stencil); + + MAGNUM_VERIFY_NO_ERROR(); + + framebuffer.invalidate({Framebuffer::InvalidationAttachment::Depth, Framebuffer::ColorAttachment(0)}); + + MAGNUM_VERIFY_NO_ERROR(); +} + +void FramebufferGLTest::invalidateSub() { + #ifndef MAGNUM_TARGET_GLES + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::ARB::framebuffer_object::string() + std::string(" is not available.")); + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::ARB::invalidate_subdata::string() + std::string(" is not available.")); + #elif defined(MAGNUM_TARGET_GLES2) + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::EXT::discard_framebuffer::string() + std::string(" is not available.")); + #endif + + Renderbuffer color; + #ifndef MAGNUM_TARGET_GLES2 + color.setStorage(RenderbufferFormat::RGBA8, Vector2i(128)); + #else + color.setStorage(RenderbufferFormat::RGBA4, Vector2i(128)); + #endif + + Renderbuffer depth; + depth.setStorage(RenderbufferFormat::DepthComponent16, Vector2i(128)); + + Framebuffer framebuffer({{}, Vector2i(128)}); + framebuffer.attachRenderbuffer(Framebuffer::ColorAttachment(0), color) + .attachRenderbuffer(Framebuffer::BufferAttachment::Depth, depth); + + MAGNUM_VERIFY_NO_ERROR(); + CORRADE_COMPARE(framebuffer.checkStatus(FramebufferTarget::ReadDraw), Framebuffer::Status::Complete); + + framebuffer.invalidate({Framebuffer::InvalidationAttachment::Depth, Framebuffer::ColorAttachment(0)}, + {{32, 16}, {79, 64}}); + + MAGNUM_VERIFY_NO_ERROR(); +} + +void FramebufferGLTest::read() { + #ifndef MAGNUM_TARGET_GLES + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::ARB::framebuffer_object::string() + std::string(" is not available.")); + #endif + + Renderbuffer color; + #ifndef MAGNUM_TARGET_GLES2 + color.setStorage(RenderbufferFormat::RGBA8, Vector2i(128)); + #else + color.setStorage(RenderbufferFormat::RGBA4, Vector2i(128)); + #endif + + /* Separate depth and stencil renderbuffers are not supported (or at least + on my NVidia, thus we need to do this juggling with one renderbuffer */ + Renderbuffer depthStencil; + #ifdef MAGNUM_TARGET_GLES2 + if(Context::current()->isExtensionSupported()) + #endif + { + #ifdef MAGNUM_TARGET_GLES2 + Debug() << "Using" << Extensions::GL::OES::packed_depth_stencil::string(); + #endif + depthStencil.setStorage(RenderbufferFormat::Depth24Stencil8, Vector2i(128)); + } + #ifdef MAGNUM_TARGET_GLES2 + else depthStencil.setStorage(RenderbufferFormat::DepthComponent16, Vector2i(128)); + #endif + + Framebuffer framebuffer({{}, Vector2i(128)}); + framebuffer.attachRenderbuffer(Framebuffer::ColorAttachment(0), color) + .attachRenderbuffer(Framebuffer::BufferAttachment::Depth, depthStencil); + + #ifdef MAGNUM_TARGET_GLES2 + if(Context::current()->isExtensionSupported()) + #endif + { + framebuffer.attachRenderbuffer(Framebuffer::BufferAttachment::Stencil, depthStencil); + } + + MAGNUM_VERIFY_NO_ERROR(); + CORRADE_COMPARE(framebuffer.checkStatus(FramebufferTarget::ReadDraw), Framebuffer::Status::Complete); + + Renderer::setClearColor(Math::normalize(Color4ub(128, 64, 32, 17))); + Renderer::setClearDepth(Math::normalize(48352)); + Renderer::setClearStencil(67); + framebuffer.clear(FramebufferClear::Color|FramebufferClear::Depth|FramebufferClear::Stencil); + + Image2D colorImage(ColorFormat::RGBA, ColorType::UnsignedByte); + framebuffer.read({16, 8}, {8, 16}, colorImage); + CORRADE_COMPARE(colorImage.size(), Vector2i(8, 16)); + + MAGNUM_VERIFY_NO_ERROR(); + CORRADE_COMPARE(colorImage.data()[0], Color4ub(128, 64, 32, 17)); + + #ifdef MAGNUM_TARGET_GLES + if(Context::current()->isExtensionSupported()) + #endif + { + #ifdef MAGNUM_TARGET_GLES + Debug() << "Using" << Extensions::GL::NV::read_depth::string(); + #endif + + Image2D depthImage(ColorFormat::DepthComponent, ColorType::UnsignedShort); + framebuffer.read({}, Vector2i(1), depthImage); + + MAGNUM_VERIFY_NO_ERROR(); + CORRADE_COMPARE(depthImage.data()[0], 48352); + } + + #ifdef MAGNUM_TARGET_GLES + if(Context::current()->isExtensionSupported()) + #endif + { + #ifdef MAGNUM_TARGET_GLES + Debug() << "Using" << Extensions::GL::NV::read_stencil::string(); + #endif + + Image2D stencilImage(ColorFormat::StencilIndex, ColorType::UnsignedByte); + framebuffer.read({}, Vector2i(1), stencilImage); + + MAGNUM_VERIFY_NO_ERROR(); + CORRADE_COMPARE(stencilImage.data()[0], 67); + } + + #ifdef MAGNUM_TARGET_GLES + if(Context::current()->isExtensionSupported()) + #endif + { + #ifdef MAGNUM_TARGET_GLES + Debug() << "Using" << Extensions::GL::NV::read_depth_stencil::string(); + #endif + + Image2D depthStencilImage(ColorFormat::DepthStencil, ColorType::UnsignedInt248); + framebuffer.read({}, Vector2i(1), depthStencilImage); + + MAGNUM_VERIFY_NO_ERROR(); + /** @todo This will probably fail on different systems */ + CORRADE_COMPARE(depthStencilImage.data()[0] >> 8, 12378300); + CORRADE_COMPARE(depthStencilImage.data()[0], 67); + } +} + +#ifndef MAGNUM_TARGET_GLES2 +void FramebufferGLTest::readBuffer() { + #ifndef MAGNUM_TARGET_GLES + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::ARB::framebuffer_object::string() + std::string(" is not available.")); + #endif + + Renderbuffer color; + color.setStorage(RenderbufferFormat::RGBA8, Vector2i(128)); + + Renderbuffer depthStencil; + depthStencil.setStorage(RenderbufferFormat::Depth24Stencil8, Vector2i(128)); + + Framebuffer framebuffer({{}, Vector2i(128)}); + framebuffer.attachRenderbuffer(Framebuffer::ColorAttachment(0), color) + .attachRenderbuffer(Framebuffer::BufferAttachment::DepthStencil, depthStencil); + + MAGNUM_VERIFY_NO_ERROR(); + CORRADE_COMPARE(framebuffer.checkStatus(FramebufferTarget::ReadDraw), Framebuffer::Status::Complete); + + Renderer::setClearColor(Math::normalize(Color4ub(128, 64, 32, 17))); + Renderer::setClearDepth(Math::normalize(48352)); + Renderer::setClearStencil(67); + framebuffer.clear(FramebufferClear::Color|FramebufferClear::Depth|FramebufferClear::Stencil); + + BufferImage2D colorImage(ColorFormat::RGBA, ColorType::UnsignedByte); + framebuffer.read({16, 8}, {8, 16}, colorImage, BufferUsage::StaticRead); + CORRADE_COMPARE(colorImage.size(), Vector2i(8, 16)); + + MAGNUM_VERIFY_NO_ERROR(); + /** @todo How to test this on ES? */ + #ifndef MAGNUM_TARGET_GLES + const auto colorData = colorImage.buffer().data(); + CORRADE_COMPARE(colorData.size(), 8*16); + CORRADE_COMPARE(colorData[0], Color4ub(128, 64, 32, 17)); + #endif +} +#endif + +void FramebufferGLTest::blit() { + #ifndef MAGNUM_TARGET_GLES + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::ARB::framebuffer_object::string() + std::string(" is not available.")); + #elif defined(MAGNUM_TARGET_GLES2) + if(!Context::current()->isExtensionSupported() && + !Context::current()->isExtensionSupported()) + CORRADE_SKIP("Required extension is not available."); + #endif + + Renderbuffer colorA, colorB; + #ifndef MAGNUM_TARGET_GLES2 + colorA.setStorage(RenderbufferFormat::RGBA8, Vector2i(128)); + colorB.setStorage(RenderbufferFormat::RGBA8, Vector2i(128)); + #else + colorA.setStorage(RenderbufferFormat::RGBA4, Vector2i(128)); + colorB.setStorage(RenderbufferFormat::RGBA4, Vector2i(128)); + #endif + + Framebuffer a({{}, Vector2i(128)}), b({{}, Vector2i(128)});; + a.attachRenderbuffer(Framebuffer::ColorAttachment(0), colorA); + b.attachRenderbuffer(Framebuffer::ColorAttachment(0), colorB); + + MAGNUM_VERIFY_NO_ERROR(); + CORRADE_COMPARE(a.checkStatus(FramebufferTarget::ReadDraw), Framebuffer::Status::Complete); + CORRADE_COMPARE(b.checkStatus(FramebufferTarget::ReadDraw), Framebuffer::Status::Complete); + + /* Clear first with some color and second with another */ + Renderer::setClearColor(Math::normalize(Color4ub(128, 64, 32, 17))); + a.clear(FramebufferClear::Color); + Renderer::setClearColor({}); + b.clear(FramebufferClear::Color); + + /* The framebuffer should be black before */ + Image2D image(ColorFormat::RGBA, ColorType::UnsignedByte); + b.read({}, Vector2i(1), image); + + MAGNUM_VERIFY_NO_ERROR(); + CORRADE_COMPARE(image.data()[0], Color4ub()); + + /* And have given color after */ + Framebuffer::blit(a, b, a.viewport(), FramebufferBlit::ColorBuffer); + b.read({}, Vector2i(1), image); + + MAGNUM_VERIFY_NO_ERROR(); + CORRADE_COMPARE(image.data()[0], Color4ub(128, 64, 32, 17)); +} + +}} + +CORRADE_TEST_MAIN(Magnum::Test::FramebufferGLTest) diff --git a/src/Test/FramebufferTest.cpp b/src/Magnum/Test/FramebufferTest.cpp similarity index 96% rename from src/Test/FramebufferTest.cpp rename to src/Magnum/Test/FramebufferTest.cpp index b902e1cbd..4863162fd 100644 --- a/src/Test/FramebufferTest.cpp +++ b/src/Magnum/Test/FramebufferTest.cpp @@ -23,9 +23,9 @@ */ #include -#include +#include -#include "Framebuffer.h" +#include "Magnum/Framebuffer.h" namespace Magnum { namespace Test { diff --git a/src/Test/ImageReferenceTest.cpp b/src/Magnum/Test/ImageReferenceTest.cpp similarity index 95% rename from src/Test/ImageReferenceTest.cpp rename to src/Magnum/Test/ImageReferenceTest.cpp index eeb80a59f..b5efefcec 100644 --- a/src/Test/ImageReferenceTest.cpp +++ b/src/Magnum/Test/ImageReferenceTest.cpp @@ -22,10 +22,10 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include -#include "ColorFormat.h" -#include "ImageReference.h" +#include "Magnum/ColorFormat.h" +#include "Magnum/ImageReference.h" namespace Magnum { namespace Test { diff --git a/src/Test/ImageTest.cpp b/src/Magnum/Test/ImageTest.cpp similarity index 98% rename from src/Test/ImageTest.cpp rename to src/Magnum/Test/ImageTest.cpp index 471900c4b..a91442979 100644 --- a/src/Test/ImageTest.cpp +++ b/src/Magnum/Test/ImageTest.cpp @@ -22,10 +22,10 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include -#include "ColorFormat.h" -#include "Image.h" +#include "Magnum/ColorFormat.h" +#include "Magnum/Image.h" namespace Magnum { namespace Test { diff --git a/src/Magnum/Test/MeshGLTest.cpp b/src/Magnum/Test/MeshGLTest.cpp new file mode 100644 index 000000000..9ab3849c7 --- /dev/null +++ b/src/Magnum/Test/MeshGLTest.cpp @@ -0,0 +1,1239 @@ +/* + This file is part of Magnum. + + Copyright © 2010, 2011, 2012, 2013 Vladimír Vondruš + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. +*/ + +#include "Magnum/Buffer.h" +#include "Magnum/ColorFormat.h" +#include "Magnum/Framebuffer.h" +#include "Magnum/Image.h" +#include "Magnum/Mesh.h" +#include "Magnum/MeshView.h" +#include "Magnum/Renderbuffer.h" +#include "Magnum/RenderbufferFormat.h" +#include "Magnum/Shader.h" +#include "Magnum/Math/Matrix.h" +#include "Magnum/Math/Vector4.h" +#include "Magnum/Test/AbstractOpenGLTester.h" + +namespace Magnum { namespace Test { + +/* Tests also MeshView class. */ + +class MeshGLTest: public AbstractOpenGLTester { + public: + explicit MeshGLTest(); + + void construct(); + void constructCopy(); + void constructMove(); + + void label(); + + #ifndef MAGNUM_TARGET_GLES2 + void addVertexBufferUnsignedInt(); + void addVertexBufferInt(); + #endif + void addVertexBufferFloat(); + #ifndef MAGNUM_TARGET_GLES + void addVertexBufferDouble(); + #endif + #ifndef MAGNUM_TARGET_GLES2 + void addVertexBufferVectorNui(); + void addVertexBufferVectorNi(); + #endif + void addVertexBufferVectorN(); + #ifndef MAGNUM_TARGET_GLES + void addVertexBufferVectorNd(); + #endif + void addVertexBufferMatrixNxN(); + #ifndef MAGNUM_TARGET_GLES + void addVertexBufferMatrixNxNd(); + #endif + #ifndef MAGNUM_TARGET_GLES2 + void addVertexBufferMatrixMxN(); + #endif + #ifndef MAGNUM_TARGET_GLES + void addVertexBufferMatrixMxNd(); + #endif + + #ifndef MAGNUM_TARGET_GLES2 + void addVertexBufferUnsignedIntWithUnsignedShort(); + void addVertexBufferUnsignedIntWithShort(); + void addVertexBufferIntWithUnsignedShort(); + void addVertexBufferIntWithShort(); + #endif + /* Other Float types omitted (covered by addVertexBufferNormalized()) */ + void addVertexBufferFloatWithHalfFloat(); + #ifndef MAGNUM_TARGET_GLES + void addVertexBufferFloatWithDouble(); + #endif + #ifndef MAGNUM_TARGET_GLES2 + void addVertexBufferVector4WithUnsignedInt2101010Rev(); + void addVertexBufferVector4WithInt2101010Rev(); + #endif + + void addVertexBufferLessVectorComponents(); + void addVertexBufferNormalized(); + #ifndef MAGNUM_TARGET_GLES + void addVertexBufferBGRA(); + #endif + + void addVertexBufferMultiple(); + void addVertexBufferMultipleGaps(); + + void setIndexBuffer(); + void setIndexBufferRange(); + void setIndexBufferUnsignedInt(); +}; + +MeshGLTest::MeshGLTest() { + addTests({&MeshGLTest::construct, + &MeshGLTest::constructCopy, + &MeshGLTest::constructMove, + + &MeshGLTest::label, + + #ifndef MAGNUM_TARGET_GLES2 + &MeshGLTest::addVertexBufferUnsignedInt, + &MeshGLTest::addVertexBufferInt, + #endif + &MeshGLTest::addVertexBufferFloat, + #ifndef MAGNUM_TARGET_GLES + &MeshGLTest::addVertexBufferDouble, + #endif + #ifndef MAGNUM_TARGET_GLES2 + &MeshGLTest::addVertexBufferVectorNui, + &MeshGLTest::addVertexBufferVectorNi, + #endif + &MeshGLTest::addVertexBufferVectorN, + #ifndef MAGNUM_TARGET_GLES + &MeshGLTest::addVertexBufferVectorNd, + #endif + &MeshGLTest::addVertexBufferMatrixNxN, + #ifndef MAGNUM_TARGET_GLES + &MeshGLTest::addVertexBufferMatrixNxNd, + #endif + #ifndef MAGNUM_TARGET_GLES2 + &MeshGLTest::addVertexBufferMatrixMxN, + #endif + #ifndef MAGNUM_TARGET_GLES + &MeshGLTest::addVertexBufferMatrixMxNd, + #endif + + #ifndef MAGNUM_TARGET_GLES2 + &MeshGLTest::addVertexBufferUnsignedIntWithUnsignedShort, + &MeshGLTest::addVertexBufferUnsignedIntWithShort, + &MeshGLTest::addVertexBufferIntWithUnsignedShort, + &MeshGLTest::addVertexBufferIntWithShort, + #endif + &MeshGLTest::addVertexBufferFloatWithHalfFloat, + #ifndef MAGNUM_TARGET_GLES + &MeshGLTest::addVertexBufferFloatWithDouble, + #endif + #ifndef MAGNUM_TARGET_GLES2 + &MeshGLTest::addVertexBufferVector4WithUnsignedInt2101010Rev, + &MeshGLTest::addVertexBufferVector4WithInt2101010Rev, + #endif + + &MeshGLTest::addVertexBufferLessVectorComponents, + &MeshGLTest::addVertexBufferNormalized, + #ifndef MAGNUM_TARGET_GLES + &MeshGLTest::addVertexBufferBGRA, + #endif + + &MeshGLTest::addVertexBufferMultiple, + &MeshGLTest::addVertexBufferMultipleGaps, + + &MeshGLTest::setIndexBuffer, + &MeshGLTest::setIndexBufferRange, + &MeshGLTest::setIndexBufferUnsignedInt}); +} + +void MeshGLTest::construct() { + { + const Mesh mesh; + + MAGNUM_VERIFY_NO_ERROR(); + + #ifndef MAGNUM_TARGET_GLES + if(Context::current()->isExtensionSupported()) + #elif defined(MAGNUM_TARGET_GLES2) + if(Context::current()->isExtensionSupported()) + #endif + { + CORRADE_VERIFY(mesh.id() > 0); + } + } + + MAGNUM_VERIFY_NO_ERROR(); +} + +void MeshGLTest::constructCopy() { + #ifndef CORRADE_GCC44_COMPATIBILITY + CORRADE_VERIFY(!(std::is_constructible{})); + /* GCC 4.6 doesn't have std::is_assignable */ + #ifndef CORRADE_GCC46_COMPATIBILITY + CORRADE_VERIFY(!(std::is_assignable{})); + #endif + #else + CORRADE_SKIP("Type traits needed to test this are not available on GCC 4.4."); + #endif +} + +void MeshGLTest::constructMove() { + Mesh a; + const Int id = a.id(); + + MAGNUM_VERIFY_NO_ERROR(); + + #ifndef MAGNUM_TARGET_GLES + if(Context::current()->isExtensionSupported()) + #elif defined(MAGNUM_TARGET_GLES2) + if(Context::current()->isExtensionSupported()) + #endif + { + CORRADE_VERIFY(id > 0); + } + + Mesh b(std::move(a)); + + CORRADE_COMPARE(a.id(), 0); + CORRADE_COMPARE(b.id(), id); + + Mesh c; + const Int cId = c.id(); + c = std::move(b); + + MAGNUM_VERIFY_NO_ERROR(); + + #ifndef MAGNUM_TARGET_GLES + if(Context::current()->isExtensionSupported()) + #elif defined(MAGNUM_TARGET_GLES2) + if(Context::current()->isExtensionSupported()) + #endif + { + CORRADE_VERIFY(cId > 0); + } + + CORRADE_COMPARE(b.id(), cId); + CORRADE_COMPARE(c.id(), id); +} + +void MeshGLTest::label() { + /* No-Op version is tested in AbstractObjectGLTest */ + if(!Context::current()->isExtensionSupported() && + !Context::current()->isExtensionSupported()) + CORRADE_SKIP("Required extension is not available"); + + Mesh mesh; + CORRADE_COMPARE(mesh.label(), ""); + + mesh.setLabel("MyMesh"); + CORRADE_COMPARE(mesh.label(), "MyMesh"); + + MAGNUM_VERIFY_NO_ERROR(); +} + +namespace { + struct FloatShader: AbstractShaderProgram { + explicit FloatShader(const std::string& type, const std::string& conversion); + }; + + #ifndef MAGNUM_TARGET_GLES2 + struct IntegerShader: AbstractShaderProgram { + explicit IntegerShader(const std::string& type); + }; + #endif + + #ifndef MAGNUM_TARGET_GLES + struct DoubleShader: AbstractShaderProgram { + explicit DoubleShader(const std::string& type, const std::string& outputType, const std::string& conversion); + }; + #endif + + struct Checker { + Checker(AbstractShaderProgram&& shader, RenderbufferFormat format, Mesh& mesh); + + template T get(ColorFormat format, ColorType type); + + Renderbuffer renderbuffer; + Framebuffer framebuffer; + }; +} + +#ifndef DOXYGEN_GENERATING_OUTPUT +FloatShader::FloatShader(const std::string& type, const std::string& conversion) { + /* We need special version for ES3, because GLSL in ES2 doesn't support + rectangle matrices */ + #ifndef MAGNUM_TARGET_GLES + Shader vert(Version::GL210, Shader::Type::Vertex); + #elif defined(MAGNUM_TARGET_GLES2) + Shader vert(Version::GLES200, Shader::Type::Vertex); + #else + Shader vert(Version::GLES300, Shader::Type::Vertex); + #endif + + vert.addSource( + #ifndef MAGNUM_TARGET_GLES3 + "attribute mediump " + type + " value;\n" + "varying mediump " + type + " valueInterpolated;\n" + #else + "in mediump " + type + " value;\n" + "out mediump " + type + " valueInterpolated;\n" + #endif + "void main() {\n" + " valueInterpolated = value;\n" + " gl_Position = vec4(0.0, 0.0, 0.0, 1.0);\n" + "}\n"); + CORRADE_INTERNAL_ASSERT_OUTPUT(vert.compile()); + attachShader(vert); + + #ifndef MAGNUM_TARGET_GLES + Shader frag(Version::GL210, Shader::Type::Fragment); + #elif defined(MAGNUM_TARGET_GLES2) + Shader frag(Version::GLES200, Shader::Type::Fragment); + #else + Shader frag(Version::GLES300, Shader::Type::Fragment); + #endif + + #ifndef MAGNUM_TARGET_GLES3 + frag.addSource("varying mediump " + type + " valueInterpolated;\n" + "void main() { gl_FragColor = " + conversion + "; }\n"); + #else + frag.addSource("in mediump " + type + " valueInterpolated;\n" + "out mediump vec4 output;\n" + "void main() { output = " + conversion + "; }\n"); + #endif + CORRADE_INTERNAL_ASSERT_OUTPUT(frag.compile()); + attachShader(frag); + + bindAttributeLocation(0, "value"); + + CORRADE_INTERNAL_ASSERT_OUTPUT(link()); +} + +#ifndef MAGNUM_TARGET_GLES2 +IntegerShader::IntegerShader(const std::string& type) { + #ifndef MAGNUM_TARGET_GLES + Shader vert(Version::GL300, Shader::Type::Vertex); + #else + Shader vert(Version::GLES300, Shader::Type::Vertex); + #endif + vert.addSource("in mediump " + type + " value;\n" + "flat out mediump " + type + " valueInterpolated;\n" + "void main() {\n" + " valueInterpolated = value;\n" + " gl_Position = vec4(0.0, 0.0, 0.0, 1.0);\n" + "}\n"); + CORRADE_INTERNAL_ASSERT_OUTPUT(vert.compile()); + attachShader(vert); + + #ifndef MAGNUM_TARGET_GLES + Shader frag(Version::GL300, Shader::Type::Fragment); + #else + Shader frag(Version::GLES300, Shader::Type::Fragment); + #endif + frag.addSource("flat in mediump " + type + " valueInterpolated;\n" + "out mediump " + type + " result;\n" + "void main() { result = valueInterpolated; }\n"); + CORRADE_INTERNAL_ASSERT_OUTPUT(frag.compile()); + attachShader(frag); + + bindAttributeLocation(0, "value"); + + CORRADE_INTERNAL_ASSERT_OUTPUT(link()); +} +#endif + +#ifndef MAGNUM_TARGET_GLES +DoubleShader::DoubleShader(const std::string& type, const std::string& outputType, const std::string& conversion) { + Shader vert(Version::GL410, Shader::Type::Vertex); + vert.addSource("in " + type + " value;\n" + "out " + outputType + " valueInterpolated;\n" + "void main() {\n" + " valueInterpolated = " + conversion + ";\n" + " gl_Position = vec4(0.0, 0.0, 0.0, 1.0);\n" + "}\n"); + CORRADE_INTERNAL_ASSERT_OUTPUT(vert.compile()); + attachShader(vert); + + Shader frag(Version::GL410, Shader::Type::Fragment); + frag.addSource("in " + outputType + " valueInterpolated;\n" + "out " + outputType + " result;\n" + "void main() { result = valueInterpolated; }\n"); + CORRADE_INTERNAL_ASSERT_OUTPUT(frag.compile()); + attachShader(frag); + + bindAttributeLocation(0, "value"); + + CORRADE_INTERNAL_ASSERT_OUTPUT(link()); +} +#endif + +Checker::Checker(AbstractShaderProgram&& shader, RenderbufferFormat format, Mesh& mesh): framebuffer({{}, Vector2i(1)}) { + renderbuffer.setStorage(format, Vector2i(1)); + framebuffer.attachRenderbuffer(Framebuffer::ColorAttachment(0), renderbuffer); + + framebuffer.bind(FramebufferTarget::ReadDraw); + shader.use(); + mesh.setVertexCount(2) + .setPrimitive(MeshPrimitive::Points); + + /* Skip first vertex so we test also offsets */ + MeshView(mesh).setVertexRange(1, 1).draw(); +} + +template T Checker::get(ColorFormat format, ColorType type) { + Image2D image(format, type); + framebuffer.read({}, Vector2i(1), image); + return image.data()[0]; +} +#endif + +#ifndef MAGNUM_TARGET_GLES2 +void MeshGLTest::addVertexBufferUnsignedInt() { + #ifndef MAGNUM_TARGET_GLES + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::EXT::gpu_shader4::string() + std::string(" is not available.")); + #endif + + typedef AbstractShaderProgram::Attribute<0, UnsignedInt> Attribute; + + constexpr UnsignedInt data[] = { 0, 157, 35681 }; + Buffer buffer; + buffer.setData(data, BufferUsage::StaticDraw); + + Mesh mesh; + mesh.addVertexBuffer(buffer, 4, Attribute()); + + MAGNUM_VERIFY_NO_ERROR(); + + const auto value = Checker(IntegerShader("uint"), RenderbufferFormat::R32UI, mesh) + .get(ColorFormat::RedInteger, ColorType::UnsignedInt); + + MAGNUM_VERIFY_NO_ERROR(); + CORRADE_COMPARE(value, 35681); +} + +void MeshGLTest::addVertexBufferInt() { + #ifndef MAGNUM_TARGET_GLES + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::EXT::gpu_shader4::string() + std::string(" is not available.")); + #endif + + typedef AbstractShaderProgram::Attribute<0, Int> Attribute; + + constexpr Int data[] = { 0, 457931, 27530 }; + Buffer buffer; + buffer.setData(data, BufferUsage::StaticDraw); + + Mesh mesh; + mesh.addVertexBuffer(buffer, 4, Attribute()); + + MAGNUM_VERIFY_NO_ERROR(); + + const auto value = Checker(IntegerShader("int"), RenderbufferFormat::R32I, mesh) + .get(ColorFormat::RedInteger, ColorType::Int); + + MAGNUM_VERIFY_NO_ERROR(); + CORRADE_COMPARE(value, 27530); +} +#endif + +void MeshGLTest::addVertexBufferFloat() { + typedef AbstractShaderProgram::Attribute<0, Float> Attribute; + + const Float data[] = { 0.0f, -0.7f, Math::normalize(96) }; + Buffer buffer; + buffer.setData(data, BufferUsage::StaticDraw); + + Mesh mesh; + mesh.addVertexBuffer(buffer, 4, Attribute()); + + MAGNUM_VERIFY_NO_ERROR(); + + const auto value = Checker(FloatShader("float", "vec4(valueInterpolated, 0.0, 0.0, 0.0)"), + #ifndef MAGNUM_TARGET_GLES2 + RenderbufferFormat::RGBA8, + #else + RenderbufferFormat::RGBA4, + #endif + mesh).get(ColorFormat::RGBA, ColorType::UnsignedByte); + + MAGNUM_VERIFY_NO_ERROR(); + CORRADE_COMPARE(value, 96); +} + +#ifndef MAGNUM_TARGET_GLES +void MeshGLTest::addVertexBufferDouble() { + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::ARB::vertex_attrib_64bit::string() + std::string(" is not available.")); + + typedef AbstractShaderProgram::Attribute<0, Double> Attribute; + + const Double data[] = { 0.0, -0.7, Math::normalize(45828) }; + Buffer buffer; + buffer.setData(data, BufferUsage::StaticDraw); + + Mesh mesh; + mesh.addVertexBuffer(buffer, 8, Attribute()); + + MAGNUM_VERIFY_NO_ERROR(); + + const auto value = Checker(DoubleShader("double", "float", "vec4(value, 0.0, 0.0, 0.0)"), + RenderbufferFormat::R16, mesh).get(ColorFormat::Red, ColorType::UnsignedShort); + + MAGNUM_VERIFY_NO_ERROR(); + CORRADE_COMPARE(value, 45828); +} +#endif + +#ifndef MAGNUM_TARGET_GLES2 +void MeshGLTest::addVertexBufferVectorNui() { + #ifndef MAGNUM_TARGET_GLES + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::EXT::gpu_shader4::string() + std::string(" is not available.")); + #endif + + typedef AbstractShaderProgram::Attribute<0, Vector3ui> Attribute; + + constexpr Vector3ui data[] = { {}, {37448, 547686, 156}, {27592, 157, 25} }; + Buffer buffer; + buffer.setData(data, BufferUsage::StaticDraw); + + Mesh mesh; + mesh.addVertexBuffer(buffer, 3*4, Attribute()); + + MAGNUM_VERIFY_NO_ERROR(); + + const auto value = Checker(IntegerShader("uvec3"), RenderbufferFormat::RGBA32UI, mesh) + .get(ColorFormat::RGBAInteger, ColorType::UnsignedInt); + + MAGNUM_VERIFY_NO_ERROR(); + CORRADE_COMPARE(value, Vector3ui(27592, 157, 25)); +} + +void MeshGLTest::addVertexBufferVectorNi() { + #ifndef MAGNUM_TARGET_GLES + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::EXT::gpu_shader4::string() + std::string(" is not available.")); + #endif + + typedef AbstractShaderProgram::Attribute<0, Vector2i> Attribute; + + constexpr Vector2i data[] = { {}, {-37448, 547686}, {27592, -157} }; + Buffer buffer; + buffer.setData(data, BufferUsage::StaticDraw); + + Mesh mesh; + mesh.addVertexBuffer(buffer, 2*4, Attribute()); + + MAGNUM_VERIFY_NO_ERROR(); + + const auto value = Checker(IntegerShader("ivec2"), RenderbufferFormat::RG32I, mesh) + .get(ColorFormat::RGInteger, ColorType::Int); + + MAGNUM_VERIFY_NO_ERROR(); + CORRADE_COMPARE(value, Vector2i(27592, -157)); +} +#endif + +void MeshGLTest::addVertexBufferVectorN() { + typedef AbstractShaderProgram::Attribute<0, Vector3> Attribute; + + const Vector3 data[] = { {}, {0.0f, -0.9f, 1.0f}, Math::normalize(Color3ub(96, 24, 156)) }; + Buffer buffer; + buffer.setData(data, BufferUsage::StaticDraw); + + Mesh mesh; + mesh.addVertexBuffer(buffer, 3*4, Attribute()); + + MAGNUM_VERIFY_NO_ERROR(); + + const auto value = Checker(FloatShader("vec3", "vec4(valueInterpolated, 0.0)"), + #ifndef MAGNUM_TARGET_GLES2 + RenderbufferFormat::RGBA8, + #else + RenderbufferFormat::RGBA4, + #endif + mesh).get(ColorFormat::RGBA, ColorType::UnsignedByte); + + MAGNUM_VERIFY_NO_ERROR(); + CORRADE_COMPARE(value, Color3ub(96, 24, 156)); +} + +#ifndef MAGNUM_TARGET_GLES +void MeshGLTest::addVertexBufferVectorNd() { + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::ARB::vertex_attrib_64bit::string() + std::string(" is not available.")); + + typedef AbstractShaderProgram::Attribute<0, Vector4d> Attribute; + + const Vector4d data[] = { + {}, {0.0, -0.9, 1.0, 1.25}, + Math::normalize(Math::Vector4(315, 65201, 2576, 12)) + }; + Buffer buffer; + buffer.setData(data, BufferUsage::StaticDraw); + + Mesh mesh; + mesh.addVertexBuffer(buffer, 4*8, Attribute()); + + MAGNUM_VERIFY_NO_ERROR(); + + const auto value = Checker(DoubleShader("dvec4", "vec4", "vec4(value)"), + RenderbufferFormat::RGBA16, mesh).get>(ColorFormat::RGBA, ColorType::UnsignedShort); + + MAGNUM_VERIFY_NO_ERROR(); + CORRADE_COMPARE(value, Math::Vector4(315, 65201, 2576, 12)); +} +#endif + +void MeshGLTest::addVertexBufferMatrixNxN() { + typedef AbstractShaderProgram::Attribute<0, Matrix3x3> Attribute; + + const Matrix3x3 data[] = { + {}, + Matrix3x3::fromDiagonal({0.0f, -0.9f, 1.0f}), + Matrix3x3::fromDiagonal(Math::normalize(Color3ub(96, 24, 156))) + }; + Buffer buffer; + buffer.setData(data, BufferUsage::StaticDraw); + + Mesh mesh; + mesh.addVertexBuffer(buffer, 3*3*4, Attribute()); + + MAGNUM_VERIFY_NO_ERROR(); + + const auto value = Checker(FloatShader("mat3", + "vec4(valueInterpolated[0][0], valueInterpolated[1][1], valueInterpolated[2][2], 0.0)"), + RenderbufferFormat::RGBA8, mesh).get(ColorFormat::RGBA, ColorType::UnsignedByte); + + MAGNUM_VERIFY_NO_ERROR(); + CORRADE_COMPARE(value, Color3ub(96, 24, 156)); +} + +#ifndef MAGNUM_TARGET_GLES +void MeshGLTest::addVertexBufferMatrixNxNd() { + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::ARB::vertex_attrib_64bit::string() + std::string(" is not available.")); + + typedef AbstractShaderProgram::Attribute<0, Matrix3x3d> Attribute; + + const Matrix3x3d data[] = { + {}, + Matrix3x3d::fromDiagonal({0.0, -0.9, 1.0}), + Matrix3x3d::fromDiagonal(Math::normalize(Math::Vector3(315, 65201, 2576))) + }; + Buffer buffer; + buffer.setData(data, BufferUsage::StaticDraw); + + Mesh mesh; + mesh.addVertexBuffer(buffer, 3*3*8, Attribute()); + + MAGNUM_VERIFY_NO_ERROR(); + + const auto value = Checker(DoubleShader("dmat3", "vec4", + "vec4(value[0][0], value[1][1], value[2][2], 0.0)"), + RenderbufferFormat::RGBA16, mesh).get>(ColorFormat::RGB, ColorType::UnsignedShort); + + MAGNUM_VERIFY_NO_ERROR(); + CORRADE_COMPARE(value, Math::Vector3(315, 65201, 2576)); +} +#endif + +#ifndef MAGNUM_TARGET_GLES2 +void MeshGLTest::addVertexBufferMatrixMxN() { + typedef AbstractShaderProgram::Attribute<0, Matrix3x4> Attribute; + + const Matrix3x4 data[] = { + {}, + Matrix3x4::fromDiagonal({0.0f, -0.9f, 1.0f}), + Matrix3x4::fromDiagonal(Math::normalize(Color3ub(96, 24, 156))) + }; + Buffer buffer; + buffer.setData(data, BufferUsage::StaticDraw); + + Mesh mesh; + mesh.addVertexBuffer(buffer, 3*4*4, Attribute()); + + MAGNUM_VERIFY_NO_ERROR(); + + const auto value = Checker(FloatShader("mat3x4", + "vec4(valueInterpolated[0][0], valueInterpolated[1][1], valueInterpolated[2][2], 0.0)"), + RenderbufferFormat::RGBA8, mesh).get(ColorFormat::RGBA, ColorType::UnsignedByte); + + MAGNUM_VERIFY_NO_ERROR(); + CORRADE_COMPARE(value, Color3ub(96, 24, 156)); +} +#endif + +#ifndef MAGNUM_TARGET_GLES +void MeshGLTest::addVertexBufferMatrixMxNd() { + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::ARB::vertex_attrib_64bit::string() + std::string(" is not available.")); + + typedef AbstractShaderProgram::Attribute<0, Matrix3x4d> Attribute; + + const Matrix3x4d data[] = { + {}, + Matrix3x4d::fromDiagonal({0.0f, -0.9f, 1.0f}), + Matrix3x4d::fromDiagonal(Math::normalize(Math::Vector3(315, 65201, 2576))) + }; + Buffer buffer; + buffer.setData(data, BufferUsage::StaticDraw); + + Mesh mesh; + mesh.addVertexBuffer(buffer, 3*4*8, Attribute()); + + MAGNUM_VERIFY_NO_ERROR(); + + const auto value = Checker(DoubleShader("dmat3x4", "vec4", + "vec4(value[0][0], value[1][1], value[2][2], 0.0)"), + RenderbufferFormat::RGBA16, mesh).get>(ColorFormat::RGB, ColorType::UnsignedShort); + + MAGNUM_VERIFY_NO_ERROR(); + CORRADE_COMPARE(value, Math::Vector3(315, 65201, 2576)); +} +#endif + +#ifndef MAGNUM_TARGET_GLES2 +void MeshGLTest::addVertexBufferUnsignedIntWithUnsignedShort() { + #ifndef MAGNUM_TARGET_GLES + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::EXT::gpu_shader4::string() + std::string(" is not available.")); + #endif + + typedef AbstractShaderProgram::Attribute<0, UnsignedInt> Attribute; + + constexpr UnsignedShort data[] = { 0, 49563, 16583 }; + Buffer buffer; + buffer.setData(data, BufferUsage::StaticDraw); + + Mesh mesh; + mesh.addVertexBuffer(buffer, 2, Attribute(Attribute::DataType::UnsignedShort)); + + MAGNUM_VERIFY_NO_ERROR(); + + const auto value = Checker(IntegerShader("uint"), RenderbufferFormat::R16UI, mesh) + .get(ColorFormat::RedInteger, ColorType::UnsignedShort); + + MAGNUM_VERIFY_NO_ERROR(); + CORRADE_COMPARE(value, 16583); +} + +void MeshGLTest::addVertexBufferUnsignedIntWithShort() { + #ifndef MAGNUM_TARGET_GLES + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::EXT::gpu_shader4::string() + std::string(" is not available.")); + #endif + + typedef AbstractShaderProgram::Attribute<0, UnsignedInt> Attribute; + + constexpr Short data[] = { 0, 24563, 16583 }; + Buffer buffer; + buffer.setData(data, BufferUsage::StaticDraw); + + Mesh mesh; + mesh.addVertexBuffer(buffer, 2, Attribute(Attribute::DataType::Short)); + + MAGNUM_VERIFY_NO_ERROR(); + + const auto value = Checker(IntegerShader("uint"), RenderbufferFormat::R16I, mesh) + .get(ColorFormat::RedInteger, ColorType::Short); + + MAGNUM_VERIFY_NO_ERROR(); + CORRADE_COMPARE(value, 16583); +} + +void MeshGLTest::addVertexBufferIntWithUnsignedShort() { + #ifndef MAGNUM_TARGET_GLES + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::EXT::gpu_shader4::string() + std::string(" is not available.")); + #endif + + typedef AbstractShaderProgram::Attribute<0, Int> Attribute; + + constexpr UnsignedShort data[] = { 0, 49563, 16583 }; + Buffer buffer; + buffer.setData(data, BufferUsage::StaticDraw); + + Mesh mesh; + mesh.addVertexBuffer(buffer, 2, Attribute(Attribute::DataType::UnsignedShort)); + + MAGNUM_VERIFY_NO_ERROR(); + + const auto value = Checker(IntegerShader("int"), RenderbufferFormat::R16UI, mesh) + .get(ColorFormat::RedInteger, ColorType::UnsignedShort); + + MAGNUM_VERIFY_NO_ERROR(); + CORRADE_COMPARE(value, 16583); +} + +void MeshGLTest::addVertexBufferIntWithShort() { + #ifndef MAGNUM_TARGET_GLES + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::EXT::gpu_shader4::string() + std::string(" is not available.")); + #endif + + typedef AbstractShaderProgram::Attribute<0, Int> Attribute; + + constexpr Short data[] = { 0, 24563, -16583 }; + Buffer buffer; + buffer.setData(data, BufferUsage::StaticDraw); + + Mesh mesh; + mesh.addVertexBuffer(buffer, 2, Attribute(Attribute::DataType::Short)); + + MAGNUM_VERIFY_NO_ERROR(); + + const auto value = Checker(IntegerShader("int"), RenderbufferFormat::R16I, mesh) + .get(ColorFormat::RedInteger, ColorType::Short); + + MAGNUM_VERIFY_NO_ERROR(); + CORRADE_COMPARE(value, -16583); +} +#endif + +void MeshGLTest::addVertexBufferFloatWithHalfFloat() { + #ifndef MAGNUM_TARGET_GLES + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::NV::half_float::string() + std::string(" is not supported.")); + #elif defined(MAGNUM_TARGET_GLES2) + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::OES::vertex_half_float::string() + std::string(" is not supported.")); + #endif + + typedef AbstractShaderProgram::Attribute<0, Float> Attribute; + + Buffer buffer; + buffer.setData({nullptr, 6}, BufferUsage::StaticDraw); + + Mesh mesh; + mesh.addVertexBuffer(buffer, 2, Attribute(Attribute::DataType::HalfFloat)); + + MAGNUM_VERIFY_NO_ERROR(); + + /* Won't test the actual values */ +} + +#ifndef MAGNUM_TARGET_GLES +void MeshGLTest::addVertexBufferFloatWithDouble() { + typedef AbstractShaderProgram::Attribute<0, Float> Attribute; + + const Double data[] = { 0.0, -0.7, Math::normalize(186) }; + Buffer buffer; + buffer.setData(data, BufferUsage::StaticDraw); + + Mesh mesh; + mesh.addVertexBuffer(buffer, 8, Attribute(Attribute::DataType::Double)); + + MAGNUM_VERIFY_NO_ERROR(); + + const auto value = Checker(FloatShader("float", "vec4(valueInterpolated, 0.0, 0.0, 0.0)"), + RenderbufferFormat::RGBA8, mesh).get(ColorFormat::RGBA, ColorType::UnsignedShort); + + MAGNUM_VERIFY_NO_ERROR(); + CORRADE_COMPARE(value, 186); +} +#endif + +#ifndef MAGNUM_TARGET_GLES2 +void MeshGLTest::addVertexBufferVector4WithUnsignedInt2101010Rev() { + #ifndef MAGNUM_TARGET_GLES + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::ARB::vertex_type_2_10_10_10_rev::string() + std::string(" is not available.")); + #endif + + typedef AbstractShaderProgram::Attribute<0, Vector4> Attribute; + + Buffer buffer; + buffer.setData({nullptr, 12}, BufferUsage::StaticDraw); + + Mesh mesh; + mesh.addVertexBuffer(buffer, 4, Attribute(Attribute::DataType::UnsignedInt2101010Rev)); + + MAGNUM_VERIFY_NO_ERROR(); + /* Won't test the actual values */ +} + +void MeshGLTest::addVertexBufferVector4WithInt2101010Rev() { + #ifndef MAGNUM_TARGET_GLES + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::ARB::vertex_type_2_10_10_10_rev::string() + std::string(" is not available.")); + #endif + + typedef AbstractShaderProgram::Attribute<0, Vector4> Attribute; + + Buffer buffer; + buffer.setData({nullptr, 12}, BufferUsage::StaticDraw); + + Mesh mesh; + mesh.addVertexBuffer(buffer, 4, Attribute(Attribute::DataType::Int2101010Rev)); + + MAGNUM_VERIFY_NO_ERROR(); + /* Won't test the actual values */ +} +#endif + +void MeshGLTest::addVertexBufferLessVectorComponents() { + typedef AbstractShaderProgram::Attribute<0, Vector4> Attribute; + + const Vector3 data[] = { + {}, {0.0f, -0.9f, 1.0f}, + Math::normalize(Color3ub(96, 24, 156)) + }; + Buffer buffer; + buffer.setData(data, BufferUsage::StaticDraw); + + Mesh mesh; + mesh.addVertexBuffer(buffer, 3*4, Attribute(Attribute::Components::Three)); + + MAGNUM_VERIFY_NO_ERROR(); + + const auto value = Checker(FloatShader("vec4", "valueInterpolated"), + #ifndef MAGNUM_TARGET_GLES2 + RenderbufferFormat::RGBA8, + #else + RenderbufferFormat::RGBA4, + #endif + mesh).get(ColorFormat::RGBA, ColorType::UnsignedByte); + + MAGNUM_VERIFY_NO_ERROR(); + CORRADE_COMPARE(value, Color4ub(96, 24, 156, 255)); +} + +void MeshGLTest::addVertexBufferNormalized() { + typedef AbstractShaderProgram::Attribute<0, Vector3> Attribute; + + constexpr Color3ub data[] = { {}, {0, 128, 64}, {32, 156, 228} }; + Buffer buffer; + buffer.setData(data, BufferUsage::StaticDraw); + + Mesh mesh; + mesh.addVertexBuffer(buffer, 3, Attribute(Attribute::DataType::UnsignedByte, Attribute::DataOption::Normalized)); + + MAGNUM_VERIFY_NO_ERROR(); + + const auto value = Checker(FloatShader("vec3", "vec4(valueInterpolated, 0.0)"), + #ifndef MAGNUM_TARGET_GLES2 + RenderbufferFormat::RGBA8, + #else + RenderbufferFormat::RGBA4, + #endif + mesh).get(ColorFormat::RGBA, ColorType::UnsignedByte); + + MAGNUM_VERIFY_NO_ERROR(); + CORRADE_COMPARE(value, Color3ub(32, 156, 228)); +} + +#ifndef MAGNUM_TARGET_GLES +void MeshGLTest::addVertexBufferBGRA() { + #ifndef MAGNUM_TARGET_GLES + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::ARB::vertex_array_bgra::string() + std::string(" is not available.")); + #endif + + typedef AbstractShaderProgram::Attribute<0, Vector4> Attribute; + + constexpr Color4ub data[] = { {}, {0, 128, 64, 161}, {96, 24, 156, 225} }; + Buffer buffer; + buffer.setData(data, BufferUsage::StaticDraw); + + Mesh mesh; + mesh.addVertexBuffer(buffer, 4, Attribute(Attribute::Components::BGRA, Attribute::DataType::UnsignedByte, Attribute::DataOption::Normalized)); + + MAGNUM_VERIFY_NO_ERROR(); + + const auto value = Checker(FloatShader("vec4", "valueInterpolated"), + #ifndef MAGNUM_TARGET_GLES2 + RenderbufferFormat::RGBA8, + #else + RenderbufferFormat::RGBA4, + #endif + mesh).get(ColorFormat::RGBA, ColorType::UnsignedByte); + + MAGNUM_VERIFY_NO_ERROR(); + CORRADE_COMPARE(value, Color4ub(156, 24, 96, 225)); +} +#endif + +namespace { + struct MultipleShader: AbstractShaderProgram { + typedef Attribute<0, Vector3> Position; + typedef Attribute<1, Vector3> Normal; + typedef Attribute<2, Vector2> TextureCoordinates; + + explicit MultipleShader(); + }; +} + +#ifndef DOXYGEN_GENERATING_OUTPUT +MultipleShader::MultipleShader() { + #ifndef MAGNUM_TARGET_GLES + Shader vert(Version::GL210, Shader::Type::Vertex); + #else + Shader vert(Version::GLES200, Shader::Type::Vertex); + #endif + + vert.addSource("attribute mediump vec4 position;\n" + "attribute mediump vec3 normal;\n" + "attribute mediump vec2 textureCoordinates;\n" + "varying mediump vec4 valueInterpolated;\n" + "void main() {\n" + " valueInterpolated = position + vec4(normal, 0.0) + vec4(textureCoordinates, 0.0, 0.0);\n" + " gl_Position = vec4(0.0, 0.0, 0.0, 1.0);\n" + "}\n"); + CORRADE_INTERNAL_ASSERT_OUTPUT(vert.compile()); + attachShader(vert); + + #ifndef MAGNUM_TARGET_GLES + Shader frag(Version::GL210, Shader::Type::Fragment); + #else + Shader frag(Version::GLES200, Shader::Type::Fragment); + #endif + + frag.addSource("varying mediump vec4 valueInterpolated;\n" + "void main() { gl_FragColor = valueInterpolated; }\n"); + CORRADE_INTERNAL_ASSERT_OUTPUT(frag.compile()); + attachShader(frag); + + bindAttributeLocation(Position::Location, "position"); + bindAttributeLocation(Normal::Location, "normal"); + bindAttributeLocation(TextureCoordinates::Location, "textureCoordinates"); + + CORRADE_INTERNAL_ASSERT_OUTPUT(link()); +} +#endif + +void MeshGLTest::addVertexBufferMultiple() { + const Float data[] = { + 0.0f, /* Offset */ + + /* First attribute */ + 0.3f, 0.1f, 0.5f, + 0.4f, 0.0f, -0.9f, + 1.0f, -0.5f, + + /* Second attribute */ + Math::normalize(64), + Math::normalize(17), + Math::normalize(56), + Math::normalize(15), + Math::normalize(164), + Math::normalize(17), + Math::normalize(97), + Math::normalize(28) + }; + + Buffer buffer; + buffer.setData(data, BufferUsage::StaticDraw); + + Mesh mesh; + mesh.addVertexBuffer(buffer, 1*4, MultipleShader::Position(), + MultipleShader::Normal(), MultipleShader::TextureCoordinates()); + + MAGNUM_VERIFY_NO_ERROR(); + + const auto value = Checker(MultipleShader(), + #ifndef MAGNUM_TARGET_GLES2 + RenderbufferFormat::RGBA8, + #else + RenderbufferFormat::RGBA4, + #endif + mesh).get(ColorFormat::RGBA, ColorType::UnsignedByte); + + MAGNUM_VERIFY_NO_ERROR(); + CORRADE_COMPARE(value, Color4ub(64 + 15 + 97, 17 + 164 + 28, 56 + 17, 255)); +} + +void MeshGLTest::addVertexBufferMultipleGaps() { + const Float data[] = { + 0.0f, 0.0f, 0.0f, 0.0f, /* Offset */ + + /* First attribute */ + 0.3f, 0.1f, 0.5f, 0.0f, + 0.4f, 0.0f, -0.9f, 0.0f, + 1.0f, -0.5f, 0.0f, 0.0f, + + /* Second attribute */ + Math::normalize(64), + Math::normalize(17), + Math::normalize(56), 0.0f, + Math::normalize(15), + Math::normalize(164), + Math::normalize(17), 0.0f, + Math::normalize(97), + Math::normalize(28), 0.0f, 0.0f + }; + Buffer buffer; + buffer.setData(data, BufferUsage::StaticDraw); + + Mesh mesh; + mesh.addVertexBuffer(buffer, 4*4, + MultipleShader::Position(), 1*4, + MultipleShader::Normal(), 1*4, + MultipleShader::TextureCoordinates(), 2*4); + + MAGNUM_VERIFY_NO_ERROR(); + + const auto value = Checker(MultipleShader(), + #ifndef MAGNUM_TARGET_GLES2 + RenderbufferFormat::RGBA8, + #else + RenderbufferFormat::RGBA4, + #endif + mesh).get(ColorFormat::RGBA, ColorType::UnsignedByte); + + MAGNUM_VERIFY_NO_ERROR(); + CORRADE_COMPARE(value, Color4ub(64 + 15 + 97, 17 + 164 + 28, 56 + 17, 255)); +} + +namespace { + struct IndexChecker { + explicit IndexChecker(Mesh& mesh); + Color4ub get(); + + Renderbuffer renderbuffer; + Framebuffer framebuffer; + }; + + const Float indexedVertexData[] = { + 0.0f, /* Offset */ + + /* First attribute */ + Math::normalize(64), + Math::normalize(17), + Math::normalize(56), + Math::normalize(15), + Math::normalize(164), + Math::normalize(17), + Math::normalize(97), + Math::normalize(28), + + /* Second attribute */ + 0.3f, 0.1f, 0.5f, + 0.4f, 0.0f, -0.9f, + 1.0f, -0.5f + }; + + constexpr Color4ub indexedResult(64 + 15 + 97, 17 + 164 + 28, 56 + 17, 255); +} + +#ifndef DOXYGEN_GENERATING_OUTPUT +IndexChecker::IndexChecker(Mesh& mesh): framebuffer({{}, Vector2i(1)}) { + #ifndef MAGNUM_TARGET_GLES2 + renderbuffer.setStorage(RenderbufferFormat::RGBA8, Vector2i(1)); + #else + renderbuffer.setStorage(RenderbufferFormat::RGBA4, Vector2i(1)); + #endif + framebuffer.attachRenderbuffer(Framebuffer::ColorAttachment(0), renderbuffer); + + framebuffer.bind(FramebufferTarget::ReadDraw); + MultipleShader shader; + shader.use(); + mesh.setIndexCount(2) + .setPrimitive(MeshPrimitive::Points); + + /* Skip first vertex so we test also offsets */ + MeshView(mesh).setIndexRange(1, 1).draw(); +} + +Color4ub IndexChecker::get() { + Image2D image(ColorFormat::RGBA, ColorType::UnsignedByte); + framebuffer.read({}, Vector2i(1), image); + return image.data()[0]; +} +#endif + +void MeshGLTest::setIndexBuffer() { + Buffer vertices; + vertices.setData(indexedVertexData, BufferUsage::StaticDraw); + + constexpr UnsignedShort indexData[] = { 2, 1, 0 }; + Buffer indices(Buffer::Target::ElementArray); + indices.setData(indexData, BufferUsage::StaticDraw); + + Mesh mesh; + mesh.addVertexBuffer(vertices, 1*4, MultipleShader::Position(), + MultipleShader::Normal(), MultipleShader::TextureCoordinates()) + .setIndexBuffer(indices, 2, Mesh::IndexType::UnsignedShort); + + MAGNUM_VERIFY_NO_ERROR(); + + const auto value = IndexChecker(mesh).get(); + + MAGNUM_VERIFY_NO_ERROR(); + CORRADE_COMPARE(value, indexedResult); +} + +void MeshGLTest::setIndexBufferRange() { + Buffer vertices; + vertices.setData(indexedVertexData, BufferUsage::StaticDraw); + + constexpr UnsignedShort indexData[] = { 2, 1, 0 }; + Buffer indices(Buffer::Target::ElementArray); + indices.setData(indexData, BufferUsage::StaticDraw); + + Mesh mesh; + mesh.addVertexBuffer(vertices, 1*4, MultipleShader::Position(), + MultipleShader::Normal(), MultipleShader::TextureCoordinates()) + .setIndexBuffer(indices, 2, Mesh::IndexType::UnsignedShort, 0, 1); + + MAGNUM_VERIFY_NO_ERROR(); + + const auto value = IndexChecker(mesh).get(); + + MAGNUM_VERIFY_NO_ERROR(); + CORRADE_COMPARE(value, indexedResult); +} + +void MeshGLTest::setIndexBufferUnsignedInt() { + #ifdef MAGNUM_TARGET_GLES2 + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::OES::element_index_uint::string() + std::string(" is not available.")); + #endif + + Buffer vertices; + vertices.setData(indexedVertexData, BufferUsage::StaticDraw); + + constexpr UnsignedInt indexData[] = { 2, 1, 0 }; + Buffer indices(Buffer::Target::ElementArray); + indices.setData(indexData, BufferUsage::StaticDraw); + + Mesh mesh; + mesh.addVertexBuffer(vertices, 1*4, MultipleShader::Position(), + MultipleShader::Normal(), MultipleShader::TextureCoordinates()) + .setIndexBuffer(indices, 4, Mesh::IndexType::UnsignedInt); + + MAGNUM_VERIFY_NO_ERROR(); + + const auto value = IndexChecker(mesh).get(); + + MAGNUM_VERIFY_NO_ERROR(); + CORRADE_COMPARE(value, indexedResult); +} + +}} + +CORRADE_TEST_MAIN(Magnum::Test::MeshGLTest) diff --git a/src/Test/MeshTest.cpp b/src/Magnum/Test/MeshTest.cpp similarity index 84% rename from src/Test/MeshTest.cpp rename to src/Magnum/Test/MeshTest.cpp index d4e833cb8..781523a3c 100644 --- a/src/Test/MeshTest.cpp +++ b/src/Magnum/Test/MeshTest.cpp @@ -23,10 +23,10 @@ */ #include -#include -#include +#include +#include -#include "Mesh.h" +#include "Magnum/Mesh.h" namespace Magnum { namespace Test { @@ -34,6 +34,8 @@ class MeshTest: public TestSuite::Tester { public: MeshTest(); + void indexSize(); + void debugPrimitive(); void debugIndexType(); void configurationPrimitive(); @@ -41,12 +43,20 @@ class MeshTest: public TestSuite::Tester { }; MeshTest::MeshTest() { - addTests({&MeshTest::debugPrimitive, + addTests({&MeshTest::indexSize, + + &MeshTest::debugPrimitive, &MeshTest::debugIndexType, &MeshTest::configurationPrimitive, &MeshTest::configurationIndexType}); } +void MeshTest::indexSize() { + CORRADE_COMPARE(Mesh::indexSize(Mesh::IndexType::UnsignedByte), 1); + CORRADE_COMPARE(Mesh::indexSize(Mesh::IndexType::UnsignedShort), 2); + CORRADE_COMPARE(Mesh::indexSize(Mesh::IndexType::UnsignedInt), 4); +} + void MeshTest::debugPrimitive() { std::ostringstream o; Debug(&o) << MeshPrimitive::TriangleFan; diff --git a/src/Magnum/Test/PrimitiveQueryGLTest.cpp b/src/Magnum/Test/PrimitiveQueryGLTest.cpp new file mode 100644 index 000000000..840170d0e --- /dev/null +++ b/src/Magnum/Test/PrimitiveQueryGLTest.cpp @@ -0,0 +1,118 @@ +/* + This file is part of Magnum. + + Copyright © 2010, 2011, 2012, 2013 Vladimír Vondruš + + 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 +#include + +#include "Magnum/AbstractShaderProgram.h" +#include "Magnum/Buffer.h" +#include "Magnum/Framebuffer.h" +#include "Magnum/Mesh.h" +#include "Magnum/Query.h" +#include "Magnum/Renderbuffer.h" +#include "Magnum/RenderbufferFormat.h" +#include "Magnum/Shader.h" +#include "Magnum/Test/AbstractOpenGLTester.h" + +namespace Magnum { namespace Test { + +class PrimitiveQueryGLTest: public AbstractOpenGLTester { + public: + explicit PrimitiveQueryGLTest(); + + void query(); +}; + +PrimitiveQueryGLTest::PrimitiveQueryGLTest() { + addTests({&PrimitiveQueryGLTest::query}); +} + +void PrimitiveQueryGLTest::query() { + #ifndef MAGNUM_TARGET_GLES + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::EXT::transform_feedback::string() + std::string(" is not available.")); + #endif + + #ifndef MAGNUM_TARGET_GLES + class MyShader: public AbstractShaderProgram { + public: + typedef Attribute<0, Vector2> Position; + + explicit MyShader() { + Utility::Resource rs("QueryGLTest"); + Shader vert(Version::GL210, Shader::Type::Vertex); + vert.addSource(rs.get("MyShader.vert")); + CORRADE_INTERNAL_ASSERT_OUTPUT(vert.compile()); + attachShader(vert); + + Shader frag(Version::GL210, Shader::Type::Fragment); + frag.addSource(rs.get("MyShader.frag")); + CORRADE_INTERNAL_ASSERT_OUTPUT(frag.compile()); + attachShader(frag); + + CORRADE_INTERNAL_ASSERT_OUTPUT(link()); + } + } shader; + + Renderbuffer renderbuffer; + renderbuffer.setStorage(RenderbufferFormat::RGBA8, Vector2i(32)); + + Framebuffer framebuffer({{}, Vector2i(32)}); + framebuffer.attachRenderbuffer(Framebuffer::ColorAttachment(0), renderbuffer); + + constexpr Vector2 data[9]; + Buffer vertices; + vertices.setData(data, BufferUsage::StaticDraw); + + Mesh mesh; + mesh.setPrimitive(MeshPrimitive::Triangles) + .setVertexCount(9) + .addVertexBuffer(vertices, 0, MyShader::Position()); + + MAGNUM_VERIFY_NO_ERROR(); + + PrimitiveQuery q; + q.begin(PrimitiveQuery::Target::PrimitivesGenerated); + + framebuffer.bind(FramebufferTarget::ReadDraw); + shader.use(); + mesh.draw(); + + q.end(); + const bool availableBefore = q.resultAvailable(); + const UnsignedInt count = q.result(); + const bool availableAfter = q.resultAvailable(); + + MAGNUM_VERIFY_NO_ERROR(); + CORRADE_VERIFY(!availableBefore); + CORRADE_VERIFY(availableAfter); + CORRADE_COMPARE(count, 3); + #else + CORRADE_SKIP("Not implemented in OpenGL ES 3.0 yet."); + #endif +} + +}} + +CORRADE_TEST_MAIN(Magnum::Test::PrimitiveQueryGLTest) diff --git a/src/Magnum/Test/QueryGLTestFiles/MyShader.frag b/src/Magnum/Test/QueryGLTestFiles/MyShader.frag new file mode 100644 index 000000000..18cf87582 --- /dev/null +++ b/src/Magnum/Test/QueryGLTestFiles/MyShader.frag @@ -0,0 +1,3 @@ +void main() { + gl_FragColor = vec4(1.0, 1.0, 1.0, 1.0); +} diff --git a/src/Magnum/Test/QueryGLTestFiles/MyShader.vert b/src/Magnum/Test/QueryGLTestFiles/MyShader.vert new file mode 100644 index 000000000..0fd808f4b --- /dev/null +++ b/src/Magnum/Test/QueryGLTestFiles/MyShader.vert @@ -0,0 +1,5 @@ +attribute lowp vec4 position; + +void main() { + gl_Position = position; +} diff --git a/src/Magnum/Test/QueryGLTestFiles/resources.conf b/src/Magnum/Test/QueryGLTestFiles/resources.conf new file mode 100644 index 000000000..daf955dd7 --- /dev/null +++ b/src/Magnum/Test/QueryGLTestFiles/resources.conf @@ -0,0 +1,7 @@ +group=QueryGLTest + +[file] +filename=MyShader.vert + +[file] +filename=MyShader.frag diff --git a/src/Test/RenderbufferGLTest.cpp b/src/Magnum/Test/RenderbufferGLTest.cpp similarity index 56% rename from src/Test/RenderbufferGLTest.cpp rename to src/Magnum/Test/RenderbufferGLTest.cpp index c9a72995f..44249cd20 100644 --- a/src/Test/RenderbufferGLTest.cpp +++ b/src/Magnum/Test/RenderbufferGLTest.cpp @@ -22,10 +22,12 @@ DEALINGS IN THE SOFTWARE. */ -#include "Context.h" -#include "Extensions.h" -#include "Renderbuffer.h" -#include "Test/AbstractOpenGLTester.h" +#include "Magnum/Math/Vector2.h" +#include "Magnum/Context.h" +#include "Magnum/Extensions.h" +#include "Magnum/Renderbuffer.h" +#include "Magnum/RenderbufferFormat.h" +#include "Magnum/Test/AbstractOpenGLTester.h" namespace Magnum { namespace Test { @@ -38,6 +40,9 @@ class RenderbufferGLTest: public AbstractOpenGLTester { void constructMove(); void label(); + + void setStorage(); + void setStorageMultisample(); }; RenderbufferGLTest::RenderbufferGLTest() { @@ -45,10 +50,18 @@ RenderbufferGLTest::RenderbufferGLTest() { &RenderbufferGLTest::constructCopy, &RenderbufferGLTest::constructMove, - &RenderbufferGLTest::label}); + &RenderbufferGLTest::label, + + &RenderbufferGLTest::setStorage, + &RenderbufferGLTest::setStorageMultisample}); } void RenderbufferGLTest::construct() { + #ifndef MAGNUM_TARGET_GLES + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::ARB::framebuffer_object::string() + std::string(" is not available.")); + #endif + { const Renderbuffer renderbuffer; @@ -72,6 +85,11 @@ void RenderbufferGLTest::constructCopy() { } void RenderbufferGLTest::constructMove() { + #ifndef MAGNUM_TARGET_GLES + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::ARB::framebuffer_object::string() + std::string(" is not available.")); + #endif + Renderbuffer a; const Int id = a.id(); @@ -94,6 +112,11 @@ void RenderbufferGLTest::constructMove() { } void RenderbufferGLTest::label() { + #ifndef MAGNUM_TARGET_GLES + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::ARB::framebuffer_object::string() + std::string(" is not available.")); + #endif + /* No-Op version is tested in AbstractObjectGLTest */ if(!Context::current()->isExtensionSupported() && !Context::current()->isExtensionSupported()) @@ -108,6 +131,44 @@ void RenderbufferGLTest::label() { MAGNUM_VERIFY_NO_ERROR(); } +void RenderbufferGLTest::setStorage() { + #ifndef MAGNUM_TARGET_GLES + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::ARB::framebuffer_object::string() + std::string(" is not available.")); + #endif + + Renderbuffer renderbuffer; + + #ifndef MAGNUM_TARGET_GLES2 + renderbuffer.setStorage(RenderbufferFormat::RGBA8, {128, 128}); + #else + renderbuffer.setStorage(RenderbufferFormat::RGBA4, {128, 128}); + #endif + + MAGNUM_VERIFY_NO_ERROR(); +} + +void RenderbufferGLTest::setStorageMultisample() { + #ifndef MAGNUM_TARGET_GLES + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::ARB::framebuffer_object::string() + std::string(" is not available.")); + #elif defined(MAGNUM_TARGET_GLES2) + if(!Context::current()->isExtensionSupported() && + !Context::current()->isExtensionSupported()) + CORRADE_SKIP("Required extension is not available."); + #endif + + Renderbuffer renderbuffer; + + #ifndef MAGNUM_TARGET_GLES2 + renderbuffer.setStorageMultisample(Renderbuffer::maxSamples(), RenderbufferFormat::RGBA8, {128, 128}); + #else + renderbuffer.setStorageMultisample(Renderbuffer::maxSamples(), RenderbufferFormat::RGBA4, {128, 128}); + #endif + + MAGNUM_VERIFY_NO_ERROR(); +} + }} CORRADE_TEST_MAIN(Magnum::Test::RenderbufferGLTest) diff --git a/src/Test/RendererTest.cpp b/src/Magnum/Test/RendererTest.cpp similarity index 97% rename from src/Test/RendererTest.cpp rename to src/Magnum/Test/RendererTest.cpp index 1a17e6cbf..57480d60a 100644 --- a/src/Test/RendererTest.cpp +++ b/src/Magnum/Test/RendererTest.cpp @@ -23,9 +23,9 @@ */ #include -#include +#include -#include "Renderer.h" +#include "Magnum/Renderer.h" namespace Magnum { namespace Test { diff --git a/src/Test/ResourceManagerTest.cpp b/src/Magnum/Test/ResourceManagerTest.cpp similarity index 98% rename from src/Test/ResourceManagerTest.cpp rename to src/Magnum/Test/ResourceManagerTest.cpp index e9bc0e8b0..a22e38828 100644 --- a/src/Test/ResourceManagerTest.cpp +++ b/src/Magnum/Test/ResourceManagerTest.cpp @@ -23,12 +23,11 @@ */ #include -#include +#include +#include -#include "AbstractResourceLoader.h" -#include "ResourceManager.h" - -#include "corradeCompatibility.h" +#include "Magnum/AbstractResourceLoader.h" +#include "Magnum/ResourceManager.h" namespace Magnum { namespace Test { diff --git a/src/Magnum/Test/SampleQueryGLTest.cpp b/src/Magnum/Test/SampleQueryGLTest.cpp new file mode 100644 index 000000000..93c2e064d --- /dev/null +++ b/src/Magnum/Test/SampleQueryGLTest.cpp @@ -0,0 +1,210 @@ +/* + This file is part of Magnum. + + Copyright © 2010, 2011, 2012, 2013 Vladimír Vondruš + + 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 +#include + +#include "Magnum/AbstractShaderProgram.h" +#include "Magnum/Buffer.h" +#include "Magnum/Framebuffer.h" +#include "Magnum/Mesh.h" +#include "Magnum/Query.h" +#include "Magnum/Renderbuffer.h" +#include "Magnum/RenderbufferFormat.h" +#include "Magnum/Shader.h" +#include "Magnum/Test/AbstractOpenGLTester.h" + +namespace Magnum { namespace Test { + +class SampleQueryGLTest: public AbstractOpenGLTester { + public: + explicit SampleQueryGLTest(); + + void querySamplesPassed(); + #ifndef MAGNUM_TARGET_GLES + void conditionalRender(); + #endif +}; + +SampleQueryGLTest::SampleQueryGLTest() { + addTests({ + &SampleQueryGLTest::querySamplesPassed, + #ifndef MAGNUM_TARGET_GLES + &SampleQueryGLTest::conditionalRender + #endif + }); +} + +namespace { + struct MyShader: public AbstractShaderProgram { + typedef Attribute<0, Vector2> Position; + + explicit MyShader(); + }; +} + +#ifndef DOXYGEN_GENERATING_OUTPUT +MyShader::MyShader() { + Utility::Resource rs("QueryGLTest"); + #ifndef MAGNUM_TARGET_GLES + Shader vert(Version::GL210, Shader::Type::Vertex); + #else + Shader vert(Version::GLES200, Shader::Type::Vertex); + #endif + vert.addSource(rs.get("MyShader.vert")); + CORRADE_INTERNAL_ASSERT_OUTPUT(vert.compile()); + attachShader(vert); + + #ifndef MAGNUM_TARGET_GLES + Shader frag(Version::GL210, Shader::Type::Fragment); + #else + Shader frag(Version::GLES200, Shader::Type::Fragment); + #endif + frag.addSource(rs.get("MyShader.frag")); + CORRADE_INTERNAL_ASSERT_OUTPUT(frag.compile()); + attachShader(frag); + + CORRADE_INTERNAL_ASSERT_OUTPUT(link()); +} +#endif + +void SampleQueryGLTest::querySamplesPassed() { + #ifdef MAGNUM_TARGET_GLES2 + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::EXT::occlusion_query_boolean::string() + std::string(" is not available.")); + #endif + + Renderbuffer renderbuffer; + #ifndef MAGNUM_TARGET_GLES2 + renderbuffer.setStorage(RenderbufferFormat::RGBA8, Vector2i(32)); + #else + renderbuffer.setStorage(RenderbufferFormat::RGBA4, Vector2i(32)); + #endif + + Framebuffer framebuffer({{}, Vector2i(32)}); + framebuffer.attachRenderbuffer(Framebuffer::ColorAttachment(0), renderbuffer); + + Buffer buffer; + constexpr Vector2 triangle[] = {{-1.0f, 1.0f}, {-1.0f, -3.0f}, {3.0f, 1.0f}}; + buffer.setData(triangle, BufferUsage::StaticDraw); + + Mesh mesh; + mesh.setPrimitive(MeshPrimitive::Triangles) + .setVertexCount(3) + .addVertexBuffer(buffer, 0, AbstractShaderProgram::Attribute<0, Vector2>()); + + MyShader shader; + + MAGNUM_VERIFY_NO_ERROR(); + + SampleQuery q; + #ifndef MAGNUM_TARGET_GLES + q.begin(SampleQuery::Target::SamplesPassed); + #else + q.begin(SampleQuery::Target::AnySamplesPassed); + #endif + + framebuffer.bind(FramebufferTarget::ReadDraw); + shader.use(); + mesh.draw(); + + q.end(); + const bool availableBefore = q.resultAvailable(); + const UnsignedInt count = q.result(); + const bool availableAfter = q.resultAvailable(); + + MAGNUM_VERIFY_NO_ERROR(); + CORRADE_VERIFY(!availableBefore); + CORRADE_VERIFY(availableAfter); + #ifndef MAGNUM_TARGET_GLES + CORRADE_COMPARE(count, 32*32); + #else + CORRADE_VERIFY(count > 0); + #endif +} + +#ifndef MAGNUM_TARGET_GLES +void SampleQueryGLTest::conditionalRender() { + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::NV::conditional_render::string() + std::string(" is not available.")); + + Renderbuffer renderbuffer; + renderbuffer.setStorage(RenderbufferFormat::RGBA8, Vector2i(32)); + + Framebuffer framebuffer({{}, Vector2i(32)}); + framebuffer.attachRenderbuffer(Framebuffer::ColorAttachment(0), renderbuffer); + + Buffer buffer; + constexpr Vector2 triangle[] = {{-1.0f, 1.0f}, {-1.0f, -3.0f}, {3.0f, 1.0f}}; + buffer.setData(triangle, BufferUsage::StaticDraw); + + Mesh mesh; + mesh.setPrimitive(MeshPrimitive::Triangles) + .setVertexCount(3) + .addVertexBuffer(buffer, 0, AbstractShaderProgram::Attribute<0, Vector2>()); + + MyShader shader; + framebuffer.bind(FramebufferTarget::ReadDraw); + shader.use(); + + MAGNUM_VERIFY_NO_ERROR(); + + SampleQuery qYes, qNo, q; + + /* This should generate some samples */ + qYes.begin(SampleQuery::Target::SamplesPassed); + mesh.draw(); + qYes.end(); + + /* Thus this should be rendered */ + qYes.beginConditionalRender(SampleQuery::ConditionalRenderMode::Wait); + q.begin(SampleQuery::Target::SamplesPassed); + mesh.draw(); + q.end(); + qYes.endConditionalRender(); + + MAGNUM_VERIFY_NO_ERROR(); + CORRADE_VERIFY(qYes.result()); + CORRADE_VERIFY(q.result()); + + /* This shouldn't generate any samples */ + qNo.begin(SampleQuery::Target::SamplesPassed); + qNo.end(); + + /* Thus this should not be rendered */ + qNo.beginConditionalRender(SampleQuery::ConditionalRenderMode::Wait); + q.begin(SampleQuery::Target::SamplesPassed); + mesh.draw(); + q.end(); + qNo.endConditionalRender(); + + MAGNUM_VERIFY_NO_ERROR(); + CORRADE_VERIFY(!qNo.result()); + CORRADE_VERIFY(!q.result()); +} +#endif + +}} + +CORRADE_TEST_MAIN(Magnum::Test::SampleQueryGLTest) diff --git a/src/Test/SamplerTest.cpp b/src/Magnum/Test/SamplerTest.cpp similarity index 97% rename from src/Test/SamplerTest.cpp rename to src/Magnum/Test/SamplerTest.cpp index a4bb1b8df..5248dc919 100644 --- a/src/Test/SamplerTest.cpp +++ b/src/Magnum/Test/SamplerTest.cpp @@ -23,9 +23,9 @@ */ #include -#include +#include -#include "Sampler.h" +#include "Magnum/Sampler.h" namespace Magnum { namespace Test { diff --git a/src/Test/ShaderGLTest.cpp b/src/Magnum/Test/ShaderGLTest.cpp similarity index 67% rename from src/Test/ShaderGLTest.cpp rename to src/Magnum/Test/ShaderGLTest.cpp index f33d103e0..a89c98fdd 100644 --- a/src/Test/ShaderGLTest.cpp +++ b/src/Magnum/Test/ShaderGLTest.cpp @@ -22,10 +22,14 @@ DEALINGS IN THE SOFTWARE. */ -#include "Context.h" -#include "Extensions.h" -#include "Shader.h" -#include "Test/AbstractOpenGLTester.h" +#include + +#include "Magnum/Context.h" +#include "Magnum/Extensions.h" +#include "Magnum/Shader.h" +#include "Magnum/Test/AbstractOpenGLTester.h" + +#include "configure.h" namespace Magnum { namespace Test { @@ -38,6 +42,10 @@ class ShaderGLTest: public AbstractOpenGLTester { void constructMove(); void label(); + + void addSource(); + void addFile(); + void compile(); }; ShaderGLTest::ShaderGLTest() { @@ -45,7 +53,11 @@ ShaderGLTest::ShaderGLTest() { &ShaderGLTest::constructCopy, &ShaderGLTest::constructMove, - &ShaderGLTest::label}); + &ShaderGLTest::label, + + &ShaderGLTest::addSource, + &ShaderGLTest::addFile, + &ShaderGLTest::compile}); } void ShaderGLTest::construct() { @@ -142,6 +154,75 @@ void ShaderGLTest::label() { MAGNUM_VERIFY_NO_ERROR(); } +void ShaderGLTest::addSource() { + #ifndef MAGNUM_TARGET_GLES + Shader shader(Version::GL210, Shader::Type::Fragment); + #else + Shader shader(Version::GLES200, Shader::Type::Fragment); + #endif + + shader.addSource("#define FOO BAR\n") + .addSource("void main() {}\n"); + + #ifndef MAGNUM_TARGET_GLES + CORRADE_COMPARE(shader.sources(), (std::vector{ + "#version 120\n", + "#line 1 1\n", + "#define FOO BAR\n", + "#line 1 2\n", + "void main() {}\n" + })); + #else + CORRADE_COMPARE(shader.sources(), (std::vector{ + "#version 100\n", + "#line 1 1\n", + "#define FOO BAR\n", + "#line 1 2\n", + "void main() {}\n" + })); + #endif +} + +void ShaderGLTest::addFile() { + #ifndef MAGNUM_TARGET_GLES + Shader shader(Version::GL210, Shader::Type::Fragment); + #else + Shader shader(Version::GLES200, Shader::Type::Fragment); + #endif + + shader.addFile(Utility::Directory::join(SHADERGLTEST_FILES_DIR, "shader.glsl")); + + #ifndef MAGNUM_TARGET_GLES + CORRADE_COMPARE(shader.sources(), (std::vector{ + "#version 120\n", + "#line 1 1\n", + "void main() {}\n" + })); + #else + CORRADE_COMPARE(shader.sources(), (std::vector{ + "#version 100\n", + "#line 1 1\n", + "void main() {}\n" + })); + #endif +} + +void ShaderGLTest::compile() { + #ifndef MAGNUM_TARGET_GLES + constexpr Version v = Version::GL210; + #else + constexpr Version v = Version::GLES200; + #endif + + Shader shader(v, Shader::Type::Fragment); + shader.addSource("void main() {}\n"); + CORRADE_VERIFY(shader.compile()); + + Shader shader2(v, Shader::Type::Fragment); + shader2.addSource("[fu] bleh error #:! stuff\n"); + CORRADE_VERIFY(!shader2.compile()); +} + }} CORRADE_TEST_MAIN(Magnum::Test::ShaderGLTest) diff --git a/src/Magnum/Test/ShaderGLTestFiles/shader.glsl b/src/Magnum/Test/ShaderGLTestFiles/shader.glsl new file mode 100644 index 000000000..ab73b3a23 --- /dev/null +++ b/src/Magnum/Test/ShaderGLTestFiles/shader.glsl @@ -0,0 +1 @@ +void main() {} diff --git a/src/Test/ShaderTest.cpp b/src/Magnum/Test/ShaderTest.cpp similarity index 96% rename from src/Test/ShaderTest.cpp rename to src/Magnum/Test/ShaderTest.cpp index 451be692a..e139113ba 100644 --- a/src/Test/ShaderTest.cpp +++ b/src/Magnum/Test/ShaderTest.cpp @@ -23,9 +23,9 @@ */ #include -#include +#include -#include "Shader.h" +#include "Magnum/Shader.h" namespace Magnum { namespace Test { diff --git a/src/Test/TextureGLTest.cpp b/src/Magnum/Test/TextureGLTest.cpp similarity index 98% rename from src/Test/TextureGLTest.cpp rename to src/Magnum/Test/TextureGLTest.cpp index f3582b65a..b4e4527e8 100644 --- a/src/Test/TextureGLTest.cpp +++ b/src/Magnum/Test/TextureGLTest.cpp @@ -22,14 +22,17 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include -#include "BufferImage.h" -#include "ColorFormat.h" -#include "Image.h" -#include "Texture.h" -#include "TextureFormat.h" -#include "Test/AbstractOpenGLTester.h" +#include "Magnum/configure.h" +#ifndef MAGNUM_TARGET_GLES2 +#include "Magnum/BufferImage.h" +#endif +#include "Magnum/ColorFormat.h" +#include "Magnum/Image.h" +#include "Magnum/Texture.h" +#include "Magnum/TextureFormat.h" +#include "Magnum/Test/AbstractOpenGLTester.h" namespace Magnum { namespace Test { @@ -1622,6 +1625,9 @@ void TextureGLTest::subImageRectangleBuffer() { #ifndef MAGNUM_TARGET_GLES void TextureGLTest::generateMipmap1D() { + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::ARB::framebuffer_object::string() + std::string(" is not supported.")); + Texture1D texture; texture.setImage(0, TextureFormat::RGBA8, ImageReference1D(ColorFormat::RGBA, ColorType::UnsignedByte, 32)); @@ -1645,6 +1651,11 @@ void TextureGLTest::generateMipmap1D() { #endif void TextureGLTest::generateMipmap2D() { + #ifndef MAGNUM_TARGET_GLES + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::ARB::framebuffer_object::string() + std::string(" is not supported.")); + #endif + Texture2D texture; texture.setImage(0, TextureFormat::RGBA8, ImageReference2D(ColorFormat::RGBA, ColorType::UnsignedByte, Vector2i(32))); @@ -1673,7 +1684,10 @@ void TextureGLTest::generateMipmap2D() { } void TextureGLTest::generateMipmap3D() { - #ifdef MAGNUM_TARGET_GLES2 + #ifndef MAGNUM_TARGET_GLES + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::ARB::framebuffer_object::string() + std::string(" is not supported.")); + #elif defined(MAGNUM_TARGET_GLES2) if(!Context::current()->isExtensionSupported()) CORRADE_SKIP(Extensions::GL::OES::texture_3D::string() + std::string(" is not supported.")); #endif @@ -1707,6 +1721,8 @@ void TextureGLTest::generateMipmap3D() { #ifndef MAGNUM_TARGET_GLES void TextureGLTest::generateMipmap1DArray() { + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::ARB::framebuffer_object::string() + std::string(" is not supported.")); if(!Context::current()->isExtensionSupported()) CORRADE_SKIP(Extensions::GL::EXT::texture_array::string() + std::string(" is not supported.")); @@ -1735,6 +1751,8 @@ void TextureGLTest::generateMipmap1DArray() { #ifndef MAGNUM_TARGET_GLES2 void TextureGLTest::generateMipmap2DArray() { #ifndef MAGNUM_TARGET_GLES + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::ARB::framebuffer_object::string() + std::string(" is not supported.")); if(!Context::current()->isExtensionSupported()) CORRADE_SKIP(Extensions::GL::EXT::texture_array::string() + std::string(" is not supported.")); #endif diff --git a/src/Magnum/Test/TimeQueryGLTest.cpp b/src/Magnum/Test/TimeQueryGLTest.cpp new file mode 100644 index 000000000..36292e4fc --- /dev/null +++ b/src/Magnum/Test/TimeQueryGLTest.cpp @@ -0,0 +1,100 @@ +/* + This file is part of Magnum. + + Copyright © 2010, 2011, 2012, 2013 Vladimír Vondruš + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. +*/ + +#include "Magnum/Query.h" +#include "Magnum/Test/AbstractOpenGLTester.h" + +namespace Magnum { namespace Test { + +class TimeQueryGLTest: public AbstractOpenGLTester { + public: + explicit TimeQueryGLTest(); + + void queryTime(); + void queryTimestamp(); +}; + +TimeQueryGLTest::TimeQueryGLTest() { + addTests({&TimeQueryGLTest::queryTime, + &TimeQueryGLTest::queryTimestamp}); +} + +void TimeQueryGLTest::queryTime() { + #ifndef MAGNUM_TARGET_GLES + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::ARB::timer_query::string() + std::string(" is not available")); + #else + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::EXT::disjoint_timer_query::string() + std::string(" is not available")); + #endif + + TimeQuery q1; + q1.begin(TimeQuery::Target::TimeElapsed); + q1.end(); + const auto result1 = q1.result(); + + MAGNUM_VERIFY_NO_ERROR(); + CORRADE_VERIFY(result1 > 0); + + TimeQuery q2; + q2.begin(TimeQuery::Target::TimeElapsed); + Renderer::setFeature(Renderer::Feature::Blending, true); + Renderer::finish(); + q2.end(); + const auto result2 = q2.result(); + + MAGNUM_VERIFY_NO_ERROR(); + CORRADE_VERIFY(result2 > result1); +} + +void TimeQueryGLTest::queryTimestamp() { + #ifdef MAGNUM_TARGET_GLES + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::EXT::disjoint_timer_query::string() + std::string(" is not available")); + #endif + + TimeQuery q1, q2, q; + + q1.timestamp(); + + q.begin(TimeQuery::Target::TimeElapsed); + Renderer::setFeature(Renderer::Feature::Blending, true); + Renderer::finish(); + q.end(); + + q2.timestamp(); + + const auto result = q.result(); + const auto result1 = q1.result(); + const auto result2 = q2.result(); + + MAGNUM_VERIFY_NO_ERROR(); + CORRADE_VERIFY(result > 0); + CORRADE_VERIFY(result2 > result1); + CORRADE_VERIFY(result2-result1 > result); +} + +}} + +CORRADE_TEST_MAIN(Magnum::Test::TimeQueryGLTest) diff --git a/src/Test/VersionTest.cpp b/src/Magnum/Test/VersionTest.cpp similarity index 96% rename from src/Test/VersionTest.cpp rename to src/Magnum/Test/VersionTest.cpp index d3d6d9693..f6ef91460 100644 --- a/src/Test/VersionTest.cpp +++ b/src/Magnum/Test/VersionTest.cpp @@ -22,9 +22,9 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include -#include "Version.h" +#include "Magnum/Version.h" namespace Magnum { namespace Test { diff --git a/src/Magnum/Test/configure.h.cmake b/src/Magnum/Test/configure.h.cmake new file mode 100644 index 000000000..7e0dfb21e --- /dev/null +++ b/src/Magnum/Test/configure.h.cmake @@ -0,0 +1,25 @@ +/* + This file is part of Magnum. + + Copyright © 2010, 2011, 2012, 2013 Vladimír Vondruš + + 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 SHADERGLTEST_FILES_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ShaderGLTestFiles" diff --git a/src/Text/AbstractFont.cpp b/src/Magnum/Text/AbstractFont.cpp similarity index 97% rename from src/Text/AbstractFont.cpp rename to src/Magnum/Text/AbstractFont.cpp index 24e0480f3..3f7494097 100644 --- a/src/Text/AbstractFont.cpp +++ b/src/Magnum/Text/AbstractFont.cpp @@ -24,11 +24,11 @@ #include "AbstractFont.h" -#include -#include -#include +#include +#include +#include -#include "Text/GlyphCache.h" +#include "Magnum/Text/GlyphCache.h" namespace Magnum { namespace Text { diff --git a/src/Text/AbstractFont.h b/src/Magnum/Text/AbstractFont.h similarity index 98% rename from src/Text/AbstractFont.h rename to src/Magnum/Text/AbstractFont.h index 6c6851e04..6c344a317 100644 --- a/src/Text/AbstractFont.h +++ b/src/Magnum/Text/AbstractFont.h @@ -31,12 +31,12 @@ #include #include #include -#include +#include -#include "Magnum.h" -#include "Texture.h" -#include "Text/Text.h" -#include "Text/magnumTextVisibility.h" +#include "Magnum/Magnum.h" +#include "Magnum/Texture.h" +#include "Magnum/Text/Text.h" +#include "Magnum/Text/visibility.h" namespace Magnum { namespace Text { diff --git a/src/Text/AbstractFontConverter.cpp b/src/Magnum/Text/AbstractFontConverter.cpp similarity index 98% rename from src/Text/AbstractFontConverter.cpp rename to src/Magnum/Text/AbstractFontConverter.cpp index dea7e0cdb..6013d0795 100644 --- a/src/Text/AbstractFontConverter.cpp +++ b/src/Magnum/Text/AbstractFontConverter.cpp @@ -25,12 +25,12 @@ #include "AbstractFontConverter.h" #include -#include -#include -#include -#include +#include +#include +#include +#include -#include "Text/GlyphCache.h" +#include "Magnum/Text/GlyphCache.h" namespace Magnum { namespace Text { diff --git a/src/Text/AbstractFontConverter.h b/src/Magnum/Text/AbstractFontConverter.h similarity index 99% rename from src/Text/AbstractFontConverter.h rename to src/Magnum/Text/AbstractFontConverter.h index b000f8572..fcd628ffd 100644 --- a/src/Text/AbstractFontConverter.h +++ b/src/Magnum/Text/AbstractFontConverter.h @@ -29,11 +29,11 @@ */ #include -#include +#include -#include "Magnum.h" -#include "Text/Text.h" -#include "Text/magnumTextVisibility.h" +#include "Magnum/Magnum.h" +#include "Magnum/Text/Text.h" +#include "Magnum/Text/visibility.h" namespace Magnum { namespace Text { diff --git a/src/Text/Alignment.h b/src/Magnum/Text/Alignment.h similarity index 99% rename from src/Text/Alignment.h rename to src/Magnum/Text/Alignment.h index 0677e0a1e..5225b7be6 100644 --- a/src/Text/Alignment.h +++ b/src/Magnum/Text/Alignment.h @@ -28,7 +28,7 @@ * @brief Enum @ref Magnum::Text::Alignment */ -#include "Types.h" +#include "Magnum/Types.h" namespace Magnum { namespace Text { diff --git a/src/Text/CMakeLists.txt b/src/Magnum/Text/CMakeLists.txt similarity index 97% rename from src/Text/CMakeLists.txt rename to src/Magnum/Text/CMakeLists.txt index 8f61ce1fe..6302f5c9f 100644 --- a/src/Text/CMakeLists.txt +++ b/src/Magnum/Text/CMakeLists.txt @@ -37,7 +37,7 @@ set(MagnumText_HEADERS Renderer.h Text.h - magnumTextVisibility.h) + visibility.h) if(MAGNUM_BUILD_DEPRECATED) set(MagnumText_HEADERS ${MagnumText_HEADERS} @@ -65,7 +65,7 @@ if(WITH_FONTCONVERTER) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/configure.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/configure.h) - include_directories(${CMAKE_CURRENT_BINARY_DIR}) + include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR}) add_executable(magnum-fontconverter fontconverter.cpp) target_link_libraries(magnum-fontconverter MagnumText Magnum MagnumWindowlessGlxApplication ${X11_LIBRARIES}) diff --git a/src/Text/DistanceFieldGlyphCache.cpp b/src/Magnum/Text/DistanceFieldGlyphCache.cpp similarity index 95% rename from src/Text/DistanceFieldGlyphCache.cpp rename to src/Magnum/Text/DistanceFieldGlyphCache.cpp index 64fc47517..562136ecb 100644 --- a/src/Text/DistanceFieldGlyphCache.cpp +++ b/src/Magnum/Text/DistanceFieldGlyphCache.cpp @@ -25,13 +25,13 @@ #include "DistanceFieldGlyphCache.h" #ifndef CORRADE_NO_ASSERT -#include "ColorFormat.h" +#include "Magnum/ColorFormat.h" #endif -#include "Context.h" -#include "Extensions.h" -#include "ImageReference.h" -#include "TextureFormat.h" -#include "TextureTools/DistanceField.h" +#include "Magnum/Context.h" +#include "Magnum/Extensions.h" +#include "Magnum/ImageReference.h" +#include "Magnum/TextureFormat.h" +#include "Magnum/TextureTools/DistanceField.h" namespace Magnum { namespace Text { diff --git a/src/Text/DistanceFieldGlyphCache.h b/src/Magnum/Text/DistanceFieldGlyphCache.h similarity index 99% rename from src/Text/DistanceFieldGlyphCache.h rename to src/Magnum/Text/DistanceFieldGlyphCache.h index 5f3c1de8f..8754c1ba5 100644 --- a/src/Text/DistanceFieldGlyphCache.h +++ b/src/Magnum/Text/DistanceFieldGlyphCache.h @@ -28,7 +28,7 @@ * @brief Class @ref Magnum::Text::DistanceFieldGlyphCache */ -#include "Text/GlyphCache.h" +#include "Magnum/Text/GlyphCache.h" namespace Magnum { namespace Text { diff --git a/src/Text/GlyphCache.cpp b/src/Magnum/Text/GlyphCache.cpp similarity index 96% rename from src/Text/GlyphCache.cpp rename to src/Magnum/Text/GlyphCache.cpp index d7acc5a26..04586012d 100644 --- a/src/Text/GlyphCache.cpp +++ b/src/Magnum/Text/GlyphCache.cpp @@ -24,11 +24,11 @@ #include "GlyphCache.h" -#include "Context.h" -#include "Extensions.h" -#include "Image.h" -#include "TextureFormat.h" -#include "TextureTools/Atlas.h" +#include "Magnum/Context.h" +#include "Magnum/Extensions.h" +#include "Magnum/Image.h" +#include "Magnum/TextureFormat.h" +#include "Magnum/TextureTools/Atlas.h" namespace Magnum { namespace Text { diff --git a/src/Text/GlyphCache.h b/src/Magnum/Text/GlyphCache.h similarity index 98% rename from src/Text/GlyphCache.h rename to src/Magnum/Text/GlyphCache.h index 5fa5ede88..6289c64cc 100644 --- a/src/Text/GlyphCache.h +++ b/src/Magnum/Text/GlyphCache.h @@ -31,9 +31,9 @@ #include #include -#include "Math/Range.h" -#include "Texture.h" -#include "Text/magnumTextVisibility.h" +#include "Magnum/Math/Range.h" +#include "Magnum/Texture.h" +#include "Magnum/Text/visibility.h" namespace Magnum { namespace Text { diff --git a/src/Text/Renderer.cpp b/src/Magnum/Text/Renderer.cpp similarity index 99% rename from src/Text/Renderer.cpp rename to src/Magnum/Text/Renderer.cpp index f7127d4f7..25d71a928 100644 --- a/src/Text/Renderer.cpp +++ b/src/Magnum/Text/Renderer.cpp @@ -24,11 +24,11 @@ #include "Renderer.h" -#include "Context.h" -#include "Extensions.h" -#include "Mesh.h" -#include "Shaders/AbstractVector.h" -#include "Text/AbstractFont.h" +#include "Magnum/Context.h" +#include "Magnum/Extensions.h" +#include "Magnum/Mesh.h" +#include "Magnum/Shaders/AbstractVector.h" +#include "Magnum/Text/AbstractFont.h" namespace Magnum { namespace Text { diff --git a/src/Text/Renderer.h b/src/Magnum/Text/Renderer.h similarity index 97% rename from src/Text/Renderer.h rename to src/Magnum/Text/Renderer.h index 27da6a9c9..f00eceff5 100644 --- a/src/Text/Renderer.h +++ b/src/Magnum/Text/Renderer.h @@ -32,14 +32,13 @@ #include #include -#include "Math/Range.h" -#include "Buffer.h" -#include "DimensionTraits.h" -#include "Mesh.h" -#include "Text/Text.h" -#include "Text/Alignment.h" - -#include "magnumTextVisibility.h" +#include "Magnum/Math/Range.h" +#include "Magnum/Buffer.h" +#include "Magnum/DimensionTraits.h" +#include "Magnum/Mesh.h" +#include "Magnum/Text/Text.h" +#include "Magnum/Text/Alignment.h" +#include "Magnum/Text/visibility.h" namespace Magnum { namespace Text { diff --git a/src/Text/Test/AbstractFontConverterTest.cpp b/src/Magnum/Text/Test/AbstractFontConverterTest.cpp similarity index 97% rename from src/Text/Test/AbstractFontConverterTest.cpp rename to src/Magnum/Text/Test/AbstractFontConverterTest.cpp index e42d483bf..a6023d444 100644 --- a/src/Text/Test/AbstractFontConverterTest.cpp +++ b/src/Magnum/Text/Test/AbstractFontConverterTest.cpp @@ -22,15 +22,15 @@ DEALINGS IN THE SOFTWARE. */ -#include -#include -#include -#include +#include +#include +#include +#include -#include "Text/AbstractFontConverter.h" -#include "Text/GlyphCache.h" +#include "Magnum/Text/AbstractFontConverter.h" +#include "Magnum/Text/GlyphCache.h" -#include "testConfigure.h" +#include "configure.h" namespace Magnum { namespace Text { namespace Test { diff --git a/src/Text/Test/AbstractFontTest.cpp b/src/Magnum/Text/Test/AbstractFontTest.cpp similarity index 94% rename from src/Text/Test/AbstractFontTest.cpp rename to src/Magnum/Text/Test/AbstractFontTest.cpp index 53811e399..3ca55091d 100644 --- a/src/Text/Test/AbstractFontTest.cpp +++ b/src/Magnum/Text/Test/AbstractFontTest.cpp @@ -22,13 +22,13 @@ DEALINGS IN THE SOFTWARE. */ -#include -#include -#include +#include +#include +#include -#include "Text/AbstractFont.h" +#include "Magnum/Text/AbstractFont.h" -#include "testConfigure.h" +#include "configure.h" namespace Magnum { namespace Text { namespace Test { diff --git a/src/Text/Test/AbstractLayouterTest.cpp b/src/Magnum/Text/Test/AbstractLayouterTest.cpp similarity index 96% rename from src/Text/Test/AbstractLayouterTest.cpp rename to src/Magnum/Text/Test/AbstractLayouterTest.cpp index 2dc0d714c..d4e95b82a 100644 --- a/src/Text/Test/AbstractLayouterTest.cpp +++ b/src/Magnum/Text/Test/AbstractLayouterTest.cpp @@ -22,10 +22,10 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include -#include "Math/Range.h" -#include "Text/AbstractFont.h" +#include "Magnum/Math/Range.h" +#include "Magnum/Text/AbstractFont.h" namespace Magnum { namespace Text { namespace Test { diff --git a/src/Text/Test/CMakeLists.txt b/src/Magnum/Text/Test/CMakeLists.txt similarity index 90% rename from src/Text/Test/CMakeLists.txt rename to src/Magnum/Text/Test/CMakeLists.txt index e48529eaa..62f613fa1 100644 --- a/src/Text/Test/CMakeLists.txt +++ b/src/Magnum/Text/Test/CMakeLists.txt @@ -22,10 +22,10 @@ # DEALINGS IN THE SOFTWARE. # -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/testConfigure.h.cmake - ${CMAKE_CURRENT_BINARY_DIR}/testConfigure.h) +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/configure.h.cmake + ${CMAKE_CURRENT_BINARY_DIR}/configure.h) -include_directories(${CMAKE_CURRENT_BINARY_DIR}) +include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR}) corrade_add_test(TextAbstractFontTest AbstractFontTest.cpp LIBRARIES Magnum MagnumText) corrade_add_test(TextAbstractFontConverterTest AbstractFontConverterTest.cpp LIBRARIES Magnum MagnumText) diff --git a/src/Text/Test/GlyphCacheGLTest.cpp b/src/Magnum/Text/Test/GlyphCacheGLTest.cpp similarity index 97% rename from src/Text/Test/GlyphCacheGLTest.cpp rename to src/Magnum/Text/Test/GlyphCacheGLTest.cpp index a2b8b2bcb..44521aa3e 100644 --- a/src/Text/Test/GlyphCacheGLTest.cpp +++ b/src/Magnum/Text/Test/GlyphCacheGLTest.cpp @@ -22,8 +22,8 @@ DEALINGS IN THE SOFTWARE. */ -#include "Test/AbstractOpenGLTester.h" -#include "Text/GlyphCache.h" +#include "Magnum/Test/AbstractOpenGLTester.h" +#include "Magnum/Text/GlyphCache.h" namespace Magnum { namespace Text { namespace Test { diff --git a/src/Text/Test/RendererGLTest.cpp b/src/Magnum/Text/Test/RendererGLTest.cpp similarity index 99% rename from src/Text/Test/RendererGLTest.cpp rename to src/Magnum/Text/Test/RendererGLTest.cpp index 13a85d42d..e5a962122 100644 --- a/src/Text/Test/RendererGLTest.cpp +++ b/src/Magnum/Text/Test/RendererGLTest.cpp @@ -22,9 +22,9 @@ DEALINGS IN THE SOFTWARE. */ -#include "Test/AbstractOpenGLTester.h" -#include "Text/AbstractFont.h" -#include "Text/Renderer.h" +#include "Magnum/Test/AbstractOpenGLTester.h" +#include "Magnum/Text/AbstractFont.h" +#include "Magnum/Text/Renderer.h" namespace Magnum { namespace Text { namespace Test { diff --git a/src/Text/Test/testConfigure.h.cmake b/src/Magnum/Text/Test/configure.h.cmake similarity index 100% rename from src/Text/Test/testConfigure.h.cmake rename to src/Magnum/Text/Test/configure.h.cmake diff --git a/src/Text/Test/data.bin b/src/Magnum/Text/Test/data.bin similarity index 100% rename from src/Text/Test/data.bin rename to src/Magnum/Text/Test/data.bin diff --git a/src/Text/Text.h b/src/Magnum/Text/Text.h similarity index 95% rename from src/Text/Text.h rename to src/Magnum/Text/Text.h index 3baccb5ec..167b12ae4 100644 --- a/src/Text/Text.h +++ b/src/Magnum/Text/Text.h @@ -28,11 +28,10 @@ * @brief Forward declarations for Magnum::Text namespace */ -#include "Types.h" +#include -#include - -#include "magnumConfigure.h" +#include "Magnum/Types.h" +#include "Magnum/configure.h" namespace Magnum { namespace Text { diff --git a/src/Text/TextRenderer.h b/src/Magnum/Text/TextRenderer.h similarity index 93% rename from src/Text/TextRenderer.h rename to src/Magnum/Text/TextRenderer.h index 5f29e3270..d92dd97b5 100644 --- a/src/Text/TextRenderer.h +++ b/src/Magnum/Text/TextRenderer.h @@ -1,7 +1,7 @@ #ifndef Magnum_Text_TextRenderer_h #define Magnum_Text_TextRenderer_h -#include "Text/Renderer.h" +#include "Magnum/Text/Renderer.h" #ifdef MAGNUM_BUILD_DEPRECATED namespace Magnum { namespace Text { diff --git a/src/Text/configure.h.cmake b/src/Magnum/Text/configure.h.cmake similarity index 100% rename from src/Text/configure.h.cmake rename to src/Magnum/Text/configure.h.cmake diff --git a/src/Text/fontconverter.cpp b/src/Magnum/Text/fontconverter.cpp similarity index 93% rename from src/Text/fontconverter.cpp rename to src/Magnum/Text/fontconverter.cpp index 5189b056d..df1601918 100644 --- a/src/Text/fontconverter.cpp +++ b/src/Magnum/Text/fontconverter.cpp @@ -22,15 +22,15 @@ DEALINGS IN THE SOFTWARE. */ -#include -#include -#include - -#include "Platform/WindowlessGlxApplication.h" -#include "Text/AbstractFont.h" -#include "Text/AbstractFontConverter.h" -#include "Text/DistanceFieldGlyphCache.h" -#include "Trade/AbstractImageConverter.h" +#include +#include +#include + +#include "Magnum/Platform/WindowlessGlxApplication.h" +#include "Magnum/Text/AbstractFont.h" +#include "Magnum/Text/AbstractFontConverter.h" +#include "Magnum/Text/DistanceFieldGlyphCache.h" +#include "Magnum/Trade/AbstractImageConverter.h" #include "configure.h" diff --git a/src/Text/magnumTextVisibility.h b/src/Magnum/Text/visibility.h similarity index 91% rename from src/Text/magnumTextVisibility.h rename to src/Magnum/Text/visibility.h index c15adef5a..9bf30e9a9 100644 --- a/src/Text/magnumTextVisibility.h +++ b/src/Magnum/Text/visibility.h @@ -1,5 +1,5 @@ -#ifndef Magnum_Text_magnumTextVisibility_h -#define Magnum_Text_magnumTextVisibility_h +#ifndef Magnum_Text_visibility_h +#define Magnum_Text_visibility_h /* This file is part of Magnum. @@ -24,9 +24,9 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include -#include "magnumConfigure.h" +#include "Magnum/configure.h" #ifndef MAGNUM_BUILD_STATIC #ifdef MagnumText_EXPORTS diff --git a/src/Texture.h b/src/Magnum/Texture.h similarity index 99% rename from src/Texture.h rename to src/Magnum/Texture.h index 265df7738..9cd2c26dc 100644 --- a/src/Texture.h +++ b/src/Magnum/Texture.h @@ -28,8 +28,8 @@ * @brief Class @ref Magnum::Texture, typedef @ref Magnum::Texture1D, @ref Magnum::Texture2D, @ref Magnum::Texture3D */ -#include "AbstractTexture.h" -#include "DimensionTraits.h" +#include "Magnum/AbstractTexture.h" +#include "Magnum/DimensionTraits.h" namespace Magnum { @@ -436,7 +436,7 @@ template class Texture: public AbstractTexture { * @param size Size of invalidated data * * If running on OpenGL ES or extension @extension{ARB,invalidate_subdata} - * is not available, this function does nothing. + * (part of OpenGL 4.3) is not available, this function does nothing. * @see @ref invalidateImage(), @fn_gl{InvalidateTexSubImage} */ void invalidateSubImage(Int level, const typename DimensionTraits::VectorType& offset, const typename DimensionTraits::VectorType& size) { diff --git a/src/TextureFormat.h b/src/Magnum/TextureFormat.h similarity index 95% rename from src/TextureFormat.h rename to src/Magnum/TextureFormat.h index 6bab5073f..2d994df25 100644 --- a/src/TextureFormat.h +++ b/src/Magnum/TextureFormat.h @@ -28,7 +28,7 @@ * @brief Enum @ref Magnum::TextureFormat */ -#include "OpenGL.h" +#include "Magnum/OpenGL.h" namespace Magnum { @@ -46,7 +46,9 @@ or WebGL. */ enum class TextureFormat: GLenum { /** - * Red component, normalized unsigned, size implementation-dependent. + * Red component, normalized unsigned, size implementation-dependent. Not + * allowed in unemulated @ref Texture::setStorage() "*Texture::setStorage()" + * calls. * @deprecated_gl Prefer to use the exactly specified version of this * format, e.g. @ref Magnum::TextureFormat::R8 "TextureFormat::R8". * @requires_gl30 %Extension @extension{ARB,texture_rg} @@ -70,7 +72,8 @@ enum class TextureFormat: GLenum { /** * Red and green component, normalized unsigned, size - * implementation-dependent. + * implementation-dependent. Not allowed in unemulated + * @ref Texture::setStorage() "*Texture::setStorage()" calls. * @deprecated_gl Prefer to use the exactly specified version of this * format, e.g. @ref Magnum::TextureFormat::RG8 "TextureFormat::RG8". * @requires_gl30 %Extension @extension{ARB,texture_rg} @@ -93,7 +96,8 @@ enum class TextureFormat: GLenum { #endif /** - * RGB, normalized unsigned, size implementation-dependent. + * RGB, normalized unsigned, size implementation-dependent. Not allowed in + * unemulated @ref Texture::setStorage() "*Texture::setStorage()" calls. * @deprecated_gl Prefer to use the exactly specified version of this * format, e.g. @ref Magnum::TextureFormat::RGB8 "TextureFormat::RGB8". */ @@ -110,7 +114,8 @@ enum class TextureFormat: GLenum { #endif /** - * RGBA, normalized unsigned, size implementation-dependent. + * RGBA, normalized unsigned, size implementation-dependent. Not allowed in + * unemulated @ref Texture::setStorage() "*Texture::setStorage()" calls. * @deprecated_gl Prefer to use the exactly specified version of this * format, e.g. @ref Magnum::TextureFormat::RGBA8 "TextureFormat::RGBA8". */ @@ -744,7 +749,9 @@ enum class TextureFormat: GLenum { #endif /** - * Depth component, size implementation-dependent. + * Depth component, size implementation-dependent. Not supported in 3D + * textures, not allowed in unemulated @ref Texture::setStorage() + * "*Texture::setStorage()" calls. * @deprecated_gl Prefer to use the exactly specified version of this * format, e.g. @ref Magnum::TextureFormat::DepthComponent16 "TextureFormat::DepthComponent16". * @requires_gles30 %Extension @es_extension{OES,depth_texture} or @@ -753,7 +760,7 @@ enum class TextureFormat: GLenum { DepthComponent = GL_DEPTH_COMPONENT, /** - * Depth component, 16bit. + * Depth component, 16bit. Not supported in 3D textures. * @requires_gles30 %Extension (@es_extension{OES,required_internalformat} * and @es_extension{OES,depth_texture}) or (@es_extension{EXT,texture_storage} * and @es_extension{ANGLE,depth_texture}) @@ -761,7 +768,7 @@ enum class TextureFormat: GLenum { DepthComponent16 = GL_DEPTH_COMPONENT16, /** - * Depth component, 24bit. + * Depth component, 24bit. Not supported in 3D textures. * @requires_gles30 %Extension @es_extension{OES,required_internalformat}, * @es_extension{OES,depth_texture} and @es_extension{OES,depth24} */ @@ -772,7 +779,7 @@ enum class TextureFormat: GLenum { #endif /** - * Depth component, 32bit. + * Depth component, 32bit. Not supported in 3D textures. * @requires_es_extension %Extension (@es_extension{OES,required_internalformat}, * @es_extension{OES,depth_texture} and @es_extension{OES,depth32}) or * (@es_extension{EXT,texture_storage} and @es_extension{ANGLE,depth_texture}) @@ -785,7 +792,7 @@ enum class TextureFormat: GLenum { #ifndef MAGNUM_TARGET_GLES2 /** - * Depth component, 32bit float. + * Depth component, 32bit float. Not supported in 3D textures. * @requires_gl30 %Extension @extension{ARB,depth_buffer_float} * @requires_gles30 Only integral depth textures are available in OpenGL ES * 2.0. @@ -795,7 +802,7 @@ enum class TextureFormat: GLenum { #ifndef MAGNUM_TARGET_GLES /** - * Stencil index, 8bit. + * Stencil index, 8bit. Not supported in 3D textures. * @requires_gl44 %Extension @extension{ARB,texture_stencil8} * @requires_gl Only available as renderbuffer format in OpenGL ES. */ @@ -803,7 +810,9 @@ enum class TextureFormat: GLenum { #endif /** - * Depth and stencil component, size implementation-dependent. + * Depth and stencil component, size implementation-dependent. Not + * supported in 3D textures, not allowed in unemulated + * @ref Texture::setStorage() "*Texture::setStorage()" calls. * @deprecated_gl Prefer to use exactly specified version of this format, * e.g. @ref Magnum::TextureFormat::Depth24Stencil8 "TextureFormat::Depth24Stencil8". * @requires_gles30 %Extension @es_extension{OES,packed_depth_stencil} @@ -815,7 +824,7 @@ enum class TextureFormat: GLenum { #endif /** - * 24bit depth and 8bit stencil component. + * 24bit depth and 8bit stencil component. Not supported in 3D textures. * @requires_gl30 %Extension @extension{ARB,framebuffer_object} * @requires_gles30 %Extension @es_extension{OES,packed_depth_stencil} and * (@es_extension{OES,required_internalformat} or @@ -829,7 +838,8 @@ enum class TextureFormat: GLenum { #ifndef MAGNUM_TARGET_GLES2 /** - * 32bit float depth component and 8bit stencil component. + * 32bit float depth component and 8bit stencil component. Not supported in + * 3D textures. * @requires_gl30 %Extension @extension{ARB,depth_buffer_float} * @requires_gles30 Only integral depth textures are available in OpenGL ES * 2.0. diff --git a/src/TextureTools/Atlas.cpp b/src/Magnum/TextureTools/Atlas.cpp similarity index 97% rename from src/TextureTools/Atlas.cpp rename to src/Magnum/TextureTools/Atlas.cpp index dd2f49f8e..0b0369501 100644 --- a/src/TextureTools/Atlas.cpp +++ b/src/Magnum/TextureTools/Atlas.cpp @@ -24,8 +24,8 @@ #include "Atlas.h" -#include "Math/Functions.h" -#include "Math/Range.h" +#include "Magnum/Math/Functions.h" +#include "Magnum/Math/Range.h" namespace Magnum { namespace TextureTools { diff --git a/src/TextureTools/Atlas.h b/src/Magnum/TextureTools/Atlas.h similarity index 94% rename from src/TextureTools/Atlas.h rename to src/Magnum/TextureTools/Atlas.h index f6ad66e8a..769fcf24f 100644 --- a/src/TextureTools/Atlas.h +++ b/src/Magnum/TextureTools/Atlas.h @@ -30,10 +30,9 @@ #include -#include "Math/Vector2.h" -#include "Magnum.h" - -#include "magnumTextureToolsVisibility.h" +#include "Magnum/Magnum.h" +#include "Magnum/Math/Vector2.h" +#include "Magnum/TextureTools/magnumTextureToolsVisibility.h" namespace Magnum { namespace TextureTools { diff --git a/src/TextureTools/CMakeLists.txt b/src/Magnum/TextureTools/CMakeLists.txt similarity index 94% rename from src/TextureTools/CMakeLists.txt rename to src/Magnum/TextureTools/CMakeLists.txt index 05623f9c0..cf6871bda 100644 --- a/src/TextureTools/CMakeLists.txt +++ b/src/Magnum/TextureTools/CMakeLists.txt @@ -51,8 +51,8 @@ if(WITH_DISTANCEFIELDCONVERTER) message(FATAL_ERROR "magnum-distancefieldconverter 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) + configure_file(${CMAKE_CURRENT_SOURCE_DIR}/distancefieldconverterConfigure.h.cmake + ${CMAKE_CURRENT_BINARY_DIR}/distancefieldconverterConfigure.h) include_directories(${CMAKE_CURRENT_BINARY_DIR}) diff --git a/src/TextureTools/DistanceField.cpp b/src/Magnum/TextureTools/DistanceField.cpp similarity index 95% rename from src/TextureTools/DistanceField.cpp rename to src/Magnum/TextureTools/DistanceField.cpp index 107d7d033..9a6b1d1d0 100644 --- a/src/TextureTools/DistanceField.cpp +++ b/src/Magnum/TextureTools/DistanceField.cpp @@ -22,19 +22,19 @@ DEALINGS IN THE SOFTWARE. */ -#include "TextureTools/DistanceField.h" - -#include - -#include "Math/Range.h" -#include "AbstractShaderProgram.h" -#include "Buffer.h" -#include "Context.h" -#include "Extensions.h" -#include "Framebuffer.h" -#include "Mesh.h" -#include "Shader.h" -#include "Texture.h" +#include "DistanceField.h" + +#include + +#include "Magnum/Math/Range.h" +#include "Magnum/AbstractShaderProgram.h" +#include "Magnum/Buffer.h" +#include "Magnum/Context.h" +#include "Magnum/Extensions.h" +#include "Magnum/Framebuffer.h" +#include "Magnum/Mesh.h" +#include "Magnum/Shader.h" +#include "Magnum/Texture.h" namespace Magnum { namespace TextureTools { diff --git a/src/TextureTools/DistanceField.h b/src/Magnum/TextureTools/DistanceField.h similarity index 97% rename from src/TextureTools/DistanceField.h rename to src/Magnum/TextureTools/DistanceField.h index dae2ec61c..0472e8e1f 100644 --- a/src/TextureTools/DistanceField.h +++ b/src/Magnum/TextureTools/DistanceField.h @@ -29,11 +29,11 @@ */ #ifndef MAGNUM_TARGET_GLES -#include "Math/Vector2.h" +#include "Magnum/Math/Vector2.h" #endif -#include "Magnum.h" +#include "Magnum/Magnum.h" -#include "TextureTools/magnumTextureToolsVisibility.h" +#include "Magnum/TextureTools/magnumTextureToolsVisibility.h" namespace Magnum { namespace TextureTools { diff --git a/src/TextureTools/DistanceFieldShader.frag b/src/Magnum/TextureTools/DistanceFieldShader.frag similarity index 100% rename from src/TextureTools/DistanceFieldShader.frag rename to src/Magnum/TextureTools/DistanceFieldShader.frag diff --git a/src/TextureTools/DistanceFieldShader.vert b/src/Magnum/TextureTools/DistanceFieldShader.vert similarity index 100% rename from src/TextureTools/DistanceFieldShader.vert rename to src/Magnum/TextureTools/DistanceFieldShader.vert diff --git a/src/TextureTools/Test/AtlasTest.cpp b/src/Magnum/TextureTools/Test/AtlasTest.cpp similarity index 96% rename from src/TextureTools/Test/AtlasTest.cpp rename to src/Magnum/TextureTools/Test/AtlasTest.cpp index 64de1e245..b353c64af 100644 --- a/src/TextureTools/Test/AtlasTest.cpp +++ b/src/Magnum/TextureTools/Test/AtlasTest.cpp @@ -23,10 +23,10 @@ */ #include -#include +#include -#include "Math/Range.h" -#include "TextureTools/Atlas.h" +#include "Magnum/Math/Range.h" +#include "Magnum/TextureTools/Atlas.h" namespace Magnum { namespace TextureTools { namespace Test { diff --git a/src/TextureTools/Test/CMakeLists.txt b/src/Magnum/TextureTools/Test/CMakeLists.txt similarity index 100% rename from src/TextureTools/Test/CMakeLists.txt rename to src/Magnum/TextureTools/Test/CMakeLists.txt diff --git a/src/TextureTools/distancefieldconverter.cpp b/src/Magnum/TextureTools/distancefieldconverter.cpp similarity index 89% rename from src/TextureTools/distancefieldconverter.cpp rename to src/Magnum/TextureTools/distancefieldconverter.cpp index 8fd096224..876a4f1f6 100644 --- a/src/TextureTools/distancefieldconverter.cpp +++ b/src/Magnum/TextureTools/distancefieldconverter.cpp @@ -22,22 +22,22 @@ DEALINGS IN THE SOFTWARE. */ -#include -#include - -#include "Math/Range.h" -#include "ColorFormat.h" -#include "Image.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" +#include +#include + +#include "Magnum/Math/Range.h" +#include "Magnum/ColorFormat.h" +#include "Magnum/Image.h" +#include "Magnum/Renderer.h" +#include "Magnum/Texture.h" +#include "Magnum/TextureFormat.h" +#include "Magnum/Platform/WindowlessGlxApplication.h" +#include "Magnum/TextureTools/DistanceField.h" +#include "Magnum/Trade/AbstractImporter.h" +#include "Magnum/Trade/AbstractImageConverter.h" +#include "Magnum/Trade/ImageData.h" + +#include "distancefieldconverterConfigure.h" namespace Magnum { namespace TextureTools { diff --git a/src/TextureTools/configure.h.cmake b/src/Magnum/TextureTools/distancefieldconverterConfigure.h.cmake similarity index 100% rename from src/TextureTools/configure.h.cmake rename to src/Magnum/TextureTools/distancefieldconverterConfigure.h.cmake diff --git a/src/TextureTools/magnumTextureToolsResourceImport.hpp b/src/Magnum/TextureTools/magnumTextureToolsResourceImport.hpp similarity index 93% rename from src/TextureTools/magnumTextureToolsResourceImport.hpp rename to src/Magnum/TextureTools/magnumTextureToolsResourceImport.hpp index 9ac0777df..1114a7138 100644 --- a/src/TextureTools/magnumTextureToolsResourceImport.hpp +++ b/src/Magnum/TextureTools/magnumTextureToolsResourceImport.hpp @@ -24,11 +24,11 @@ DEALINGS IN THE SOFTWARE. */ -#include "magnumConfigure.h" +#include "Magnum/magnumConfigure.h" #ifdef MAGNUM_BUILD_STATIC -#include -#include +#include +#include static int magnumTextureToolsResourceImport() { CORRADE_RESOURCE_INITIALIZE(MagnumTextureTools_RCS) diff --git a/src/TextureTools/magnumTextureToolsVisibility.h b/src/Magnum/TextureTools/magnumTextureToolsVisibility.h similarity index 95% rename from src/TextureTools/magnumTextureToolsVisibility.h rename to src/Magnum/TextureTools/magnumTextureToolsVisibility.h index c552e907d..68ea9e6c4 100644 --- a/src/TextureTools/magnumTextureToolsVisibility.h +++ b/src/Magnum/TextureTools/magnumTextureToolsVisibility.h @@ -24,9 +24,9 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include -#include "magnumConfigure.h" +#include "Magnum/configure.h" #ifndef MAGNUM_BUILD_STATIC #ifdef MagnumTextureTools_EXPORTS diff --git a/src/TextureTools/resources.conf b/src/Magnum/TextureTools/resources.conf similarity index 100% rename from src/TextureTools/resources.conf rename to src/Magnum/TextureTools/resources.conf diff --git a/src/Timeline.cpp b/src/Magnum/Timeline.cpp similarity index 95% rename from src/Timeline.cpp rename to src/Magnum/Timeline.cpp index 6d6c2b65e..74d8a5748 100644 --- a/src/Timeline.cpp +++ b/src/Magnum/Timeline.cpp @@ -24,10 +24,10 @@ #include "Timeline.h" -#include -#include +#include +#include -#include "Magnum.h" +#include "Magnum/Magnum.h" using namespace std::chrono; diff --git a/src/Timeline.h b/src/Magnum/Timeline.h similarity index 98% rename from src/Timeline.h rename to src/Magnum/Timeline.h index 9144196e3..893d80be1 100644 --- a/src/Timeline.h +++ b/src/Magnum/Timeline.h @@ -24,17 +24,16 @@ DEALINGS IN THE SOFTWARE. */ -#include -#include - -#include "Types.h" - -#include "magnumVisibility.h" - /** @file * @brief Class Magnum::Timeline */ +#include +#include + +#include "Magnum/Types.h" +#include "Magnum/visibility.h" + namespace Magnum { /** diff --git a/src/Trade/AbstractImageConverter.cpp b/src/Magnum/Trade/AbstractImageConverter.cpp similarity index 96% rename from src/Trade/AbstractImageConverter.cpp rename to src/Magnum/Trade/AbstractImageConverter.cpp index e9598d1e7..49ca46e56 100644 --- a/src/Trade/AbstractImageConverter.cpp +++ b/src/Magnum/Trade/AbstractImageConverter.cpp @@ -24,9 +24,9 @@ #include "AbstractImageConverter.h" -#include -#include -#include +#include +#include +#include namespace Magnum { namespace Trade { diff --git a/src/Trade/AbstractImageConverter.h b/src/Magnum/Trade/AbstractImageConverter.h similarity index 97% rename from src/Trade/AbstractImageConverter.h rename to src/Magnum/Trade/AbstractImageConverter.h index d3f46e1d9..4601c620f 100644 --- a/src/Trade/AbstractImageConverter.h +++ b/src/Magnum/Trade/AbstractImageConverter.h @@ -28,11 +28,11 @@ * @brief Class Magnum::Trade::AbstractImageConverter */ -#include +#include -#include "Magnum.h" -#include "Text/Text.h" -#include "magnumVisibility.h" +#include "Magnum/Magnum.h" +#include "Magnum/visibility.h" +#include "Magnum/Text/Text.h" namespace Magnum { namespace Trade { diff --git a/src/Trade/AbstractImporter.cpp b/src/Magnum/Trade/AbstractImporter.cpp similarity index 97% rename from src/Trade/AbstractImporter.cpp rename to src/Magnum/Trade/AbstractImporter.cpp index 001f3d159..d3aa45af9 100644 --- a/src/Trade/AbstractImporter.cpp +++ b/src/Magnum/Trade/AbstractImporter.cpp @@ -24,20 +24,20 @@ #include "AbstractImporter.h" -#include -#include -#include - -#include "Trade/AbstractMaterialData.h" -#include "Trade/CameraData.h" -#include "Trade/ImageData.h" -#include "Trade/LightData.h" -#include "Trade/MeshData2D.h" -#include "Trade/MeshData3D.h" -#include "Trade/ObjectData2D.h" -#include "Trade/ObjectData3D.h" -#include "Trade/SceneData.h" -#include "Trade/TextureData.h" +#include +#include +#include + +#include "Magnum/Trade/AbstractMaterialData.h" +#include "Magnum/Trade/CameraData.h" +#include "Magnum/Trade/ImageData.h" +#include "Magnum/Trade/LightData.h" +#include "Magnum/Trade/MeshData2D.h" +#include "Magnum/Trade/MeshData3D.h" +#include "Magnum/Trade/ObjectData2D.h" +#include "Magnum/Trade/ObjectData3D.h" +#include "Magnum/Trade/SceneData.h" +#include "Magnum/Trade/TextureData.h" namespace Magnum { namespace Trade { diff --git a/src/Trade/AbstractImporter.h b/src/Magnum/Trade/AbstractImporter.h similarity index 98% rename from src/Trade/AbstractImporter.h rename to src/Magnum/Trade/AbstractImporter.h index ef427065c..602aad875 100644 --- a/src/Trade/AbstractImporter.h +++ b/src/Magnum/Trade/AbstractImporter.h @@ -29,14 +29,13 @@ */ #include -#include -#include +#include +#include -#include "Optional/optional.hpp" - -#include "Magnum.h" -#include "magnumVisibility.h" -#include "Trade/Trade.h" +#include "Magnum/Magnum.h" +#include "Magnum/visibility.h" +#include "Magnum/Trade/Trade.h" +#include "MagnumExternal/Optional/optional.hpp" namespace Magnum { namespace Trade { diff --git a/src/Trade/AbstractMaterialData.cpp b/src/Magnum/Trade/AbstractMaterialData.cpp similarity index 98% rename from src/Trade/AbstractMaterialData.cpp rename to src/Magnum/Trade/AbstractMaterialData.cpp index 689cc7bbe..9d70a125c 100644 --- a/src/Trade/AbstractMaterialData.cpp +++ b/src/Magnum/Trade/AbstractMaterialData.cpp @@ -24,7 +24,7 @@ #include "AbstractMaterialData.h" -#include +#include namespace Magnum { namespace Trade { diff --git a/src/Trade/AbstractMaterialData.h b/src/Magnum/Trade/AbstractMaterialData.h similarity index 97% rename from src/Trade/AbstractMaterialData.h rename to src/Magnum/Trade/AbstractMaterialData.h index f06202657..c4d02009f 100644 --- a/src/Trade/AbstractMaterialData.h +++ b/src/Magnum/Trade/AbstractMaterialData.h @@ -28,8 +28,8 @@ * @brief Class @ref Magnum::Trade::AbstractMaterialData, enum @ref Magnum::Trade::MaterialType */ -#include "magnumVisibility.h" -#include "Magnum.h" +#include "Magnum/Magnum.h" +#include "Magnum/visibility.h" namespace Magnum { namespace Trade { diff --git a/src/Trade/CMakeLists.txt b/src/Magnum/Trade/CMakeLists.txt similarity index 100% rename from src/Trade/CMakeLists.txt rename to src/Magnum/Trade/CMakeLists.txt diff --git a/src/Trade/CameraData.h b/src/Magnum/Trade/CameraData.h similarity index 100% rename from src/Trade/CameraData.h rename to src/Magnum/Trade/CameraData.h diff --git a/src/Trade/ImageData.h b/src/Magnum/Trade/ImageData.h similarity index 91% rename from src/Trade/ImageData.h rename to src/Magnum/Trade/ImageData.h index 181b768bb..18b51b1af 100644 --- a/src/Trade/ImageData.h +++ b/src/Magnum/Trade/ImageData.h @@ -28,7 +28,7 @@ * @brief Class @ref Magnum::Trade::ImageData, typedef @ref Magnum::Trade::ImageData1D, @ref Magnum::Trade::ImageData2D, @ref Magnum::Trade::ImageData3D */ -#include "ImageReference.h" +#include "Magnum/ImageReference.h" namespace Magnum { namespace Trade { @@ -86,13 +86,24 @@ template class ImageData: public AbstractImage { /** @brief %Image size */ typename DimensionTraits::VectorType size() const { return _size; } + /** @copydoc Image::dataSize() */ + std::size_t dataSize(const typename DimensionTraits::VectorType& size) const { + return AbstractImage::dataSize(size); + } + /** * @brief Pointer to raw data * * @see @ref release() */ - unsigned char* data() { return _data; } - const unsigned char* data() const { return _data; } /**< @overload */ + template T* data() { + return reinterpret_cast(_data); + } + + /** @overload */ + template const T* data() const { + return reinterpret_cast(_data); + } /** * @brief Release data storage diff --git a/src/Trade/LightData.h b/src/Magnum/Trade/LightData.h similarity index 100% rename from src/Trade/LightData.h rename to src/Magnum/Trade/LightData.h diff --git a/src/Trade/MeshData2D.cpp b/src/Magnum/Trade/MeshData2D.cpp similarity index 99% rename from src/Trade/MeshData2D.cpp rename to src/Magnum/Trade/MeshData2D.cpp index b06ba0dbd..b14a32e5f 100644 --- a/src/Trade/MeshData2D.cpp +++ b/src/Magnum/Trade/MeshData2D.cpp @@ -24,7 +24,7 @@ #include "MeshData2D.h" -#include "Math/Vector2.h" +#include "Magnum/Math/Vector2.h" namespace Magnum { namespace Trade { diff --git a/src/Trade/MeshData2D.h b/src/Magnum/Trade/MeshData2D.h similarity index 98% rename from src/Trade/MeshData2D.h rename to src/Magnum/Trade/MeshData2D.h index 25f901687..a7e5ad498 100644 --- a/src/Trade/MeshData2D.h +++ b/src/Magnum/Trade/MeshData2D.h @@ -30,9 +30,8 @@ #include -#include "Magnum.h" - -#include "magnumVisibility.h" +#include "Magnum/Magnum.h" +#include "Magnum/visibility.h" #ifdef CORRADE_GCC45_COMPATIBILITY #include "Mesh.h" diff --git a/src/Trade/MeshData3D.cpp b/src/Magnum/Trade/MeshData3D.cpp similarity index 99% rename from src/Trade/MeshData3D.cpp rename to src/Magnum/Trade/MeshData3D.cpp index efca0af13..a23dcc745 100644 --- a/src/Trade/MeshData3D.cpp +++ b/src/Magnum/Trade/MeshData3D.cpp @@ -24,7 +24,7 @@ #include "MeshData3D.h" -#include "Math/Vector3.h" +#include "Magnum/Math/Vector3.h" namespace Magnum { namespace Trade { diff --git a/src/Trade/MeshData3D.h b/src/Magnum/Trade/MeshData3D.h similarity index 98% rename from src/Trade/MeshData3D.h rename to src/Magnum/Trade/MeshData3D.h index a1821dfa6..ab4bcac28 100644 --- a/src/Trade/MeshData3D.h +++ b/src/Magnum/Trade/MeshData3D.h @@ -30,9 +30,8 @@ #include -#include "Magnum.h" - -#include "magnumVisibility.h" +#include "Magnum/Magnum.h" +#include "Magnum/visibility.h" #ifdef CORRADE_GCC45_COMPATIBILITY #include "Mesh.h" diff --git a/src/Trade/MeshObjectData2D.cpp b/src/Magnum/Trade/MeshObjectData2D.cpp similarity index 100% rename from src/Trade/MeshObjectData2D.cpp rename to src/Magnum/Trade/MeshObjectData2D.cpp diff --git a/src/Trade/MeshObjectData2D.h b/src/Magnum/Trade/MeshObjectData2D.h similarity index 98% rename from src/Trade/MeshObjectData2D.h rename to src/Magnum/Trade/MeshObjectData2D.h index d3df17a4c..b7864b54a 100644 --- a/src/Trade/MeshObjectData2D.h +++ b/src/Magnum/Trade/MeshObjectData2D.h @@ -28,7 +28,7 @@ * @brief Class Magnum::Trade::MeshObjectData2D */ -#include "ObjectData2D.h" +#include "Magnum/Trade/ObjectData2D.h" namespace Magnum { namespace Trade { diff --git a/src/Trade/MeshObjectData3D.cpp b/src/Magnum/Trade/MeshObjectData3D.cpp similarity index 100% rename from src/Trade/MeshObjectData3D.cpp rename to src/Magnum/Trade/MeshObjectData3D.cpp diff --git a/src/Trade/MeshObjectData3D.h b/src/Magnum/Trade/MeshObjectData3D.h similarity index 98% rename from src/Trade/MeshObjectData3D.h rename to src/Magnum/Trade/MeshObjectData3D.h index 2628c733a..8bc9032b4 100644 --- a/src/Trade/MeshObjectData3D.h +++ b/src/Magnum/Trade/MeshObjectData3D.h @@ -28,7 +28,7 @@ * @brief Class Magnum::Trade::MeshObjectData3D */ -#include "ObjectData3D.h" +#include "Magnum/Trade/ObjectData3D.h" namespace Magnum { namespace Trade { diff --git a/src/Trade/ObjectData2D.cpp b/src/Magnum/Trade/ObjectData2D.cpp similarity index 100% rename from src/Trade/ObjectData2D.cpp rename to src/Magnum/Trade/ObjectData2D.cpp diff --git a/src/Trade/ObjectData2D.h b/src/Magnum/Trade/ObjectData2D.h similarity index 98% rename from src/Trade/ObjectData2D.h rename to src/Magnum/Trade/ObjectData2D.h index 98b64bf7f..a38d96bd2 100644 --- a/src/Trade/ObjectData2D.h +++ b/src/Magnum/Trade/ObjectData2D.h @@ -30,8 +30,8 @@ #include -#include "Math/Matrix3.h" -#include "Magnum.h" +#include "Magnum/Magnum.h" +#include "Magnum/Math/Matrix3.h" namespace Magnum { namespace Trade { diff --git a/src/Trade/ObjectData3D.cpp b/src/Magnum/Trade/ObjectData3D.cpp similarity index 100% rename from src/Trade/ObjectData3D.cpp rename to src/Magnum/Trade/ObjectData3D.cpp diff --git a/src/Trade/ObjectData3D.h b/src/Magnum/Trade/ObjectData3D.h similarity index 98% rename from src/Trade/ObjectData3D.h rename to src/Magnum/Trade/ObjectData3D.h index 8fcaf1b46..e7f3aa34a 100644 --- a/src/Trade/ObjectData3D.h +++ b/src/Magnum/Trade/ObjectData3D.h @@ -30,8 +30,8 @@ #include -#include "Math/Matrix4.h" -#include "Magnum.h" +#include "Magnum/Magnum.h" +#include "Magnum/Math/Matrix4.h" namespace Magnum { namespace Trade { diff --git a/src/Trade/PhongMaterialData.cpp b/src/Magnum/Trade/PhongMaterialData.cpp similarity index 100% rename from src/Trade/PhongMaterialData.cpp rename to src/Magnum/Trade/PhongMaterialData.cpp diff --git a/src/Trade/PhongMaterialData.h b/src/Magnum/Trade/PhongMaterialData.h similarity index 98% rename from src/Trade/PhongMaterialData.h rename to src/Magnum/Trade/PhongMaterialData.h index 67aa359ee..a0f8d53f0 100644 --- a/src/Trade/PhongMaterialData.h +++ b/src/Magnum/Trade/PhongMaterialData.h @@ -28,9 +28,9 @@ * @brief Class Magnum::Trade::PhongMaterialData */ -#include "Math/Vector3.h" -#include "Magnum.h" -#include "AbstractMaterialData.h" +#include "Magnum/Magnum.h" +#include "Magnum/Math/Vector3.h" +#include "Magnum/Trade/AbstractMaterialData.h" namespace Magnum { namespace Trade { diff --git a/src/Trade/SceneData.cpp b/src/Magnum/Trade/SceneData.cpp similarity index 100% rename from src/Trade/SceneData.cpp rename to src/Magnum/Trade/SceneData.cpp diff --git a/src/Trade/SceneData.h b/src/Magnum/Trade/SceneData.h similarity index 97% rename from src/Trade/SceneData.h rename to src/Magnum/Trade/SceneData.h index 2a2a5d7fa..a37ba850a 100644 --- a/src/Trade/SceneData.h +++ b/src/Magnum/Trade/SceneData.h @@ -31,8 +31,8 @@ #include #include -#include "Types.h" -#include "magnumVisibility.h" +#include "Magnum/Types.h" +#include "Magnum/visibility.h" namespace Magnum { namespace Trade { diff --git a/src/Trade/Test/AbstractImageConverterTest.cpp b/src/Magnum/Trade/Test/AbstractImageConverterTest.cpp similarity index 90% rename from src/Trade/Test/AbstractImageConverterTest.cpp rename to src/Magnum/Trade/Test/AbstractImageConverterTest.cpp index fd0ef8864..b581716bd 100644 --- a/src/Trade/Test/AbstractImageConverterTest.cpp +++ b/src/Magnum/Trade/Test/AbstractImageConverterTest.cpp @@ -22,16 +22,16 @@ DEALINGS IN THE SOFTWARE. */ -#include -#include -#include -#include +#include +#include +#include +#include -#include "ColorFormat.h" -#include "ImageReference.h" -#include "Trade/AbstractImageConverter.h" +#include "Magnum/ColorFormat.h" +#include "Magnum/ImageReference.h" +#include "Magnum/Trade/AbstractImageConverter.h" -#include "testConfigure.h" +#include "configure.h" namespace Magnum { namespace Trade { namespace Test { diff --git a/src/Trade/Test/AbstractImporterTest.cpp b/src/Magnum/Trade/Test/AbstractImporterTest.cpp similarity index 92% rename from src/Trade/Test/AbstractImporterTest.cpp rename to src/Magnum/Trade/Test/AbstractImporterTest.cpp index 140b4011a..7730a1e1b 100644 --- a/src/Trade/Test/AbstractImporterTest.cpp +++ b/src/Magnum/Trade/Test/AbstractImporterTest.cpp @@ -22,13 +22,13 @@ DEALINGS IN THE SOFTWARE. */ -#include -#include -#include +#include +#include +#include -#include "Trade/AbstractImporter.h" +#include "Magnum/Trade/AbstractImporter.h" -#include "testConfigure.h" +#include "configure.h" namespace Magnum { namespace Trade { namespace Test { diff --git a/src/Trade/Test/AbstractMaterialDataTest.cpp b/src/Magnum/Trade/Test/AbstractMaterialDataTest.cpp similarity index 95% rename from src/Trade/Test/AbstractMaterialDataTest.cpp rename to src/Magnum/Trade/Test/AbstractMaterialDataTest.cpp index c85efb8cc..bb385635a 100644 --- a/src/Trade/Test/AbstractMaterialDataTest.cpp +++ b/src/Magnum/Trade/Test/AbstractMaterialDataTest.cpp @@ -23,9 +23,9 @@ */ #include -#include +#include -#include "Trade/AbstractMaterialData.h" +#include "Magnum/Trade/AbstractMaterialData.h" namespace Magnum { namespace Trade { namespace Test { diff --git a/src/Trade/Test/CMakeLists.txt b/src/Magnum/Trade/Test/CMakeLists.txt similarity index 91% rename from src/Trade/Test/CMakeLists.txt rename to src/Magnum/Trade/Test/CMakeLists.txt index d1a162e92..8a3bd4515 100644 --- a/src/Trade/Test/CMakeLists.txt +++ b/src/Magnum/Trade/Test/CMakeLists.txt @@ -22,10 +22,10 @@ # DEALINGS IN THE SOFTWARE. # -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/testConfigure.h.cmake - ${CMAKE_CURRENT_BINARY_DIR}/testConfigure.h) +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/configure.h.cmake + ${CMAKE_CURRENT_BINARY_DIR}/configure.h) -include_directories(${CMAKE_CURRENT_BINARY_DIR}) +include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR}) corrade_add_test(TradeAbstractImageConverterTest AbstractImageConverterTest.cpp LIBRARIES Magnum) corrade_add_test(TradeAbstractImporterTest AbstractImporterTest.cpp LIBRARIES Magnum) diff --git a/src/Trade/Test/ImageDataTest.cpp b/src/Magnum/Trade/Test/ImageDataTest.cpp similarity index 97% rename from src/Trade/Test/ImageDataTest.cpp rename to src/Magnum/Trade/Test/ImageDataTest.cpp index 23afcde51..8793e285a 100644 --- a/src/Trade/Test/ImageDataTest.cpp +++ b/src/Magnum/Trade/Test/ImageDataTest.cpp @@ -22,10 +22,10 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include -#include "ColorFormat.h" -#include "Trade/ImageData.h" +#include "Magnum/ColorFormat.h" +#include "Magnum/Trade/ImageData.h" namespace Magnum { namespace Trade { namespace Test { diff --git a/src/Trade/Test/ObjectData2DTest.cpp b/src/Magnum/Trade/Test/ObjectData2DTest.cpp similarity index 95% rename from src/Trade/Test/ObjectData2DTest.cpp rename to src/Magnum/Trade/Test/ObjectData2DTest.cpp index a41001b63..0138f5c3b 100644 --- a/src/Trade/Test/ObjectData2DTest.cpp +++ b/src/Magnum/Trade/Test/ObjectData2DTest.cpp @@ -23,9 +23,9 @@ */ #include -#include +#include -#include "Trade/ObjectData2D.h" +#include "Magnum/Trade/ObjectData2D.h" namespace Magnum { namespace Trade { namespace Test { diff --git a/src/Trade/Test/ObjectData3DTest.cpp b/src/Magnum/Trade/Test/ObjectData3DTest.cpp similarity index 95% rename from src/Trade/Test/ObjectData3DTest.cpp rename to src/Magnum/Trade/Test/ObjectData3DTest.cpp index 285a7a1ad..b5ecbde22 100644 --- a/src/Trade/Test/ObjectData3DTest.cpp +++ b/src/Magnum/Trade/Test/ObjectData3DTest.cpp @@ -23,9 +23,9 @@ */ #include -#include +#include -#include "Trade/ObjectData3D.h" +#include "Magnum/Trade/ObjectData3D.h" namespace Magnum { namespace Trade { namespace Test { diff --git a/src/Trade/Test/TextureDataTest.cpp b/src/Magnum/Trade/Test/TextureDataTest.cpp similarity index 95% rename from src/Trade/Test/TextureDataTest.cpp rename to src/Magnum/Trade/Test/TextureDataTest.cpp index d0946907a..aca858149 100644 --- a/src/Trade/Test/TextureDataTest.cpp +++ b/src/Magnum/Trade/Test/TextureDataTest.cpp @@ -23,9 +23,9 @@ */ #include -#include +#include -#include "Trade/TextureData.h" +#include "Magnum/Trade/TextureData.h" namespace Magnum { namespace Trade { namespace Test { diff --git a/src/Trade/Test/testConfigure.h.cmake b/src/Magnum/Trade/Test/configure.h.cmake similarity index 100% rename from src/Trade/Test/testConfigure.h.cmake rename to src/Magnum/Trade/Test/configure.h.cmake diff --git a/src/Trade/Test/file.bin b/src/Magnum/Trade/Test/file.bin similarity index 100% rename from src/Trade/Test/file.bin rename to src/Magnum/Trade/Test/file.bin diff --git a/src/Trade/TextureData.cpp b/src/Magnum/Trade/TextureData.cpp similarity index 100% rename from src/Trade/TextureData.cpp rename to src/Magnum/Trade/TextureData.cpp diff --git a/src/Trade/TextureData.h b/src/Magnum/Trade/TextureData.h similarity index 98% rename from src/Trade/TextureData.h rename to src/Magnum/Trade/TextureData.h index 2ffb54341..9d99a1b9b 100644 --- a/src/Trade/TextureData.h +++ b/src/Magnum/Trade/TextureData.h @@ -28,9 +28,9 @@ * @brief Class Magnum::Trade::TextureData */ -#include "Array.h" -#include "Sampler.h" -#include "magnumVisibility.h" +#include "Magnum/Array.h" +#include "Magnum/Sampler.h" +#include "Magnum/visibility.h" namespace Magnum { namespace Trade { diff --git a/src/Trade/Trade.h b/src/Magnum/Trade/Trade.h similarity index 98% rename from src/Trade/Trade.h rename to src/Magnum/Trade/Trade.h index 33ad440a1..8bf30adfa 100644 --- a/src/Trade/Trade.h +++ b/src/Magnum/Trade/Trade.h @@ -28,7 +28,7 @@ * @brief Forward declarations for Magnum::Trade namespace */ -#include "Types.h" +#include "Magnum/Types.h" namespace Magnum { namespace Trade { diff --git a/src/Types.h b/src/Magnum/Types.h similarity index 98% rename from src/Types.h rename to src/Magnum/Types.h index 18627ff63..bd332b6b8 100644 --- a/src/Types.h +++ b/src/Magnum/Types.h @@ -30,7 +30,7 @@ #include -#include "magnumConfigure.h" +#include "Magnum/configure.h" namespace Magnum { diff --git a/src/Version.cpp b/src/Magnum/Version.cpp similarity index 98% rename from src/Version.cpp rename to src/Magnum/Version.cpp index 57cdd543b..1be0559df 100644 --- a/src/Version.cpp +++ b/src/Magnum/Version.cpp @@ -24,7 +24,7 @@ #include "Version.h" -#include +#include namespace Magnum { diff --git a/src/Version.h b/src/Magnum/Version.h similarity index 98% rename from src/Version.h rename to src/Magnum/Version.h index e89cb45fb..c42e00fdc 100644 --- a/src/Version.h +++ b/src/Magnum/Version.h @@ -30,8 +30,8 @@ #include -#include "Magnum.h" -#include "magnumVisibility.h" +#include "Magnum/Magnum.h" +#include "Magnum/visibility.h" namespace Magnum { diff --git a/src/magnumConfigure.h.cmake b/src/Magnum/configure.h.cmake similarity index 100% rename from src/magnumConfigure.h.cmake rename to src/Magnum/configure.h.cmake diff --git a/src/magnumVisibility.h b/src/Magnum/visibility.h similarity index 86% rename from src/magnumVisibility.h rename to src/Magnum/visibility.h index d85a39fff..abcadc967 100644 --- a/src/magnumVisibility.h +++ b/src/Magnum/visibility.h @@ -1,5 +1,5 @@ -#ifndef Magnum_magnumVisibility_h -#define Magnum_magnumVisibility_h +#ifndef Magnum_visibility_h +#define Magnum_visibility_h /* This file is part of Magnum. @@ -24,12 +24,12 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include -#include "magnumConfigure.h" +#include "Magnum/configure.h" #ifndef MAGNUM_BUILD_STATIC - #if defined(Magnum_EXPORTS) || defined(MagnumObjects_EXPORTS) || defined(MagnumMathObjects_EXPORTS) + #if defined(Magnum_EXPORTS) || defined(MagnumMathObjects_EXPORTS) #define MAGNUM_EXPORT CORRADE_VISIBILITY_EXPORT #else #define MAGNUM_EXPORT CORRADE_VISIBILITY_IMPORT diff --git a/external/CMakeLists.txt b/src/MagnumExternal/CMakeLists.txt similarity index 100% rename from external/CMakeLists.txt rename to src/MagnumExternal/CMakeLists.txt diff --git a/external/OpenGL/CMakeLists.txt b/src/MagnumExternal/OpenGL/CMakeLists.txt similarity index 100% rename from external/OpenGL/CMakeLists.txt rename to src/MagnumExternal/OpenGL/CMakeLists.txt diff --git a/external/OpenGL/GL/CMakeLists.txt b/src/MagnumExternal/OpenGL/GL/CMakeLists.txt similarity index 94% rename from external/OpenGL/GL/CMakeLists.txt rename to src/MagnumExternal/OpenGL/GL/CMakeLists.txt index c8048349e..33f3113a3 100644 --- a/external/OpenGL/GL/CMakeLists.txt +++ b/src/MagnumExternal/OpenGL/GL/CMakeLists.txt @@ -30,4 +30,4 @@ else() set_target_properties(MagnumGLLoadGenObjects PROPERTIES COMPILE_FLAGS "${CMAKE_SHARED_LIBRARY_CXX_FLAGS} -DGLLoadGen_EXPORTS") endif() -install(FILES gl_magnum.h DESTINATION ${MAGNUM_INCLUDE_INSTALL_DIR}/OpenGL/GL) +install(FILES gl_magnum.h DESTINATION ${MAGNUM_EXTERNAL_INCLUDE_INSTALL_DIR}/OpenGL/GL) diff --git a/external/OpenGL/GL/README.md b/src/MagnumExternal/OpenGL/GL/README.md similarity index 100% rename from external/OpenGL/GL/README.md rename to src/MagnumExternal/OpenGL/GL/README.md diff --git a/external/OpenGL/GL/extensions.txt b/src/MagnumExternal/OpenGL/GL/extensions.txt similarity index 100% rename from external/OpenGL/GL/extensions.txt rename to src/MagnumExternal/OpenGL/GL/extensions.txt diff --git a/external/OpenGL/GL/gl_magnum.c b/src/MagnumExternal/OpenGL/GL/gl_magnum.c similarity index 100% rename from external/OpenGL/GL/gl_magnum.c rename to src/MagnumExternal/OpenGL/GL/gl_magnum.c diff --git a/external/OpenGL/GL/gl_magnum.h b/src/MagnumExternal/OpenGL/GL/gl_magnum.h similarity index 100% rename from external/OpenGL/GL/gl_magnum.h rename to src/MagnumExternal/OpenGL/GL/gl_magnum.h diff --git a/external/OpenGL/GLES2/CMakeLists.txt b/src/MagnumExternal/OpenGL/GLES2/CMakeLists.txt similarity index 93% rename from external/OpenGL/GLES2/CMakeLists.txt rename to src/MagnumExternal/OpenGL/GLES2/CMakeLists.txt index 2a1a501ca..adfe3f038 100644 --- a/external/OpenGL/GLES2/CMakeLists.txt +++ b/src/MagnumExternal/OpenGL/GLES2/CMakeLists.txt @@ -33,4 +33,4 @@ if(TARGET_GLES2 AND NOT CORRADE_TARGET_NACL) gl2.h) endif() -install(FILES ${MagnumOpenGL_HEADERS} DESTINATION ${MAGNUM_INCLUDE_INSTALL_DIR}/OpenGL/GLES2) +install(FILES ${MagnumOpenGL_HEADERS} DESTINATION ${MAGNUM_EXTERNAL_INCLUDE_INSTALL_DIR}/OpenGL/GLES2) diff --git a/external/OpenGL/GLES2/gl2.h b/src/MagnumExternal/OpenGL/GLES2/gl2.h similarity index 100% rename from external/OpenGL/GLES2/gl2.h rename to src/MagnumExternal/OpenGL/GLES2/gl2.h diff --git a/external/OpenGL/GLES2/gl2ext.h b/src/MagnumExternal/OpenGL/GLES2/gl2ext.h similarity index 100% rename from external/OpenGL/GLES2/gl2ext.h rename to src/MagnumExternal/OpenGL/GLES2/gl2ext.h diff --git a/external/OpenGL/GLES2/gl2platform.h b/src/MagnumExternal/OpenGL/GLES2/gl2platform.h similarity index 100% rename from external/OpenGL/GLES2/gl2platform.h rename to src/MagnumExternal/OpenGL/GLES2/gl2platform.h diff --git a/external/OpenGL/GLES3/CMakeLists.txt b/src/MagnumExternal/OpenGL/GLES3/CMakeLists.txt similarity index 92% rename from external/OpenGL/GLES3/CMakeLists.txt rename to src/MagnumExternal/OpenGL/GLES3/CMakeLists.txt index 6699d72ba..14e62289b 100644 --- a/external/OpenGL/GLES3/CMakeLists.txt +++ b/src/MagnumExternal/OpenGL/GLES3/CMakeLists.txt @@ -22,4 +22,4 @@ # DEALINGS IN THE SOFTWARE. # -install(FILES gl3.h gl3platform.h DESTINATION ${MAGNUM_INCLUDE_INSTALL_DIR}/OpenGL/GLES3) +install(FILES gl3.h gl3platform.h DESTINATION ${MAGNUM_EXTERNAL_INCLUDE_INSTALL_DIR}/OpenGL/GLES3) diff --git a/external/OpenGL/GLES3/gl3.h b/src/MagnumExternal/OpenGL/GLES3/gl3.h similarity index 100% rename from external/OpenGL/GLES3/gl3.h rename to src/MagnumExternal/OpenGL/GLES3/gl3.h diff --git a/external/OpenGL/GLES3/gl3platform.h b/src/MagnumExternal/OpenGL/GLES3/gl3platform.h similarity index 100% rename from external/OpenGL/GLES3/gl3platform.h rename to src/MagnumExternal/OpenGL/GLES3/gl3platform.h diff --git a/external/OpenGL/KHR/CMakeLists.txt b/src/MagnumExternal/OpenGL/KHR/CMakeLists.txt similarity index 93% rename from external/OpenGL/KHR/CMakeLists.txt rename to src/MagnumExternal/OpenGL/KHR/CMakeLists.txt index e8e737ceb..ba8222611 100644 --- a/external/OpenGL/KHR/CMakeLists.txt +++ b/src/MagnumExternal/OpenGL/KHR/CMakeLists.txt @@ -24,5 +24,5 @@ # NaCl has its own gl2.h, this one causes linker issues if(NOT CORRADE_TARGET_NACL) - install(FILES khrplatform.h DESTINATION ${MAGNUM_INCLUDE_INSTALL_DIR}/OpenGL/KHR) + install(FILES khrplatform.h DESTINATION ${MAGNUM_EXTERNAL_INCLUDE_INSTALL_DIR}/OpenGL/KHR) endif() diff --git a/external/OpenGL/KHR/khrplatform.h b/src/MagnumExternal/OpenGL/KHR/khrplatform.h similarity index 100% rename from external/OpenGL/KHR/khrplatform.h rename to src/MagnumExternal/OpenGL/KHR/khrplatform.h diff --git a/external/Optional/CMakeLists.txt b/src/MagnumExternal/Optional/CMakeLists.txt similarity index 93% rename from external/Optional/CMakeLists.txt rename to src/MagnumExternal/Optional/CMakeLists.txt index 46923f333..9a0576e57 100644 --- a/external/Optional/CMakeLists.txt +++ b/src/MagnumExternal/Optional/CMakeLists.txt @@ -22,4 +22,4 @@ # DEALINGS IN THE SOFTWARE. # -install(FILES optional.hpp DESTINATION ${MAGNUM_INCLUDE_INSTALL_DIR}/Optional) +install(FILES optional.hpp DESTINATION ${MAGNUM_EXTERNAL_INCLUDE_INSTALL_DIR}/Optional) diff --git a/external/Optional/LICENSE_1_0.txt b/src/MagnumExternal/Optional/LICENSE_1_0.txt similarity index 100% rename from external/Optional/LICENSE_1_0.txt rename to src/MagnumExternal/Optional/LICENSE_1_0.txt diff --git a/external/Optional/optional.hpp b/src/MagnumExternal/Optional/optional.hpp similarity index 100% rename from external/Optional/optional.hpp rename to src/MagnumExternal/Optional/optional.hpp diff --git a/src/Plugins/CMakeLists.txt b/src/MagnumPlugins/CMakeLists.txt similarity index 97% rename from src/Plugins/CMakeLists.txt rename to src/MagnumPlugins/CMakeLists.txt index f7324492d..dd4f4b9fa 100644 --- a/src/Plugins/CMakeLists.txt +++ b/src/MagnumPlugins/CMakeLists.txt @@ -22,8 +22,6 @@ # DEALINGS IN THE SOFTWARE. # -include_directories(${CMAKE_CURRENT_SOURCE_DIR}) - # Wrapper for creating given plugin type macro(add_plugin) if(NOT BUILD_STATIC) diff --git a/src/Plugins/MagnumFont/CMakeLists.txt b/src/MagnumPlugins/MagnumFont/CMakeLists.txt similarity index 98% rename from src/Plugins/MagnumFont/CMakeLists.txt rename to src/MagnumPlugins/MagnumFont/CMakeLists.txt index 8c6a47117..fbff53fea 100644 --- a/src/Plugins/MagnumFont/CMakeLists.txt +++ b/src/MagnumPlugins/MagnumFont/CMakeLists.txt @@ -34,7 +34,7 @@ set_target_properties(MagnumFontObjects PROPERTIES COMPILE_FLAGS "${CMAKE_SHARED add_plugin(MagnumFont ${MAGNUM_PLUGINS_FONT_INSTALL_DIR} MagnumFont.conf $ - pluginRegistrationMagnumFont.cpp) + pluginRegistration.cpp) target_link_libraries(MagnumFont Magnum MagnumText) if(WIN32) diff --git a/src/Plugins/MagnumFont/MagnumFont.conf b/src/MagnumPlugins/MagnumFont/MagnumFont.conf similarity index 100% rename from src/Plugins/MagnumFont/MagnumFont.conf rename to src/MagnumPlugins/MagnumFont/MagnumFont.conf diff --git a/src/Plugins/MagnumFont/MagnumFont.cpp b/src/MagnumPlugins/MagnumFont/MagnumFont.cpp similarity index 97% rename from src/Plugins/MagnumFont/MagnumFont.cpp rename to src/MagnumPlugins/MagnumFont/MagnumFont.cpp index 24313b1c1..c80253d0f 100644 --- a/src/Plugins/MagnumFont/MagnumFont.cpp +++ b/src/MagnumPlugins/MagnumFont/MagnumFont.cpp @@ -25,14 +25,13 @@ #include "MagnumFont.h" #include -#include -#include -#include +#include +#include +#include -#include "Text/GlyphCache.h" -#include "Trade/ImageData.h" - -#include "TgaImporter/TgaImporter.h" +#include "Magnum/Text/GlyphCache.h" +#include "Magnum/Trade/ImageData.h" +#include "MagnumPlugins/TgaImporter/TgaImporter.h" namespace Magnum { namespace Text { diff --git a/src/Plugins/MagnumFont/MagnumFont.h b/src/MagnumPlugins/MagnumFont/MagnumFont.h similarity index 98% rename from src/Plugins/MagnumFont/MagnumFont.h rename to src/MagnumPlugins/MagnumFont/MagnumFont.h index a7e3ec65e..2bf5f0e28 100644 --- a/src/Plugins/MagnumFont/MagnumFont.h +++ b/src/MagnumPlugins/MagnumFont/MagnumFont.h @@ -28,8 +28,8 @@ * @brief Class Magnum::Text::MagnumFont */ -#include "Text/AbstractFont.h" -#include "Trade/Trade.h" +#include "Magnum/Text/AbstractFont.h" +#include "Magnum/Trade/Trade.h" namespace Magnum { namespace Text { diff --git a/src/Plugins/MagnumFont/Test/CMakeLists.txt b/src/MagnumPlugins/MagnumFont/Test/CMakeLists.txt similarity index 87% rename from src/Plugins/MagnumFont/Test/CMakeLists.txt rename to src/MagnumPlugins/MagnumFont/Test/CMakeLists.txt index 4b91644ed..4f1d89ded 100644 --- a/src/Plugins/MagnumFont/Test/CMakeLists.txt +++ b/src/MagnumPlugins/MagnumFont/Test/CMakeLists.txt @@ -22,9 +22,9 @@ # DEALINGS IN THE SOFTWARE. # -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/magnumFontTestConfigure.h.cmake - ${CMAKE_CURRENT_BINARY_DIR}/magnumFontTestConfigure.h) +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/configure.h.cmake + ${CMAKE_CURRENT_BINARY_DIR}/configure.h) -include_directories(${CMAKE_CURRENT_BINARY_DIR}) +include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR}) corrade_add_test(MagnumFontGLTest MagnumFontGLTest.cpp LIBRARIES MagnumFontTestLib ${GL_TEST_LIBRARIES}) diff --git a/src/Plugins/MagnumFont/Test/MagnumFontGLTest.cpp b/src/MagnumPlugins/MagnumFont/Test/MagnumFontGLTest.cpp similarity index 95% rename from src/Plugins/MagnumFont/Test/MagnumFontGLTest.cpp rename to src/MagnumPlugins/MagnumFont/Test/MagnumFontGLTest.cpp index f0d3b69e3..2ca6675b1 100644 --- a/src/Plugins/MagnumFont/Test/MagnumFontGLTest.cpp +++ b/src/MagnumPlugins/MagnumFont/Test/MagnumFontGLTest.cpp @@ -22,13 +22,13 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include -#include "Test/AbstractOpenGLTester.h" -#include "Text/GlyphCache.h" -#include "MagnumFont/MagnumFont.h" +#include "Magnum/Test/AbstractOpenGLTester.h" +#include "Magnum/Text/GlyphCache.h" +#include "MagnumPlugins/MagnumFont/MagnumFont.h" -#include "magnumFontTestConfigure.h" +#include "configure.h" namespace Magnum { namespace Text { namespace Test { diff --git a/src/Plugins/MagnumFont/Test/magnumFontTestConfigure.h.cmake b/src/MagnumPlugins/MagnumFont/Test/configure.h.cmake similarity index 100% rename from src/Plugins/MagnumFont/Test/magnumFontTestConfigure.h.cmake rename to src/MagnumPlugins/MagnumFont/Test/configure.h.cmake diff --git a/src/Plugins/MagnumFont/Test/font.conf b/src/MagnumPlugins/MagnumFont/Test/font.conf similarity index 100% rename from src/Plugins/MagnumFont/Test/font.conf rename to src/MagnumPlugins/MagnumFont/Test/font.conf diff --git a/src/Plugins/MagnumFont/Test/font.tga b/src/MagnumPlugins/MagnumFont/Test/font.tga similarity index 100% rename from src/Plugins/MagnumFont/Test/font.tga rename to src/MagnumPlugins/MagnumFont/Test/font.tga diff --git a/src/Plugins/MagnumFont/pluginRegistrationMagnumFont.cpp b/src/MagnumPlugins/MagnumFont/pluginRegistration.cpp similarity index 96% rename from src/Plugins/MagnumFont/pluginRegistrationMagnumFont.cpp rename to src/MagnumPlugins/MagnumFont/pluginRegistration.cpp index 374ca3657..ddd27376d 100644 --- a/src/Plugins/MagnumFont/pluginRegistrationMagnumFont.cpp +++ b/src/MagnumPlugins/MagnumFont/pluginRegistration.cpp @@ -22,7 +22,7 @@ DEALINGS IN THE SOFTWARE. */ -#include "MagnumFont/MagnumFont.h" +#include "MagnumPlugins/MagnumFont/MagnumFont.h" CORRADE_PLUGIN_REGISTER(MagnumFont, Magnum::Text::MagnumFont, "cz.mosra.magnum.Text.AbstractFont/0.2.3") diff --git a/src/Plugins/MagnumFontConverter/CMakeLists.txt b/src/MagnumPlugins/MagnumFontConverter/CMakeLists.txt similarity index 98% rename from src/Plugins/MagnumFontConverter/CMakeLists.txt rename to src/MagnumPlugins/MagnumFontConverter/CMakeLists.txt index 5f590b7e8..50bbd169c 100644 --- a/src/Plugins/MagnumFontConverter/CMakeLists.txt +++ b/src/MagnumPlugins/MagnumFontConverter/CMakeLists.txt @@ -34,7 +34,7 @@ set_target_properties(MagnumFontConverterObjects PROPERTIES COMPILE_FLAGS "${CMA add_plugin(MagnumFontConverter ${MAGNUM_PLUGINS_FONTCONVERTER_INSTALL_DIR} MagnumFontConverter.conf $ - pluginRegistrationMagnumFontConverter.cpp) + pluginRegistration.cpp) target_link_libraries(MagnumFontConverter Magnum MagnumText) if(WIN32) diff --git a/src/Plugins/MagnumFontConverter/MagnumFontConverter.conf b/src/MagnumPlugins/MagnumFontConverter/MagnumFontConverter.conf similarity index 100% rename from src/Plugins/MagnumFontConverter/MagnumFontConverter.conf rename to src/MagnumPlugins/MagnumFontConverter/MagnumFontConverter.conf diff --git a/src/Plugins/MagnumFontConverter/MagnumFontConverter.cpp b/src/MagnumPlugins/MagnumFontConverter/MagnumFontConverter.cpp similarity index 95% rename from src/Plugins/MagnumFontConverter/MagnumFontConverter.cpp rename to src/MagnumPlugins/MagnumFontConverter/MagnumFontConverter.cpp index 143c64738..7eeba8d08 100644 --- a/src/Plugins/MagnumFontConverter/MagnumFontConverter.cpp +++ b/src/MagnumPlugins/MagnumFontConverter/MagnumFontConverter.cpp @@ -25,14 +25,14 @@ #include "MagnumFontConverter.h" #include -#include -#include - -#include "ColorFormat.h" -#include "Image.h" -#include "Text/GlyphCache.h" -#include "Text/AbstractFont.h" -#include "TgaImageConverter/TgaImageConverter.h" +#include +#include + +#include "Magnum/ColorFormat.h" +#include "Magnum/Image.h" +#include "Magnum/Text/GlyphCache.h" +#include "Magnum/Text/AbstractFont.h" +#include "MagnumPlugins/TgaImageConverter/TgaImageConverter.h" namespace Magnum { namespace Text { diff --git a/src/Plugins/MagnumFontConverter/MagnumFontConverter.h b/src/MagnumPlugins/MagnumFontConverter/MagnumFontConverter.h similarity index 98% rename from src/Plugins/MagnumFontConverter/MagnumFontConverter.h rename to src/MagnumPlugins/MagnumFontConverter/MagnumFontConverter.h index a1a830861..40dfed169 100644 --- a/src/Plugins/MagnumFontConverter/MagnumFontConverter.h +++ b/src/MagnumPlugins/MagnumFontConverter/MagnumFontConverter.h @@ -28,7 +28,7 @@ * @brief Class Magnum::Text::MagnumFontConverter */ -#include "Text/AbstractFontConverter.h" +#include "Magnum/Text/AbstractFontConverter.h" namespace Magnum { namespace Text { diff --git a/src/Plugins/MagnumFontConverter/Test/CMakeLists.txt b/src/MagnumPlugins/MagnumFontConverter/Test/CMakeLists.txt similarity index 82% rename from src/Plugins/MagnumFontConverter/Test/CMakeLists.txt rename to src/MagnumPlugins/MagnumFontConverter/Test/CMakeLists.txt index 6ca4fda60..7525fb99b 100644 --- a/src/Plugins/MagnumFontConverter/Test/CMakeLists.txt +++ b/src/MagnumPlugins/MagnumFontConverter/Test/CMakeLists.txt @@ -22,11 +22,10 @@ # DEALINGS IN THE SOFTWARE. # -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/magnumFontConverterTestConfigure.h.cmake - ${CMAKE_CURRENT_BINARY_DIR}/magnumFontConverterTestConfigure.h) +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/configure.h.cmake + ${CMAKE_CURRENT_BINARY_DIR}/configure.h) -include_directories(${CMAKE_CURRENT_BINARY_DIR}/../../MagnumFont/Test/ - ${CMAKE_CURRENT_BINARY_DIR}) +include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR}) corrade_add_test(MagnumFontConverterGLTest MagnumFontConverterGLTest.cpp LIBRARIES MagnumFontConverterTestLib diff --git a/src/Plugins/MagnumFontConverter/Test/MagnumFontConverterGLTest.cpp b/src/MagnumPlugins/MagnumFontConverter/Test/MagnumFontConverterGLTest.cpp similarity index 89% rename from src/Plugins/MagnumFontConverter/Test/MagnumFontConverterGLTest.cpp rename to src/MagnumPlugins/MagnumFontConverter/Test/MagnumFontConverterGLTest.cpp index 1563322a4..c2ac760c9 100644 --- a/src/Plugins/MagnumFontConverter/Test/MagnumFontConverterGLTest.cpp +++ b/src/MagnumPlugins/MagnumFontConverter/Test/MagnumFontConverterGLTest.cpp @@ -22,22 +22,21 @@ DEALINGS IN THE SOFTWARE. */ -#include -#include - -#include "ColorFormat.h" -#include "Extensions.h" -#include "TextureFormat.h" -#include "Test/AbstractOpenGLTester.h" -#include "Text/GlyphCache.h" -#include "Trade/ImageData.h" - -#include "Text/AbstractFont.h" -#include "MagnumFontConverter/MagnumFontConverter.h" -#include "TgaImporter/TgaImporter.h" - -#include "magnumFontTestConfigure.h" -#include "magnumFontConverterTestConfigure.h" +#include +#include + +#include "Magnum/ColorFormat.h" +#include "Magnum/Extensions.h" +#include "Magnum/TextureFormat.h" +#include "Magnum/Test/AbstractOpenGLTester.h" +#include "Magnum/Text/GlyphCache.h" +#include "Magnum/Text/AbstractFont.h" +#include "Magnum/Trade/ImageData.h" +#include "MagnumPlugins/MagnumFontConverter/MagnumFontConverter.h" +#include "MagnumPlugins/TgaImporter/TgaImporter.h" + +#include "../../MagnumFont/Test/configure.h" +#include "configure.h" namespace Magnum { namespace Text { namespace Test { diff --git a/src/Plugins/MagnumFontConverter/Test/magnumFontConverterTestConfigure.h.cmake b/src/MagnumPlugins/MagnumFontConverter/Test/configure.h.cmake similarity index 100% rename from src/Plugins/MagnumFontConverter/Test/magnumFontConverterTestConfigure.h.cmake rename to src/MagnumPlugins/MagnumFontConverter/Test/configure.h.cmake diff --git a/src/Plugins/MagnumFontConverter/pluginRegistrationMagnumFontConverter.cpp b/src/MagnumPlugins/MagnumFontConverter/pluginRegistration.cpp similarity index 95% rename from src/Plugins/MagnumFontConverter/pluginRegistrationMagnumFontConverter.cpp rename to src/MagnumPlugins/MagnumFontConverter/pluginRegistration.cpp index 4f7bc44df..36ffb1362 100644 --- a/src/Plugins/MagnumFontConverter/pluginRegistrationMagnumFontConverter.cpp +++ b/src/MagnumPlugins/MagnumFontConverter/pluginRegistration.cpp @@ -22,7 +22,7 @@ DEALINGS IN THE SOFTWARE. */ -#include "MagnumFontConverter/MagnumFontConverter.h" +#include "MagnumPlugins/MagnumFontConverter/MagnumFontConverter.h" CORRADE_PLUGIN_REGISTER(MagnumFontConverter, Magnum::Text::MagnumFontConverter, "cz.mosra.magnum.Text.AbstractFontConverter/0.1.1") diff --git a/src/Plugins/TgaImageConverter/CMakeLists.txt b/src/MagnumPlugins/TgaImageConverter/CMakeLists.txt similarity index 98% rename from src/Plugins/TgaImageConverter/CMakeLists.txt rename to src/MagnumPlugins/TgaImageConverter/CMakeLists.txt index 1efdd806e..c374a2bdf 100644 --- a/src/Plugins/TgaImageConverter/CMakeLists.txt +++ b/src/MagnumPlugins/TgaImageConverter/CMakeLists.txt @@ -34,7 +34,7 @@ set_target_properties(TgaImageConverterObjects PROPERTIES COMPILE_FLAGS "-DTgaIm add_plugin(TgaImageConverter ${MAGNUM_PLUGINS_IMAGECONVERTER_INSTALL_DIR} TgaImageConverter.conf $ - pluginRegistrationTgaImageConverter.cpp) + pluginRegistration.cpp) target_link_libraries(TgaImageConverter Magnum) install(FILES ${TgaImageConverter_HEADERS} DESTINATION ${MAGNUM_PLUGINS_INCLUDE_INSTALL_DIR}/TgaImageConverter) diff --git a/src/Plugins/TgaImageConverter/Test/CMakeLists.txt b/src/MagnumPlugins/TgaImageConverter/Test/CMakeLists.txt similarity index 96% rename from src/Plugins/TgaImageConverter/Test/CMakeLists.txt rename to src/MagnumPlugins/TgaImageConverter/Test/CMakeLists.txt index f1c56f698..874dff234 100644 --- a/src/Plugins/TgaImageConverter/Test/CMakeLists.txt +++ b/src/MagnumPlugins/TgaImageConverter/Test/CMakeLists.txt @@ -25,6 +25,6 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/configure.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/configure.h) -include_directories(${CMAKE_CURRENT_BINARY_DIR}) +include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR}) corrade_add_test(TgaImageConverterTest TgaImageConverterTest.cpp LIBRARIES TgaImageConverterTestLib TgaImporterTestLib) diff --git a/src/Plugins/TgaImageConverter/Test/TgaImageConverterTest.cpp b/src/MagnumPlugins/TgaImageConverter/Test/TgaImageConverterTest.cpp similarity index 92% rename from src/Plugins/TgaImageConverter/Test/TgaImageConverterTest.cpp rename to src/MagnumPlugins/TgaImageConverter/Test/TgaImageConverterTest.cpp index 5b0cc3ace..ff60eae36 100644 --- a/src/Plugins/TgaImageConverter/Test/TgaImageConverterTest.cpp +++ b/src/MagnumPlugins/TgaImageConverter/Test/TgaImageConverterTest.cpp @@ -24,15 +24,15 @@ #include #include -#include -#include -#include - -#include "ColorFormat.h" -#include "Image.h" -#include "Trade/ImageData.h" -#include "TgaImageConverter/TgaImageConverter.h" -#include "TgaImporter/TgaImporter.h" +#include +#include +#include + +#include "Magnum/ColorFormat.h" +#include "Magnum/Image.h" +#include "Magnum/Trade/ImageData.h" +#include "MagnumPlugins/TgaImageConverter/TgaImageConverter.h" +#include "MagnumPlugins/TgaImporter/TgaImporter.h" #include "configure.h" diff --git a/src/Plugins/TgaImageConverter/Test/configure.h.cmake b/src/MagnumPlugins/TgaImageConverter/Test/configure.h.cmake similarity index 100% rename from src/Plugins/TgaImageConverter/Test/configure.h.cmake rename to src/MagnumPlugins/TgaImageConverter/Test/configure.h.cmake diff --git a/src/Plugins/TgaImageConverter/TgaImageConverter.conf b/src/MagnumPlugins/TgaImageConverter/TgaImageConverter.conf similarity index 100% rename from src/Plugins/TgaImageConverter/TgaImageConverter.conf rename to src/MagnumPlugins/TgaImageConverter/TgaImageConverter.conf diff --git a/src/Plugins/TgaImageConverter/TgaImageConverter.cpp b/src/MagnumPlugins/TgaImageConverter/TgaImageConverter.cpp similarity index 94% rename from src/Plugins/TgaImageConverter/TgaImageConverter.cpp rename to src/MagnumPlugins/TgaImageConverter/TgaImageConverter.cpp index 2a733ca71..cf52b18da 100644 --- a/src/Plugins/TgaImageConverter/TgaImageConverter.cpp +++ b/src/MagnumPlugins/TgaImageConverter/TgaImageConverter.cpp @@ -26,21 +26,19 @@ #include #include +#include +#include -#include -#include - -#include "ColorFormat.h" -#include "Image.h" +#include "Magnum/ColorFormat.h" +#include "Magnum/Image.h" +#include "MagnumPlugins/TgaImporter/TgaHeader.h" #ifdef MAGNUM_TARGET_GLES #include -#include "Math/Swizzle.h" -#include "Math/Vector4.h" +#include "Magnum/Math/Swizzle.h" +#include "Magnum/Math/Vector4.h" #endif -#include "TgaImporter/TgaHeader.h" - namespace Magnum { namespace Trade { #ifdef MAGNUM_TARGET_GLES diff --git a/src/Plugins/TgaImageConverter/TgaImageConverter.h b/src/MagnumPlugins/TgaImageConverter/TgaImageConverter.h similarity index 98% rename from src/Plugins/TgaImageConverter/TgaImageConverter.h rename to src/MagnumPlugins/TgaImageConverter/TgaImageConverter.h index da7a73292..4a381068c 100644 --- a/src/Plugins/TgaImageConverter/TgaImageConverter.h +++ b/src/MagnumPlugins/TgaImageConverter/TgaImageConverter.h @@ -28,7 +28,7 @@ * @brief Class Magnum::Trade::TgaImageConverter */ -#include "Trade/AbstractImageConverter.h" +#include "Magnum/Trade/AbstractImageConverter.h" #ifndef DOXYGEN_GENERATING_OUTPUT #ifndef MAGNUM_BUILD_STATIC diff --git a/src/Plugins/TgaImageConverter/pluginRegistrationTgaImageConverter.cpp b/src/MagnumPlugins/TgaImageConverter/pluginRegistration.cpp similarity index 95% rename from src/Plugins/TgaImageConverter/pluginRegistrationTgaImageConverter.cpp rename to src/MagnumPlugins/TgaImageConverter/pluginRegistration.cpp index fe5767e82..d86424f94 100644 --- a/src/Plugins/TgaImageConverter/pluginRegistrationTgaImageConverter.cpp +++ b/src/MagnumPlugins/TgaImageConverter/pluginRegistration.cpp @@ -22,7 +22,7 @@ DEALINGS IN THE SOFTWARE. */ -#include "TgaImageConverter/TgaImageConverter.h" +#include "MagnumPlugins/TgaImageConverter/TgaImageConverter.h" CORRADE_PLUGIN_REGISTER(TgaImageConverter, Magnum::Trade::TgaImageConverter, "cz.mosra.magnum.Trade.AbstractImageConverter/0.2.1") diff --git a/src/Plugins/TgaImporter/CMakeLists.txt b/src/MagnumPlugins/TgaImporter/CMakeLists.txt similarity index 98% rename from src/Plugins/TgaImporter/CMakeLists.txt rename to src/MagnumPlugins/TgaImporter/CMakeLists.txt index 2f893e5f0..1df89a098 100644 --- a/src/Plugins/TgaImporter/CMakeLists.txt +++ b/src/MagnumPlugins/TgaImporter/CMakeLists.txt @@ -35,7 +35,7 @@ set_target_properties(TgaImporterObjects PROPERTIES COMPILE_FLAGS "-DTgaImporter add_plugin(TgaImporter ${MAGNUM_PLUGINS_IMPORTER_INSTALL_DIR} TgaImporter.conf $ - pluginRegistrationTgaImporter.cpp) + pluginRegistration.cpp) target_link_libraries(TgaImporter Magnum) install(FILES ${TgaImporter_HEADERS} DESTINATION ${MAGNUM_PLUGINS_INCLUDE_INSTALL_DIR}/TgaImporter) diff --git a/src/Plugins/TgaImporter/Test/CMakeLists.txt b/src/MagnumPlugins/TgaImporter/Test/CMakeLists.txt similarity index 96% rename from src/Plugins/TgaImporter/Test/CMakeLists.txt rename to src/MagnumPlugins/TgaImporter/Test/CMakeLists.txt index 3e825ad47..cc9dbc3fc 100644 --- a/src/Plugins/TgaImporter/Test/CMakeLists.txt +++ b/src/MagnumPlugins/TgaImporter/Test/CMakeLists.txt @@ -25,6 +25,6 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/configure.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/configure.h) -include_directories(${CMAKE_CURRENT_BINARY_DIR}) +include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR}) corrade_add_test(TgaImporterTest TgaImporterTest.cpp LIBRARIES TgaImporterTestLib) diff --git a/src/Plugins/TgaImporter/Test/TgaImporterTest.cpp b/src/MagnumPlugins/TgaImporter/Test/TgaImporterTest.cpp similarity index 97% rename from src/Plugins/TgaImporter/Test/TgaImporterTest.cpp rename to src/MagnumPlugins/TgaImporter/Test/TgaImporterTest.cpp index 0e3da14ff..b66228ccf 100644 --- a/src/Plugins/TgaImporter/Test/TgaImporterTest.cpp +++ b/src/MagnumPlugins/TgaImporter/Test/TgaImporterTest.cpp @@ -23,13 +23,13 @@ */ #include -#include -#include -#include +#include +#include +#include -#include "ColorFormat.h" -#include "Trade/ImageData.h" -#include "TgaImporter/TgaImporter.h" +#include "Magnum/ColorFormat.h" +#include "Magnum/Trade/ImageData.h" +#include "MagnumPlugins/TgaImporter/TgaImporter.h" #include "configure.h" diff --git a/src/Plugins/TgaImporter/Test/configure.h.cmake b/src/MagnumPlugins/TgaImporter/Test/configure.h.cmake similarity index 100% rename from src/Plugins/TgaImporter/Test/configure.h.cmake rename to src/MagnumPlugins/TgaImporter/Test/configure.h.cmake diff --git a/src/Plugins/TgaImporter/Test/file.tga b/src/MagnumPlugins/TgaImporter/Test/file.tga similarity index 100% rename from src/Plugins/TgaImporter/Test/file.tga rename to src/MagnumPlugins/TgaImporter/Test/file.tga diff --git a/src/Plugins/TgaImporter/TgaHeader.h b/src/MagnumPlugins/TgaImporter/TgaHeader.h similarity index 98% rename from src/Plugins/TgaImporter/TgaHeader.h rename to src/MagnumPlugins/TgaImporter/TgaHeader.h index def766d8e..c7416baea 100644 --- a/src/Plugins/TgaImporter/TgaHeader.h +++ b/src/MagnumPlugins/TgaImporter/TgaHeader.h @@ -28,7 +28,7 @@ * @brief Struct Magnum::Trade::TgaHeader */ -#include +#include "Magnum/Types.h" namespace Magnum { namespace Trade { diff --git a/src/Plugins/TgaImporter/TgaImporter.conf b/src/MagnumPlugins/TgaImporter/TgaImporter.conf similarity index 100% rename from src/Plugins/TgaImporter/TgaImporter.conf rename to src/MagnumPlugins/TgaImporter/TgaImporter.conf diff --git a/src/Plugins/TgaImporter/TgaImporter.cpp b/src/MagnumPlugins/TgaImporter/TgaImporter.cpp similarity index 94% rename from src/Plugins/TgaImporter/TgaImporter.cpp rename to src/MagnumPlugins/TgaImporter/TgaImporter.cpp index f34419edb..f53d32724 100644 --- a/src/Plugins/TgaImporter/TgaImporter.cpp +++ b/src/MagnumPlugins/TgaImporter/TgaImporter.cpp @@ -26,21 +26,23 @@ #include #include -#include -#include +#include +#include -#include "ColorFormat.h" -#include "Trade/ImageData.h" +#include "Magnum/ColorFormat.h" +#include "Magnum/Trade/ImageData.h" +#include "MagnumPlugins/TgaImporter/TgaHeader.h" #ifdef MAGNUM_TARGET_GLES #include -#include "Math/Swizzle.h" -#include "Math/Vector4.h" -#include "Context.h" -#include "Extensions.h" +#include "Magnum/Math/Swizzle.h" +#include "Magnum/Math/Vector4.h" #endif -#include "TgaHeader.h" +#ifdef MAGNUM_TARGET_GLES2 +#include "Magnum/Context.h" +#include "Magnum/Extensions.h" +#endif namespace Magnum { namespace Trade { diff --git a/src/Plugins/TgaImporter/TgaImporter.h b/src/MagnumPlugins/TgaImporter/TgaImporter.h similarity index 97% rename from src/Plugins/TgaImporter/TgaImporter.h rename to src/MagnumPlugins/TgaImporter/TgaImporter.h index ff0bc78a1..0042b9a98 100644 --- a/src/Plugins/TgaImporter/TgaImporter.h +++ b/src/MagnumPlugins/TgaImporter/TgaImporter.h @@ -28,9 +28,9 @@ * @brief Class Magnum::Trade::TgaImporter */ -#include +#include -#include "Trade/AbstractImporter.h" +#include "Magnum/Trade/AbstractImporter.h" #ifndef DOXYGEN_GENERATING_OUTPUT #ifndef MAGNUM_BUILD_STATIC diff --git a/src/Plugins/TgaImporter/pluginRegistrationTgaImporter.cpp b/src/MagnumPlugins/TgaImporter/pluginRegistration.cpp similarity index 96% rename from src/Plugins/TgaImporter/pluginRegistrationTgaImporter.cpp rename to src/MagnumPlugins/TgaImporter/pluginRegistration.cpp index 25a34e435..8b5fd7294 100644 --- a/src/Plugins/TgaImporter/pluginRegistrationTgaImporter.cpp +++ b/src/MagnumPlugins/TgaImporter/pluginRegistration.cpp @@ -22,7 +22,7 @@ DEALINGS IN THE SOFTWARE. */ -#include "TgaImporter.h" +#include "MagnumPlugins/TgaImporter/TgaImporter.h" CORRADE_PLUGIN_REGISTER(TgaImporter, Magnum::Trade::TgaImporter, "cz.mosra.magnum.Trade.AbstractImporter/0.3") diff --git a/src/Plugins/WavAudioImporter/CMakeLists.txt b/src/MagnumPlugins/WavAudioImporter/CMakeLists.txt similarity index 98% rename from src/Plugins/WavAudioImporter/CMakeLists.txt rename to src/MagnumPlugins/WavAudioImporter/CMakeLists.txt index a1a406d74..b55568489 100644 --- a/src/Plugins/WavAudioImporter/CMakeLists.txt +++ b/src/MagnumPlugins/WavAudioImporter/CMakeLists.txt @@ -39,7 +39,7 @@ set_target_properties(WavAudioImporterObjects PROPERTIES COMPILE_FLAGS "-DWavAud add_plugin(WavAudioImporter ${MAGNUM_PLUGINS_AUDIOIMPORTER_INSTALL_DIR} WavAudioImporter.conf $ - pluginRegistrationWavAudioImporter.cpp) + pluginRegistration.cpp) target_link_libraries(WavAudioImporter Magnum MagnumAudio) install(FILES ${WavAudioImporter_HEADERS} DESTINATION ${MAGNUM_PLUGINS_INCLUDE_INSTALL_DIR}/WavAudioImporter) diff --git a/src/Plugins/WavAudioImporter/Test/CMakeLists.txt b/src/MagnumPlugins/WavAudioImporter/Test/CMakeLists.txt similarity index 96% rename from src/Plugins/WavAudioImporter/Test/CMakeLists.txt rename to src/MagnumPlugins/WavAudioImporter/Test/CMakeLists.txt index fda7c7e61..bf72a385b 100644 --- a/src/Plugins/WavAudioImporter/Test/CMakeLists.txt +++ b/src/MagnumPlugins/WavAudioImporter/Test/CMakeLists.txt @@ -25,6 +25,6 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/configure.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/configure.h) -include_directories(${CMAKE_CURRENT_BINARY_DIR}) +include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR}) corrade_add_test(WavAudioImporterTest WavImporterTest.cpp LIBRARIES WavAudioImporterTestLib) diff --git a/src/Plugins/WavAudioImporter/Test/WavImporterTest.cpp b/src/MagnumPlugins/WavAudioImporter/Test/WavImporterTest.cpp similarity index 96% rename from src/Plugins/WavAudioImporter/Test/WavImporterTest.cpp rename to src/MagnumPlugins/WavAudioImporter/Test/WavImporterTest.cpp index 1a9593379..63aad6fdf 100644 --- a/src/Plugins/WavAudioImporter/Test/WavImporterTest.cpp +++ b/src/MagnumPlugins/WavAudioImporter/Test/WavImporterTest.cpp @@ -23,11 +23,11 @@ */ #include -#include -#include -#include +#include +#include +#include -#include "WavAudioImporter/WavImporter.h" +#include "MagnumPlugins/WavAudioImporter/WavImporter.h" #include "configure.h" diff --git a/src/Plugins/WavAudioImporter/Test/configure.h.cmake b/src/MagnumPlugins/WavAudioImporter/Test/configure.h.cmake similarity index 100% rename from src/Plugins/WavAudioImporter/Test/configure.h.cmake rename to src/MagnumPlugins/WavAudioImporter/Test/configure.h.cmake diff --git a/src/Plugins/WavAudioImporter/Test/mono16.wav b/src/MagnumPlugins/WavAudioImporter/Test/mono16.wav similarity index 100% rename from src/Plugins/WavAudioImporter/Test/mono16.wav rename to src/MagnumPlugins/WavAudioImporter/Test/mono16.wav diff --git a/src/Plugins/WavAudioImporter/Test/stereo8.wav b/src/MagnumPlugins/WavAudioImporter/Test/stereo8.wav similarity index 100% rename from src/Plugins/WavAudioImporter/Test/stereo8.wav rename to src/MagnumPlugins/WavAudioImporter/Test/stereo8.wav diff --git a/src/Plugins/WavAudioImporter/Test/unsupportedChannelCount.wav b/src/MagnumPlugins/WavAudioImporter/Test/unsupportedChannelCount.wav similarity index 100% rename from src/Plugins/WavAudioImporter/Test/unsupportedChannelCount.wav rename to src/MagnumPlugins/WavAudioImporter/Test/unsupportedChannelCount.wav diff --git a/src/Plugins/WavAudioImporter/Test/unsupportedFormat.wav b/src/MagnumPlugins/WavAudioImporter/Test/unsupportedFormat.wav similarity index 100% rename from src/Plugins/WavAudioImporter/Test/unsupportedFormat.wav rename to src/MagnumPlugins/WavAudioImporter/Test/unsupportedFormat.wav diff --git a/src/Plugins/WavAudioImporter/Test/wrongSignature.wav b/src/MagnumPlugins/WavAudioImporter/Test/wrongSignature.wav similarity index 100% rename from src/Plugins/WavAudioImporter/Test/wrongSignature.wav rename to src/MagnumPlugins/WavAudioImporter/Test/wrongSignature.wav diff --git a/src/Plugins/WavAudioImporter/WavAudioImporter.conf b/src/MagnumPlugins/WavAudioImporter/WavAudioImporter.conf similarity index 100% rename from src/Plugins/WavAudioImporter/WavAudioImporter.conf rename to src/MagnumPlugins/WavAudioImporter/WavAudioImporter.conf diff --git a/src/Plugins/WavAudioImporter/WavHeader.h b/src/MagnumPlugins/WavAudioImporter/WavHeader.h similarity index 98% rename from src/Plugins/WavAudioImporter/WavHeader.h rename to src/MagnumPlugins/WavAudioImporter/WavHeader.h index 32779d21c..c4d94a8a0 100644 --- a/src/Plugins/WavAudioImporter/WavHeader.h +++ b/src/MagnumPlugins/WavAudioImporter/WavHeader.h @@ -28,7 +28,7 @@ * @brief Struct Magnum::Audio::WavHeader */ -#include "Types.h" +#include "Magnum/Types.h" namespace Magnum { namespace Audio { diff --git a/src/Plugins/WavAudioImporter/WavImporter.cpp b/src/MagnumPlugins/WavAudioImporter/WavImporter.cpp similarity index 96% rename from src/Plugins/WavAudioImporter/WavImporter.cpp rename to src/MagnumPlugins/WavAudioImporter/WavImporter.cpp index b833ab9ab..730a08192 100644 --- a/src/Plugins/WavAudioImporter/WavImporter.cpp +++ b/src/MagnumPlugins/WavAudioImporter/WavImporter.cpp @@ -24,11 +24,11 @@ #include "WavImporter.h" -#include -#include -#include +#include +#include +#include -#include "WavHeader.h" +#include "MagnumPlugins/WavAudioImporter/WavHeader.h" namespace Magnum { namespace Audio { diff --git a/src/Plugins/WavAudioImporter/WavImporter.h b/src/MagnumPlugins/WavAudioImporter/WavImporter.h similarity index 96% rename from src/Plugins/WavAudioImporter/WavImporter.h rename to src/MagnumPlugins/WavAudioImporter/WavImporter.h index 58c8d2c84..45a04fe40 100644 --- a/src/Plugins/WavAudioImporter/WavImporter.h +++ b/src/MagnumPlugins/WavAudioImporter/WavImporter.h @@ -28,10 +28,9 @@ * @brief Class Magnum::Audio::WavImporter */ -#include -#include +#include -#include "Audio/AbstractImporter.h" +#include "Magnum/Audio/AbstractImporter.h" namespace Magnum { namespace Audio { diff --git a/src/Plugins/WavAudioImporter/pluginRegistrationWavAudioImporter.cpp b/src/MagnumPlugins/WavAudioImporter/pluginRegistration.cpp similarity index 95% rename from src/Plugins/WavAudioImporter/pluginRegistrationWavAudioImporter.cpp rename to src/MagnumPlugins/WavAudioImporter/pluginRegistration.cpp index 7b7a69a6b..afcd8b3f6 100644 --- a/src/Plugins/WavAudioImporter/pluginRegistrationWavAudioImporter.cpp +++ b/src/MagnumPlugins/WavAudioImporter/pluginRegistration.cpp @@ -22,7 +22,7 @@ DEALINGS IN THE SOFTWARE. */ -#include "WavAudioImporter/WavImporter.h" +#include "MagnumPlugins/WavAudioImporter/WavImporter.h" CORRADE_PLUGIN_REGISTER(WavAudioImporter, Magnum::Audio::WavImporter, "cz.mosra.magnum.Audio.AbstractImporter/0.1") diff --git a/src/Test/AbstractShaderProgramGLTest.cpp b/src/Test/AbstractShaderProgramGLTest.cpp deleted file mode 100644 index 3f702012b..000000000 --- a/src/Test/AbstractShaderProgramGLTest.cpp +++ /dev/null @@ -1,132 +0,0 @@ -/* - This file is part of Magnum. - - Copyright © 2010, 2011, 2012, 2013 Vladimír Vondruš - - 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 "AbstractShaderProgram.h" -#include "Context.h" -#include "Extensions.h" -#include "Test/AbstractOpenGLTester.h" - -namespace Magnum { namespace Test { - -class AbstractShaderProgramGLTest: public AbstractOpenGLTester { - public: - explicit AbstractShaderProgramGLTest(); - - void construct(); - void constructCopy(); - void constructMove(); - - void label(); -}; - -AbstractShaderProgramGLTest::AbstractShaderProgramGLTest() { - addTests({&AbstractShaderProgramGLTest::construct, - &AbstractShaderProgramGLTest::constructCopy, - &AbstractShaderProgramGLTest::constructMove, - - &AbstractShaderProgramGLTest::label}); -} - -namespace { - -class MyShader: public AbstractShaderProgram { - public: - explicit MyShader() {} - - #ifdef CORRADE_GCC45_COMPATIBILITY - MyShader(const MyShader&) = delete; - MyShader(MyShader&& other): AbstractShaderProgram(std::move(other)) {} - MyShader& operator=(const MyShader&) = delete; - MyShader& operator=(MyShader&& other) { - AbstractShaderProgram::operator=(std::move(other)); - return *this; - } - #endif -}; - -} - -void AbstractShaderProgramGLTest::construct() { - { - const MyShader shader; - - MAGNUM_VERIFY_NO_ERROR(); - CORRADE_VERIFY(shader.id() > 0); - } - - MAGNUM_VERIFY_NO_ERROR(); -} - -void AbstractShaderProgramGLTest::constructCopy() { - #ifndef CORRADE_GCC44_COMPATIBILITY - CORRADE_VERIFY(!(std::is_constructible::value)); - /* GCC 4.6 doesn't have std::is_assignable */ - #ifndef CORRADE_GCC46_COMPATIBILITY - CORRADE_VERIFY(!(std::is_assignable{})); - #endif - #else - CORRADE_SKIP("Type traits needed to test this are not available on GCC 4.4."); - #endif -} - -void AbstractShaderProgramGLTest::constructMove() { - MyShader a; - const Int id = a.id(); - - MAGNUM_VERIFY_NO_ERROR(); - CORRADE_VERIFY(id > 0); - - MyShader b(std::move(a)); - - CORRADE_COMPARE(a.id(), 0); - CORRADE_COMPARE(b.id(), id); - - MyShader c; - const Int cId = c.id(); - c = std::move(b); - - MAGNUM_VERIFY_NO_ERROR(); - CORRADE_VERIFY(cId > 0); - CORRADE_COMPARE(b.id(), cId); - CORRADE_COMPARE(c.id(), id); -} - -void AbstractShaderProgramGLTest::label() { - /* No-Op version is tested in AbstractObjectGLTest */ - if(!Context::current()->isExtensionSupported() && - !Context::current()->isExtensionSupported()) - CORRADE_SKIP("Required extension is not available"); - - MyShader shader; - CORRADE_COMPARE(shader.label(), ""); - - shader.setLabel("MyShader"); - CORRADE_COMPARE(shader.label(), "MyShader"); - - MAGNUM_VERIFY_NO_ERROR(); -} - -}} - -CORRADE_TEST_MAIN(Magnum::Test::AbstractShaderProgramGLTest) diff --git a/src/Test/FramebufferGLTest.cpp b/src/Test/FramebufferGLTest.cpp deleted file mode 100644 index ece22b725..000000000 --- a/src/Test/FramebufferGLTest.cpp +++ /dev/null @@ -1,118 +0,0 @@ -/* - This file is part of Magnum. - - Copyright © 2010, 2011, 2012, 2013 Vladimír Vondruš - - 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 "Context.h" -#include "Extensions.h" -#include "Framebuffer.h" -#include "Test/AbstractOpenGLTester.h" - -namespace Magnum { namespace Test { - -class FramebufferGLTest: public AbstractOpenGLTester { - public: - explicit FramebufferGLTest(); - - void construct(); - void constructCopy(); - void constructMove(); - - void label(); -}; - -FramebufferGLTest::FramebufferGLTest() { - addTests({&FramebufferGLTest::construct, - &FramebufferGLTest::constructCopy, - &FramebufferGLTest::constructMove, - - &FramebufferGLTest::label}); -} - -void FramebufferGLTest::construct() { - { - const Framebuffer framebuffer({{32, 16}, {128, 256}}); - - MAGNUM_VERIFY_NO_ERROR(); - CORRADE_VERIFY(framebuffer.id() > 0); - CORRADE_COMPARE(framebuffer.viewport(), Range2Di({32, 16}, {128, 256})); - } - - MAGNUM_VERIFY_NO_ERROR(); -} - -void FramebufferGLTest::constructCopy() { - #ifndef CORRADE_GCC44_COMPATIBILITY - CORRADE_VERIFY(!(std::is_constructible::value)); - /* GCC 4.6 doesn't have std::is_assignable */ - #ifndef CORRADE_GCC46_COMPATIBILITY - CORRADE_VERIFY(!(std::is_assignable{})); - #endif - #else - CORRADE_SKIP("Type traits needed to test this are not available on GCC 4.4."); - #endif -} - -void FramebufferGLTest::constructMove() { - Framebuffer a({{32, 16}, {128, 256}}); - const Int id = a.id(); - - MAGNUM_VERIFY_NO_ERROR(); - CORRADE_VERIFY(id > 0); - - Framebuffer b(std::move(a)); - - CORRADE_COMPARE(a.id(), 0); - CORRADE_COMPARE(b.id(), id); - CORRADE_COMPARE(b.viewport(), Range2Di({32, 16}, {128, 256})); - - Framebuffer c({{128, 256}, {32, 16}}); - const Int cId = c.id(); - c = std::move(b); - - MAGNUM_VERIFY_NO_ERROR(); - CORRADE_VERIFY(cId > 0); - CORRADE_COMPARE(b.id(), cId); - CORRADE_COMPARE(c.id(), id); - CORRADE_COMPARE(c.viewport(), Range2Di({32, 16}, {128, 256})); -} - -void FramebufferGLTest::label() { - /* No-Op version is tested in AbstractObjectGLTest */ - if(!Context::current()->isExtensionSupported() && - !Context::current()->isExtensionSupported()) - CORRADE_SKIP("Required extension is not available"); - - Framebuffer framebuffer({{}, Vector2i(32)}); - - CORRADE_COMPARE(framebuffer.label(), ""); - MAGNUM_VERIFY_NO_ERROR(); - - framebuffer.setLabel("MyFramebuffer"); - MAGNUM_VERIFY_NO_ERROR(); - - CORRADE_COMPARE(framebuffer.label(), "MyFramebuffer"); -} - -}} - -CORRADE_TEST_MAIN(Magnum::Test::FramebufferGLTest) diff --git a/src/Test/MeshGLTest.cpp b/src/Test/MeshGLTest.cpp deleted file mode 100644 index 297e4dcc6..000000000 --- a/src/Test/MeshGLTest.cpp +++ /dev/null @@ -1,138 +0,0 @@ -/* - This file is part of Magnum. - - Copyright © 2010, 2011, 2012, 2013 Vladimír Vondruš - - 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 "Context.h" -#include "Extensions.h" -#include "Mesh.h" -#include "Test/AbstractOpenGLTester.h" - -namespace Magnum { namespace Test { - -class MeshGLTest: public AbstractOpenGLTester { - public: - explicit MeshGLTest(); - - void construct(); - void constructCopy(); - void constructMove(); - - void label(); -}; - -MeshGLTest::MeshGLTest() { - addTests({&MeshGLTest::construct, - &MeshGLTest::constructCopy, - &MeshGLTest::constructMove, - - &MeshGLTest::label}); -} - -void MeshGLTest::construct() { - { - const Mesh mesh; - - MAGNUM_VERIFY_NO_ERROR(); - - #ifndef MAGNUM_TARGET_GLES - if(Context::current()->isExtensionSupported()) - #elif defined(MAGNUM_TARGET_GLES2) - if(Context::current()->isExtensionSupported()) - #endif - { - CORRADE_VERIFY(mesh.id() > 0); - } - } - - MAGNUM_VERIFY_NO_ERROR(); -} - -void MeshGLTest::constructCopy() { - #ifndef CORRADE_GCC44_COMPATIBILITY - CORRADE_VERIFY(!(std::is_constructible::value)); - /* GCC 4.6 doesn't have std::is_assignable */ - #ifndef CORRADE_GCC46_COMPATIBILITY - CORRADE_VERIFY(!(std::is_assignable{})); - #endif - #else - CORRADE_SKIP("Type traits needed to test this are not available on GCC 4.4."); - #endif -} - -void MeshGLTest::constructMove() { - Mesh a; - const Int id = a.id(); - - MAGNUM_VERIFY_NO_ERROR(); - - #ifndef MAGNUM_TARGET_GLES - if(Context::current()->isExtensionSupported()) - #elif defined(MAGNUM_TARGET_GLES2) - if(Context::current()->isExtensionSupported()) - #endif - { - CORRADE_VERIFY(id > 0); - } - - Mesh b(std::move(a)); - - CORRADE_COMPARE(a.id(), 0); - CORRADE_COMPARE(b.id(), id); - - Mesh c; - const Int cId = c.id(); - c = std::move(b); - - MAGNUM_VERIFY_NO_ERROR(); - - #ifndef MAGNUM_TARGET_GLES - if(Context::current()->isExtensionSupported()) - #elif defined(MAGNUM_TARGET_GLES2) - if(Context::current()->isExtensionSupported()) - #endif - { - CORRADE_VERIFY(cId > 0); - } - - CORRADE_COMPARE(b.id(), cId); - CORRADE_COMPARE(c.id(), id); -} - -void MeshGLTest::label() { - /* No-Op version is tested in AbstractObjectGLTest */ - if(!Context::current()->isExtensionSupported() && - !Context::current()->isExtensionSupported()) - CORRADE_SKIP("Required extension is not available"); - - Mesh mesh; - CORRADE_COMPARE(mesh.label(), ""); - - mesh.setLabel("MyMesh"); - CORRADE_COMPARE(mesh.label(), "MyMesh"); - - MAGNUM_VERIFY_NO_ERROR(); -} - -}} - -CORRADE_TEST_MAIN(Magnum::Test::MeshGLTest)