diff --git a/src/AbstractTexture.cpp b/src/AbstractTexture.cpp index aa48df3f8..e445d7e3a 100644 --- a/src/AbstractTexture.cpp +++ b/src/AbstractTexture.cpp @@ -99,6 +99,7 @@ AbstractTexture::InternalFormat::InternalFormat(AbstractTexture::Components comp #undef internalFormatSwitch } +#ifndef DOXYGEN_GENERATING_OUTPUT void AbstractTexture::DataHelper<2>::setWrapping(Target target, const Math::Vector& wrapping) { CORRADE_ASSERT(target != Target::Rectangle || ((wrapping[0] == Wrapping::ClampToEdge || wrapping[0] == Wrapping::ClampToBorder) && (wrapping[0] == Wrapping::ClampToEdge || wrapping[1] == Wrapping::ClampToEdge)), "AbstractTexture: rectangle texture wrapping must either clamp to border or to edge", ) @@ -111,5 +112,6 @@ void AbstractTexture::DataHelper<3>::setWrapping(Target target, const Math::Vect glTexParameteri(static_cast(target), GL_TEXTURE_WRAP_T, static_cast(wrapping[1])); glTexParameteri(static_cast(target), GL_TEXTURE_WRAP_R, static_cast(wrapping[2])); } +#endif } diff --git a/src/AbstractTexture.h b/src/AbstractTexture.h index 38cd8ebbc..c3bbbd2db 100644 --- a/src/AbstractTexture.h +++ b/src/AbstractTexture.h @@ -512,89 +512,9 @@ class MAGNUM_EXPORT AbstractTexture { void generateMipmap(); protected: - /** - * @brief Helper for setting texture data - * - * Workaround for partial template specialization. - */ - template struct DataHelper { - #ifdef DOXYGEN_GENERATING_OUTPUT - /** - * @brief %Texture target - * - * Each dimension has its own unique subset of these targets. - */ - enum class Target: GLenum { - Texture1D = GL_TEXTURE_1D, /**< One-dimensional texture */ - Texture2D = GL_TEXTURE_2D, /**< Two-dimensional texture */ - Texture3D = GL_TEXTURE_3D, /**< Three-dimensional texture */ - - /** - * Array of one-dimensional textures - * - * @requires_gl30 Extension EXT_texture_array - */ - Array1D = GL_TEXTURE_1D_ARRAY, - - /** - * Array of two-dimensional textures - * - * @requires_gl30 Extension EXT_texture_array - */ - Array2D = GL_TEXTURE_2D_ARRAY, - - /** - * Rectangle texture - * - * @requires_gl31 Extension ARB_texture_rectangle - */ - Rectangle = GL_TEXTURE_RECTANGLE, - - CubeMap = GL_TEXTURE_CUBE_MAP /**< Cube map texture */ - }; - - /** - * @brief Target for given dimension - * - * Returns `Target::Texture1D`, `Target::Texture2D` or - * `Target::Texture3D` based on dimension count. - */ - inline constexpr static Target target(); - - /** - * @brief Set texture wrapping - * @param target Target, such as `GL_TEXTURE_RECTANGLE` - * @param wrapping Wrapping type for all texture dimensions - */ - inline static void setWrapping(GLenum target, const Math::Vector& wrapping); - - /** - * @brief Set texture data - * @param target %Target - * @param mipLevel Mip level - * @param internalFormat Internal texture format - * @param image Image, BufferedImage or for example - * Trade::ImageData of the same dimension count - * - * Calls `glTexImage1D`, `glTexImage2D`, `glTexImage3D` depending - * on dimension count. - */ - template inline static void set(Target target, GLint mipLevel, InternalFormat internalFormat, T* image); - - /** - * @brief Set texture subdata - * @param target %Target - * @param mipLevel Mip level - * @param offset Offset where to put data in the texture - * @param image Image, BufferedImage or for example - * Trade::ImageData of the same dimension count - * - * Calls `glTexSubImage1D`, `glTexSubImage2D`, `glTexSubImage3D` - * depending on dimension count. - */ - template inline static void setSub(Target target, GLint mipLevel, const Math::Vector& offset, T* image); - #endif - }; + #ifndef DOXYGEN_GENERATING_OUTPUT + template struct DataHelper {}; + #endif private: const GLenum target; diff --git a/src/Texture.h b/src/Texture.h index bf3c1582f..69fc3fe56 100644 --- a/src/Texture.h +++ b/src/Texture.h @@ -53,12 +53,54 @@ for more information. template class Texture: public AbstractTexture { public: static const size_t Dimensions = textureDimensions; /**< @brief %Texture dimension count */ + + #ifdef DOXYGEN_GENERATING_OUTPUT + /** + * @brief %Texture target + * + * Each dimension has its own unique subset of these targets. + */ + enum class Target: GLenum { + Texture1D = GL_TEXTURE_1D, /**< One-dimensional texture */ + Texture2D = GL_TEXTURE_2D, /**< Two-dimensional texture */ + Texture3D = GL_TEXTURE_3D, /**< Three-dimensional texture */ + + /** + * Array of one-dimensional textures (i.e. two dimensions in total) + * + * @requires_gl30 Extension EXT_texture_array + */ + Array1D = GL_TEXTURE_1D_ARRAY, + + /** + * Array of two-dimensional textures (i.e. three dimensions in total) + * + * @requires_gl30 Extension EXT_texture_array + */ + Array2D = GL_TEXTURE_2D_ARRAY, + + /** + * Rectangle texture (i.e. two dimensions) + * + * @requires_gl31 Extension ARB_texture_rectangle + */ + Rectangle = GL_TEXTURE_RECTANGLE, + + /** + * Cube map texture. Use CubeMapTexture class. + */ + CubeMap = GL_TEXTURE_CUBE_MAP + }; + #else typedef typename DataHelper::Target Target; /**< @brief %Texture target */ + #endif /** * @brief Constructor * @param layer %Texture layer (number between 0 and 31) - * @param target %Texture target + * @param target %Texture target. If not set, default value + * is `Target::Texture1D`, `Target::Texture2D` or + * `Target::Texture3D` based on dimension count. * * Creates one OpenGL texture. */