Browse Source

Shaders: allow building this library with MAGNUM_TARGET_GL turned off.

So far it contains just the uniform definitions and utilities related
to line drawing, nothing else, but especially the line utilities were
needed to be able to build MeshTools tests on a GL-less build.
pull/674/head
Vladimír Vondruš 1 year ago
parent
commit
1709a4ad2b
  1. 2
      CMakeLists.txt
  2. 6
      doc/building.dox
  3. 3
      doc/changelog.dox
  4. 2
      doc/custom-buildsystems-order.dot
  5. 5
      modules/FindMagnum.cmake
  6. 99
      src/Magnum/Shaders/CMakeLists.txt
  7. 4
      src/Magnum/Shaders/DistanceFieldVector.h
  8. 20
      src/Magnum/Shaders/DistanceFieldVectorGL.h
  9. 4
      src/Magnum/Shaders/Flat.h
  10. 20
      src/Magnum/Shaders/FlatGL.h
  11. 2
      src/Magnum/Shaders/Generic.h
  12. 8
      src/Magnum/Shaders/GenericGL.h
  13. 22
      src/Magnum/Shaders/LineGL.h
  14. 4
      src/Magnum/Shaders/MeshVisualizer.h
  15. 16
      src/Magnum/Shaders/MeshVisualizerGL.h
  16. 4
      src/Magnum/Shaders/Phong.h
  17. 12
      src/Magnum/Shaders/PhongGL.h
  18. 12
      src/Magnum/Shaders/Shaders.h
  19. 37
      src/Magnum/Shaders/Test/CMakeLists.txt
  20. 4
      src/Magnum/Shaders/Vector.h
  21. 20
      src/Magnum/Shaders/VectorGL.h
  22. 8
      src/Magnum/Shaders/VertexColor.h
  23. 20
      src/Magnum/Shaders/VertexColorGL.h

2
CMakeLists.txt

@ -245,7 +245,7 @@ cmake_dependent_option(MAGNUM_WITH_SHADERTOOLS "Build ShaderTools library" ON "N
cmake_dependent_option(MAGNUM_WITH_TEXT "Build Text library" ON "NOT MAGNUM_WITH_FONTCONVERTER;NOT MAGNUM_WITH_MAGNUMFONT;NOT MAGNUM_WITH_MAGNUMFONTCONVERTER" ON) cmake_dependent_option(MAGNUM_WITH_TEXT "Build Text library" ON "NOT MAGNUM_WITH_FONTCONVERTER;NOT MAGNUM_WITH_MAGNUMFONT;NOT MAGNUM_WITH_MAGNUMFONTCONVERTER" ON)
cmake_dependent_option(MAGNUM_WITH_TEXTURETOOLS "Build TextureTools library" ON "NOT MAGNUM_WITH_TEXT;NOT MAGNUM_WITH_DISTANCEFIELDCONVERTER" ON) cmake_dependent_option(MAGNUM_WITH_TEXTURETOOLS "Build TextureTools library" ON "NOT MAGNUM_WITH_TEXT;NOT MAGNUM_WITH_DISTANCEFIELDCONVERTER" ON)
cmake_dependent_option(MAGNUM_WITH_TRADE "Build Trade library" ON "NOT MAGNUM_WITH_MATERIALTOOLS;NOT MAGNUM_WITH_MESHTOOLS;NOT MAGNUM_WITH_PRIMITIVES;NOT MAGNUM_WITH_SCENETOOLS;NOT MAGNUM_WITH_IMAGECONVERTER;NOT MAGNUM_WITH_ANYIMAGEIMPORTER;NOT MAGNUM_WITH_ANYIMAGECONVERTER;NOT MAGNUM_WITH_ANYSCENEIMPORTER;NOT MAGNUM_WITH_OBJIMPORTER;NOT MAGNUM_WITH_TGAIMAGECONVERTER;NOT MAGNUM_WITH_TGAIMPORTER" ON) cmake_dependent_option(MAGNUM_WITH_TRADE "Build Trade library" ON "NOT MAGNUM_WITH_MATERIALTOOLS;NOT MAGNUM_WITH_MESHTOOLS;NOT MAGNUM_WITH_PRIMITIVES;NOT MAGNUM_WITH_SCENETOOLS;NOT MAGNUM_WITH_IMAGECONVERTER;NOT MAGNUM_WITH_ANYIMAGEIMPORTER;NOT MAGNUM_WITH_ANYIMAGECONVERTER;NOT MAGNUM_WITH_ANYSCENEIMPORTER;NOT MAGNUM_WITH_OBJIMPORTER;NOT MAGNUM_WITH_TGAIMAGECONVERTER;NOT MAGNUM_WITH_TGAIMPORTER" ON)
cmake_dependent_option(MAGNUM_WITH_GL "Build GL library" ON "NOT MAGNUM_WITH_SHADERS;NOT MAGNUM_WITH_GL_INFO;NOT MAGNUM_WITH_ANDROIDAPPLICATION;NOT MAGNUM_WITH_WINDOWLESSIOSAPPLICATION;NOT MAGNUM_WITH_WINDOWLESSCGLAPPLICATION;NOT MAGNUM_WITH_WINDOWLESSGLXAPPLICATION;NOT MAGNUM_WITH_CGLCONTEXT;NOT MAGNUM_WITH_GLXAPPLICATION;NOT MAGNUM_WITH_GLXCONTEXT;NOT MAGNUM_WITH_XEGLAPPLICATION;NOT MAGNUM_WITH_WINDOWLESSWGLAPPLICATION;NOT MAGNUM_WITH_WGLCONTEXT;NOT MAGNUM_WITH_DISTANCEFIELDCONVERTER" ON) cmake_dependent_option(MAGNUM_WITH_GL "Build GL library" ON "NOT MAGNUM_WITH_GL_INFO;NOT MAGNUM_WITH_ANDROIDAPPLICATION;NOT MAGNUM_WITH_WINDOWLESSIOSAPPLICATION;NOT MAGNUM_WITH_WINDOWLESSCGLAPPLICATION;NOT MAGNUM_WITH_WINDOWLESSGLXAPPLICATION;NOT MAGNUM_WITH_CGLCONTEXT;NOT MAGNUM_WITH_GLXAPPLICATION;NOT MAGNUM_WITH_GLXCONTEXT;NOT MAGNUM_WITH_XEGLAPPLICATION;NOT MAGNUM_WITH_WINDOWLESSWGLAPPLICATION;NOT MAGNUM_WITH_WGLCONTEXT;NOT MAGNUM_WITH_DISTANCEFIELDCONVERTER" ON)
cmake_dependent_option(MAGNUM_TARGET_GL "Build libraries with OpenGL interoperability" ON "MAGNUM_WITH_GL" OFF) cmake_dependent_option(MAGNUM_TARGET_GL "Build libraries with OpenGL interoperability" ON "MAGNUM_WITH_GL" OFF)

6
doc/building.dox

@ -563,8 +563,7 @@ can specify which parts will be built and which not:
- `MAGNUM_WITH_AUDIO` --- Build the @ref Audio library. Depends on - `MAGNUM_WITH_AUDIO` --- Build the @ref Audio library. Depends on
[OpenAL](https://www.openal.org/), not enabled by default. [OpenAL](https://www.openal.org/), not enabled by default.
- `MAGNUM_WITH_DEBUGTOOLS` --- Build the @ref DebugTools library. - `MAGNUM_WITH_DEBUGTOOLS` --- Build the @ref DebugTools library.
- `MAGNUM_WITH_GL` --- Build the @ref GL library. Enabled automatically if - `MAGNUM_WITH_GL` --- Build the @ref GL library
`MAGNUM_WITH_SHADERS` is enabled.
- `MAGNUM_WITH_MATERIALTOOLS` --- Build the @ref MaterialTools library. - `MAGNUM_WITH_MATERIALTOOLS` --- Build the @ref MaterialTools library.
Enables also building of the @ref Trade library. Enables also building of the @ref Trade library.
- `MAGNUM_WITH_MESHTOOLS` --- Build the @ref MeshTools library. Enables also - `MAGNUM_WITH_MESHTOOLS` --- Build the @ref MeshTools library. Enables also
@ -574,8 +573,7 @@ can specify which parts will be built and which not:
- `MAGNUM_WITH_SCENEGRAPH` --- Build the @ref SceneGraph library - `MAGNUM_WITH_SCENEGRAPH` --- Build the @ref SceneGraph library
- `MAGNUM_WITH_SCENETOOLS` --- Build the @ref SceneTools library. Enables - `MAGNUM_WITH_SCENETOOLS` --- Build the @ref SceneTools library. Enables
also building of the @ref Trade library. also building of the @ref Trade library.
- `MAGNUM_WITH_SHADERS` --- Build the @ref Shaders library. Enables also - `MAGNUM_WITH_SHADERS` --- Build the @ref Shaders library
building of the @ref GL library.
- `MAGNUM_WITH_SHADERTOOLS` --- Build the @ref ShaderTools library - `MAGNUM_WITH_SHADERTOOLS` --- Build the @ref ShaderTools library
- `MAGNUM_WITH_TEXT` --- Build the @ref Text library. Enables also building - `MAGNUM_WITH_TEXT` --- Build the @ref Text library. Enables also building
of the @ref TextureTools library. of the @ref TextureTools library.

3
doc/changelog.dox

@ -892,6 +892,9 @@ See also:
@subsubsection changelog-latest-changes-shaders Shaders library @subsubsection changelog-latest-changes-shaders Shaders library
- This library no longer has a hard dependency on OpenGL. If
@ref MAGNUM_TARGET_GL is not enabled, this library will contain just
uniform struct definitions and related utilities.
- In the original implementation of normal mapping in @ref Shaders::PhongGL, - In the original implementation of normal mapping in @ref Shaders::PhongGL,
there shader didn't provide a way to supply bitangent direction, forcing there shader didn't provide a way to supply bitangent direction, forcing
users to patch normal maps. This is now possible using newly added users to patch normal maps. This is now possible using newly added

2
doc/custom-buildsystems-order.dot

@ -92,7 +92,7 @@ digraph "Magnum library dependency order" {
MagnumSceneGraph -> Magnum MagnumSceneGraph -> Magnum
MagnumShaders -> MagnumGL MagnumShaders -> MagnumGL [style=dotted]
MagnumShaderTools -> Magnum MagnumShaderTools -> Magnum
MagnumShaderTools -> CorradePluginManager MagnumShaderTools -> CorradePluginManager

5
modules/FindMagnum.cmake

@ -491,7 +491,10 @@ endif()
set(_MAGNUM_SceneGraph_DEPENDENCIES ) set(_MAGNUM_SceneGraph_DEPENDENCIES )
set(_MAGNUM_SceneTools_DEPENDENCIES Trade) set(_MAGNUM_SceneTools_DEPENDENCIES Trade)
set(_MAGNUM_Shaders_DEPENDENCIES GL) set(_MAGNUM_Shaders_DEPENDENCIES )
if(MAGNUM_TARGET_GL)
list(APPEND _MAGNUM_Shaders_DEPENDENCIES GL)
endif()
set(_MAGNUM_Text_DEPENDENCIES TextureTools) set(_MAGNUM_Text_DEPENDENCIES TextureTools)
if(MAGNUM_TARGET_GL) if(MAGNUM_TARGET_GL)

99
src/Magnum/Shaders/CMakeLists.txt

@ -28,23 +28,40 @@
# property that would have to be set on each target separately. # property that would have to be set on each target separately.
set(CMAKE_FOLDER "Magnum/Shaders") set(CMAKE_FOLDER "Magnum/Shaders")
if(NOT MAGNUM_WITH_GL) set(MagnumShaders_SRCS )
message(SEND_ERROR "Shaders are available only if MAGNUM_WITH_GL is enabled")
endif() set(MagnumShaders_GracefulAssert_SRCS
Line.cpp)
set(MagnumShaders_HEADERS
DistanceFieldVector.h
Flat.h
Generic.h
Line.h
MeshVisualizer.h
Phong.h
Shaders.h
Vector.h
if(MAGNUM_TARGET_GLES2) visibility.h)
# Header files to display in project view of IDEs only
set(MagnumShaders_PRIVATE_HEADERS
Implementation/lineMiterLimit.h)
if(MAGNUM_TARGET_GL)
if(MAGNUM_TARGET_GLES2)
corrade_add_resource(MagnumShaders_RESOURCES_GL resources-gles2.conf) corrade_add_resource(MagnumShaders_RESOURCES_GL resources-gles2.conf)
else() else()
corrade_add_resource(MagnumShaders_RESOURCES_GL resources-gl.conf) corrade_add_resource(MagnumShaders_RESOURCES_GL resources-gl.conf)
endif() endif()
set(MagnumShaders_SRCS list(APPEND MagnumShaders_SRCS
${MagnumShaders_RESOURCES_GL}) ${MagnumShaders_RESOURCES_GL})
set(MagnumShaders_GracefulAssert_SRCS list(APPEND MagnumShaders_GracefulAssert_SRCS
DistanceFieldVectorGL.cpp DistanceFieldVectorGL.cpp
FlatGL.cpp FlatGL.cpp
Line.cpp
MeshVisualizerGL.cpp MeshVisualizerGL.cpp
PhongGL.cpp PhongGL.cpp
VectorGL.cpp VectorGL.cpp
@ -52,68 +69,62 @@ set(MagnumShaders_GracefulAssert_SRCS
glShaderWrapper.cpp) glShaderWrapper.cpp)
set(MagnumShaders_HEADERS list(APPEND MagnumShaders_HEADERS
DistanceFieldVector.h
DistanceFieldVectorGL.h DistanceFieldVectorGL.h
Flat.h
FlatGL.h FlatGL.h
Generic.h
GenericGL.h GenericGL.h
Line.h
MeshVisualizer.h
MeshVisualizerGL.h MeshVisualizerGL.h
Phong.h
PhongGL.h PhongGL.h
Shaders.h
Vector.h
VectorGL.h VectorGL.h
VertexColorGL.h VertexColorGL.h
glShaderWrapper.h glShaderWrapper.h)
visibility.h)
# Header files to display in project view of IDEs only
set(MagnumShaders_PRIVATE_HEADERS
Implementation/lineMiterLimit.h)
if(NOT MAGNUM_TARGET_GLES2) if(NOT MAGNUM_TARGET_GLES2)
list(APPEND MagnumShaders_GracefulAssert_SRCS list(APPEND MagnumShaders_GracefulAssert_SRCS
LineGL.cpp) LineGL.cpp)
list(APPEND MagnumShaders_HEADERS list(APPEND MagnumShaders_HEADERS
LineGL.h) LineGL.h)
endif() endif()
if(MAGNUM_BUILD_DEPRECATED) if(MAGNUM_BUILD_DEPRECATED)
list(APPEND MagnumShaders_HEADERS list(APPEND MagnumShaders_HEADERS
VertexColor.h) VertexColor.h)
endif()
endif() endif()
# Objects shared between main and test library # Objects shared between main and test library. On non-GL builds contains
add_library(MagnumShadersObjects OBJECT # nothing so it's not even defined.
if(MAGNUM_TARGET_GL)
add_library(MagnumShadersObjects OBJECT
${MagnumShaders_SRCS} ${MagnumShaders_SRCS}
${MagnumShaders_HEADERS} ${MagnumShaders_HEADERS}
${MagnumShaders_PRIVATE_HEADERS}) ${MagnumShaders_PRIVATE_HEADERS})
if(MAGNUM_BUILD_STATIC) if(MAGNUM_BUILD_STATIC)
# On the static build we're importing the resources manually, so no need to # On the static build we're importing the resources manually, so no need to
# have the implicit initializers as well. # have the implicit initializers as well.
set_property(SOURCE ${MagnumShaders_RCS} APPEND PROPERTY COMPILE_DEFINITIONS set_property(SOURCE ${MagnumShaders_RCS} APPEND PROPERTY COMPILE_DEFINITIONS
"CORRADE_AUTOMATIC_INITIALIZER=CORRADE_NOOP" "CORRADE_AUTOMATIC_INITIALIZER=CORRADE_NOOP"
"CORRADE_AUTOMATIC_FINALIZER=CORRADE_NOOP") "CORRADE_AUTOMATIC_FINALIZER=CORRADE_NOOP")
endif() endif()
target_include_directories(MagnumShadersObjects PUBLIC target_include_directories(MagnumShadersObjects PUBLIC
$<TARGET_PROPERTY:Magnum,INTERFACE_INCLUDE_DIRECTORIES> $<TARGET_PROPERTY:Magnum,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:MagnumGL,INTERFACE_INCLUDE_DIRECTORIES>) $<TARGET_PROPERTY:MagnumGL,INTERFACE_INCLUDE_DIRECTORIES>)
if(NOT MAGNUM_BUILD_STATIC) if(NOT MAGNUM_BUILD_STATIC)
target_compile_definitions(MagnumShadersObjects PRIVATE "MagnumShadersObjects_EXPORTS") target_compile_definitions(MagnumShadersObjects PRIVATE "MagnumShadersObjects_EXPORTS")
endif() endif()
if(NOT MAGNUM_BUILD_STATIC OR MAGNUM_BUILD_STATIC_PIC) if(NOT MAGNUM_BUILD_STATIC OR MAGNUM_BUILD_STATIC_PIC)
set_target_properties(MagnumShadersObjects PROPERTIES POSITION_INDEPENDENT_CODE ON) set_target_properties(MagnumShadersObjects PROPERTIES POSITION_INDEPENDENT_CODE ON)
endif()
set(MagnumShadersObjects_OBJECTS $<TARGET_OBJECTS:MagnumShadersObjects>)
else()
set(MagnumShadersObjects_OBJECTS )
endif() endif()
# Main Shaders library # Main Shaders library
add_library(MagnumShaders ${SHARED_OR_STATIC} add_library(MagnumShaders ${SHARED_OR_STATIC}
$<TARGET_OBJECTS:MagnumShadersObjects> ${MagnumShadersObjects_OBJECTS}
${MagnumShaders_GracefulAssert_SRCS}) ${MagnumShaders_GracefulAssert_SRCS})
set_target_properties(MagnumShaders PROPERTIES DEBUG_POSTFIX "-d") set_target_properties(MagnumShaders PROPERTIES DEBUG_POSTFIX "-d")
if(NOT MAGNUM_BUILD_STATIC) if(NOT MAGNUM_BUILD_STATIC)
@ -121,9 +132,10 @@ if(NOT MAGNUM_BUILD_STATIC)
elseif(MAGNUM_BUILD_STATIC_PIC) elseif(MAGNUM_BUILD_STATIC_PIC)
set_target_properties(MagnumShaders PROPERTIES POSITION_INDEPENDENT_CODE ON) set_target_properties(MagnumShaders PROPERTIES POSITION_INDEPENDENT_CODE ON)
endif() endif()
target_link_libraries(MagnumShaders PUBLIC target_link_libraries(MagnumShaders PUBLIC Magnum)
Magnum if(MAGNUM_TARGET_GL)
MagnumGL) target_link_libraries(MagnumShaders PUBLIC MagnumGL)
endif()
install(TARGETS MagnumShaders install(TARGETS MagnumShaders
RUNTIME DESTINATION ${MAGNUM_BINARY_INSTALL_DIR} RUNTIME DESTINATION ${MAGNUM_BINARY_INSTALL_DIR}
@ -134,7 +146,7 @@ install(FILES ${MagnumShaders_HEADERS} DESTINATION ${MAGNUM_INCLUDE_INSTALL_DIR}
if(MAGNUM_BUILD_TESTS) if(MAGNUM_BUILD_TESTS)
# Library with graceful assert for testing # Library with graceful assert for testing
add_library(MagnumShadersTestLib ${SHARED_OR_STATIC} ${EXCLUDE_FROM_ALL_IF_TEST_TARGET} add_library(MagnumShadersTestLib ${SHARED_OR_STATIC} ${EXCLUDE_FROM_ALL_IF_TEST_TARGET}
$<TARGET_OBJECTS:MagnumShadersObjects> ${MagnumShadersObjects_OBJECTS}
${MagnumShaders_GracefulAssert_SRCS}) ${MagnumShaders_GracefulAssert_SRCS})
set_target_properties(MagnumShadersTestLib PROPERTIES DEBUG_POSTFIX "-d") set_target_properties(MagnumShadersTestLib PROPERTIES DEBUG_POSTFIX "-d")
target_compile_definitions(MagnumShadersTestLib PRIVATE target_compile_definitions(MagnumShadersTestLib PRIVATE
@ -142,9 +154,10 @@ if(MAGNUM_BUILD_TESTS)
if(MAGNUM_BUILD_STATIC_PIC) if(MAGNUM_BUILD_STATIC_PIC)
set_target_properties(MagnumShadersTestLib PROPERTIES POSITION_INDEPENDENT_CODE ON) set_target_properties(MagnumShadersTestLib PROPERTIES POSITION_INDEPENDENT_CODE ON)
endif() endif()
target_link_libraries(MagnumShadersTestLib PUBLIC target_link_libraries(MagnumShadersTestLib PUBLIC Magnum)
Magnum if(MAGNUM_TARGET_GL)
MagnumGL) target_link_libraries(MagnumShadersTestLib PUBLIC MagnumGL)
endif()
add_subdirectory(Test ${EXCLUDE_FROM_ALL_IF_TEST_TARGET}) add_subdirectory(Test ${EXCLUDE_FROM_ALL_IF_TEST_TARGET})
endif() endif()

4
src/Magnum/Shaders/DistanceFieldVector.h

@ -33,7 +33,7 @@
#include "Magnum/Magnum.h" #include "Magnum/Magnum.h"
#include "Magnum/Math/Color.h" #include "Magnum/Math/Color.h"
#ifdef MAGNUM_BUILD_DEPRECATED #if defined(MAGNUM_TARGET_GL) && defined(MAGNUM_BUILD_DEPRECATED)
#include <Corrade/Utility/Macros.h> #include <Corrade/Utility/Macros.h>
#include "Magnum/Shaders/DistanceFieldVectorGL.h" #include "Magnum/Shaders/DistanceFieldVectorGL.h"
@ -247,7 +247,7 @@ struct DistanceFieldVectorMaterialUniform {
#endif #endif
}; };
#ifdef MAGNUM_BUILD_DEPRECATED #if defined(MAGNUM_TARGET_GL) && defined(MAGNUM_BUILD_DEPRECATED)
/** @brief @copybrief DistanceFieldVectorGL /** @brief @copybrief DistanceFieldVectorGL
* @m_deprecated_since_latest Use @ref DistanceFieldVectorGL instead. * @m_deprecated_since_latest Use @ref DistanceFieldVectorGL instead.
*/ */

20
src/Magnum/Shaders/DistanceFieldVectorGL.h

@ -27,11 +27,16 @@
DEALINGS IN THE SOFTWARE. DEALINGS IN THE SOFTWARE.
*/ */
#ifdef MAGNUM_TARGET_GL
/** @file /** @file
* @brief Class @ref Magnum::Shaders::DistanceFieldVectorGL, typedef @ref Magnum::Shaders::DistanceFieldVectorGL2D, @ref Magnum::Shaders::DistanceFieldVectorGL3D * @brief Class @ref Magnum::Shaders::DistanceFieldVectorGL, typedef @ref Magnum::Shaders::DistanceFieldVectorGL2D, @ref Magnum::Shaders::DistanceFieldVectorGL3D
* @m_since_latest * @m_since_latest
*/ */
#endif
#include "Magnum/configure.h"
#ifdef MAGNUM_TARGET_GL
#include <Corrade/Utility/Move.h> #include <Corrade/Utility/Move.h>
#include "Magnum/DimensionTraits.h" #include "Magnum/DimensionTraits.h"
@ -80,6 +85,10 @@ working on the framebuffer, you need to enable
@image html shaders-distancefieldvector.png width=256px @image html shaders-distancefieldvector.png width=256px
@note This class is available only if Magnum is compiled with
@ref MAGNUM_TARGET_GL enabled (done by default). See @ref building-features
for more information.
@section Shaders-DistanceFieldVectorGL-usage Example usage @section Shaders-DistanceFieldVectorGL-usage Example usage
Common mesh setup: Common mesh setup:
@ -883,12 +892,20 @@ template<UnsignedInt dimensions> class DistanceFieldVectorGL<dimensions>::Compil
/** /**
@brief Two-dimensional distance field vector OpenGL shader @brief Two-dimensional distance field vector OpenGL shader
@m_since_latest @m_since_latest
@note This typedef is available only if Magnum is compiled with
@ref MAGNUM_TARGET_GL enabled (done by default). See @ref building-features
for more information.
*/ */
typedef DistanceFieldVectorGL<2> DistanceFieldVectorGL2D; typedef DistanceFieldVectorGL<2> DistanceFieldVectorGL2D;
/** /**
@brief Three-dimensional distance field vector OpenGL shader @brief Three-dimensional distance field vector OpenGL shader
@m_since_latest @m_since_latest
@note This typedef is available only if Magnum is compiled with
@ref MAGNUM_TARGET_GL enabled (done by default). See @ref building-features
for more information.
*/ */
typedef DistanceFieldVectorGL<3> DistanceFieldVectorGL3D; typedef DistanceFieldVectorGL<3> DistanceFieldVectorGL3D;
@ -906,5 +923,8 @@ namespace Implementation {
#endif #endif
}} }}
#else
#error this header is available only in the OpenGL build
#endif
#endif #endif

4
src/Magnum/Shaders/Flat.h

@ -33,7 +33,7 @@
#include "Magnum/Magnum.h" #include "Magnum/Magnum.h"
#include "Magnum/Math/Color.h" #include "Magnum/Math/Color.h"
#ifdef MAGNUM_BUILD_DEPRECATED #if defined(MAGNUM_TARGET_GL) && defined(MAGNUM_BUILD_DEPRECATED)
#include <Corrade/Utility/Macros.h> #include <Corrade/Utility/Macros.h>
#include "Magnum/Shaders/FlatGL.h" #include "Magnum/Shaders/FlatGL.h"
@ -274,7 +274,7 @@ struct FlatMaterialUniform {
#endif #endif
}; };
#ifdef MAGNUM_BUILD_DEPRECATED #if defined(MAGNUM_TARGET_GL) && defined(MAGNUM_BUILD_DEPRECATED)
/** @brief @copybrief FlatGL /** @brief @copybrief FlatGL
* @m_deprecated_since_latest Use @ref FlatGL instead. * @m_deprecated_since_latest Use @ref FlatGL instead.
*/ */

20
src/Magnum/Shaders/FlatGL.h

@ -27,11 +27,16 @@
DEALINGS IN THE SOFTWARE. DEALINGS IN THE SOFTWARE.
*/ */
#ifdef MAGNUM_TARGET_GL
/** @file /** @file
* @brief Class @ref Magnum::Shaders::FlatGL, typedef @ref Magnum::Shaders::FlatGL2D, @ref Magnum::Shaders::FlatGL3D * @brief Class @ref Magnum::Shaders::FlatGL, typedef @ref Magnum::Shaders::FlatGL2D, @ref Magnum::Shaders::FlatGL3D
* @m_since_latest * @m_since_latest
*/ */
#endif
#include "Magnum/configure.h"
#ifdef MAGNUM_TARGET_GL
#include <Corrade/Utility/Move.h> #include <Corrade/Utility/Move.h>
#include "Magnum/DimensionTraits.h" #include "Magnum/DimensionTraits.h"
@ -85,6 +90,10 @@ configure the shader.
@image html shaders-flat.png width=256px @image html shaders-flat.png width=256px
@note This function is available only if Magnum is compiled with
@ref MAGNUM_TARGET_GL enabled (done by default). See @ref building-features
for more information.
@section Shaders-FlatGL-colored Colored rendering @section Shaders-FlatGL-colored Colored rendering
Common mesh setup: Common mesh setup:
@ -1590,12 +1599,20 @@ template<UnsignedInt dimensions> class FlatGL<dimensions>::CompileState: public
/** /**
@brief 2D flat OpenGL shader @brief 2D flat OpenGL shader
@m_since_latest @m_since_latest
@note This typedef is available only if Magnum is compiled with
@ref MAGNUM_TARGET_GL enabled (done by default). See @ref building-features
for more information.
*/ */
typedef FlatGL<2> FlatGL2D; typedef FlatGL<2> FlatGL2D;
/** /**
@brief 3D flat OpenGL shader @brief 3D flat OpenGL shader
@m_since_latest @m_since_latest
@note This typedef is available only if Magnum is compiled with
@ref MAGNUM_TARGET_GL enabled (done by default). See @ref building-features
for more information.
*/ */
typedef FlatGL<3> FlatGL3D; typedef FlatGL<3> FlatGL3D;
@ -1613,5 +1630,8 @@ namespace Implementation {
#endif #endif
}} }}
#else
#error this header is available only in the OpenGL build
#endif
#endif #endif

2
src/Magnum/Shaders/Generic.h

@ -34,7 +34,7 @@
#include "Magnum/Math/Matrix3.h" #include "Magnum/Math/Matrix3.h"
#include "Magnum/Math/Matrix4.h" #include "Magnum/Math/Matrix4.h"
#ifdef MAGNUM_BUILD_DEPRECATED #if defined(MAGNUM_TARGET_GL) && defined(MAGNUM_BUILD_DEPRECATED)
#include <Corrade/Utility/Macros.h> #include <Corrade/Utility/Macros.h>
#include "Magnum/Shaders/GenericGL.h" #include "Magnum/Shaders/GenericGL.h"

8
src/Magnum/Shaders/GenericGL.h

@ -27,11 +27,16 @@
DEALINGS IN THE SOFTWARE. DEALINGS IN THE SOFTWARE.
*/ */
#ifdef MAGNUM_TARGET_GL
/** @file /** @file
* @brief Struct @ref Magnum::Shaders::GenericGL, typedef @ref Magnum::Shaders::GenericGL2D, @ref Magnum::Shaders::GenericGL3D * @brief Struct @ref Magnum::Shaders::GenericGL, typedef @ref Magnum::Shaders::GenericGL2D, @ref Magnum::Shaders::GenericGL3D
* @m_since_latest * @m_since_latest
*/ */
#endif
#include "Magnum/configure.h"
#ifdef MAGNUM_TARGET_GL
#include "Magnum/GL/Attribute.h" #include "Magnum/GL/Attribute.h"
#include "Magnum/Shaders/Shaders.h" #include "Magnum/Shaders/Shaders.h"
@ -632,5 +637,8 @@ typedef CORRADE_DEPRECATED("use GenericGL3D instead") GenericGL3D Generic3D;
#endif #endif
}} }}
#else
#error this header is available only in the OpenGL build
#endif
#endif #endif

22
src/Magnum/Shaders/LineGL.h

@ -26,13 +26,16 @@
DEALINGS IN THE SOFTWARE. DEALINGS IN THE SOFTWARE.
*/ */
#ifndef MAGNUM_TARGET_GLES2 #if defined(MAGNUM_TARGET_GL) && !defined(MAGNUM_TARGET_GLES2)
/** @file /** @file
* @brief Class @ref Magnum::Shaders::LineGL, typedef @ref Magnum::Shaders::LineGL2D, @ref Magnum::Shaders::LineGL3D * @brief Class @ref Magnum::Shaders::LineGL, typedef @ref Magnum::Shaders::LineGL2D, @ref Magnum::Shaders::LineGL3D
* @m_since_latest * @m_since_latest
*/ */
#endif #endif
#include "Magnum/configure.h"
#if defined(MAGNUM_TARGET_GL) && !defined(MAGNUM_TARGET_GLES2)
#include <Corrade/Utility/Move.h> #include <Corrade/Utility/Move.h>
#include "Magnum/DimensionTraits.h" #include "Magnum/DimensionTraits.h"
@ -41,7 +44,6 @@
#include "Magnum/Shaders/glShaderWrapper.h" #include "Magnum/Shaders/glShaderWrapper.h"
#include "Magnum/Shaders/visibility.h" #include "Magnum/Shaders/visibility.h"
#ifndef MAGNUM_TARGET_GLES2
namespace Magnum { namespace Shaders { namespace Magnum { namespace Shaders {
namespace Implementation { namespace Implementation {
@ -72,6 +74,10 @@ styles, and antialiased independently of MSAA being used or not.
@experimental @experimental
@note This class is available only if Magnum is compiled with
@ref MAGNUM_TARGET_GL enabled (done by default). See @ref building-features
for more information.
@requires_gl30 Extension @gl_extension{EXT,gpu_shader4} @requires_gl30 Extension @gl_extension{EXT,gpu_shader4}
@requires_gles30 Requires integer support in shaders which is not available in @requires_gles30 Requires integer support in shaders which is not available in
OpenGL ES 2.0. OpenGL ES 2.0.
@ -1144,12 +1150,20 @@ template<UnsignedInt dimensions> class LineGL<dimensions>::CompileState: public
/** /**
@brief 2D line OpenGL shader @brief 2D line OpenGL shader
@m_since_latest @m_since_latest
@note This typedef is available only if Magnum is compiled with
@ref MAGNUM_TARGET_GL enabled (done by default). See @ref building-features
for more information.
*/ */
typedef LineGL<2> LineGL2D; typedef LineGL<2> LineGL2D;
/** /**
@brief 3D LineGL OpenGL shader @brief 3D LineGL OpenGL shader
@m_since_latest @m_since_latest
@note This typedef is available only if Magnum is compiled with
@ref MAGNUM_TARGET_GL enabled (done by default). See @ref building-features
for more information.
*/ */
typedef LineGL<3> LineGL3D; typedef LineGL<3> LineGL3D;
@ -1173,8 +1187,10 @@ namespace Implementation {
#endif #endif
}} }}
#else #elif defined(MAGNUM_TARGET_GLES2)
#error this header is not available in the OpenGL ES 2.0 / WebGL 1.0 build #error this header is not available in the OpenGL ES 2.0 / WebGL 1.0 build
#else
#error this header is available only in the OpenGL build
#endif #endif
#endif #endif

4
src/Magnum/Shaders/MeshVisualizer.h

@ -34,7 +34,7 @@
#include "Magnum/Math/Color.h" #include "Magnum/Math/Color.h"
#include "Magnum/Math/Matrix.h" #include "Magnum/Math/Matrix.h"
#ifdef MAGNUM_BUILD_DEPRECATED #if defined(MAGNUM_TARGET_GL) && defined(MAGNUM_BUILD_DEPRECATED)
#include <Corrade/Utility/Macros.h> #include <Corrade/Utility/Macros.h>
#include "Magnum/Shaders/MeshVisualizerGL.h" #include "Magnum/Shaders/MeshVisualizerGL.h"
@ -598,7 +598,7 @@ struct MeshVisualizerMaterialUniform {
#endif #endif
}; };
#ifdef MAGNUM_BUILD_DEPRECATED #if defined(MAGNUM_TARGET_GL) && defined(MAGNUM_BUILD_DEPRECATED)
/** @brief @copybrief MeshVisualizerGL2D /** @brief @copybrief MeshVisualizerGL2D
* @m_deprecated_since_latest Use @ref MeshVisualizerGL2D instead. * @m_deprecated_since_latest Use @ref MeshVisualizerGL2D instead.
*/ */

16
src/Magnum/Shaders/MeshVisualizerGL.h

@ -27,11 +27,16 @@
DEALINGS IN THE SOFTWARE. DEALINGS IN THE SOFTWARE.
*/ */
#ifdef MAGNUM_TARGET_GL
/** @file /** @file
* @brief Class @ref Magnum::Shaders::MeshVisualizerGL2D, @ref Magnum::Shaders::MeshVisualizerGL3D * @brief Class @ref Magnum::Shaders::MeshVisualizerGL2D, @ref Magnum::Shaders::MeshVisualizerGL3D
* @m_since_latest * @m_since_latest
*/ */
#endif
#include "Magnum/configure.h"
#ifdef MAGNUM_TARGET_GL
#include <Corrade/Utility/Move.h> #include <Corrade/Utility/Move.h>
#include <Corrade/Utility/Utility.h> #include <Corrade/Utility/Utility.h>
@ -180,6 +185,10 @@ behavior with nothing enabled. The shader is a 2D variant of
@ref MeshVisualizerGL3D with mostly identical workflow. See its documentation @ref MeshVisualizerGL3D with mostly identical workflow. See its documentation
for more information, workflows that differ are shown below. for more information, workflows that differ are shown below.
@note This class is available only if Magnum is compiled with
@ref MAGNUM_TARGET_GL enabled (done by default). See @ref building-features
for more information.
@section Shaders-MeshVisualizerGL2D-instancing Instanced rendering @section Shaders-MeshVisualizerGL2D-instancing Instanced rendering
Enabling @ref Flag::InstancedTransformation will turn the shader into an Enabling @ref Flag::InstancedTransformation will turn the shader into an
@ -1421,6 +1430,10 @@ visualization or object/primitive ID visualization by passing an appropriate
@ref Flag to @ref Configuration::setFlags() --- there's no default behavior @ref Flag to @ref Configuration::setFlags() --- there's no default behavior
with nothing enabled. with nothing enabled.
@note This class is available only if Magnum is compiled with
@ref MAGNUM_TARGET_GL enabled (done by default). See @ref building-features
for more information.
@section Shaders-MeshVisualizerGL3D-wireframe Wireframe visualization @section Shaders-MeshVisualizerGL3D-wireframe Wireframe visualization
Wireframe visualization is done by enabling @ref Flag::Wireframe. It is done Wireframe visualization is done by enabling @ref Flag::Wireframe. It is done
@ -3420,5 +3433,8 @@ CORRADE_ENUMSET_OPERATORS(MeshVisualizerGL2D::Flags)
CORRADE_ENUMSET_OPERATORS(MeshVisualizerGL3D::Flags) CORRADE_ENUMSET_OPERATORS(MeshVisualizerGL3D::Flags)
}} }}
#else
#error this header is available only in the OpenGL build
#endif
#endif #endif

4
src/Magnum/Shaders/Phong.h

@ -35,7 +35,7 @@
#include "Magnum/Math/Color.h" #include "Magnum/Math/Color.h"
#include "Magnum/Math/Matrix.h" #include "Magnum/Math/Matrix.h"
#ifdef MAGNUM_BUILD_DEPRECATED #if defined(MAGNUM_TARGET_GL) && defined(MAGNUM_BUILD_DEPRECATED)
#include <Corrade/Utility/Macros.h> #include <Corrade/Utility/Macros.h>
#include "Magnum/Shaders/PhongGL.h" #include "Magnum/Shaders/PhongGL.h"
@ -549,7 +549,7 @@ struct PhongLightUniform {
#endif #endif
}; };
#ifdef MAGNUM_BUILD_DEPRECATED #if defined(MAGNUM_TARGET_GL) && defined(MAGNUM_BUILD_DEPRECATED)
/** @brief @copybrief PhongGL /** @brief @copybrief PhongGL
* @m_deprecated_since_latest Use @ref PhongGL instead. * @m_deprecated_since_latest Use @ref PhongGL instead.
*/ */

12
src/Magnum/Shaders/PhongGL.h

@ -28,11 +28,16 @@
DEALINGS IN THE SOFTWARE. DEALINGS IN THE SOFTWARE.
*/ */
#ifdef MAGNUM_TARGET_GL
/** @file /** @file
* @brief Class @ref Magnum::Shaders::PhongGL * @brief Class @ref Magnum::Shaders::PhongGL
* @m_since_latest * @m_since_latest
*/ */
#endif
#include "Magnum/configure.h"
#ifdef MAGNUM_TARGET_GL
#include <initializer_list> #include <initializer_list>
#include <Corrade/Utility/Move.h> #include <Corrade/Utility/Move.h>
@ -56,6 +61,10 @@ shader.
@image html shaders-phong.png width=256px @image html shaders-phong.png width=256px
@note This class is available only if Magnum is compiled with
@ref MAGNUM_TARGET_GL enabled (done by default). See @ref building-features
for more information.
@section Shaders-PhongGL-colored Colored rendering @section Shaders-PhongGL-colored Colored rendering
Common mesh setup: Common mesh setup:
@ -2434,5 +2443,8 @@ MAGNUM_SHADERS_EXPORT Debug& operator<<(Debug& debug, PhongGL::Flags value);
CORRADE_ENUMSET_OPERATORS(PhongGL::Flags) CORRADE_ENUMSET_OPERATORS(PhongGL::Flags)
}} }}
#else
#error this header is available only in the OpenGL build
#endif
#endif #endif

12
src/Magnum/Shaders/Shaders.h

@ -32,13 +32,17 @@
#include "Magnum/Types.h" #include "Magnum/Types.h"
#ifdef MAGNUM_BUILD_DEPRECATED #if defined(MAGNUM_TARGET_GL) && defined(MAGNUM_BUILD_DEPRECATED)
#include <Corrade/Utility/Macros.h> #include <Corrade/Utility/Macros.h>
#endif #endif
#ifndef DOXYGEN_GENERATING_OUTPUT #ifndef DOXYGEN_GENERATING_OUTPUT
namespace Magnum { namespace Shaders { namespace Magnum { namespace Shaders {
enum class LineCapStyle: UnsignedByte;
enum class LineJoinStyle: UnsignedByte;
#ifdef MAGNUM_TARGET_GL
template<UnsignedInt> class DistanceFieldVectorGL; template<UnsignedInt> class DistanceFieldVectorGL;
typedef DistanceFieldVectorGL<2> DistanceFieldVectorGL2D; typedef DistanceFieldVectorGL<2> DistanceFieldVectorGL2D;
typedef DistanceFieldVectorGL<3> DistanceFieldVectorGL3D; typedef DistanceFieldVectorGL<3> DistanceFieldVectorGL3D;
@ -57,12 +61,9 @@ typedef CORRADE_DEPRECATED("use FlatGL2D instead") FlatGL2D Flat2D;
typedef CORRADE_DEPRECATED("use FlatGL3D instead") FlatGL3D Flat3D; typedef CORRADE_DEPRECATED("use FlatGL3D instead") FlatGL3D Flat3D;
#endif #endif
/* Generic is used only statically */ /* GenericGL is used only statically */
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
enum class LineCapStyle: UnsignedByte;
enum class LineJoinStyle: UnsignedByte;
template<UnsignedInt> class LineGL; template<UnsignedInt> class LineGL;
typedef LineGL<2> LineGL2D; typedef LineGL<2> LineGL2D;
typedef LineGL<3> LineGL3D; typedef LineGL<3> LineGL3D;
@ -98,6 +99,7 @@ template<UnsignedInt dimensions> using VertexColor CORRADE_DEPRECATED_ALIAS("use
typedef CORRADE_DEPRECATED("use VertexColorGL2D instead") VertexColorGL2D VertexColor2D; typedef CORRADE_DEPRECATED("use VertexColorGL2D instead") VertexColorGL2D VertexColor2D;
typedef CORRADE_DEPRECATED("use VertexColorGL3D instead") VertexColorGL3D VertexColor3D; typedef CORRADE_DEPRECATED("use VertexColorGL3D instead") VertexColorGL3D VertexColor3D;
#endif #endif
#endif
}} }}
#endif #endif

37
src/Magnum/Shaders/Test/CMakeLists.txt

@ -31,30 +31,33 @@ set(CMAKE_FOLDER "Magnum/Shaders/Test")
corrade_add_test(ShadersDistanceFieldVectorTest DistanceFieldVectorTest.cpp LIBRARIES MagnumShaders) corrade_add_test(ShadersDistanceFieldVectorTest DistanceFieldVectorTest.cpp LIBRARIES MagnumShaders)
corrade_add_test(ShadersFlatTest FlatTest.cpp LIBRARIES MagnumShaders) corrade_add_test(ShadersFlatTest FlatTest.cpp LIBRARIES MagnumShaders)
corrade_add_test(ShadersGenericTest GenericTest.cpp LIBRARIES MagnumShaders) corrade_add_test(ShadersGenericTest GenericTest.cpp LIBRARIES MagnumShaders)
corrade_add_test(ShadersGLShaderWrapperTest GLShaderWrapperTest.cpp LIBRARIES MagnumShaders)
corrade_add_test(ShadersMeshVisualizerTest MeshVisualizerTest.cpp LIBRARIES MagnumShaders) corrade_add_test(ShadersMeshVisualizerTest MeshVisualizerTest.cpp LIBRARIES MagnumShaders)
corrade_add_test(ShadersPhongTest PhongTest.cpp LIBRARIES MagnumShaders) corrade_add_test(ShadersPhongTest PhongTest.cpp LIBRARIES MagnumShaders)
corrade_add_test(ShadersLineTest LineTest.cpp LIBRARIES MagnumShadersTestLib)
target_compile_definitions(ShadersLineTest PRIVATE "CORRADE_GRACEFUL_ASSERT")
corrade_add_test(ShadersVectorTest VectorTest.cpp LIBRARIES MagnumShaders) corrade_add_test(ShadersVectorTest VectorTest.cpp LIBRARIES MagnumShaders)
# There's an underscore between GL and Test to disambiguate from GLTest, which if(MAGNUM_TARGET_GL)
# is a common suffix used to mark tests that need a GL context. Ugly, I know. corrade_add_test(ShadersGLShaderWrapperTest GLShaderWrapperTest.cpp LIBRARIES MagnumShaders)
corrade_add_test(ShadersDistanceFieldVectorGL_Test DistanceFieldVectorGL_Test.cpp LIBRARIES MagnumShaders)
corrade_add_test(ShadersFlatGL_Test FlatGL_Test.cpp LIBRARIES MagnumShadersTestLib)
corrade_add_test(ShadersGenericGL_Test GenericGL_Test.cpp LIBRARIES MagnumShaders)
corrade_add_test(ShadersMeshVisualizerGL_Test MeshVisualizerGL_Test.cpp LIBRARIES MagnumShadersTestLib)
corrade_add_test(ShadersPhongGL_Test PhongGL_Test.cpp LIBRARIES MagnumShadersTestLib)
corrade_add_test(ShadersVectorGL_Test VectorGL_Test.cpp LIBRARIES MagnumShaders)
corrade_add_test(ShadersVertexColorGL_Test VertexColorGL_Test.cpp LIBRARIES MagnumShaders)
if(NOT MAGNUM_TARGET_GLES2) # There's an underscore between GL and Test to disambiguate from GLTest,
corrade_add_test(ShadersLineTest LineTest.cpp LIBRARIES MagnumShadersTestLib) # which is a common suffix used to mark tests that need a GL context. Ugly,
target_compile_definitions(ShadersLineTest PRIVATE "CORRADE_GRACEFUL_ASSERT") # I know.
corrade_add_test(ShadersDistanceFieldVectorGL_Test DistanceFieldVectorGL_Test.cpp LIBRARIES MagnumShaders)
corrade_add_test(ShadersFlatGL_Test FlatGL_Test.cpp LIBRARIES MagnumShadersTestLib)
corrade_add_test(ShadersGenericGL_Test GenericGL_Test.cpp LIBRARIES MagnumShaders)
corrade_add_test(ShadersMeshVisualizerGL_Test MeshVisualizerGL_Test.cpp LIBRARIES MagnumShadersTestLib)
corrade_add_test(ShadersPhongGL_Test PhongGL_Test.cpp LIBRARIES MagnumShadersTestLib)
corrade_add_test(ShadersVectorGL_Test VectorGL_Test.cpp LIBRARIES MagnumShaders)
corrade_add_test(ShadersVertexColorGL_Test VertexColorGL_Test.cpp LIBRARIES MagnumShaders)
if(NOT MAGNUM_TARGET_GLES2)
corrade_add_test(ShadersLineGL_Test LineGL_Test.cpp LIBRARIES MagnumShaders) corrade_add_test(ShadersLineGL_Test LineGL_Test.cpp LIBRARIES MagnumShaders)
endif() endif()
if(MAGNUM_BUILD_GL_TESTS) if(MAGNUM_BUILD_GL_TESTS)
# Otherwise CMake complains that Corrade::PluginManager is not found, wtf # Otherwise CMake complains that Corrade::PluginManager is not found,
# wtf
find_package(Corrade REQUIRED PluginManager) find_package(Corrade REQUIRED PluginManager)
if(CORRADE_TARGET_EMSCRIPTEN OR CORRADE_TARGET_ANDROID) if(CORRADE_TARGET_EMSCRIPTEN OR CORRADE_TARGET_ANDROID)
@ -521,5 +524,5 @@ if(MAGNUM_BUILD_GL_TESTS)
PROPERTIES MACOSX_PACKAGE_LOCATION Resources) PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
endif() endif()
endif() endif()
endif()
endif() endif()

4
src/Magnum/Shaders/Vector.h

@ -33,7 +33,7 @@
#include "Magnum/Magnum.h" #include "Magnum/Magnum.h"
#include "Magnum/Math/Color.h" #include "Magnum/Math/Color.h"
#ifdef MAGNUM_BUILD_DEPRECATED #if defined(MAGNUM_TARGET_GL) && defined(MAGNUM_BUILD_DEPRECATED)
#include <Corrade/Utility/Macros.h> #include <Corrade/Utility/Macros.h>
#include "Magnum/Shaders/VectorGL.h" #include "Magnum/Shaders/VectorGL.h"
@ -189,7 +189,7 @@ struct VectorMaterialUniform {
#endif #endif
}; };
#ifdef MAGNUM_BUILD_DEPRECATED #if defined(MAGNUM_TARGET_GL) && defined(MAGNUM_BUILD_DEPRECATED)
/** @brief @copybrief Shaders::VectorGL /** @brief @copybrief Shaders::VectorGL
* @m_deprecated_since_latest Use @ref Shaders::VectorGL "VectorGL" instead. * @m_deprecated_since_latest Use @ref Shaders::VectorGL "VectorGL" instead.
*/ */

20
src/Magnum/Shaders/VectorGL.h

@ -27,11 +27,16 @@
DEALINGS IN THE SOFTWARE. DEALINGS IN THE SOFTWARE.
*/ */
#ifdef MAGNUM_TARGET_GL
/** @file /** @file
* @brief Class @ref Magnum::Shaders::VectorGL, typedef @ref Magnum::Shaders::VectorGL2D, @ref Magnum::Shaders::VectorGL3D * @brief Class @ref Magnum::Shaders::VectorGL, typedef @ref Magnum::Shaders::VectorGL2D, @ref Magnum::Shaders::VectorGL3D
* @m_since_latest * @m_since_latest
*/ */
#endif
#include "Magnum/configure.h"
#ifdef MAGNUM_TARGET_GL
#include <Corrade/Utility/Move.h> #include <Corrade/Utility/Move.h>
#include "Magnum/DimensionTraits.h" #include "Magnum/DimensionTraits.h"
@ -78,6 +83,10 @@ working on the framebuffer, you need to enable
@ref GL::Renderer::Feature::Blending and set up the blending function. See @ref GL::Renderer::Feature::Blending and set up the blending function. See
@ref GL::Renderer::setBlendFunction() for details. @ref GL::Renderer::setBlendFunction() for details.
@note This class is available only if Magnum is compiled with
@ref MAGNUM_TARGET_GL enabled (done by default). See @ref building-features
for more information.
@section Shaders-VectorGL-usage Example usage @section Shaders-VectorGL-usage Example usage
Common mesh setup: Common mesh setup:
@ -837,12 +846,20 @@ template<UnsignedInt dimensions> class VectorGL<dimensions>::CompileState: publi
/** /**
@brief Two-dimensional vector OpenGL shader @brief Two-dimensional vector OpenGL shader
@m_since_latest @m_since_latest
@note This typedef is available only if Magnum is compiled with
@ref MAGNUM_TARGET_GL enabled (done by default). See @ref building-features
for more information.
*/ */
typedef VectorGL<2> VectorGL2D; typedef VectorGL<2> VectorGL2D;
/** /**
@brief Three-dimensional vector OpenGL shader @brief Three-dimensional vector OpenGL shader
@m_since_latest @m_since_latest
@note This typedef is available only if Magnum is compiled with
@ref MAGNUM_TARGET_GL enabled (done by default). See @ref building-features
for more information.
*/ */
typedef VectorGL<3> VectorGL3D; typedef VectorGL<3> VectorGL3D;
@ -860,5 +877,8 @@ namespace Implementation {
#endif #endif
}} }}
#else
#error this header is available only in the OpenGL build
#endif
#endif #endif

8
src/Magnum/Shaders/VertexColor.h

@ -26,7 +26,7 @@
DEALINGS IN THE SOFTWARE. DEALINGS IN THE SOFTWARE.
*/ */
#ifdef MAGNUM_BUILD_DEPRECATED #if defined(MAGNUM_TARGET_GL) && defined(MAGNUM_BUILD_DEPRECATED)
/** @file /** @file
* @brief Typedef @ref Magnum::Shaders::VertexColor, alias @ref Magnum::Shaders::VertexColor2D, @ref Magnum::Shaders::VertexColor3D * @brief Typedef @ref Magnum::Shaders::VertexColor, alias @ref Magnum::Shaders::VertexColor2D, @ref Magnum::Shaders::VertexColor3D
* @m_deprecated_since_latest Use @ref Magnum/Shaders/VertexColorGL.h, the * @m_deprecated_since_latest Use @ref Magnum/Shaders/VertexColorGL.h, the
@ -37,7 +37,7 @@
#include "Magnum/configure.h" #include "Magnum/configure.h"
#ifdef MAGNUM_BUILD_DEPRECATED #if defined(MAGNUM_TARGET_GL) && defined(MAGNUM_BUILD_DEPRECATED)
#include <Corrade/Utility/Macros.h> #include <Corrade/Utility/Macros.h>
#include "Magnum/Shaders/VertexColorGL.h" #include "Magnum/Shaders/VertexColorGL.h"
@ -64,8 +64,10 @@ typedef CORRADE_DEPRECATED("use VertexColorGL2D instead") VertexColorGL2D Vertex
typedef CORRADE_DEPRECATED("use VertexColorGL3D instead") VertexColorGL3D VertexColor3D; typedef CORRADE_DEPRECATED("use VertexColorGL3D instead") VertexColorGL3D VertexColor3D;
}} }}
#else #elif defined(MAGNUM_TARGET_GL)
#error use Magnum/Shaders/VertexColorGL.h, the VertexColorGL class and related typedefs instead #error use Magnum/Shaders/VertexColorGL.h, the VertexColorGL class and related typedefs instead
#else
#error this header is available only in the OpenGL build
#endif #endif
#endif #endif

20
src/Magnum/Shaders/VertexColorGL.h

@ -27,11 +27,16 @@
DEALINGS IN THE SOFTWARE. DEALINGS IN THE SOFTWARE.
*/ */
#ifdef MAGNUM_TARGET_GL
/** @file /** @file
* @brief Class @ref Magnum::Shaders::VertexColorGL, typedef @ref Magnum::Shaders::VertexColorGL2D, @ref Magnum::Shaders::VertexColorGL3D * @brief Class @ref Magnum::Shaders::VertexColorGL, typedef @ref Magnum::Shaders::VertexColorGL2D, @ref Magnum::Shaders::VertexColorGL3D
* @m_since_latest * @m_since_latest
*/ */
#endif
#include "Magnum/configure.h"
#ifdef MAGNUM_TARGET_GL
#include <Corrade/Utility/Move.h> #include <Corrade/Utility/Move.h>
#include "Magnum/DimensionTraits.h" #include "Magnum/DimensionTraits.h"
@ -77,6 +82,10 @@ working on the framebuffer, you need to enable
@ref GL::Renderer::Feature::Blending and set up the blending function. See @ref GL::Renderer::Feature::Blending and set up the blending function. See
@ref GL::Renderer::setBlendFunction() for details. @ref GL::Renderer::setBlendFunction() for details.
@note This class is available only if Magnum is compiled with
@ref MAGNUM_TARGET_GL enabled (done by default). See @ref building-features
for more information.
@section Shaders-VertexColorGL-example Example usage @section Shaders-VertexColorGL-example Example usage
Common mesh setup. The shader accepts either three- or four-component color Common mesh setup. The shader accepts either three- or four-component color
@ -558,12 +567,20 @@ template<UnsignedInt dimensions> class VertexColorGL<dimensions>::CompileState:
/** /**
@brief 2D vertex color OpenGL shader @brief 2D vertex color OpenGL shader
@m_since_latest @m_since_latest
@note This typedef is available only if Magnum is compiled with
@ref MAGNUM_TARGET_GL enabled (done by default). See @ref building-features
for more information.
*/ */
typedef VertexColorGL<2> VertexColorGL2D; typedef VertexColorGL<2> VertexColorGL2D;
/** /**
@brief 3D vertex color OpenGL shader @brief 3D vertex color OpenGL shader
@m_since_latest @m_since_latest
@note This typedef is available only if Magnum is compiled with
@ref MAGNUM_TARGET_GL enabled (done by default). See @ref building-features
for more information.
*/ */
typedef VertexColorGL<3> VertexColorGL3D; typedef VertexColorGL<3> VertexColorGL3D;
@ -581,5 +598,8 @@ namespace Implementation {
#endif #endif
}} }}
#else
#error this header is available only in the OpenGL build
#endif
#endif #endif

Loading…
Cancel
Save