Browse Source

SceneTools: new library.

Nothing to see here so far.
pull/542/merge
Vladimír Vondruš 4 years ago
parent
commit
1032a09865
  1. 3
      CMakeLists.txt
  2. 2
      doc/building.dox
  3. 6
      doc/changelog.dox
  4. 1
      doc/cmake.dox
  5. 3
      doc/custom-buildsystems-order.dot
  6. 26
      doc/namespaces.dox
  7. 8
      modules/FindMagnum.cmake
  8. 4
      src/Magnum/CMakeLists.txt
  9. 71
      src/Magnum/SceneTools/CMakeLists.txt
  10. 42
      src/Magnum/SceneTools/SceneTools.h
  11. 24
      src/Magnum/SceneTools/Test/CMakeLists.txt
  12. 48
      src/Magnum/SceneTools/visibility.h

3
CMakeLists.txt

@ -113,11 +113,12 @@ cmake_dependent_option(WITH_AUDIO "Build Audio library" OFF "NOT WITH_AL_INFO;NO
option(WITH_DEBUGTOOLS "Build DebugTools library" ON) option(WITH_DEBUGTOOLS "Build DebugTools library" ON)
cmake_dependent_option(WITH_MESHTOOLS "Build MeshTools library" ON "NOT WITH_OBJIMPORTER;NOT WITH_SCENECONVERTER" ON) cmake_dependent_option(WITH_MESHTOOLS "Build MeshTools library" ON "NOT WITH_OBJIMPORTER;NOT WITH_SCENECONVERTER" ON)
option(WITH_SCENEGRAPH "Build SceneGraph library" ON) option(WITH_SCENEGRAPH "Build SceneGraph library" ON)
option(WITH_SCENETOOLS "Build SceneTools library" ON)
option(WITH_SHADERS "Build Shaders library" ON) option(WITH_SHADERS "Build Shaders library" ON)
cmake_dependent_option(WITH_SHADERTOOLS "Build ShaderTools library" ON "NOT WITH_SHADERCONVERTER" ON) cmake_dependent_option(WITH_SHADERTOOLS "Build ShaderTools library" ON "NOT WITH_SHADERCONVERTER" ON)
cmake_dependent_option(WITH_TEXT "Build Text library" ON "NOT WITH_FONTCONVERTER;NOT WITH_MAGNUMFONT;NOT WITH_MAGNUMFONTCONVERTER" ON) cmake_dependent_option(WITH_TEXT "Build Text library" ON "NOT WITH_FONTCONVERTER;NOT WITH_MAGNUMFONT;NOT WITH_MAGNUMFONTCONVERTER" ON)
cmake_dependent_option(WITH_TEXTURETOOLS "Build TextureTools library" ON "NOT WITH_TEXT;NOT WITH_DISTANCEFIELDCONVERTER" ON) cmake_dependent_option(WITH_TEXTURETOOLS "Build TextureTools library" ON "NOT WITH_TEXT;NOT WITH_DISTANCEFIELDCONVERTER" ON)
cmake_dependent_option(WITH_TRADE "Build Trade library" ON "NOT WITH_MESHTOOLS;NOT WITH_PRIMITIVES;NOT WITH_IMAGECONVERTER;NOT WITH_ANYIMAGEIMPORTER;NOT WITH_ANYIMAGECONVERTER;NOT WITH_ANYSCENEIMPORTER;NOT WITH_OBJIMPORTER;NOT WITH_TGAIMAGECONVERTER;NOT WITH_TGAIMPORTER" ON) cmake_dependent_option(WITH_TRADE "Build Trade library" ON "NOT WITH_MESHTOOLS;NOT WITH_PRIMITIVES;NOT WITH_SCENETOOLS;NOT WITH_IMAGECONVERTER;NOT WITH_ANYIMAGEIMPORTER;NOT WITH_ANYIMAGECONVERTER;NOT WITH_ANYSCENEIMPORTER;NOT WITH_OBJIMPORTER;NOT WITH_TGAIMAGECONVERTER;NOT WITH_TGAIMPORTER" ON)
cmake_dependent_option(WITH_GL "Build GL library" ON "NOT WITH_SHADERS;NOT WITH_GL_INFO;NOT WITH_ANDROIDAPPLICATION;NOT WITH_WINDOWLESSIOSAPPLICATION;NOT WITH_CGLCONTEXT;NOT WITH_GLXAPPLICATION;NOT WITH_GLXCONTEXT;NOT WITH_XEGLAPPLICATION;NOT WITH_WINDOWLESSWGLAPPLICATION;NOT WITH_WGLCONTEXT;NOT WITH_WINDOWLESSWINDOWSEGLAPPLICATION;NOT WITH_DISTANCEFIELDCONVERTER" ON) cmake_dependent_option(WITH_GL "Build GL library" ON "NOT WITH_SHADERS;NOT WITH_GL_INFO;NOT WITH_ANDROIDAPPLICATION;NOT WITH_WINDOWLESSIOSAPPLICATION;NOT WITH_CGLCONTEXT;NOT WITH_GLXAPPLICATION;NOT WITH_GLXCONTEXT;NOT WITH_XEGLAPPLICATION;NOT WITH_WINDOWLESSWGLAPPLICATION;NOT WITH_WGLCONTEXT;NOT WITH_WINDOWLESSWINDOWSEGLAPPLICATION;NOT WITH_DISTANCEFIELDCONVERTER" ON)
option(WITH_PRIMITIVES "Build Primitives library" ON) option(WITH_PRIMITIVES "Build Primitives library" ON)

2
doc/building.dox

@ -488,6 +488,8 @@ specify which parts will be built and which not:
- `WITH_PRIMITIVES` --- Build the @ref Primitives library. Enables also - `WITH_PRIMITIVES` --- Build the @ref Primitives library. Enables also
building of the Trade library. building of the Trade library.
- `WITH_SCENEGRAPH` --- Build the @ref SceneGraph library - `WITH_SCENEGRAPH` --- Build the @ref SceneGraph library
- `WITH_SCENETOOLS` --- Build the @ref SceneTools library. Enables also
building of the Trade library.
- `WITH_SHADERS` --- Build the @ref Shaders library. Enables also building of - `WITH_SHADERS` --- Build the @ref Shaders library. Enables also building of
the GL library. the GL library.
- `WITH_SHADERTOOLS` --- Build the @ref ShaderTools library - `WITH_SHADERTOOLS` --- Build the @ref ShaderTools library

6
doc/changelog.dox

@ -177,6 +177,12 @@ See also:
- Added @ref SceneGraph::Object::move() - Added @ref SceneGraph::Object::move()
@subsubsection changelog-latest-new-scenetools SceneTools library
- New @ref SceneTools library that'll be a home for various whole-scene
optimization algorithms such as hierarchy flattening, redundant node
removal and such
@subsubsection changelog-latest-new-shaders Shaders library @subsubsection changelog-latest-new-shaders Shaders library
- All builtin shaders now have opt-in support for uniform buffers on desktop, - All builtin shaders now have opt-in support for uniform buffers on desktop,

1
doc/cmake.dox

@ -196,6 +196,7 @@ the components. The optional components are:
- `MeshTools` --- @ref MeshTools library - `MeshTools` --- @ref MeshTools library
- `Primitives` --- @ref Primitives library - `Primitives` --- @ref Primitives library
- `SceneGraph` --- @ref SceneGraph library - `SceneGraph` --- @ref SceneGraph library
- `SceneTools` --- @ref SceneTools library
- `Shaders` --- @ref Shaders library - `Shaders` --- @ref Shaders library
- `ShaderTools` --- @ref ShaderTools library - `ShaderTools` --- @ref ShaderTools library
- `Text` --- @ref Text library - `Text` --- @ref Text library

3
doc/custom-buildsystems-order.dot

@ -44,6 +44,7 @@ digraph "Magnum library dependency order" {
MagnumOpenGLTester [label="Magnum\nOpenGLTester" class="m-info"] MagnumOpenGLTester [label="Magnum\nOpenGLTester" class="m-info"]
MagnumPrimitives [label="Magnum\nPrimitives" class="m-info"] MagnumPrimitives [label="Magnum\nPrimitives" class="m-info"]
MagnumSceneGraph [label="Magnum\nSceneGraph" class="m-info"] MagnumSceneGraph [label="Magnum\nSceneGraph" class="m-info"]
MagnumSceneTools [label="Magnum\nSceneTools" class="m-info"]
MagnumShaders [label="Magnum\nShaders" class="m-info"] MagnumShaders [label="Magnum\nShaders" class="m-info"]
MagnumShaderTools [label="Magnum\nShaderTools" class="m-info"] MagnumShaderTools [label="Magnum\nShaderTools" class="m-info"]
MagnumText [label="Magnum\nText" class="m-info"] MagnumText [label="Magnum\nText" class="m-info"]
@ -83,6 +84,8 @@ digraph "Magnum library dependency order" {
MagnumPrimitives -> MagnumMeshTools MagnumPrimitives -> MagnumMeshTools
MagnumPrimitives -> MagnumTrade MagnumPrimitives -> MagnumTrade
MagnumSceneTools -> MagnumTrade
MagnumSceneGraph -> Magnum MagnumSceneGraph -> Magnum
MagnumShaders -> MagnumGL MagnumShaders -> MagnumGL

26
doc/namespaces.dox

@ -419,6 +419,32 @@ target_link_libraries(your-app PRIVATE Magnum::SceneGraph)
See @ref building, @ref cmake and @ref scenegraph for more information. See @ref building, @ref cmake and @ref scenegraph for more information.
*/ */
/** @dir Magnum/SceneTools
* @brief Namespace @ref Magnum::SceneTools
* @m_since_latest
*/
/** @namespace Magnum::SceneTools
@brief Scene tools
@m_since_latest
Scene manipulation and optimization tools.
This library is built if `WITH_SCENETOOLS` is enabled when building Magnum. To
use this library with CMake, request the `SceneTools` component of the
`Magnum` package and link to the `Magnum::SceneTools` target:
@code{.cmake}
find_package(Magnum REQUIRED SceneTools)
# ...
target_link_libraries(your-app PRIVATE Magnum::SceneTools)
@endcode
Additional utilities are built separately. See the
@ref magnum-sceneconverter "magnum-sceneconverter" utility documentation,
@ref building and @ref cmake for more information.
*/
/** @dir Magnum/Shaders /** @dir Magnum/Shaders
* @brief Namespace @ref Magnum::Shaders * @brief Namespace @ref Magnum::Shaders
*/ */

8
modules/FindMagnum.cmake

@ -60,6 +60,7 @@
# MeshTools - MeshTools library # MeshTools - MeshTools library
# Primitives - Primitives library # Primitives - Primitives library
# SceneGraph - SceneGraph library # SceneGraph - SceneGraph library
# SceneTools - SceneTools library
# Shaders - Shaders library # Shaders - Shaders library
# ShaderTools - ShaderTools library # ShaderTools - ShaderTools library
# Text - Text library # Text - Text library
@ -229,7 +230,7 @@ foreach(_component ${Magnum_FIND_COMPONENTS})
# Unrolling the transitive dependencies here so this doesn't need to be # Unrolling the transitive dependencies here so this doesn't need to be
# after resolving inter-component dependencies. Listing also all plugins. # after resolving inter-component dependencies. Listing also all plugins.
if(_component MATCHES "^(Audio|DebugTools|MeshTools|Primitives|ShaderTools|Text|TextureTools|Trade|.+Importer|.+ImageConverter|.+Font|.+ShaderConverter)$") if(_component MATCHES "^(Audio|DebugTools|MeshTools|Primitives|SceneTools|ShaderTools|Text|TextureTools|Trade|.+Importer|.+ImageConverter|.+Font|.+ShaderConverter)$")
set(_MAGNUM_${_COMPONENT}_CORRADE_DEPENDENCIES PluginManager) set(_MAGNUM_${_COMPONENT}_CORRADE_DEPENDENCIES PluginManager)
endif() endif()
@ -354,8 +355,8 @@ endif()
# Component distinction (listing them explicitly to avoid mistakes with finding # Component distinction (listing them explicitly to avoid mistakes with finding
# components from other repositories) # components from other repositories)
set(_MAGNUM_LIBRARY_COMPONENTS set(_MAGNUM_LIBRARY_COMPONENTS
Audio DebugTools GL MeshTools Primitives SceneGraph Shaders ShaderTools Audio DebugTools GL MeshTools Primitives SceneGraph SceneTools Shaders
Text TextureTools Trade ShaderTools Text TextureTools Trade
WindowlessEglApplication EglContext OpenGLTester) WindowlessEglApplication EglContext OpenGLTester)
set(_MAGNUM_PLUGIN_COMPONENTS set(_MAGNUM_PLUGIN_COMPONENTS
AnyAudioImporter AnyImageConverter AnyImageImporter AnySceneConverter AnyAudioImporter AnyImageConverter AnyImageImporter AnySceneConverter
@ -452,6 +453,7 @@ if(MAGNUM_TARGET_GL)
list(APPEND _MAGNUM_Primitives_DEPENDENCIES GL) list(APPEND _MAGNUM_Primitives_DEPENDENCIES GL)
endif() endif()
set(_MAGNUM_SceneGraph_DEPENDENCIES ) set(_MAGNUM_SceneGraph_DEPENDENCIES )
set(_MAGNUM_SceneTools_DEPENDENCIES Trade)
set(_MAGNUM_Shaders_DEPENDENCIES GL) set(_MAGNUM_Shaders_DEPENDENCIES GL)
set(_MAGNUM_Text_DEPENDENCIES TextureTools) set(_MAGNUM_Text_DEPENDENCIES TextureTools)
if(MAGNUM_TARGET_GL) if(MAGNUM_TARGET_GL)

4
src/Magnum/CMakeLists.txt

@ -214,6 +214,10 @@ if(WITH_SCENEGRAPH)
add_subdirectory(SceneGraph) add_subdirectory(SceneGraph)
endif() endif()
if(WITH_SCENETOOLS)
add_subdirectory(SceneTools)
endif()
if(WITH_SHADERS) if(WITH_SHADERS)
add_subdirectory(Shaders) add_subdirectory(Shaders)
endif() endif()

71
src/Magnum/SceneTools/CMakeLists.txt

@ -0,0 +1,71 @@
#
# This file is part of Magnum.
#
# Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019,
# 2020, 2021 Vladimír Vondruš <mosra@centrum.cz>
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
#
set(MagnumSceneTools_HEADERS
SceneTools.h
visibility.h)
# Main SceneTools library
add_library(MagnumSceneTools INTERFACE
${MagnumSceneTools_HEADERS})
set_target_properties(MagnumSceneTools PROPERTIES
DEBUG_POSTFIX "-d"
FOLDER "Magnum/SceneTools")
if(NOT BUILD_STATIC)
set_target_properties(MagnumSceneTools PROPERTIES VERSION ${MAGNUM_LIBRARY_VERSION} SOVERSION ${MAGNUM_LIBRARY_SOVERSION})
elseif(BUILD_STATIC_PIC)
set_target_properties(MagnumSceneTools PROPERTIES POSITION_INDEPENDENT_CODE ON)
endif()
#target_link_libraries(MagnumSceneTools PUBLIC
#Magnum
#MagnumTrade)
install(TARGETS MagnumSceneTools
RUNTIME DESTINATION ${MAGNUM_BINARY_INSTALL_DIR}
LIBRARY DESTINATION ${MAGNUM_LIBRARY_INSTALL_DIR}
ARCHIVE DESTINATION ${MAGNUM_LIBRARY_INSTALL_DIR})
install(FILES ${MagnumSceneTools_HEADERS} DESTINATION ${MAGNUM_INCLUDE_INSTALL_DIR}/SceneTools)
if(BUILD_TESTS)
# Library with graceful assert for testing
add_library(MagnumSceneToolsTestLib INTERFACE )
#set_target_properties(MagnumSceneToolsTestLib PROPERTIES
#DEBUG_POSTFIX "-d"
#FOLDER "Magnum/SceneTools")
#target_compile_definitions(MagnumSceneToolsTestLib PRIVATE
#"CORRADE_GRACEFUL_ASSERT" "MagnumSceneTools_EXPORTS")
if(BUILD_STATIC_PIC)
set_target_properties(MagnumSceneToolsTestLib PROPERTIES POSITION_INDEPENDENT_CODE ON)
endif()
#target_link_libraries(MagnumSceneToolsTestLib PUBLIC
#Magnum
#MagnumTrade)
add_subdirectory(Test)
endif()
# Magnum SceneTools target alias for superprojects
add_library(Magnum::SceneTools ALIAS MagnumSceneTools)

42
src/Magnum/SceneTools/SceneTools.h

@ -0,0 +1,42 @@
#ifndef Magnum_SceneTools_SceneTools_h
#define Magnum_SceneTools_SceneTools_h
/*
This file is part of Magnum.
Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019,
2020, 2021 Vladimír Vondruš <mosra@centrum.cz>
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*/
/** @file
* @brief Forward declarations for the @ref Magnum::SceneTools namespace
* @m_since_latest
*/
#include "Magnum/configure.h"
namespace Magnum { namespace SceneTools {
#ifndef DOXYGEN_GENERATING_OUTPUT
#endif
}}
#endif

24
src/Magnum/SceneTools/Test/CMakeLists.txt

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

48
src/Magnum/SceneTools/visibility.h

@ -0,0 +1,48 @@
#ifndef Magnum_SceneTools_visibility_h
#define Magnum_SceneTools_visibility_h
/*
This file is part of Magnum.
Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019,
2020, 2021 Vladimír Vondruš <mosra@centrum.cz>
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*/
#include <Corrade/Utility/VisibilityMacros.h>
#include "Magnum/configure.h"
#ifndef DOXYGEN_GENERATING_OUTPUT
#ifndef MAGNUM_BUILD_STATIC
#if defined(MagnumSceneTools_EXPORTS) || defined(MagnumSceneToolsObjects_EXPORTS)
#define MAGNUM_SCENETOOLS_EXPORT CORRADE_VISIBILITY_EXPORT
#else
#define MAGNUM_SCENETOOLS_EXPORT CORRADE_VISIBILITY_IMPORT
#endif
#else
#define MAGNUM_SCENETOOLS_EXPORT CORRADE_VISIBILITY_STATIC
#endif
#define MAGNUM_SCENETOOLS_LOCAL CORRADE_VISIBILITY_LOCAL
#else
#define MAGNUM_SCENETOOLS_EXPORT
#define MAGNUM_SCENETOOLS_LOCAL
#endif
#endif
Loading…
Cancel
Save