diff --git a/doc/generated/shaders.cpp b/doc/generated/shaders.cpp index 7001683e9..1515c664a 100644 --- a/doc/generated/shaders.cpp +++ b/doc/generated/shaders.cpp @@ -40,8 +40,12 @@ #include #include #include +#include #include #include +#include +#include +#include #include #include #include @@ -59,10 +63,6 @@ #include #include #include -#include -#include -#include -#include #include "configure.h" @@ -131,7 +131,7 @@ int ShaderVisualizer::exec() { std::string filename = (this->*fun)(); AbstractFramebuffer::blit(multisampleFramebuffer, framebuffer, framebuffer.viewport(), FramebufferBlit::Color); - Image2D result = framebuffer.read(framebuffer.viewport(), {ColorFormat::RGBA, ColorType::UnsignedByte}); + Image2D result = framebuffer.read(framebuffer.viewport(), {PixelFormat::RGBA, PixelType::UnsignedByte}); converter->exportToFile(result, Utility::Directory::join("../", "shaders-" + filename)); } diff --git a/src/Magnum/AbstractFramebuffer.cpp b/src/Magnum/AbstractFramebuffer.cpp index daa0cd845..50776618a 100644 --- a/src/Magnum/AbstractFramebuffer.cpp +++ b/src/Magnum/AbstractFramebuffer.cpp @@ -454,12 +454,12 @@ void AbstractFramebuffer::readBufferImplementationDSAEXT(GLenum buffer) { } #endif -void AbstractFramebuffer::readImplementationDefault(const Range2Di& rectangle, const ColorFormat format, const ColorType type, const std::size_t, GLvoid* const data) { +void AbstractFramebuffer::readImplementationDefault(const Range2Di& rectangle, const PixelFormat format, const PixelType type, const std::size_t, GLvoid* const data) { glReadPixels(rectangle.min().x(), rectangle.min().y(), rectangle.sizeX(), rectangle.sizeY(), GLenum(format), GLenum(type), data); } #ifndef MAGNUM_TARGET_WEBGL -void AbstractFramebuffer::readImplementationRobustness(const Range2Di& rectangle, const ColorFormat format, const ColorType type, const std::size_t dataSize, GLvoid* const data) { +void AbstractFramebuffer::readImplementationRobustness(const Range2Di& rectangle, const PixelFormat format, const PixelType type, const std::size_t dataSize, GLvoid* const data) { #ifndef MAGNUM_TARGET_GLES glReadnPixelsARB(rectangle.min().x(), rectangle.min().y(), rectangle.sizeX(), rectangle.sizeY(), GLenum(format), GLenum(type), dataSize, data); #elif !defined(CORRADE_TARGET_NACL) diff --git a/src/Magnum/AbstractFramebuffer.h b/src/Magnum/AbstractFramebuffer.h index dd59bbd17..bfc1107ae 100644 --- a/src/Magnum/AbstractFramebuffer.h +++ b/src/Magnum/AbstractFramebuffer.h @@ -327,7 +327,7 @@ class MAGNUM_EXPORT AbstractFramebuffer { * * Convenience alternative to the above, example usage: * @code - * Image2D image = framebuffer.read(framebuffer.viewport(), {ColorFormat::RGBA, ColorType::UnsignedByte}); + * Image2D image = framebuffer.read(framebuffer.viewport(), {PixelFormat::RGBA, PixelType::UnsignedByte}); * @endcode */ Image2D read(const Range2Di& rectangle, Image2D&& image); @@ -364,7 +364,7 @@ class MAGNUM_EXPORT AbstractFramebuffer { * * Convenience alternative to the above, example usage: * @code - * BufferImage2D image = framebuffer.read(framebuffer.viewport(), {ColorFormat::RGBA, ColorType::UnsignedByte}, BufferUsage::StaticRead); + * BufferImage2D image = framebuffer.read(framebuffer.viewport(), {PixelFormat::RGBA, PixelType::UnsignedByte}, BufferUsage::StaticRead); * @endcode */ BufferImage2D read(const Range2Di& rectangle, BufferImage2D&& image, BufferUsage usage); @@ -455,9 +455,9 @@ class MAGNUM_EXPORT AbstractFramebuffer { void MAGNUM_LOCAL readBufferImplementationDSAEXT(GLenum buffer); #endif - static void MAGNUM_LOCAL readImplementationDefault(const Range2Di& rectangle, ColorFormat format, ColorType type, std::size_t dataSize, GLvoid* data); + static void MAGNUM_LOCAL readImplementationDefault(const Range2Di& rectangle, PixelFormat format, PixelType type, std::size_t dataSize, GLvoid* data); #ifndef MAGNUM_TARGET_WEBGL - static void MAGNUM_LOCAL readImplementationRobustness(const Range2Di& rectangle, ColorFormat format, ColorType type, std::size_t dataSize, GLvoid* data); + static void MAGNUM_LOCAL readImplementationRobustness(const Range2Di& rectangle, PixelFormat format, PixelType type, std::size_t dataSize, GLvoid* data); #endif void MAGNUM_LOCAL invalidateImplementationNoOp(GLsizei, const GLenum*); diff --git a/src/Magnum/AbstractTexture.cpp b/src/Magnum/AbstractTexture.cpp index f8553e844..663099330 100644 --- a/src/Magnum/AbstractTexture.cpp +++ b/src/Magnum/AbstractTexture.cpp @@ -31,10 +31,10 @@ #include "Magnum/BufferImage.h" #endif #include "Magnum/Array.h" -#include "Magnum/ColorFormat.h" #include "Magnum/Context.h" #include "Magnum/Extensions.h" #include "Magnum/Image.h" +#include "Magnum/PixelFormat.h" #include "Magnum/TextureFormat.h" #include "Magnum/Math/Color.h" #include "Magnum/Math/Range.h" @@ -471,7 +471,7 @@ void AbstractTexture::bindInternal() { } #if !defined(MAGNUM_TARGET_GLES) || defined(MAGNUM_TARGET_GLES2) -ColorFormat AbstractTexture::imageFormatForInternalFormat(const TextureFormat internalFormat) { +PixelFormat AbstractTexture::imageFormatForInternalFormat(const TextureFormat internalFormat) { switch(internalFormat) { #if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2)) case TextureFormat::Red: @@ -496,7 +496,7 @@ ColorFormat AbstractTexture::imageFormatForInternalFormat(const TextureFormat in case TextureFormat::CompressedR11Eac: case TextureFormat::CompressedSignedR11Eac: #endif - return ColorFormat::Red; + return PixelFormat::Red; #endif #ifndef MAGNUM_TARGET_GLES2 @@ -506,7 +506,7 @@ ColorFormat AbstractTexture::imageFormatForInternalFormat(const TextureFormat in case TextureFormat::R16I: case TextureFormat::R32UI: case TextureFormat::R32I: - return ColorFormat::RedInteger; + return PixelFormat::RedInteger; #endif #if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2)) @@ -532,7 +532,7 @@ ColorFormat AbstractTexture::imageFormatForInternalFormat(const TextureFormat in case TextureFormat::CompressedRG11Eac: case TextureFormat::CompressedSignedRG11Eac: #endif - return ColorFormat::RG; + return PixelFormat::RG; #endif #ifndef MAGNUM_TARGET_GLES2 @@ -542,7 +542,7 @@ ColorFormat AbstractTexture::imageFormatForInternalFormat(const TextureFormat in case TextureFormat::RG16I: case TextureFormat::RG32UI: case TextureFormat::RG32I: - return ColorFormat::RGInteger; + return PixelFormat::RGInteger; #endif case TextureFormat::RGB: @@ -592,7 +592,7 @@ ColorFormat AbstractTexture::imageFormatForInternalFormat(const TextureFormat in case TextureFormat::CompressedSRGB8Etc2: #endif case TextureFormat::CompressedRGBS3tcDxt1: - return ColorFormat::RGB; + return PixelFormat::RGB; #ifndef MAGNUM_TARGET_GLES2 case TextureFormat::RGB8UI: @@ -601,7 +601,7 @@ ColorFormat AbstractTexture::imageFormatForInternalFormat(const TextureFormat in case TextureFormat::RGB16I: case TextureFormat::RGB32UI: case TextureFormat::RGB32I: - return ColorFormat::RGBInteger; + return PixelFormat::RGBInteger; #endif case TextureFormat::RGBA: @@ -680,7 +680,7 @@ ColorFormat AbstractTexture::imageFormatForInternalFormat(const TextureFormat in case TextureFormat::CompressedRGBAAstc12x12: case TextureFormat::CompressedSRGB8Alpha8Astc12x12: #endif - return ColorFormat::RGBA; + return PixelFormat::RGBA; #ifndef MAGNUM_TARGET_GLES2 case TextureFormat::RGBA8UI: @@ -690,14 +690,14 @@ ColorFormat AbstractTexture::imageFormatForInternalFormat(const TextureFormat in case TextureFormat::RGBA32UI: case TextureFormat::RGBA32I: case TextureFormat::RGB10A2UI: - return ColorFormat::RGBAInteger; + return PixelFormat::RGBAInteger; #endif #ifdef MAGNUM_TARGET_GLES2 case TextureFormat::Luminance: - return ColorFormat::Luminance; + return PixelFormat::Luminance; case TextureFormat::LuminanceAlpha: - return ColorFormat::LuminanceAlpha; + return PixelFormat::LuminanceAlpha; #endif case TextureFormat::DepthComponent: @@ -711,11 +711,11 @@ ColorFormat AbstractTexture::imageFormatForInternalFormat(const TextureFormat in #ifndef MAGNUM_TARGET_GLES2 case TextureFormat::DepthComponent32F: #endif - return ColorFormat::DepthComponent; + return PixelFormat::DepthComponent; #ifndef MAGNUM_TARGET_WEBGL case TextureFormat::StencilIndex8: - return ColorFormat::StencilIndex; + return PixelFormat::StencilIndex; #endif case TextureFormat::DepthStencil: @@ -725,13 +725,13 @@ ColorFormat AbstractTexture::imageFormatForInternalFormat(const TextureFormat in #ifndef MAGNUM_TARGET_GLES2 case TextureFormat::Depth32FStencil8: #endif - return ColorFormat::DepthStencil; + return PixelFormat::DepthStencil; } CORRADE_ASSERT_UNREACHABLE(); } -ColorType AbstractTexture::imageTypeForInternalFormat(const TextureFormat internalFormat) { +PixelType AbstractTexture::imageTypeForInternalFormat(const TextureFormat internalFormat) { switch(internalFormat) { #if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2)) case TextureFormat::Red: @@ -820,7 +820,7 @@ ColorType AbstractTexture::imageTypeForInternalFormat(const TextureFormat intern case TextureFormat::CompressedRGBAAstc12x12: case TextureFormat::CompressedSRGB8Alpha8Astc12x12: #endif - return ColorType::UnsignedByte; + return PixelType::UnsignedByte; #ifndef MAGNUM_TARGET_GLES2 case TextureFormat::R8Snorm: @@ -835,7 +835,7 @@ ColorType AbstractTexture::imageTypeForInternalFormat(const TextureFormat intern case TextureFormat::CompressedSignedRedRgtc1: case TextureFormat::CompressedSignedRGRgtc2: #endif - return ColorType::Byte; + return PixelType::Byte; #endif #ifndef MAGNUM_TARGET_GLES @@ -857,7 +857,7 @@ ColorType AbstractTexture::imageTypeForInternalFormat(const TextureFormat intern #ifndef MAGNUM_TARGET_GLES case TextureFormat::RGBA12: /**< @todo really? */ #endif - return ColorType::UnsignedShort; + return PixelType::UnsignedShort; #ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES @@ -870,7 +870,7 @@ ColorType AbstractTexture::imageTypeForInternalFormat(const TextureFormat intern case TextureFormat::RG16I: case TextureFormat::RGB16I: case TextureFormat::RGBA16I: - return ColorType::Short; + return PixelType::Short; #endif #ifndef MAGNUM_TARGET_GLES2 @@ -878,19 +878,19 @@ ColorType AbstractTexture::imageTypeForInternalFormat(const TextureFormat intern case TextureFormat::RG16F: case TextureFormat::RGB16F: case TextureFormat::RGBA16F: - return ColorType::HalfFloat; + return PixelType::HalfFloat; case TextureFormat::R32UI: case TextureFormat::RG32UI: case TextureFormat::RGB32UI: case TextureFormat::RGBA32UI: - return ColorType::UnsignedInt; + return PixelType::UnsignedInt; case TextureFormat::R32I: case TextureFormat::RG32I: case TextureFormat::RGB32I: case TextureFormat::RGBA32I: - return ColorType::Int; + return PixelType::Int; case TextureFormat::R32F: case TextureFormat::RG32F: @@ -900,24 +900,24 @@ ColorType AbstractTexture::imageTypeForInternalFormat(const TextureFormat intern case TextureFormat::CompressedRGBBptcUnsignedFloat: case TextureFormat::CompressedRGBBptcSignedFloat: #endif - return ColorType::Float; + return PixelType::Float; #endif #ifndef MAGNUM_TARGET_GLES case TextureFormat::R3B3G2: - return ColorType::UnsignedByte332; + return PixelType::UnsignedByte332; case TextureFormat::RGB4: - return ColorType::UnsignedShort4444; + return PixelType::UnsignedShort4444; #endif #ifndef MAGNUM_TARGET_GLES case TextureFormat::RGB5: #endif case TextureFormat::RGB5A1: - return ColorType::UnsignedShort5551; + return PixelType::UnsignedShort5551; case TextureFormat::RGB565: - return ColorType::UnsignedShort565; + return PixelType::UnsignedShort565; #if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2)) #if !defined(MAGNUM_TARGET_GLES) || defined(MAGNUM_TARGET_GLES2) @@ -927,19 +927,19 @@ ColorType AbstractTexture::imageTypeForInternalFormat(const TextureFormat intern #ifndef MAGNUM_TARGET_GLES2 case TextureFormat::RGB10A2UI: #endif - return ColorType::UnsignedInt2101010Rev; /**< @todo Rev for all? */ + return PixelType::UnsignedInt2101010Rev; /**< @todo Rev for all? */ #endif #ifndef MAGNUM_TARGET_GLES2 case TextureFormat::R11FG11FB10F: - return ColorType::UnsignedInt10F11F11FRev; + return PixelType::UnsignedInt10F11F11FRev; case TextureFormat::RGB9E5: - return ColorType::UnsignedInt5999Rev; + return PixelType::UnsignedInt5999Rev; #endif #if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2)) case TextureFormat::DepthComponent16: - return ColorType::UnsignedShort; + return PixelType::UnsignedShort; #endif case TextureFormat::DepthComponent: @@ -949,27 +949,27 @@ ColorType AbstractTexture::imageTypeForInternalFormat(const TextureFormat intern #ifndef MAGNUM_TARGET_WEBGL case TextureFormat::DepthComponent32: #endif - return ColorType::UnsignedInt; + return PixelType::UnsignedInt; #ifndef MAGNUM_TARGET_GLES2 case TextureFormat::DepthComponent32F: - return ColorType::Float; + return PixelType::Float; #endif #ifndef MAGNUM_TARGET_WEBGL case TextureFormat::StencilIndex8: - return ColorType::UnsignedByte; + return PixelType::UnsignedByte; #endif case TextureFormat::DepthStencil: #if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2)) case TextureFormat::Depth24Stencil8: #endif - return ColorType::UnsignedInt248; + return PixelType::UnsignedInt248; #ifndef MAGNUM_TARGET_GLES2 case TextureFormat::Depth32FStencil8: - return ColorType::Float32UnsignedInt248Rev; + return PixelType::Float32UnsignedInt248Rev; #endif } @@ -1113,8 +1113,8 @@ void AbstractTexture::getLevelParameterImplementationDSAEXT(GLint level, GLenum #ifndef MAGNUM_TARGET_GLES void AbstractTexture::storageImplementationFallback(const GLsizei levels, const TextureFormat internalFormat, const Math::Vector<1, GLsizei>& size) { - const ColorFormat format = imageFormatForInternalFormat(internalFormat); - const ColorType type = imageTypeForInternalFormat(internalFormat); + const PixelFormat format = imageFormatForInternalFormat(internalFormat); + const PixelType type = imageTypeForInternalFormat(internalFormat); for(GLsizei level = 0; level != levels; ++level) DataHelper<1>::setImage(*this, level, internalFormat, @@ -1138,8 +1138,8 @@ void AbstractTexture::storageImplementationDSAEXT(GLsizei levels, TextureFormat #if !defined(MAGNUM_TARGET_GLES) || defined(MAGNUM_TARGET_GLES2) void AbstractTexture::storageImplementationFallback(const GLsizei levels, const TextureFormat internalFormat, const Vector2i& size) { - const ColorFormat format = imageFormatForInternalFormat(internalFormat); - const ColorType type = imageTypeForInternalFormat(internalFormat); + const PixelFormat format = imageFormatForInternalFormat(internalFormat); + const PixelType type = imageTypeForInternalFormat(internalFormat); /* Common code for classic types */ #ifndef MAGNUM_TARGET_GLES @@ -1207,8 +1207,8 @@ void AbstractTexture::storageImplementationDSAEXT(GLsizei levels, TextureFormat #if !defined(MAGNUM_TARGET_GLES) || (defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)) void AbstractTexture::storageImplementationFallback(GLsizei levels, TextureFormat internalFormat, const Vector3i& size) { - const ColorFormat format = imageFormatForInternalFormat(internalFormat); - const ColorType type = imageTypeForInternalFormat(internalFormat); + const PixelFormat format = imageFormatForInternalFormat(internalFormat); + const PixelType type = imageTypeForInternalFormat(internalFormat); /* Common code for classic type */ #ifndef MAGNUM_TARGET_GLES2 @@ -1318,7 +1318,7 @@ void AbstractTexture::storageMultisampleImplementationDSAEXT(const GLsizei sampl #endif #ifndef MAGNUM_TARGET_GLES -void AbstractTexture::getImageImplementationDefault(const GLint level, const ColorFormat format, const ColorType type, const std::size_t, GLvoid* const data) { +void AbstractTexture::getImageImplementationDefault(const GLint level, const PixelFormat format, const PixelType type, const std::size_t, GLvoid* const data) { bindInternal(); glGetTexImage(_target, level, GLenum(format), GLenum(type), data); } @@ -1328,7 +1328,7 @@ void AbstractTexture::getCompressedImageImplementationDefault(const GLint level, glGetCompressedTexImage(_target, level, data); } -void AbstractTexture::getImageImplementationDSA(const GLint level, const ColorFormat format, const ColorType type, const std::size_t dataSize, GLvoid* const data) { +void AbstractTexture::getImageImplementationDSA(const GLint level, const PixelFormat format, const PixelType type, const std::size_t dataSize, GLvoid* const data) { glGetTextureImage(_id, level, GLenum(format), GLenum(type), dataSize, data); } @@ -1336,7 +1336,7 @@ void AbstractTexture::getCompressedImageImplementationDSA(const GLint level, con glGetCompressedTextureImage(_id, level, dataSize, data); } -void AbstractTexture::getImageImplementationDSAEXT(const GLint level, const ColorFormat format, const ColorType type, const std::size_t, GLvoid* const data) { +void AbstractTexture::getImageImplementationDSAEXT(const GLint level, const PixelFormat format, const PixelType type, const std::size_t, GLvoid* const data) { _flags |= ObjectFlag::Created; glGetTextureImageEXT(_id, _target, level, GLenum(format), GLenum(type), data); } @@ -1346,7 +1346,7 @@ void AbstractTexture::getCompressedImageImplementationDSAEXT(const GLint level, glGetCompressedTextureImageEXT(_id, _target, level, data); } -void AbstractTexture::getImageImplementationRobustness(const GLint level, const ColorFormat format, const ColorType type, const std::size_t dataSize, GLvoid* const data) { +void AbstractTexture::getImageImplementationRobustness(const GLint level, const PixelFormat format, const PixelType type, const std::size_t dataSize, GLvoid* const data) { bindInternal(); glGetnTexImageARB(_target, level, GLenum(format), GLenum(type), dataSize, data); } @@ -1358,67 +1358,67 @@ void AbstractTexture::getCompressedImageImplementationRobustness(const GLint lev #endif #ifndef MAGNUM_TARGET_GLES -void AbstractTexture::subImageImplementationDefault(GLint level, const Math::Vector<1, GLint>& offset, const Math::Vector<1, GLsizei>& size, ColorFormat format, ColorType type, const GLvoid* data) { +void AbstractTexture::subImageImplementationDefault(GLint level, const Math::Vector<1, GLint>& offset, const Math::Vector<1, GLsizei>& size, PixelFormat format, PixelType type, const GLvoid* data) { bindInternal(); glTexSubImage1D(_target, level, offset[0], size[0], GLenum(format), GLenum(type), data); } -void AbstractTexture::compressedSubImageImplementationDefault(const GLint level, const Math::Vector<1, GLint>& offset, const Math::Vector<1, GLsizei>& size, const CompressedColorFormat format, const Containers::ArrayView data) { +void AbstractTexture::compressedSubImageImplementationDefault(const GLint level, const Math::Vector<1, GLint>& offset, const Math::Vector<1, GLsizei>& size, const CompressedPixelFormat format, const Containers::ArrayView data) { bindInternal(); glCompressedTexSubImage1D(_target, level, offset[0], size[0], GLenum(format), data.size(), data); } -void AbstractTexture::subImageImplementationDSA(const GLint level, const Math::Vector<1, GLint>& offset, const Math::Vector<1, GLsizei>& size, const ColorFormat format, const ColorType type, const GLvoid* const data) { +void AbstractTexture::subImageImplementationDSA(const GLint level, const Math::Vector<1, GLint>& offset, const Math::Vector<1, GLsizei>& size, const PixelFormat format, const PixelType type, const GLvoid* const data) { glTextureSubImage1D(_id, level, offset[0], size[0], GLenum(format), GLenum(type), data); } -void AbstractTexture::compressedSubImageImplementationDSA(const GLint level, const Math::Vector<1, GLint>& offset, const Math::Vector<1, GLsizei>& size, const CompressedColorFormat format, const Containers::ArrayView data) { +void AbstractTexture::compressedSubImageImplementationDSA(const GLint level, const Math::Vector<1, GLint>& offset, const Math::Vector<1, GLsizei>& size, const CompressedPixelFormat format, const Containers::ArrayView data) { glCompressedTextureSubImage1D(_id, level, offset[0], size[0], GLenum(format), data.size(), data); } -void AbstractTexture::subImageImplementationDSAEXT(GLint level, const Math::Vector<1, GLint>& offset, const Math::Vector<1, GLsizei>& size, ColorFormat format, ColorType type, const GLvoid* data) { +void AbstractTexture::subImageImplementationDSAEXT(GLint level, const Math::Vector<1, GLint>& offset, const Math::Vector<1, GLsizei>& size, PixelFormat format, PixelType type, const GLvoid* data) { _flags |= ObjectFlag::Created; glTextureSubImage1DEXT(_id, _target, level, offset[0], size[0], GLenum(format), GLenum(type), data); } -void AbstractTexture::compressedSubImageImplementationDSAEXT(const GLint level, const Math::Vector<1, GLint>& offset, const Math::Vector<1, GLsizei>& size, const CompressedColorFormat format, const Containers::ArrayView data) { +void AbstractTexture::compressedSubImageImplementationDSAEXT(const GLint level, const Math::Vector<1, GLint>& offset, const Math::Vector<1, GLsizei>& size, const CompressedPixelFormat format, const Containers::ArrayView data) { _flags |= ObjectFlag::Created; glCompressedTextureSubImage1DEXT(_id, _target, level, offset[0], size[0], GLenum(format), data.size(), data); } #endif -void AbstractTexture::subImageImplementationDefault(GLint level, const Vector2i& offset, const Vector2i& size, ColorFormat format, ColorType type, const GLvoid* data) { +void AbstractTexture::subImageImplementationDefault(GLint level, const Vector2i& offset, const Vector2i& size, PixelFormat format, PixelType type, const GLvoid* data) { bindInternal(); glTexSubImage2D(_target, level, offset.x(), offset.y(), size.x(), size.y(), GLenum(format), GLenum(type), data); } -void AbstractTexture::compressedSubImageImplementationDefault(const GLint level, const Vector2i& offset, const Vector2i& size, const CompressedColorFormat format, const Containers::ArrayView data) { +void AbstractTexture::compressedSubImageImplementationDefault(const GLint level, const Vector2i& offset, const Vector2i& size, const CompressedPixelFormat format, const Containers::ArrayView data) { bindInternal(); glCompressedTexSubImage2D(_target, level, offset.x(), offset.y(), size.x(), size.y(), GLenum(format), data.size(), data); } #ifndef MAGNUM_TARGET_GLES -void AbstractTexture::subImageImplementationDSA(const GLint level, const Vector2i& offset, const Vector2i& size, const ColorFormat format, const ColorType type, const GLvoid* const data) { +void AbstractTexture::subImageImplementationDSA(const GLint level, const Vector2i& offset, const Vector2i& size, const PixelFormat format, const PixelType type, const GLvoid* const data) { glTextureSubImage2D(_id, level, offset.x(), offset.y(), size.x(), size.y(), GLenum(format), GLenum(type), data); } -void AbstractTexture::compressedSubImageImplementationDSA(const GLint level, const Vector2i& offset, const Vector2i& size, const CompressedColorFormat format, const Containers::ArrayView data) { +void AbstractTexture::compressedSubImageImplementationDSA(const GLint level, const Vector2i& offset, const Vector2i& size, const CompressedPixelFormat format, const Containers::ArrayView data) { glCompressedTextureSubImage2D(_id, level, offset.x(), offset.y(), size.x(), size.y(), GLenum(format), data.size(), data); } -void AbstractTexture::subImageImplementationDSAEXT(GLint level, const Vector2i& offset, const Vector2i& size, ColorFormat format, ColorType type, const GLvoid* data) { +void AbstractTexture::subImageImplementationDSAEXT(GLint level, const Vector2i& offset, const Vector2i& size, PixelFormat format, PixelType type, const GLvoid* data) { _flags |= ObjectFlag::Created; glTextureSubImage2DEXT(_id, _target, level, offset.x(), offset.y(), size.x(), size.y(), GLenum(format), GLenum(type), data); } -void AbstractTexture::compressedSubImageImplementationDSAEXT(GLint level, const Vector2i& offset, const Vector2i& size, CompressedColorFormat format, Corrade::Containers::ArrayView< const GLvoid > data) { +void AbstractTexture::compressedSubImageImplementationDSAEXT(GLint level, const Vector2i& offset, const Vector2i& size, CompressedPixelFormat format, Corrade::Containers::ArrayView< const GLvoid > data) { _flags |= ObjectFlag::Created; glCompressedTextureSubImage2DEXT(_id, _target, level, offset.x(), offset.y(), size.x(), size.y(), GLenum(format), data.size(), data); } #endif #if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2)) -void AbstractTexture::subImageImplementationDefault(GLint level, const Vector3i& offset, const Vector3i& size, ColorFormat format, ColorType type, const GLvoid* data) { +void AbstractTexture::subImageImplementationDefault(GLint level, const Vector3i& offset, const Vector3i& size, PixelFormat format, PixelType type, const GLvoid* data) { bindInternal(); #ifndef MAGNUM_TARGET_GLES2 glTexSubImage3D(_target, level, offset.x(), offset.y(), offset.z(), size.x(), size.y(), size.z(), GLenum(format), GLenum(type), data); @@ -1435,7 +1435,7 @@ void AbstractTexture::subImageImplementationDefault(GLint level, const Vector3i& #endif } -void AbstractTexture::compressedSubImageImplementationDefault(const GLint level, const Vector3i& offset, const Vector3i& size, const CompressedColorFormat format, const Containers::ArrayView data) { +void AbstractTexture::compressedSubImageImplementationDefault(const GLint level, const Vector3i& offset, const Vector3i& size, const CompressedPixelFormat format, const Containers::ArrayView data) { bindInternal(); #ifndef MAGNUM_TARGET_GLES2 glCompressedTexSubImage3D(_target, level, offset.x(), offset.y(), offset.z(), size.x(), size.y(), size.z(), GLenum(format), data.size(), data); @@ -1453,20 +1453,20 @@ void AbstractTexture::compressedSubImageImplementationDefault(const GLint level, #endif #ifndef MAGNUM_TARGET_GLES -void AbstractTexture::subImageImplementationDSA(const GLint level, const Vector3i& offset, const Vector3i& size, const ColorFormat format, const ColorType type, const GLvoid* const data) { +void AbstractTexture::subImageImplementationDSA(const GLint level, const Vector3i& offset, const Vector3i& size, const PixelFormat format, const PixelType type, const GLvoid* const data) { glTextureSubImage3D(_id, level, offset.x(), offset.y(), offset.z(), size.x(), size.y(), size.z(), GLenum(format), GLenum(type), data); } -void AbstractTexture::compressedSubImageImplementationDSA(const GLint level, const Vector3i& offset, const Vector3i& size, const CompressedColorFormat format, const Containers::ArrayView data) { +void AbstractTexture::compressedSubImageImplementationDSA(const GLint level, const Vector3i& offset, const Vector3i& size, const CompressedPixelFormat format, const Containers::ArrayView data) { glCompressedTextureSubImage3D(_id, level, offset.x(), offset.y(), offset.z(), size.x(), size.y(), size.z(), GLenum(format), data.size(), data); } -void AbstractTexture::subImageImplementationDSAEXT(GLint level, const Vector3i& offset, const Vector3i& size, ColorFormat format, ColorType type, const GLvoid* data) { +void AbstractTexture::subImageImplementationDSAEXT(GLint level, const Vector3i& offset, const Vector3i& size, PixelFormat format, PixelType type, const GLvoid* data) { _flags |= ObjectFlag::Created; glTextureSubImage3DEXT(_id, _target, level, offset.x(), offset.y(), offset.z(), size.x(), size.y(), size.z(), GLenum(format), GLenum(type), data); } -void AbstractTexture::compressedSubImageImplementationDSAEXT(const GLint level, const Vector3i& offset, const Vector3i& size, const CompressedColorFormat format, const Containers::ArrayView data) { +void AbstractTexture::compressedSubImageImplementationDSAEXT(const GLint level, const Vector3i& offset, const Vector3i& size, const CompressedPixelFormat format, const Containers::ArrayView data) { _flags |= ObjectFlag::Created; glCompressedTextureSubImage3DEXT(_id, _target, level, offset.x(), offset.y(), offset.z(), size.x(), size.y(), size.z(), GLenum(format), data.size(), data); } @@ -1530,7 +1530,7 @@ template void AbstractTexture::compressedImage(const GLi Buffer::unbindInternal(Buffer::TargetHint::PixelPack); (this->*Context::current()->state().texture->getCompressedImageImplementation)(level, dataSize, data); - image.setData(CompressedColorFormat(format), size, std::move(data)); + image.setData(CompressedPixelFormat(format), size, std::move(data)); } template void MAGNUM_EXPORT AbstractTexture::compressedImage<1>(GLint, CompressedImage<1>&); @@ -1544,7 +1544,7 @@ template void AbstractTexture::compressedImage(const GLi GLint format; (this->*Context::current()->state().texture->getLevelParameterivImplementation)(level, GL_TEXTURE_INTERNAL_FORMAT, &format); - image.setData(CompressedColorFormat(format), size, {nullptr, std::size_t(dataSize)}, usage); + image.setData(CompressedPixelFormat(format), size, {nullptr, std::size_t(dataSize)}, usage); image.buffer().bindInternal(Buffer::TargetHint::PixelPack); (this->*Context::current()->state().texture->getCompressedImageImplementation)(level, dataSize, nullptr); } diff --git a/src/Magnum/AbstractTexture.h b/src/Magnum/AbstractTexture.h index 099d16bb9..9909e9817 100644 --- a/src/Magnum/AbstractTexture.h +++ b/src/Magnum/AbstractTexture.h @@ -522,10 +522,10 @@ class MAGNUM_EXPORT AbstractTexture: public AbstractObject { #endif #ifndef MAGNUM_TARGET_GLES - void MAGNUM_LOCAL getImageImplementationDefault(GLint level, ColorFormat format, ColorType type, std::size_t dataSize, GLvoid* data); - void MAGNUM_LOCAL getImageImplementationDSA(GLint level, ColorFormat format, ColorType type, std::size_t dataSize, GLvoid* data); - void MAGNUM_LOCAL getImageImplementationDSAEXT(GLint level, ColorFormat format, ColorType type, std::size_t dataSize, GLvoid* data); - void MAGNUM_LOCAL getImageImplementationRobustness(GLint level, ColorFormat format, ColorType type, std::size_t dataSize, GLvoid* data); + void MAGNUM_LOCAL getImageImplementationDefault(GLint level, PixelFormat format, PixelType type, std::size_t dataSize, GLvoid* data); + void MAGNUM_LOCAL getImageImplementationDSA(GLint level, PixelFormat format, PixelType type, std::size_t dataSize, GLvoid* data); + void MAGNUM_LOCAL getImageImplementationDSAEXT(GLint level, PixelFormat format, PixelType type, std::size_t dataSize, GLvoid* data); + void MAGNUM_LOCAL getImageImplementationRobustness(GLint level, PixelFormat format, PixelType type, std::size_t dataSize, GLvoid* data); void MAGNUM_LOCAL getCompressedImageImplementationDefault(GLint level, std::size_t dataSize, GLvoid* data); void MAGNUM_LOCAL getCompressedImageImplementationDSA(GLint level, std::size_t dataSize, GLvoid* data); @@ -534,33 +534,33 @@ class MAGNUM_EXPORT AbstractTexture: public AbstractObject { #endif #ifndef MAGNUM_TARGET_GLES - void MAGNUM_LOCAL subImageImplementationDefault(GLint level, const Math::Vector<1, GLint>& offset, const Math::Vector<1, GLsizei>& size, ColorFormat format, ColorType type, const GLvoid* data); - void MAGNUM_LOCAL subImageImplementationDSA(GLint level, const Math::Vector<1, GLint>& offset, const Math::Vector<1, GLsizei>& size, ColorFormat format, ColorType type, const GLvoid* data); - void MAGNUM_LOCAL subImageImplementationDSAEXT(GLint level, const Math::Vector<1, GLint>& offset, const Math::Vector<1, GLsizei>& size, ColorFormat format, ColorType type, const GLvoid* data); + void MAGNUM_LOCAL subImageImplementationDefault(GLint level, const Math::Vector<1, GLint>& offset, const Math::Vector<1, GLsizei>& size, PixelFormat format, PixelType type, const GLvoid* data); + void MAGNUM_LOCAL subImageImplementationDSA(GLint level, const Math::Vector<1, GLint>& offset, const Math::Vector<1, GLsizei>& size, PixelFormat format, PixelType type, const GLvoid* data); + void MAGNUM_LOCAL subImageImplementationDSAEXT(GLint level, const Math::Vector<1, GLint>& offset, const Math::Vector<1, GLsizei>& size, PixelFormat format, PixelType type, const GLvoid* data); - void MAGNUM_LOCAL compressedSubImageImplementationDefault(GLint level, const Math::Vector<1, GLint>& offset, const Math::Vector<1, GLsizei>& size, CompressedColorFormat format, Containers::ArrayView data); - void MAGNUM_LOCAL compressedSubImageImplementationDSA(GLint level, const Math::Vector<1, GLint>& offset, const Math::Vector<1, GLsizei>& size, CompressedColorFormat format, Containers::ArrayView data); - void MAGNUM_LOCAL compressedSubImageImplementationDSAEXT(GLint level, const Math::Vector<1, GLint>& offset, const Math::Vector<1, GLsizei>& size, CompressedColorFormat format, Containers::ArrayView data); + void MAGNUM_LOCAL compressedSubImageImplementationDefault(GLint level, const Math::Vector<1, GLint>& offset, const Math::Vector<1, GLsizei>& size, CompressedPixelFormat format, Containers::ArrayView data); + void MAGNUM_LOCAL compressedSubImageImplementationDSA(GLint level, const Math::Vector<1, GLint>& offset, const Math::Vector<1, GLsizei>& size, CompressedPixelFormat format, Containers::ArrayView data); + void MAGNUM_LOCAL compressedSubImageImplementationDSAEXT(GLint level, const Math::Vector<1, GLint>& offset, const Math::Vector<1, GLsizei>& size, CompressedPixelFormat format, Containers::ArrayView data); #endif - void MAGNUM_LOCAL subImageImplementationDefault(GLint level, const Vector2i& offset, const Vector2i& size, ColorFormat format, ColorType type, const GLvoid* data); - void MAGNUM_LOCAL compressedSubImageImplementationDefault(GLint level, const Vector2i& offset, const Vector2i& size, CompressedColorFormat format, Containers::ArrayView data); + void MAGNUM_LOCAL subImageImplementationDefault(GLint level, const Vector2i& offset, const Vector2i& size, PixelFormat format, PixelType type, const GLvoid* data); + void MAGNUM_LOCAL compressedSubImageImplementationDefault(GLint level, const Vector2i& offset, const Vector2i& size, CompressedPixelFormat format, Containers::ArrayView data); #ifndef MAGNUM_TARGET_GLES - void MAGNUM_LOCAL subImageImplementationDSA(GLint level, const Vector2i& offset, const Vector2i& size, ColorFormat format, ColorType type, const GLvoid* data); - void MAGNUM_LOCAL subImageImplementationDSAEXT(GLint level, const Vector2i& offset, const Vector2i& size, ColorFormat format, ColorType type, const GLvoid* data); - void MAGNUM_LOCAL compressedSubImageImplementationDSA(GLint level, const Vector2i& offset, const Vector2i& size, CompressedColorFormat format, Containers::ArrayView data); - void MAGNUM_LOCAL compressedSubImageImplementationDSAEXT(GLint level, const Vector2i& offset, const Vector2i& size, CompressedColorFormat format, Containers::ArrayView data); + void MAGNUM_LOCAL subImageImplementationDSA(GLint level, const Vector2i& offset, const Vector2i& size, PixelFormat format, PixelType type, const GLvoid* data); + void MAGNUM_LOCAL subImageImplementationDSAEXT(GLint level, const Vector2i& offset, const Vector2i& size, PixelFormat format, PixelType type, const GLvoid* data); + void MAGNUM_LOCAL compressedSubImageImplementationDSA(GLint level, const Vector2i& offset, const Vector2i& size, CompressedPixelFormat format, Containers::ArrayView data); + void MAGNUM_LOCAL compressedSubImageImplementationDSAEXT(GLint level, const Vector2i& offset, const Vector2i& size, CompressedPixelFormat format, Containers::ArrayView data); #endif #if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2)) - void MAGNUM_LOCAL subImageImplementationDefault(GLint level, const Vector3i& offset, const Vector3i& size, ColorFormat format, ColorType type, const GLvoid* data); - void MAGNUM_LOCAL compressedSubImageImplementationDefault(GLint level, const Vector3i& offset, const Vector3i& size, CompressedColorFormat format, Containers::ArrayView data); + void MAGNUM_LOCAL subImageImplementationDefault(GLint level, const Vector3i& offset, const Vector3i& size, PixelFormat format, PixelType type, const GLvoid* data); + void MAGNUM_LOCAL compressedSubImageImplementationDefault(GLint level, const Vector3i& offset, const Vector3i& size, CompressedPixelFormat format, Containers::ArrayView data); #endif #ifndef MAGNUM_TARGET_GLES - void MAGNUM_LOCAL subImageImplementationDSA(GLint level, const Vector3i& offset, const Vector3i& size, ColorFormat format, ColorType type, const GLvoid* data); - void MAGNUM_LOCAL subImageImplementationDSAEXT(GLint level, const Vector3i& offset, const Vector3i& size, ColorFormat format, ColorType type, const GLvoid* data); - void MAGNUM_LOCAL compressedSubImageImplementationDSA(GLint level, const Vector3i& offset, const Vector3i& size, CompressedColorFormat format, Containers::ArrayView data); - void MAGNUM_LOCAL compressedSubImageImplementationDSAEXT(GLint level, const Vector3i& offset, const Vector3i& size, CompressedColorFormat format, Containers::ArrayView data); + void MAGNUM_LOCAL subImageImplementationDSA(GLint level, const Vector3i& offset, const Vector3i& size, PixelFormat format, PixelType type, const GLvoid* data); + void MAGNUM_LOCAL subImageImplementationDSAEXT(GLint level, const Vector3i& offset, const Vector3i& size, PixelFormat format, PixelType type, const GLvoid* data); + void MAGNUM_LOCAL compressedSubImageImplementationDSA(GLint level, const Vector3i& offset, const Vector3i& size, CompressedPixelFormat format, Containers::ArrayView data); + void MAGNUM_LOCAL compressedSubImageImplementationDSAEXT(GLint level, const Vector3i& offset, const Vector3i& size, CompressedPixelFormat format, Containers::ArrayView data); #endif void MAGNUM_LOCAL invalidateImageImplementationNoOp(GLint level); @@ -574,8 +574,8 @@ class MAGNUM_EXPORT AbstractTexture: public AbstractObject { #endif #if !defined(MAGNUM_TARGET_GLES) || defined(MAGNUM_TARGET_GLES2) - ColorFormat MAGNUM_LOCAL imageFormatForInternalFormat(TextureFormat internalFormat); - ColorType MAGNUM_LOCAL imageTypeForInternalFormat(TextureFormat internalFormat); + PixelFormat MAGNUM_LOCAL imageFormatForInternalFormat(TextureFormat internalFormat); + PixelType MAGNUM_LOCAL imageTypeForInternalFormat(TextureFormat internalFormat); #endif GLuint _id; diff --git a/src/Magnum/BufferImage.cpp b/src/Magnum/BufferImage.cpp index 716036202..86092993a 100644 --- a/src/Magnum/BufferImage.cpp +++ b/src/Magnum/BufferImage.cpp @@ -28,26 +28,26 @@ namespace Magnum { #ifndef MAGNUM_TARGET_GLES2 -template BufferImage::BufferImage(ColorFormat format, ColorType type, const VectorTypeFor& size, const void* data, BufferUsage usage): _format{format}, _type{type}, _size{size}, _buffer{Buffer::TargetHint::PixelPack} { +template BufferImage::BufferImage(PixelFormat format, PixelType type, const VectorTypeFor& size, const void* data, BufferUsage usage): _format{format}, _type{type}, _size{size}, _buffer{Buffer::TargetHint::PixelPack} { _buffer.setData({data, dataSize(size)}, usage); } -template BufferImage::BufferImage(ColorFormat format, ColorType type): _format{format}, _type{type}, _buffer{Buffer::TargetHint::PixelPack} {} +template BufferImage::BufferImage(PixelFormat format, PixelType type): _format{format}, _type{type}, _buffer{Buffer::TargetHint::PixelPack} {} -template void BufferImage::setData(ColorFormat format, ColorType type, const VectorTypeFor& size, const void* data, BufferUsage usage) { +template void BufferImage::setData(PixelFormat format, PixelType type, const VectorTypeFor& size, const void* data, BufferUsage usage) { _format = format; _type = type; _size = size; _buffer.setData({data, dataSize(size)}, usage); } -template CompressedBufferImage::CompressedBufferImage(CompressedColorFormat format, const VectorTypeFor& size, Containers::ArrayView data, BufferUsage usage): _format{format}, _size{size}, _buffer{Buffer::TargetHint::PixelPack}, _dataSize{data.size()} { +template CompressedBufferImage::CompressedBufferImage(CompressedPixelFormat format, const VectorTypeFor& size, Containers::ArrayView data, BufferUsage usage): _format{format}, _size{size}, _buffer{Buffer::TargetHint::PixelPack}, _dataSize{data.size()} { _buffer.setData(data, usage); } template CompressedBufferImage::CompressedBufferImage(): _format{}, _buffer{Buffer::TargetHint::PixelPack}, _dataSize{} {} -template void CompressedBufferImage::setData(CompressedColorFormat format, const VectorTypeFor& size, Containers::ArrayView data, BufferUsage usage) { +template void CompressedBufferImage::setData(CompressedPixelFormat format, const VectorTypeFor& size, Containers::ArrayView data, BufferUsage usage) { _format = format; _size = size; _buffer.setData(data, usage); diff --git a/src/Magnum/BufferImage.h b/src/Magnum/BufferImage.h index fc0661743..1e77fa6fd 100644 --- a/src/Magnum/BufferImage.h +++ b/src/Magnum/BufferImage.h @@ -67,7 +67,7 @@ template class BufferImage { * @todo Make it more flexible (usable with * @extension{ARB,buffer_storage}, avoiding relocations...) */ - explicit BufferImage(ColorFormat format, ColorType type, const VectorTypeFor& size, const void* data, BufferUsage usage); + explicit BufferImage(PixelFormat format, PixelType type, const VectorTypeFor& size, const void* data, BufferUsage usage); /** * @brief Constructor @@ -77,7 +77,7 @@ template class BufferImage { * Size is zero and buffer are empty, call @ref setData() to fill the * image with data. */ - /*implicit*/ BufferImage(ColorFormat format, ColorType type); + /*implicit*/ BufferImage(PixelFormat format, PixelType type); /** @brief Copying is not allowed */ BufferImage(const BufferImage&) = delete; @@ -92,10 +92,10 @@ template class BufferImage { BufferImage& operator=(BufferImage&& other) noexcept; /** @brief Format of pixel data */ - ColorFormat format() const { return _format; } + PixelFormat format() const { return _format; } /** @brief Data type of pixel data */ - ColorType type() const { return _type; } + PixelType type() const { return _type; } /** @brief Pixel size (in bytes) */ std::size_t pixelSize() const { return Implementation::imagePixelSize(_format, _type); } @@ -125,11 +125,11 @@ template class BufferImage { * @todo Make it more flexible (usable with * @extension{ARB,buffer_storage}, avoiding relocations...) */ - void setData(ColorFormat format, ColorType type, const VectorTypeFor& size, const void* data, BufferUsage usage); + void setData(PixelFormat format, PixelType type, const VectorTypeFor& size, const void* data, BufferUsage usage); private: - ColorFormat _format; - ColorType _type; + PixelFormat _format; + PixelType _type; Math::Vector _size; Buffer _buffer; }; @@ -172,7 +172,7 @@ template class CompressedBufferImage { * @todo Make it more flexible (usable with * @extension{ARB,buffer_storage}, avoiding relocations...) */ - explicit CompressedBufferImage(CompressedColorFormat format, const VectorTypeFor& size, Containers::ArrayView data, BufferUsage usage); + explicit CompressedBufferImage(CompressedPixelFormat format, const VectorTypeFor& size, Containers::ArrayView data, BufferUsage usage); /** * @brief Constructor @@ -195,7 +195,7 @@ template class CompressedBufferImage { CompressedBufferImage& operator=(CompressedBufferImage&& other) noexcept; /** @brief Format of compressed data */ - CompressedColorFormat format() const { return _format; } + CompressedPixelFormat format() const { return _format; } /** @brief Image size */ VectorTypeFor size() const { return _size; } @@ -219,10 +219,10 @@ template class CompressedBufferImage { * @todo Make it more flexible (usable with * @extension{ARB,buffer_storage}, avoiding relocations...) */ - void setData(CompressedColorFormat format, const VectorTypeFor& size, Containers::ArrayView data, BufferUsage usage); + void setData(CompressedPixelFormat format, const VectorTypeFor& size, Containers::ArrayView data, BufferUsage usage); private: - CompressedColorFormat _format; + CompressedPixelFormat _format; Math::Vector _size; Buffer _buffer; std::size_t _dataSize; diff --git a/src/Magnum/CMakeLists.txt b/src/Magnum/CMakeLists.txt index 0e5220d5b..250781d5f 100644 --- a/src/Magnum/CMakeLists.txt +++ b/src/Magnum/CMakeLists.txt @@ -34,7 +34,6 @@ set(Magnum_SRCS AbstractShaderProgram.cpp Attribute.cpp Buffer.cpp - ColorFormat.cpp CubeMapTexture.cpp Context.cpp DefaultFramebuffer.cpp @@ -43,6 +42,7 @@ set(Magnum_SRCS Mesh.cpp MeshView.cpp OpenGL.cpp + PixelFormat.cpp PixelStorage.cpp Renderbuffer.cpp Renderer.cpp @@ -86,7 +86,6 @@ set(Magnum_HEADERS Array.h Attribute.h Buffer.h - ColorFormat.h Context.h CubeMapTexture.h DefaultFramebuffer.h @@ -99,6 +98,7 @@ set(Magnum_HEADERS Mesh.h MeshView.h OpenGL.h + PixelFormat.h PixelStorage.h Renderbuffer.h RenderbufferFormat.h @@ -133,6 +133,7 @@ set(Magnum_PRIVATE_HEADERS if(BUILD_DEPRECATED) list(APPEND Magnum_HEADERS Color.h + ColorFormat.h ImageReference.h) endif() diff --git a/src/Magnum/ColorFormat.h b/src/Magnum/ColorFormat.h index 7a686135e..cadc3262c 100644 --- a/src/Magnum/ColorFormat.h +++ b/src/Magnum/ColorFormat.h @@ -26,1181 +26,35 @@ */ /** @file - * @brief Enum @ref Magnum::ColorFormat, @ref Magnum::ColorType, @ref Magnum::CompressedColorFormat + * @deprecated Use @ref Magnum/PixelFormat.h instead. */ -#include "Magnum/Magnum.h" -#include "Magnum/OpenGL.h" -#include "Magnum/visibility.h" +#include "Magnum/configure.h" -namespace Magnum { - -/** -@brief Format of image data - -Note that some formats can be used only for framebuffer reading (using -@ref AbstractFramebuffer::read()) and some only for texture data (using -@ref Texture::setSubImage() and others), the limitations are mentioned in -documentation of each particular value. - -In most cases you may want to use @ref ColorFormat::Red (for grayscale images), -@ref ColorFormat::RGB or @ref ColorFormat::RGBA along with -@ref ColorType::UnsignedByte, the matching texture format is then -@ref TextureFormat::R8, @ref TextureFormat::RGB8 or @ref TextureFormat::RGBA8. -See documentation of these values for possible limitations when using OpenGL ES -2.0 or WebGL. - -@see @ref Image, @ref ImageView, @ref BufferImage, @ref Trade::ImageData -*/ -enum class ColorFormat: GLenum { - #if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2)) - /** - * Floating-point red channel. - * @requires_gles30 For texture data only, extension - * @es_extension{EXT,texture_rg} in OpenGL ES 2.0. - * @requires_es_extension For framebuffer reading, extension - * @es_extension{EXT,texture_rg} - * @requires_webgl20 For texture data only. Not available in WebGL 1.0, see - * @ref ColorFormat::Luminance for an alternative. - */ - #ifndef MAGNUM_TARGET_GLES2 - Red = GL_RED, - #else - Red = GL_RED_EXT, - #endif - #endif - - #ifndef MAGNUM_TARGET_GLES - /** - * Floating-point green channel. - * @requires_gl Only @ref ColorFormat::Red is available in OpenGL ES or - * WebGL. - */ - Green = GL_GREEN, - - /** - * Floating-point blue channel. - * @requires_gl Only @ref ColorFormat::Red is available in OpenGL ES or - * WebGL. - */ - Blue = GL_BLUE, - #endif - - #if defined(MAGNUM_TARGET_GLES2) || defined(DOXYGEN_GENERATING_OUTPUT) - /** - * Floating-point luminance channel. The value is used for all RGB - * channels. - * @requires_gles20 Not available in ES 3.0, WebGL 2.0 or desktop OpenGL. - * Use @ref ColorFormat::Red instead. - * @deprecated_gl Included for compatibility reasons only, use - * @ref ColorFormat::Red instead. - */ - Luminance = GL_LUMINANCE, - #endif - - #if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2)) - /** - * Floating-point red and green channel. - * @requires_gl30 Extension @extension{ARB,texture_rg} and @extension{EXT,texture_integer} - * @requires_gles30 For texture data only, extension - * @es_extension{EXT,texture_rg} in OpenGL ES 2.0. - * @requires_es_extension For framebuffer reading, extension - * @es_extension{EXT,texture_rg} - * @requires_webgl20 For texture data only. Not available in WebGL 1.0, see - * @ref ColorFormat::LuminanceAlpha for and alternative. - */ - #ifndef MAGNUM_TARGET_GLES2 - RG = GL_RG, - #else - RG = GL_RG_EXT, - #endif - #endif - - #if defined(MAGNUM_TARGET_GLES2) || defined(DOXYGEN_GENERATING_OUTPUT) - /** - * Floating-point luminance and alpha channel. First value is used for all - * RGB channels, second value is used for alpha channel. - * @requires_gles20 Not available in ES 3.0, WebGL 2.0 or desktop OpenGL. - * Use @ref ColorFormat::RG instead. - * @deprecated_gl Included for compatibility reasons only, use - * @ref ColorFormat::RG instead. - */ - LuminanceAlpha = GL_LUMINANCE_ALPHA, - #endif - - /** - * Floating-point RGB. - * @requires_gl Can't be used for framebuffer reading in OpenGL ES or WebGL. - */ - RGB = GL_RGB, - - /** Floating-point RGBA. */ - RGBA = GL_RGBA, - - #ifndef MAGNUM_TARGET_GLES - /** - * Floating-point BGR. - * @requires_gl Only RGB component ordering is available in OpenGL ES and - * WebGL. - */ - BGR = GL_BGR, - #endif - - #ifndef MAGNUM_TARGET_WEBGL - /** - * Floating-point BGRA. - * @requires_es_extension Extension @es_extension{EXT,read_format_bgra} - * for framebuffer reading, extension @es_extension{APPLE,texture_format_BGRA8888} - * or @es_extension{EXT,texture_format_BGRA8888} for texture data. - * @requires_gles Only RGBA component ordering is available in WebGL. - */ - #ifndef MAGNUM_TARGET_GLES - BGRA = GL_BGRA, - #else - BGRA = GL_BGRA_EXT, - #endif - #endif - - #ifndef MAGNUM_TARGET_GLES2 - /** - * Integer red channel. - * @requires_gl30 Extension @extension{EXT,texture_integer} - * @requires_gles30 Only floating-point image data are available in OpenGL - * ES 2.0. - * @requires_webgl20 Only floating-point image data are available in WebGL - * 1.0. - */ - RedInteger = GL_RED_INTEGER, - - #ifndef MAGNUM_TARGET_GLES - /** - * Integer green channel. - * @requires_gl30 Extension @extension{EXT,texture_integer} - * @requires_gl Only @ref ColorFormat::RedInteger is available in OpenGL ES - * 3.0 and WebGL 2.0, only floating-point image data are available in - * OpenGL ES 2.0 and WebGL 1.0. - */ - GreenInteger = GL_GREEN_INTEGER, - - /** - * Integer blue channel. - * @requires_gl30 Extension @extension{EXT,texture_integer} - * @requires_gl Only @ref ColorFormat::RedInteger is available in OpenGL ES - * 3.0 and WebGL 2.0, only floating-point image data are available in - * OpenGL ES 2.0 and WebGL 1.0. - */ - BlueInteger = GL_BLUE_INTEGER, - #endif - - /** - * Integer red and green channel. - * @requires_gl30 Extension @extension{ARB,texture_rg} and @extension{EXT,texture_integer} - * @requires_gl Can't be used for framebuffer reading in OpenGL ES or - * WebGL. - * @requires_gles30 For texture data only, only floating-point image data - * are available in OpenGL ES 2.0. - * @requires_webgl20 For texture data only, only floating-point image data - * are available in WebGL 1.0. - */ - RGInteger = GL_RG_INTEGER, - - /** - * Integer RGB. - * @requires_gl30 Extension @extension{EXT,texture_integer} - * @requires_gl Can't be used for framebuffer reading in OpenGL ES or - * WebGL. - * @requires_gles30 For texture data only, only floating-point image data - * are available in OpenGL ES 2.0. - * @requires_webgl20 For texture data only, only floating-point image data - * are available in WebGL 1.0. - */ - RGBInteger = GL_RGB_INTEGER, - - /** - * Integer RGBA. - * @requires_gl30 Extension @extension{EXT,texture_integer} - * @requires_gles30 Only floating-point image data are available in OpenGL - * ES 2.0. - * @requires_webgl20 Only floating-point image data are available in WebGL - * 1.0. - */ - RGBAInteger = GL_RGBA_INTEGER, - - #ifndef MAGNUM_TARGET_GLES - /** - * Integer BGR. - * @requires_gl30 Extension @extension{EXT,texture_integer} - * @requires_gl Only @ref ColorFormat::RGBInteger is available in OpenGL ES - * 3.0 and WebGL 2.0, only floating-point image data are available in - * OpenGL ES 2.0 and WebGL 1.0. - */ - BGRInteger = GL_BGR_INTEGER, - - /** - * Integer BGRA. - * @requires_gl30 Extension @extension{EXT,texture_integer} - * @requires_gl Only @ref ColorFormat::RGBAInteger is available in OpenGL - * ES 3.0 and WebGL 2.0, only floating-point image data are available - * in OpenGL ES 2.0 and WebGL 1.0. - */ - BGRAInteger = GL_BGRA_INTEGER, - #endif - #endif - - /** - * Depth component. - * @requires_gles30 For texture data only, extension @es_extension{OES,depth_texture} - * or @es_extension{ANGLE,depth_texture} in OpenGL ES 2.0. - * @requires_es_extension For framebuffer reading only, extension - * @es_extension2{NV,read_depth,GL_NV_read_depth_stencil}. - * @requires_webgl20 For texture data only, extension - * @webgl_extension{WEBGL,depth_texture} in WebGL 1.0. - */ - DepthComponent = GL_DEPTH_COMPONENT, - - #ifndef MAGNUM_TARGET_WEBGL - /** - * Stencil index. - * @requires_gl44 Extension @extension{ARB,texture_stencil8} for texture - * data, otherwise for framebuffer reading only. - * @requires_es_extension Extension @es_extension2{NV,read_stencil,GL_NV_read_depth_stencil}, - * for framebuffer reading only. - * @requires_es_extension Extension @es_extension{ANDROID,extension_pack_es31a}/ - * @es_extension{OES,texture_stencil8}, for texture data only. - * @requires_gles Stencil index is not available in WebGL. - */ - #ifndef MAGNUM_TARGET_GLES - StencilIndex = GL_STENCIL_INDEX, - #else - StencilIndex = GL_STENCIL_INDEX_OES, - #endif - #endif - - /** - * Depth and stencil. - * @requires_gl30 Extension @extension{ARB,framebuffer_object} - * @requires_gles30 For texture data only, extension @es_extension{OES,packed_depth_stencil} - * in OpenGL ES 2.0. - * @requires_es_extension For framebuffer reading only, extension - * @es_extension2{NV,read_depth_stencil,GL_NV_read_depth_stencil} - * @requires_webgl20 For texture data only, extension - * @webgl_extension{WEBGL,depth_texture} in WebGL 1.0. - */ - #ifndef MAGNUM_TARGET_GLES2 - DepthStencil = GL_DEPTH_STENCIL - #else - /* Using OES version even though WebGL 1.0 *has* DEPTH_STENCIL constant, - because there are no such headers for it */ - DepthStencil = GL_DEPTH_STENCIL_OES - #endif -}; - -/** -@brief Type of image data - -Note that some formats can be used only for framebuffer reading (using -@ref AbstractFramebuffer::read()) and some only for texture data (using -@ref Texture::setSubImage() and others), the limitations are mentioned in -documentation of each particular value. - -In most cases you may want to use @ref ColorType::UnsignedByte along with -@ref ColorFormat::Red (for grayscale images), @ref ColorFormat::RGB or -@ref ColorFormat::RGBA, the matching texture format is then -@ref TextureFormat::R8, @ref TextureFormat::RGB8 or @ref TextureFormat::RGBA8. -See documentation of these values for possible limitations when using OpenGL ES -2.0 or WebGL. - -@see @ref Image, @ref ImageView, @ref BufferImage, @ref Trade::ImageData -*/ -enum class ColorType: GLenum { - /** Each component unsigned byte. */ - UnsignedByte = GL_UNSIGNED_BYTE, - - #ifndef MAGNUM_TARGET_GLES2 - /** - * Each component signed byte. - * @requires_gles30 For texture data only, only @ref ColorType::UnsignedByte - * is available in OpenGL ES 2.0. - * @requires_gl Can't be used for framebuffer reading in OpenGL ES or - * WebGL. - * @requires_webgl20 For texture data only, only @ref ColorType::UnsignedByte - * is available in WebGL 1.0. - */ - Byte = GL_BYTE, - #endif - - /** - * Each component unsigned short. - * @requires_gles30 For texture data only, extension @es_extension{OES,depth_texture} - * or @es_extension{ANGLE,depth_texture} in OpenGL ES 2.0. - * @requires_gl Can't be used for framebuffer reading in OpenGL ES or - * WebGL. - * @requires_webgl20 For texture data only, extension - * @webgl_extension{WEBGL,depth_texture} in WebGL 1.0. - */ - UnsignedShort = GL_UNSIGNED_SHORT, - - #ifndef MAGNUM_TARGET_GLES2 - /** - * Each component signed short. - * @requires_gl Can't be used for framebuffer reading in OpenGL ES or - * WebGL. - * @requires_gles30 For texture data only, only @ref ColorType::UnsignedShort - * is available in OpenGL ES 2.0. - * @requires_webgl20 For texture data only, only @ref ColorType::UnsignedShort - * is available in WebGL 1.0. - */ - Short = GL_SHORT, - #endif - - /** - * Each component unsigned int. - * @requires_gles30 For texture data only, extension @es_extension{OES,depth_texture} - * or @es_extension{ANGLE,depth_texture} in OpenGL ES 2.0. - * @requires_webgl20 For texture data only, extension - * @webgl_extension{WEBGL,depth_texture} in WebGL 1.0. - */ - UnsignedInt = GL_UNSIGNED_INT, - - #ifndef MAGNUM_TARGET_GLES2 - /** - * Each component signed int. - * @requires_gles30 Only @ref ColorType::UnsignedInt is available in OpenGL - * ES 2.0. - * @requires_webgl20 Only @ref ColorType::UnsignedInt is available in WebGL - * 1.0. - */ - Int = GL_INT, - #endif - - /** - * Each component half float. - * @requires_gl30 Extension @extension{ARB,half_float_pixel} - * @requires_gles30 For texture data only, extension - * @es_extension2{OES,texture_half_float,OES_texture_float} in OpenGL - * ES 2.0. - * @requires_webgl20 For texture data only, extension - * @webgl_extension{OES,texture_half_float} in WebGL 1.0. - */ - #ifndef MAGNUM_TARGET_GLES2 - HalfFloat = GL_HALF_FLOAT, - #else - HalfFloat = GL_HALF_FLOAT_OES, - #endif - - /** - * Each component float. - * @requires_gles30 For texture data only, extension @es_extension{OES,texture_float} - * in OpenGL ES 2.0. - * @requires_webgl20 For texture data only, extension @webgl_extension{OES,texture_float} - * in WebGL 1.0. - */ - Float = GL_FLOAT, - - #ifndef MAGNUM_TARGET_GLES - /** - * RGB, unsigned byte, red and green component 3bit, blue component 2bit. - * @requires_gl Packed 12bit types are not available in OpenGL ES or WebGL. - */ - UnsignedByte332 = GL_UNSIGNED_BYTE_3_3_2, - - /** - * BGR, unsigned byte, red and green component 3bit, blue component 2bit. - * @requires_gl Packed 12bit types are not available in OpenGL ES or WebGL. - */ - UnsignedByte233Rev = GL_UNSIGNED_BYTE_2_3_3_REV, - #endif - - /** - * RGB, unsigned byte, red and blue component 5bit, green 6bit. - * @requires_gl Can't be used for framebuffer reading in OpenGL ES or WebGL. - */ - UnsignedShort565 = GL_UNSIGNED_SHORT_5_6_5, - - #ifndef MAGNUM_TARGET_GLES - /** - * BGR, unsigned short, red and blue 5bit, green 6bit. - * @requires_gl Only @ref ColorType::UnsignedShort565 is available in - * OpenGL ES or WebGL. - */ - UnsignedShort565Rev = GL_UNSIGNED_SHORT_5_6_5_REV, - #endif - - /** - * RGBA, unsigned short, each component 4bit. - * @requires_gl Can't be used for framebuffer reading in OpenGL ES or WebGL. - */ - UnsignedShort4444 = GL_UNSIGNED_SHORT_4_4_4_4, - - #ifndef MAGNUM_TARGET_WEBGL - /** - * ABGR, unsigned short, each component 4bit. - * @requires_es_extension For framebuffer reading only, extension - * @es_extension{EXT,read_format_bgra} - * @requires_gles Only RGBA component ordering is available in WebGL. - */ - #ifndef MAGNUM_TARGET_GLES - UnsignedShort4444Rev = GL_UNSIGNED_SHORT_4_4_4_4_REV, - #else - UnsignedShort4444Rev = GL_UNSIGNED_SHORT_4_4_4_4_REV_EXT, - #endif - #endif - - /** - * RGBA, unsigned short, each RGB component 5bit, alpha component 1bit. - * @requires_gl Can't be used for framebuffer reading in OpenGL ES or WebGL. - */ - UnsignedShort5551 = GL_UNSIGNED_SHORT_5_5_5_1, - - #ifndef MAGNUM_TARGET_WEBGL - /** - * ABGR, unsigned short, each RGB component 5bit, alpha component 1bit. - * @requires_es_extension For framebuffer reading only, extension - * @es_extension{EXT,read_format_bgra} - * @requires_gles Not available in WebGL. - */ - #ifndef MAGNUM_TARGET_GLES - UnsignedShort1555Rev = GL_UNSIGNED_SHORT_1_5_5_5_REV, - #else - UnsignedShort1555Rev = GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT, - #endif - #endif - - #ifndef MAGNUM_TARGET_GLES - /** - * RGBA, unsigned int, each component 8bit. - * @requires_gl Use @ref ColorType::UnsignedByte in OpenGL ES and WebGL - * instead. - */ - UnsignedInt8888 = GL_UNSIGNED_INT_8_8_8_8, - - /** - * ABGR, unsigned int, each component 8bit. - * @requires_gl Only RGBA component ordering is available in OpenGL ES and - * WebGL, see @ref ColorType::UnsignedInt8888 for more information. - */ - UnsignedInt8888Rev = GL_UNSIGNED_INT_8_8_8_8_REV, - - /** - * RGBA, unsigned int, each RGB component 10bit, alpha component 2bit. - * @requires_gl Only @ref ColorType::UnsignedInt2101010Rev is available in - * OpenGL ES and WebGL. - */ - UnsignedInt1010102 = GL_UNSIGNED_INT_10_10_10_2, - #endif - - #if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2)) - /** - * ABGR, unsigned int, each RGB component 10bit, alpha component 2bit. - * @requires_gles30 Can't be used for framebuffer reading in OpenGL ES 2.0. - * @requires_gles30 For texture data only, extension - * @es_extension{EXT,texture_type_2_10_10_10_REV} in OpenGL ES 2.0. - * Not available in WebGL 1.0. - * @requires_webgl20 Only RGBA component ordering is available in WebGL - * 1.0. - */ - #ifndef MAGNUM_TARGET_GLES2 - UnsignedInt2101010Rev = GL_UNSIGNED_INT_2_10_10_10_REV, - #else - UnsignedInt2101010Rev = GL_UNSIGNED_INT_2_10_10_10_REV_EXT, - #endif - #endif - - #ifndef MAGNUM_TARGET_GLES2 - /** - * BGR, unsigned int, red and green 11bit float, blue 10bit float. - * @requires_gl30 Extension @extension{EXT,packed_float} - * @requires_gles30 Floating-point types are not available in OpenGL ES - * 2.0. - * @requires_webgl20 Floating-point types are not available in WebGL 1.0. - */ - UnsignedInt10F11F11FRev = GL_UNSIGNED_INT_10F_11F_11F_REV, - - /** - * BGR, unsigned int, each component 9bit + 5bit exponent. - * @requires_gl30 Extension @extension{EXT,texture_shared_exponent} - * @requires_gles30 Only 8bit and 16bit types are available in OpenGL ES - * 2.0. - * @requires_webgl20 Only 8bit and 16bit types are available in WebGL 1.0. - */ - UnsignedInt5999Rev = GL_UNSIGNED_INT_5_9_9_9_REV, - #endif - - /** - * Unsigned int, depth component 24bit, stencil index 8bit. - * @requires_gl30 Extension @extension{ARB,framebuffer_object} - * @requires_gles30 For texture data only, extension - * @es_extension{OES,packed_depth_stencil} in OpenGL ES 2.0. - * @requires_webgl20 For texture data only, extension - * @webgl_extension{WEBGL,depth_texture} in WebGL 1.0. - */ - #ifndef MAGNUM_TARGET_GLES2 - UnsignedInt248 = GL_UNSIGNED_INT_24_8, - #else - UnsignedInt248 = GL_UNSIGNED_INT_24_8_OES, - #endif - - #ifndef MAGNUM_TARGET_GLES2 - /** - * Float + unsigned int, depth component 32bit float, 24bit gap, stencil - * index 8bit. - * @requires_gl30 Extension @extension{ARB,depth_buffer_float} - * @requires_gles30 For texture data only, only @ref ColorType::UnsignedInt248 - * is available in OpenGL ES 2.0. - * @requires_webgl20 For texture data only, only @ref ColorType::UnsignedInt248 - * is available in WebGL 1.0. - */ - Float32UnsignedInt248Rev = GL_FLOAT_32_UNSIGNED_INT_24_8_REV - #endif -}; - -/** -@brief Format of compressed image data - -Equivalent to `Compressed*` values of @ref TextureFormat enum. - -@see @ref CompressedImage, @ref CompressedImageView, @ref CompressedBufferImage, - @ref Trade::ImageData -*/ -enum class CompressedColorFormat: GLenum { - #ifndef MAGNUM_TARGET_GLES - /** - * Compressed red channel, normalized unsigned. - * @requires_gl30 Extension @extension{ARB,texture_rg} - * @requires_gl Generic texture compression is not available in OpenGL ES - * or WebGL. - */ - Red = GL_COMPRESSED_RED, +#ifdef MAGNUM_BUILD_DEPRECATED +#include "Magnum/PixelFormat.h" +CORRADE_DEPRECATED_FILE("use Magnum/PixelFormat.h instead") - /** - * Compressed red and green channel, normalized unsigned. - * @requires_gl30 Extension @extension{ARB,texture_rg} - * @requires_gl Generic texture compression is not available in OpenGL ES - * or WebGL. - */ - RG = GL_COMPRESSED_RG, - - /** - * Compressed RGB, normalized unsigned. - * @requires_gl Generic texture compression is not available in OpenGL ES - * or WebGL. - */ - RGB = GL_COMPRESSED_RGB, - - /** - * Compressed RGBA, normalized unsigned. - * @requires_gl Generic texture compression is not available in OpenGL ES - * or WebGL. - */ - RGBA = GL_COMPRESSED_RGBA, - - /** - * RGTC compressed red channel, normalized unsigned. **Available only for - * 2D, 2D array, cube map and cube map array textures.** - * @requires_gl30 Extension @extension{EXT,texture_compression_rgtc} - * @requires_gl Generic texture compression is not available in OpenGL ES - * or WebGL. - */ - RedRgtc1 = GL_COMPRESSED_RED_RGTC1, - - /** - * RGTC compressed red and green channel, normalized unsigned. **Available - * only for 2D, 2D array, cube map and cube map array textures.** - * @requires_gl30 Extension @extension{EXT,texture_compression_rgtc} - * @requires_gl RGTC texture compression is not available in OpenGL ES or - * WebGL. - */ - RGRgtc2 = GL_COMPRESSED_RG_RGTC2, - - /** - * RGTC compressed red channel, normalized signed. **Available only for 2D, - * 2D array, cube map and cube map array textures.** - * @requires_gl30 Extension @extension{EXT,texture_compression_rgtc} - * @requires_gl RGTC texture compression is not available in OpenGL ES or - * WebGL. - */ - SignedRedRgtc1 = GL_COMPRESSED_SIGNED_RED_RGTC1, - - /** - * RGTC compressed red and green channel, normalized signed. **Available - * only for 2D, 2D array, cube map and cube map array textures.** - * @requires_gl30 Extension @extension{EXT,texture_compression_rgtc} - * @requires_gl RGTC texture compression is not available in OpenGL ES or - * WebGL. - */ - SignedRGRgtc2 = GL_COMPRESSED_SIGNED_RG_RGTC2, - - /** - * BPTC compressed RGB, unsigned float. **Available only on 2D, 3D, 2D - * array, cube map and cube map array textures.** - * @requires_gl42 Extension @extension{ARB,texture_compression_bptc} - * @requires_gl BPTC texture compression is not available in OpenGL ES or - * WebGL. - */ - RGBBptcUnsignedFloat = GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT, - - /** - * BPTC compressed RGB, signed float. **Available only on 2D, 3D, 2D array, - * cube map and cube map array textures.** - * @requires_gl42 Extension @extension{ARB,texture_compression_bptc} - * @requires_gl BPTC texture compression is not available in OpenGL ES or - * WebGL. - */ - RGBBptcSignedFloat = GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT, - - /** - * BPTC compressed RGBA, normalized unsigned. **Available only on 2D, 3D, - * 2D array, cube map and cube map array textures.** - * @requires_gl42 Extension @extension{ARB,texture_compression_bptc} - * @requires_gl BPTC texture compression is not available in OpenGL ES or - * WebGL. - */ - RGBABptcUnorm = GL_COMPRESSED_RGBA_BPTC_UNORM, - - /** - * BPTC compressed sRGBA, normalized unsigned. **Available only on 2D, 3D, - * 2D array, cube map and cube map array textures.** - * @requires_gl42 Extension @extension{ARB,texture_compression_bptc} - * @requires_gl BPTC texture compression is not available in OpenGL ES or - * WebGL. - */ - SRGBAlphaBptcUnorm = GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM, - #endif - - #ifndef MAGNUM_TARGET_GLES2 - /** - * ETC2 compressed RGB, normalized unsigned. **Available only on 2D, 2D - * array, cube map and cube map array textures.** - * @requires_gl43 Extension @extension{ARB,ES3_compatibility} - * @requires_gles30 ETC2 texture compression is not available in OpenGL ES - * 2.0. - */ - RGB8Etc2 = GL_COMPRESSED_RGB8_ETC2, - - /** - * ETC2 compressed sRGB, normalized unsigned. **Available only on 2D, 2D - * array, cube map and cube map array textures.** - * @requires_gl43 Extension @extension{ARB,ES3_compatibility} - * @requires_gles30 ETC2 texture compression is not available in OpenGL ES - * 2.0. - */ - SRGB8Etc2 = GL_COMPRESSED_SRGB8_ETC2, - - /** - * ETC2 compressed RGB with punchthrough (single-bit) alpha, normalized - * unsigned. **Available only on 2D, 2D array, cube map and cube map array - * textures.** - * @requires_gl43 Extension @extension{ARB,ES3_compatibility} - * @requires_gles30 ETC2 texture compression is not available in OpenGL ES - * 2.0. - */ - RGB8PunchthroughAlpha1Etc2 = GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2, - - /** - * ETC2 compressed sRGB with punchthrough (single-bit) alpha, normalized - * unsigned. **Available only on 2D, 2D array, cube map and cube map array - * textures.** - * @requires_gl43 Extension @extension{ARB,ES3_compatibility} - * @requires_gles30 ETC2 texture compression is not available in OpenGL ES - * 2.0. - */ - SRGB8PunchthroughAlpha1Etc2 = GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2, - - /** - * ETC2/EAC compressed RGBA, normalized unsigned. **Available only on 2D, - * 2D array, cube map and cube map array textures.** - * @requires_gl43 Extension @extension{ARB,ES3_compatibility} - * @requires_gles30 ETC2 texture compression is not available in OpenGL ES - * 2.0. - */ - RGBA8Etc2Eac = GL_COMPRESSED_RGBA8_ETC2_EAC, - - /** - * ETC2/EAC compressed sRGB with alpha, normalized unsigned. **Available - * only on 2D, 2D array, cube map and cube map array textures.** - * @requires_gl43 Extension @extension{ARB,ES3_compatibility} - * @requires_gles30 ETC2 texture compression is not available in OpenGL ES - * 2.0. - */ - SRGB8Alpha8Etc2Eac = GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC, - - /** - * EAC compressed red channel, normalized unsigned. **Available only on 2D, - * 2D array, cube map and cube map array textures.** - * @requires_gl43 Extension @extension{ARB,ES3_compatibility} - * @requires_gles30 ETC2 texture compression is not available in OpenGL ES - * 2.0. - */ - R11Eac = GL_COMPRESSED_R11_EAC, - - /** - * EAC compressed red channel, normalized signed. **Available only on 2D, - * 2D array, cube map and cube map array textures.** - * @requires_gl43 Extension @extension{ARB,ES3_compatibility} - * @requires_gles30 ETC2 texture compression is not available in OpenGL ES - * 2.0. - */ - SignedR11Eac = GL_COMPRESSED_SIGNED_R11_EAC, - - /** - * EAC compressed red and green channel, normalized unsigned. **Available - * only on 2D, 2D array, cube map and cube map array textures.** - * @requires_gl43 Extension @extension{ARB,ES3_compatibility} - * @requires_gles30 ETC2 texture compression is not available in OpenGL ES - * 2.0. - */ - RG11Eac = GL_COMPRESSED_RG11_EAC, - - /** - * EAC compressed red and green channel, normalized signed. **Available - * only on 2D, 2D array, cube map and cube map array textures.** - * @requires_gl43 Extension @extension{ARB,ES3_compatibility} - * @requires_gles30 ETC2 texture compression is not available in OpenGL ES - * 2.0. - */ - SignedRG11Eac = GL_COMPRESSED_SIGNED_RG11_EAC, - #endif - - /** - * S3TC DXT1 compressed RGB. **Available only for 2D, 3D, 2D array, cube - * map and cube map array textures.** - * @requires_extension Extension @extension{EXT,texture_compression_s3tc} - * @requires_es_extension Extension @es_extension2{EXT,texture_compression_s3tc,texture_compression_s3tc} - * @requires_webgl_extension Extension @webgl_extension{WEBGL,compressed_texture_s3tc} - */ - RGBS3tcDxt1 = GL_COMPRESSED_RGB_S3TC_DXT1_EXT, - - /** - * S3TC DXT1 compressed RGBA. **Available only for 2D, 3D, 2D array, cube - * map and cube map array textures.** - * @requires_extension Extension @extension{EXT,texture_compression_s3tc} - * @requires_es_extension Extension @es_extension2{EXT,texture_compression_s3tc,texture_compression_s3tc} - * @requires_webgl_extension Extension @webgl_extension{WEBGL,compressed_texture_s3tc} - */ - RGBAS3tcDxt1 = GL_COMPRESSED_RGBA_S3TC_DXT1_EXT, - - /** - * S3TC DXT3 compressed RGBA. **Available only for 2D, 3D, 2D array, cube - * map and cube map array textures.** - * @requires_extension Extension @extension{EXT,texture_compression_s3tc} - * @requires_es_extension Extension @es_extension2{EXT,texture_compression_s3tc,texture_compression_s3tc} - * @requires_webgl_extension Extension @webgl_extension{WEBGL,compressed_texture_s3tc} - */ - RGBAS3tcDxt3 = GL_COMPRESSED_RGBA_S3TC_DXT3_EXT, - - /** - * S3TC DXT5 compressed RGBA. **Available only for 2D, 3D, 2D array, cube - * map and cube map array textures.** - * @requires_extension Extension @extension{EXT,texture_compression_s3tc} - * @requires_es_extension Extension @es_extension2{EXT,texture_compression_s3tc,texture_compression_s3tc} - * @requires_webgl_extension Extension @webgl_extension{WEBGL,compressed_texture_s3tc} - */ - RGBAS3tcDxt5 = GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, - - #ifndef MAGNUM_TARGET_WEBGL - /** - * ASTC compressed RGBA with 4x4 blocks. **Available only on 2D, 3D, 2D - * array, cube map and cube map array textures.** - * @requires_extension Extension @extension3{KHR,texture_compression_astc_ldr,texture_compression_astc_hdr} - * @requires_extension Extension @extension{KHR,texture_compression_astc_hdr} - * for 3D textures and HDR profile - * @requires_es_extension Extension @es_extension{ANDROID,extension_pack_es31a}/ - * @es_extension2{KHR,texture_compression_astc_ldr,texture_compression_astc_hdr} - * @requires_es_extension Extension @es_extension2{KHR,texture_compression_astc_hdr,texture_compression_astc_hdr} - * for 3D textures and HDR profile - * @requires_gles ASTC texture compression is not available in WebGL. - */ - RGBAAstc4x4 = GL_COMPRESSED_RGBA_ASTC_4x4_KHR, - - /** - * ASTC compressed sRGB with alpha with 4x4 blocks. **Available only on 2D, - * 3D, 2D array, cube map and cube map array textures.** - * @requires_extension Extension @extension3{KHR,texture_compression_astc_ldr,texture_compression_astc_hdr} - * @requires_extension Extension @extension{KHR,texture_compression_astc_hdr} - * for 3D textures and HDR profile - * @requires_es_extension Extension @es_extension{ANDROID,extension_pack_es31a}/ - * @es_extension2{KHR,texture_compression_astc_ldr,texture_compression_astc_hdr} - * @requires_es_extension Extension @es_extension2{KHR,texture_compression_astc_hdr,texture_compression_astc_hdr} - * for 3D textures and HDR profile - * @requires_gles ASTC texture compression is not available in WebGL. - */ - SRGB8Alpha8Astc4x4 = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR, - - /** - * ASTC compressed RGBA with 5x4 blocks. **Available only on 2D, 3D, 2D - * array, cube map and cube map array textures.** - * @requires_extension Extension @extension3{KHR,texture_compression_astc_ldr,texture_compression_astc_hdr} - * @requires_extension Extension @extension{KHR,texture_compression_astc_hdr} - * for 3D textures and HDR profile - * @requires_es_extension Extension @es_extension{ANDROID,extension_pack_es31a}/ - * @es_extension2{KHR,texture_compression_astc_ldr,texture_compression_astc_hdr} - * @requires_es_extension Extension @es_extension2{KHR,texture_compression_astc_hdr,texture_compression_astc_hdr} - * for 3D textures and HDR profile - * @requires_gles ASTC texture compression is not available in WebGL. - */ - RGBAAstc5x4 = GL_COMPRESSED_RGBA_ASTC_5x4_KHR, - - /** - * ASTC compressed sRGB with alpha with 5x4 blocks. **Available only on 2D, - * 3D, 2D array, cube map and cube map array textures.** - * @requires_extension Extension @extension3{KHR,texture_compression_astc_ldr,texture_compression_astc_hdr} - * @requires_extension Extension @extension{KHR,texture_compression_astc_hdr} - * for 3D textures and HDR profile - * @requires_es_extension Extension @es_extension{ANDROID,extension_pack_es31a}/ - * @es_extension2{KHR,texture_compression_astc_ldr,texture_compression_astc_hdr} - * @requires_es_extension Extension @es_extension2{KHR,texture_compression_astc_hdr,texture_compression_astc_hdr} - * for 3D textures and HDR profile - * @requires_gles ASTC texture compression is not available in WebGL. - */ - SRGB8Alpha8Astc5x4 = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR, - - /** - * ASTC compressed RGBA with 5x5 blocks. **Available only on 2D, 3D, 2D - * array, cube map and cube map array textures.** - * @requires_extension Extension @extension3{KHR,texture_compression_astc_ldr,texture_compression_astc_hdr} - * @requires_extension Extension @extension{KHR,texture_compression_astc_hdr} - * for 3D textures and HDR profile - * @requires_es_extension Extension @es_extension{ANDROID,extension_pack_es31a}/ - * @es_extension2{KHR,texture_compression_astc_ldr,texture_compression_astc_hdr} - * @requires_es_extension Extension @es_extension2{KHR,texture_compression_astc_hdr,texture_compression_astc_hdr} - * for 3D textures and HDR profile - * @requires_gles ASTC texture compression is not available in WebGL. - */ - RGBAAstc5x5 = GL_COMPRESSED_RGBA_ASTC_5x5_KHR, - - /** - * ASTC compressed sRGB with alpha with 5x5 blocks. **Available only on 2D, - * 3D, 2D array, cube map and cube map array textures.** - * @requires_extension Extension @extension3{KHR,texture_compression_astc_ldr,texture_compression_astc_hdr} - * @requires_extension Extension @extension{KHR,texture_compression_astc_hdr} - * for 3D textures and HDR profile - * @requires_es_extension Extension @es_extension{ANDROID,extension_pack_es31a}/ - * @es_extension2{KHR,texture_compression_astc_ldr,texture_compression_astc_hdr} - * @requires_es_extension Extension @es_extension2{KHR,texture_compression_astc_hdr,texture_compression_astc_hdr} - * for 3D textures and HDR profile - * @requires_gles ASTC texture compression is not available in WebGL. - */ - SRGB8Alpha8Astc5x5 = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR, - - /** - * ASTC compressed RGBA with 6x5 blocks. **Available only on 2D, 3D, 2D - * array, cube map and cube map array textures.** - * @requires_extension Extension @extension3{KHR,texture_compression_astc_ldr,texture_compression_astc_hdr} - * @requires_extension Extension @extension{KHR,texture_compression_astc_hdr} - * for 3D textures and HDR profile - * @requires_es_extension Extension @es_extension{ANDROID,extension_pack_es31a}/ - * @es_extension2{KHR,texture_compression_astc_ldr,texture_compression_astc_hdr} - * @requires_es_extension Extension @es_extension2{KHR,texture_compression_astc_hdr,texture_compression_astc_hdr} - * for 3D textures and HDR profile - * @requires_gles ASTC texture compression is not available in WebGL. - */ - RGBAAstc6x5 = GL_COMPRESSED_RGBA_ASTC_6x5_KHR, - - /** - * ASTC compressed sRGB with alpha with 6x5 blocks. **Available only on 2D, - * 3D, 2D array, cube map and cube map array textures.** - * @requires_extension Extension @extension3{KHR,texture_compression_astc_ldr,texture_compression_astc_hdr} - * @requires_extension Extension @extension{KHR,texture_compression_astc_hdr} - * for 3D textures and HDR profile - * @requires_es_extension Extension @es_extension{ANDROID,extension_pack_es31a}/ - * @es_extension2{KHR,texture_compression_astc_ldr,texture_compression_astc_hdr} - * @requires_es_extension Extension @es_extension2{KHR,texture_compression_astc_hdr,texture_compression_astc_hdr} - * for 3D textures and HDR profile - * @requires_gles ASTC texture compression is not available in WebGL. - */ - SRGB8Alpha8Astc6x5 = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR, - - /** - * ASTC compressed RGBA with 6x6 blocks. **Available only on 2D, 3D, 2D - * array, cube map and cube map array textures.** - * @requires_extension Extension @extension3{KHR,texture_compression_astc_ldr,texture_compression_astc_hdr} - * @requires_extension Extension @extension{KHR,texture_compression_astc_hdr} - * for 3D textures and HDR profile - * @requires_es_extension Extension @es_extension{ANDROID,extension_pack_es31a}/ - * @es_extension2{KHR,texture_compression_astc_ldr,texture_compression_astc_hdr} - * @requires_es_extension Extension @es_extension2{KHR,texture_compression_astc_hdr,texture_compression_astc_hdr} - * for 3D textures and HDR profile - * @requires_gles ASTC texture compression is not available in WebGL. - */ - RGBAAstc6x6 = GL_COMPRESSED_RGBA_ASTC_6x6_KHR, - - /** - * ASTC compressed sRGB with alpha with 6x6 blocks. **Available only on 2D, - * 3D, 2D array, cube map and cube map array textures.** - * @requires_extension Extension @extension3{KHR,texture_compression_astc_ldr,texture_compression_astc_hdr} - * @requires_extension Extension @extension{KHR,texture_compression_astc_hdr} - * for 3D textures and HDR profile - * @requires_es_extension Extension @es_extension{ANDROID,extension_pack_es31a}/ - * @es_extension2{KHR,texture_compression_astc_ldr,texture_compression_astc_hdr} - * @requires_es_extension Extension @es_extension2{KHR,texture_compression_astc_hdr,texture_compression_astc_hdr} - * for 3D textures and HDR profile - * @requires_gles ASTC texture compression is not available in WebGL. - */ - SRGB8Alpha8Astc6x6 = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR, - - /** - * ASTC compressed RGBA with 8x5 blocks. **Available only on 2D, 3D, 2D - * array, cube map and cube map array textures.** - * @requires_extension Extension @extension3{KHR,texture_compression_astc_ldr,texture_compression_astc_hdr} - * @requires_extension Extension @extension{KHR,texture_compression_astc_hdr} - * for 3D textures and HDR profile - * @requires_es_extension Extension @es_extension{ANDROID,extension_pack_es31a}/ - * @es_extension2{KHR,texture_compression_astc_ldr,texture_compression_astc_hdr} - * @requires_es_extension Extension @es_extension2{KHR,texture_compression_astc_hdr,texture_compression_astc_hdr} - * for 3D textures and HDR profile - * @requires_gles ASTC texture compression is not available in WebGL. - */ - RGBAAstc8x5 = GL_COMPRESSED_RGBA_ASTC_8x5_KHR, - - /** - * ASTC compressed sRGB with alpha with 8x5 blocks. **Available only on 2D, - * 3D, 2D array, cube map and cube map array textures.** - * @requires_extension Extension @extension3{KHR,texture_compression_astc_ldr,texture_compression_astc_hdr} - * @requires_extension Extension @extension{KHR,texture_compression_astc_hdr} - * for 3D textures and HDR profile - * @requires_es_extension Extension @es_extension{ANDROID,extension_pack_es31a}/ - * @es_extension2{KHR,texture_compression_astc_ldr,texture_compression_astc_hdr} - * @requires_es_extension Extension @es_extension2{KHR,texture_compression_astc_hdr,texture_compression_astc_hdr} - * for 3D textures and HDR profile - * @requires_gles ASTC texture compression is not available in WebGL. - */ - SRGB8Alpha8Astc8x5 = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR, - - /** - * ASTC compressed RGBA with 8x6 blocks. **Available only on 2D, 3D, 2D - * array, cube map and cube map array textures.** - * @requires_extension Extension @extension3{KHR,texture_compression_astc_ldr,texture_compression_astc_hdr} - * @requires_extension Extension @extension{KHR,texture_compression_astc_hdr} - * for 3D textures and HDR profile - * @requires_es_extension Extension @es_extension{ANDROID,extension_pack_es31a}/ - * @es_extension2{KHR,texture_compression_astc_ldr,texture_compression_astc_hdr} - * @requires_es_extension Extension @es_extension2{KHR,texture_compression_astc_hdr,texture_compression_astc_hdr} - * for 3D textures and HDR profile - * @requires_gles ASTC texture compression is not available in WebGL. - */ - RGBAAstc8x6 = GL_COMPRESSED_RGBA_ASTC_8x6_KHR, - - /** - * ASTC compressed sRGB with alpha with 8x6 blocks. **Available only on 2D, - * 3D, 2D array, cube map and cube map array textures.** - * @requires_extension Extension @extension3{KHR,texture_compression_astc_ldr,texture_compression_astc_hdr} - * @requires_extension Extension @extension{KHR,texture_compression_astc_hdr} - * for 3D textures and HDR profile - * @requires_es_extension Extension @es_extension{ANDROID,extension_pack_es31a}/ - * @es_extension2{KHR,texture_compression_astc_ldr,texture_compression_astc_hdr} - * @requires_es_extension Extension @es_extension2{KHR,texture_compression_astc_hdr,texture_compression_astc_hdr} - * for 3D textures and HDR profile - * @requires_gles ASTC texture compression is not available in WebGL. - */ - SRGB8Alpha8Astc8x6 = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR, - - /** - * ASTC compressed RGBA with 8x8 blocks. **Available only on 2D, 3D, 2D - * array, cube map and cube map array textures.** - * @requires_extension Extension @extension3{KHR,texture_compression_astc_ldr,texture_compression_astc_hdr} - * @requires_extension Extension @extension{KHR,texture_compression_astc_hdr} - * for 3D textures and HDR profile - * @requires_es_extension Extension @es_extension{ANDROID,extension_pack_es31a}/ - * @es_extension2{KHR,texture_compression_astc_ldr,texture_compression_astc_hdr} - * @requires_es_extension Extension @es_extension2{KHR,texture_compression_astc_hdr,texture_compression_astc_hdr} - * for 3D textures and HDR profile - * @requires_gles ASTC texture compression is not available in WebGL. - */ - RGBAAstc8x8 = GL_COMPRESSED_RGBA_ASTC_8x8_KHR, - - /** - * ASTC compressed sRGB with alpha with 8x8 blocks. **Available only on 2D, - * 3D, 2D array, cube map and cube map array textures.** - * @requires_extension Extension @extension3{KHR,texture_compression_astc_ldr,texture_compression_astc_hdr} - * @requires_extension Extension @extension{KHR,texture_compression_astc_hdr} - * for 3D textures and HDR profile - * @requires_es_extension Extension @es_extension{ANDROID,extension_pack_es31a}/ - * @es_extension2{KHR,texture_compression_astc_ldr,texture_compression_astc_hdr} - * @requires_es_extension Extension @es_extension2{KHR,texture_compression_astc_hdr,texture_compression_astc_hdr} - * for 3D textures and HDR profile - * @requires_gles ASTC texture compression is not available in WebGL. - */ - SRGB8Alpha8Astc8x8 = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR, - - /** - * ASTC compressed RGBA with 10x5 blocks. **Available only on 2D, 3D, 2D - * array, cube map and cube map array textures.** - * @requires_extension Extension @extension3{KHR,texture_compression_astc_ldr,texture_compression_astc_hdr} - * @requires_extension Extension @extension{KHR,texture_compression_astc_hdr} - * for 3D textures and HDR profile - * @requires_es_extension Extension @es_extension{ANDROID,extension_pack_es31a}/ - * @es_extension2{KHR,texture_compression_astc_ldr,texture_compression_astc_hdr} - * @requires_es_extension Extension @es_extension2{KHR,texture_compression_astc_hdr,texture_compression_astc_hdr} - * for 3D textures and HDR profile - * @requires_gles ASTC texture compression is not available in WebGL. - */ - RGBAAstc10x5 = GL_COMPRESSED_RGBA_ASTC_10x5_KHR, - - /** - * ASTC compressed sRGB with alpha with 10x5 blocks. **Available only on - * 2D, 3D, 2D array, cube map and cube map array textures.** - * @requires_extension Extension @extension3{KHR,texture_compression_astc_ldr,texture_compression_astc_hdr} - * @requires_extension Extension @extension{KHR,texture_compression_astc_hdr} - * for 3D textures and HDR profile - * @requires_es_extension Extension @es_extension{ANDROID,extension_pack_es31a}/ - * @es_extension2{KHR,texture_compression_astc_ldr,texture_compression_astc_hdr} - * @requires_es_extension Extension @es_extension2{KHR,texture_compression_astc_hdr,texture_compression_astc_hdr} - * for 3D textures and HDR profile - * @requires_gles ASTC texture compression is not available in WebGL. - */ - SRGB8Alpha8Astc10x5 = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR, - - /** - * ASTC compressed RGBA with 10x6 blocks. **Available only on 2D, 3D, 2D - * array, cube map and cube map array textures.** - * @requires_extension Extension @extension3{KHR,texture_compression_astc_ldr,texture_compression_astc_hdr} - * @requires_extension Extension @extension{KHR,texture_compression_astc_hdr} - * for 3D textures and HDR profile - * @requires_es_extension Extension @es_extension{ANDROID,extension_pack_es31a}/ - * @es_extension2{KHR,texture_compression_astc_ldr,texture_compression_astc_hdr} - * @requires_es_extension Extension @es_extension2{KHR,texture_compression_astc_hdr,texture_compression_astc_hdr} - * for 3D textures and HDR profile - * @requires_gles ASTC texture compression is not available in WebGL. - */ - RGBAAstc10x6 = GL_COMPRESSED_RGBA_ASTC_10x6_KHR, - - /** - * ASTC compressed sRGB with alpha with 10x6 blocks. **Available only on - * 2D, 3D, 2D array, cube map and cube map array textures.** - * @requires_extension Extension @extension3{KHR,texture_compression_astc_ldr,texture_compression_astc_hdr} - * @requires_extension Extension @extension{KHR,texture_compression_astc_hdr} - * for 3D textures and HDR profile - * @requires_es_extension Extension @es_extension{ANDROID,extension_pack_es31a}/ - * @es_extension2{KHR,texture_compression_astc_ldr,texture_compression_astc_hdr} - * @requires_es_extension Extension @es_extension2{KHR,texture_compression_astc_hdr,texture_compression_astc_hdr} - * for 3D textures and HDR profile - * @requires_gles ASTC texture compression is not available in WebGL. - */ - SRGB8Alpha8Astc10x6 = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR, - - /** - * ASTC compressed RGBA with 10x8 blocks. **Available only on 2D, 3D, 2D - * array, cube map and cube map array textures.** - * @requires_extension Extension @extension3{KHR,texture_compression_astc_ldr,texture_compression_astc_hdr} - * @requires_extension Extension @extension{KHR,texture_compression_astc_hdr} - * for 3D textures and HDR profile - * @requires_es_extension Extension @es_extension{ANDROID,extension_pack_es31a}/ - * @es_extension2{KHR,texture_compression_astc_ldr,texture_compression_astc_hdr} - * @requires_es_extension Extension @es_extension2{KHR,texture_compression_astc_hdr,texture_compression_astc_hdr} - * for 3D textures and HDR profile - * @requires_gles ASTC texture compression is not available in WebGL. - */ - RGBAAstc10x8 = GL_COMPRESSED_RGBA_ASTC_10x8_KHR, - - /** - * ASTC compressed sRGB with alpha with 10x8 blocks. **Available only on - * 2D, 3D, 2D array, cube map and cube map array textures.** - * @requires_extension Extension @extension3{KHR,texture_compression_astc_ldr,texture_compression_astc_hdr} - * @requires_extension Extension @extension{KHR,texture_compression_astc_hdr} - * for 3D textures and HDR profile - * @requires_es_extension Extension @es_extension{ANDROID,extension_pack_es31a}/ - * @es_extension2{KHR,texture_compression_astc_ldr,texture_compression_astc_hdr} - * @requires_es_extension Extension @es_extension2{KHR,texture_compression_astc_hdr,texture_compression_astc_hdr} - * for 3D textures and HDR profile - * @requires_gles ASTC texture compression is not available in WebGL. - */ - SRGB8Alpha8Astc10x8 = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR, - - /** - * ASTC compressed RGBA with 10x10 blocks. **Available only on 2D, 3D, 2D - * array, cube map and cube map array textures.** - * @requires_extension Extension @extension3{KHR,texture_compression_astc_ldr,texture_compression_astc_hdr} - * @requires_extension Extension @extension{KHR,texture_compression_astc_hdr} - * for 3D textures and HDR profile - * @requires_es_extension Extension @es_extension{ANDROID,extension_pack_es31a}/ - * @es_extension2{KHR,texture_compression_astc_ldr,texture_compression_astc_hdr} - * @requires_es_extension Extension @es_extension2{KHR,texture_compression_astc_hdr,texture_compression_astc_hdr} - * for 3D textures and HDR profile - * @requires_gles ASTC texture compression is not available in WebGL. - */ - RGBAAstc10x10 = GL_COMPRESSED_RGBA_ASTC_10x10_KHR, - - /** - * ASTC compressed sRGB with alpha with 10x10 blocks. **Available only on - * 2D, 3D, 2D array, cube map and cube map array textures.** - * @requires_extension Extension @extension3{KHR,texture_compression_astc_ldr,texture_compression_astc_hdr} - * @requires_extension Extension @extension{KHR,texture_compression_astc_hdr} - * for 3D textures and HDR profile - * @requires_es_extension Extension @es_extension{ANDROID,extension_pack_es31a}/ - * @es_extension2{KHR,texture_compression_astc_ldr,texture_compression_astc_hdr} - * @requires_es_extension Extension @es_extension2{KHR,texture_compression_astc_hdr,texture_compression_astc_hdr} - * for 3D textures and HDR profile - * @requires_gles ASTC texture compression is not available in WebGL. - */ - SRGB8Alpha8Astc10x10 = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR, - - /** - * ASTC compressed RGBA with 12x10 blocks. **Available only on 2D, 3D, 2D - * array, cube map and cube map array textures.** - * @requires_extension Extension @extension3{KHR,texture_compression_astc_ldr,texture_compression_astc_hdr} - * @requires_extension Extension @extension{KHR,texture_compression_astc_hdr} - * for 3D textures and HDR profile - * @requires_es_extension Extension @es_extension{ANDROID,extension_pack_es31a}/ - * @es_extension2{KHR,texture_compression_astc_ldr,texture_compression_astc_hdr} - * @requires_es_extension Extension @es_extension2{KHR,texture_compression_astc_hdr,texture_compression_astc_hdr} - * for 3D textures and HDR profile - * @requires_gles ASTC texture compression is not available in WebGL. - */ - RGBAAstc12x10 = GL_COMPRESSED_RGBA_ASTC_12x10_KHR, - - /** - * ASTC compressed sRGB with alpha with 12x10 blocks. **Available only on - * 2D, 3D, 2D array, cube map and cube map array textures.** - * @requires_extension Extension @extension3{KHR,texture_compression_astc_ldr,texture_compression_astc_hdr} - * @requires_extension Extension @extension{KHR,texture_compression_astc_hdr} - * for 3D textures and HDR profile - * @requires_es_extension Extension @es_extension{ANDROID,extension_pack_es31a}/ - * @es_extension2{KHR,texture_compression_astc_ldr,texture_compression_astc_hdr} - * @requires_es_extension Extension @es_extension2{KHR,texture_compression_astc_hdr,texture_compression_astc_hdr} - * for 3D textures and HDR profile - * @requires_gles ASTC texture compression is not available in WebGL. - */ - SRGB8Alpha8Astc12x10 = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR, - - /** - * ASTC compressed RGBA with 12x12 blocks. **Available only on 2D, 3D, 2D - * array, cube map and cube map array textures.** - * @requires_extension Extension @extension3{KHR,texture_compression_astc_ldr,texture_compression_astc_hdr} - * @requires_extension Extension @extension{KHR,texture_compression_astc_hdr} - * for 3D textures and HDR profile - * @requires_es_extension Extension @es_extension{ANDROID,extension_pack_es31a}/ - * @es_extension2{KHR,texture_compression_astc_ldr,texture_compression_astc_hdr} - * @requires_es_extension Extension @es_extension2{KHR,texture_compression_astc_hdr,texture_compression_astc_hdr} - * for 3D textures and HDR profile - * @requires_gles ASTC texture compression is not available in WebGL. - */ - RGBAAstc12x12 = GL_COMPRESSED_RGBA_ASTC_12x12_KHR, - - /** - * ASTC compressed sRGB with alpha with 12x12 blocks. **Available only on - * 2D, 3D, 2D array, cube map and cube map array textures.** - * @requires_extension Extension @extension3{KHR,texture_compression_astc_ldr,texture_compression_astc_hdr} - * @requires_extension Extension @extension{KHR,texture_compression_astc_hdr} - * for 3D textures and HDR profile - * @requires_es_extension Extension @es_extension{ANDROID,extension_pack_es31a}/ - * @es_extension2{KHR,texture_compression_astc_ldr,texture_compression_astc_hdr} - * @requires_es_extension Extension @es_extension2{KHR,texture_compression_astc_hdr,texture_compression_astc_hdr} - * for 3D textures and HDR profile - * @requires_gles ASTC texture compression is not available in WebGL. - */ - SRGB8Alpha8Astc12x12 = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR, - #endif -}; +namespace Magnum { -/** @debugoperatorenum{Magnum::ColorFormat} */ -Debug MAGNUM_EXPORT operator<<(Debug debug, ColorFormat value); +/** @copybrief PixelFormat + * @deprecated Use @ref PixelFormat instead. + */ +typedef CORRADE_DEPRECATED("use PixelFormat instead") PixelFormat ColorFormat; -/** @debugoperatorenum{Magnum::ColorType} */ -Debug MAGNUM_EXPORT operator<<(Debug debug, ColorType value); +/** @copybrief PixelType + * @deprecated Use @ref PixelType instead. + */ +typedef CORRADE_DEPRECATED("use PixelType instead") PixelType ColorType; -/** @debugoperatorenum{Magnum::CompressedColorFormat} */ -Debug MAGNUM_EXPORT operator<<(Debug debug, CompressedColorFormat value); +/** @copybrief CompressedPixelFormat + * @deprecated Use @ref CompressedPixelFormat instead. + */ +typedef CORRADE_DEPRECATED("use CompressedPixelFormat instead") CompressedPixelFormat CompressedColorFormat; } +#else +#error use Magnum/PixelFormat.h instead +#endif #endif diff --git a/src/Magnum/CubeMapTexture.cpp b/src/Magnum/CubeMapTexture.cpp index 7a0f4fb58..8c007b167 100644 --- a/src/Magnum/CubeMapTexture.cpp +++ b/src/Magnum/CubeMapTexture.cpp @@ -101,7 +101,7 @@ void CubeMapTexture::compressedImage(const Int level, CompressedImage3D& image) Buffer::unbindInternal(Buffer::TargetHint::PixelPack); glGetCompressedTextureImage(_id, level, dataSize, data); - image.setData(CompressedColorFormat(format), size, std::move(data)); + image.setData(CompressedPixelFormat(format), size, std::move(data)); } CompressedImage3D CubeMapTexture::compressedImage(const Int level, CompressedImage3D&& image) { @@ -119,7 +119,7 @@ void CubeMapTexture::compressedImage(const Int level, CompressedBufferImage3D& i (this->*Context::current()->state().texture->getLevelParameterivImplementation)(level, GL_TEXTURE_INTERNAL_FORMAT, &format); image.buffer().bindInternal(Buffer::TargetHint::PixelPack); - image.setData(CompressedColorFormat(format), size, {nullptr, std::size_t(dataSize)}, usage); + image.setData(CompressedPixelFormat(format), size, {nullptr, std::size_t(dataSize)}, usage); glGetCompressedTextureImage(_id, level, dataSize, nullptr); } @@ -168,7 +168,7 @@ void CubeMapTexture::compressedImage(const Coordinate coordinate, const Int leve Buffer::unbindInternal(Buffer::TargetHint::PixelPack); (this->*Context::current()->state().texture->getCompressedCubeImageImplementation)(coordinate, level, size, dataSize, data); - image.setData(CompressedColorFormat(format), size, std::move(data)); + image.setData(CompressedPixelFormat(format), size, std::move(data)); } CompressedImage2D CubeMapTexture::compressedImage(const Coordinate coordinate, const Int level, CompressedImage2D&& image) { @@ -183,7 +183,7 @@ void CubeMapTexture::compressedImage(const Coordinate coordinate, const Int leve GLint format; (this->*Context::current()->state().texture->getLevelParameterivImplementation)(level, GL_TEXTURE_INTERNAL_FORMAT, &format); - image.setData(CompressedColorFormat(format), size, {nullptr, std::size_t(dataSize)}, usage); + image.setData(CompressedPixelFormat(format), size, {nullptr, std::size_t(dataSize)}, usage); image.buffer().bindInternal(Buffer::TargetHint::PixelPack); (this->*Context::current()->state().texture->getCompressedCubeImageImplementation)(coordinate, level, size, dataSize, nullptr); } @@ -296,7 +296,7 @@ Vector2i CubeMapTexture::getImageSizeImplementationDSAEXT(const Int level) { #endif #ifndef MAGNUM_TARGET_GLES -void CubeMapTexture::getImageImplementationDefault(const Coordinate coordinate, const GLint level, const Vector2i&, const ColorFormat format, const ColorType type, std::size_t, GLvoid* const data) { +void CubeMapTexture::getImageImplementationDefault(const Coordinate coordinate, const GLint level, const Vector2i&, const PixelFormat format, const PixelType type, std::size_t, GLvoid* const data) { bindInternal(); glGetTexImage(GLenum(coordinate), level, GLenum(format), GLenum(type), data); } @@ -306,7 +306,7 @@ void CubeMapTexture::getCompressedImageImplementationDefault(const Coordinate co glGetCompressedTexImage(GLenum(coordinate), level, data); } -void CubeMapTexture::getImageImplementationDSA(const Coordinate coordinate, const GLint level, const Vector2i& size, const ColorFormat format, const ColorType type, const std::size_t dataSize, GLvoid* const data) { +void CubeMapTexture::getImageImplementationDSA(const Coordinate coordinate, const GLint level, const Vector2i& size, const PixelFormat format, const PixelType type, const std::size_t dataSize, GLvoid* const data) { glGetTextureSubImage(_id, level, 0, 0, GLenum(coordinate) - GL_TEXTURE_CUBE_MAP_POSITIVE_X, size.x(), size.y(), 1, GLenum(format), GLenum(type), dataSize, data); } @@ -314,7 +314,7 @@ void CubeMapTexture::getCompressedImageImplementationDSA(const Coordinate coordi glGetCompressedTextureSubImage(_id, level, 0, 0, GLenum(coordinate) - GL_TEXTURE_CUBE_MAP_POSITIVE_X, size.x(), size.y(), 1, dataSize, data); } -void CubeMapTexture::getImageImplementationDSAEXT(const Coordinate coordinate, const GLint level, const Vector2i&, const ColorFormat format, const ColorType type, std::size_t, GLvoid* const data) { +void CubeMapTexture::getImageImplementationDSAEXT(const Coordinate coordinate, const GLint level, const Vector2i&, const PixelFormat format, const PixelType type, std::size_t, GLvoid* const data) { _flags |= ObjectFlag::Created; glGetTextureImageEXT(_id, GLenum(coordinate), level, GLenum(format), GLenum(type), data); } @@ -324,7 +324,7 @@ void CubeMapTexture::getCompressedImageImplementationDSAEXT(const Coordinate coo glGetCompressedTextureImageEXT(_id, GLenum(coordinate), level, data); } -void CubeMapTexture::getImageImplementationRobustness(const Coordinate coordinate, const GLint level, const Vector2i&, const ColorFormat format, const ColorType type, const std::size_t dataSize, GLvoid* const data) { +void CubeMapTexture::getImageImplementationRobustness(const Coordinate coordinate, const GLint level, const Vector2i&, const PixelFormat format, const PixelType type, const std::size_t dataSize, GLvoid* const data) { bindInternal(); glGetnTexImageARB(GLenum(coordinate), level, GLenum(format), GLenum(type), dataSize, data); } @@ -335,31 +335,31 @@ void CubeMapTexture::getCompressedImageImplementationRobustness(const Coordinate } #endif -void CubeMapTexture::subImageImplementationDefault(const Coordinate coordinate, const GLint level, const Vector2i& offset, const Vector2i& size, const ColorFormat format, const ColorType type, const GLvoid* const data) { +void CubeMapTexture::subImageImplementationDefault(const Coordinate coordinate, const GLint level, const Vector2i& offset, const Vector2i& size, const PixelFormat format, const PixelType type, const GLvoid* const data) { bindInternal(); glTexSubImage2D(GLenum(coordinate), level, offset.x(), offset.y(), size.x(), size.y(), GLenum(format), GLenum(type), data); } -void CubeMapTexture::compressedSubImageImplementationDefault(const Coordinate coordinate, const GLint level, const Vector2i& offset, const Vector2i& size, const CompressedColorFormat format, const Containers::ArrayView data) { +void CubeMapTexture::compressedSubImageImplementationDefault(const Coordinate coordinate, const GLint level, const Vector2i& offset, const Vector2i& size, const CompressedPixelFormat format, const Containers::ArrayView data) { bindInternal(); glCompressedTexSubImage2D(GLenum(coordinate), level, offset.x(), offset.y(), size.x(), size.y(), GLenum(format), data.size(), data); } #ifndef MAGNUM_TARGET_GLES -void CubeMapTexture::subImageImplementationDSA(const Coordinate coordinate, const GLint level, const Vector2i& offset, const Vector2i& size, const ColorFormat format, const ColorType type, const GLvoid* const data) { +void CubeMapTexture::subImageImplementationDSA(const Coordinate coordinate, const GLint level, const Vector2i& offset, const Vector2i& size, const PixelFormat format, const PixelType type, const GLvoid* const data) { glTextureSubImage3D(_id, level, offset.x(), offset.y(), GLenum(coordinate) - GL_TEXTURE_CUBE_MAP_POSITIVE_X, size.x(), size.y(), 1, GLenum(format), GLenum(type), data); } -void CubeMapTexture::compressedSubImageImplementationDSA(const Coordinate coordinate, const GLint level, const Vector2i& offset, const Vector2i& size, const CompressedColorFormat format, const Containers::ArrayView data) { +void CubeMapTexture::compressedSubImageImplementationDSA(const Coordinate coordinate, const GLint level, const Vector2i& offset, const Vector2i& size, const CompressedPixelFormat format, const Containers::ArrayView data) { glCompressedTextureSubImage3D(_id, level, offset.x(), offset.y(), GLenum(coordinate) - GL_TEXTURE_CUBE_MAP_POSITIVE_X, size.x(), size.y(), 1, GLenum(format), data.size(), data); } -void CubeMapTexture::subImageImplementationDSAEXT(const Coordinate coordinate, const GLint level, const Vector2i& offset, const Vector2i& size, const ColorFormat format, const ColorType type, const GLvoid* const data) { +void CubeMapTexture::subImageImplementationDSAEXT(const Coordinate coordinate, const GLint level, const Vector2i& offset, const Vector2i& size, const PixelFormat format, const PixelType type, const GLvoid* const data) { _flags |= ObjectFlag::Created; glTextureSubImage2DEXT(_id, GLenum(coordinate), level, offset.x(), offset.y(), size.x(), size.y(), GLenum(format), GLenum(type), data); } -void CubeMapTexture::compressedSubImageImplementationDSAEXT(const Coordinate coordinate, const GLint level, const Vector2i& offset, const Vector2i& size, const CompressedColorFormat format, const Containers::ArrayView data) { +void CubeMapTexture::compressedSubImageImplementationDSAEXT(const Coordinate coordinate, const GLint level, const Vector2i& offset, const Vector2i& size, const CompressedPixelFormat format, const Containers::ArrayView data) { _flags |= ObjectFlag::Created; glTextureSubImage2DEXT(_id, GLenum(coordinate), level, offset.x(), offset.y(), size.x(), size.y(), GLenum(format), data.size(), data); } diff --git a/src/Magnum/CubeMapTexture.h b/src/Magnum/CubeMapTexture.h index f62af5c30..41363a989 100644 --- a/src/Magnum/CubeMapTexture.h +++ b/src/Magnum/CubeMapTexture.h @@ -57,7 +57,7 @@ See @ref Texture documentation for introduction. Common usage is to fully configure all texture parameters and then set the data from e.g. set of Image objects: @code -Image2D positiveX(ColorFormat::RGBA, ColorType::UnsignedByte, {256, 256}, data); +Image2D positiveX(PixelFormat::RGBA, PixelType::UnsignedByte, {256, 256}, data); // ... CubeMapTexture texture; @@ -454,7 +454,7 @@ class MAGNUM_EXPORT CubeMapTexture: public AbstractTexture { * * Convenience alternative to the above, example usage: * @code - * Image3D image = texture.image(0, {ColorFormat::RGBA, ColorType::UnsignedByte}); + * Image3D image = texture.image(0, {PixelFormat::RGBA, PixelType::UnsignedByte}); * @endcode */ Image3D image(Int level, Image3D&& image); @@ -473,7 +473,7 @@ class MAGNUM_EXPORT CubeMapTexture: public AbstractTexture { * * Convenience alternative to the above, example usage: * @code - * BufferImage3D image = texture.image(0, {ColorFormat::RGBA, ColorType::UnsignedByte}, BufferUsage::StaticRead); + * BufferImage3D image = texture.image(0, {PixelFormat::RGBA, PixelType::UnsignedByte}, BufferUsage::StaticRead); * @endcode */ BufferImage3D image(Int level, BufferImage3D&& image, BufferUsage usage); @@ -556,7 +556,7 @@ class MAGNUM_EXPORT CubeMapTexture: public AbstractTexture { * * Convenience alternative to the above, example usage: * @code - * Image2D image = texture.image(CubeMapTexture::Coordinate::PositiveX, 0, {ColorFormat::RGBA, ColorType::UnsignedByte}); + * Image2D image = texture.image(CubeMapTexture::Coordinate::PositiveX, 0, {PixelFormat::RGBA, PixelType::UnsignedByte}); * @endcode */ Image2D image(Coordinate coordinate, Int level, Image2D&& image); @@ -574,7 +574,7 @@ class MAGNUM_EXPORT CubeMapTexture: public AbstractTexture { * * Convenience alternative to the above, example usage: * @code - * BufferImage2D image = texture.image(CubeMapTexture::Coordinate::PositiveX, 0, {ColorFormat::RGBA, ColorType::UnsignedByte}, BufferUsage::StaticRead); + * BufferImage2D image = texture.image(CubeMapTexture::Coordinate::PositiveX, 0, {PixelFormat::RGBA, PixelType::UnsignedByte}, BufferUsage::StaticRead); * @endcode */ BufferImage2D image(Coordinate coordinate, Int level, BufferImage2D&& image, BufferUsage usage); @@ -653,7 +653,7 @@ class MAGNUM_EXPORT CubeMapTexture: public AbstractTexture { * * Convenience alternative to the above, example usage: * @code - * Image3D image = texture.subImage(0, range, {ColorFormat::RGBA, ColorType::UnsignedByte}); + * Image3D image = texture.subImage(0, range, {PixelFormat::RGBA, PixelType::UnsignedByte}); * @endcode */ Image3D subImage(Int level, const Range3Di& range, Image3D&& image); @@ -675,7 +675,7 @@ class MAGNUM_EXPORT CubeMapTexture: public AbstractTexture { * * Convenience alternative to the above, example usage: * @code - * BufferImage3D image = texture.subImage(0, range, {ColorFormat::RGBA, ColorType::UnsignedByte}, BufferUsage::StaticRead); + * BufferImage3D image = texture.subImage(0, range, {PixelFormat::RGBA, PixelType::UnsignedByte}, BufferUsage::StaticRead); * @endcode */ BufferImage3D subImage(Int level, const Range3Di& range, BufferImage3D&& image, BufferUsage usage); @@ -939,10 +939,10 @@ class MAGNUM_EXPORT CubeMapTexture: public AbstractTexture { #endif #ifndef MAGNUM_TARGET_GLES - void MAGNUM_LOCAL getImageImplementationDefault(Coordinate coordinate, GLint level, const Vector2i& size, ColorFormat format, ColorType type, std::size_t dataSize, GLvoid* data); - void MAGNUM_LOCAL getImageImplementationDSA(Coordinate coordinate, GLint level, const Vector2i& size, ColorFormat format, ColorType type, std::size_t dataSize, GLvoid* data); - void MAGNUM_LOCAL getImageImplementationDSAEXT(Coordinate coordinate, GLint level, const Vector2i& size, ColorFormat format, ColorType type, std::size_t dataSize, GLvoid* data); - void MAGNUM_LOCAL getImageImplementationRobustness(Coordinate coordinate, GLint level, const Vector2i& size, ColorFormat format, ColorType type, std::size_t dataSize, GLvoid* data); + void MAGNUM_LOCAL getImageImplementationDefault(Coordinate coordinate, GLint level, const Vector2i& size, PixelFormat format, PixelType type, std::size_t dataSize, GLvoid* data); + void MAGNUM_LOCAL getImageImplementationDSA(Coordinate coordinate, GLint level, const Vector2i& size, PixelFormat format, PixelType type, std::size_t dataSize, GLvoid* data); + void MAGNUM_LOCAL getImageImplementationDSAEXT(Coordinate coordinate, GLint level, const Vector2i& size, PixelFormat format, PixelType type, std::size_t dataSize, GLvoid* data); + void MAGNUM_LOCAL getImageImplementationRobustness(Coordinate coordinate, GLint level, const Vector2i& size, PixelFormat format, PixelType type, std::size_t dataSize, GLvoid* data); void MAGNUM_LOCAL getCompressedImageImplementationDefault(Coordinate coordinate, GLint level, const Vector2i& size, std::size_t dataSize, GLvoid* data); void MAGNUM_LOCAL getCompressedImageImplementationDSA(Coordinate coordinate, GLint level, const Vector2i& size, std::size_t dataSize, GLvoid* data); @@ -950,16 +950,16 @@ class MAGNUM_EXPORT CubeMapTexture: public AbstractTexture { void MAGNUM_LOCAL getCompressedImageImplementationRobustness(Coordinate coordinate, GLint level, const Vector2i& size, std::size_t dataSize, GLvoid* data); #endif - void MAGNUM_LOCAL subImageImplementationDefault(Coordinate coordinate, GLint level, const Vector2i& offset, const Vector2i& size, ColorFormat format, ColorType type, const GLvoid* data); + void MAGNUM_LOCAL subImageImplementationDefault(Coordinate coordinate, GLint level, const Vector2i& offset, const Vector2i& size, PixelFormat format, PixelType type, const GLvoid* data); #ifndef MAGNUM_TARGET_GLES - void MAGNUM_LOCAL subImageImplementationDSA(Coordinate coordinate, GLint level, const Vector2i& offset, const Vector2i& size, ColorFormat format, ColorType type, const GLvoid* data); - void MAGNUM_LOCAL subImageImplementationDSAEXT(Coordinate coordinate, GLint level, const Vector2i& offset, const Vector2i& size, ColorFormat format, ColorType type, const GLvoid* data); + void MAGNUM_LOCAL subImageImplementationDSA(Coordinate coordinate, GLint level, const Vector2i& offset, const Vector2i& size, PixelFormat format, PixelType type, const GLvoid* data); + void MAGNUM_LOCAL subImageImplementationDSAEXT(Coordinate coordinate, GLint level, const Vector2i& offset, const Vector2i& size, PixelFormat format, PixelType type, const GLvoid* data); #endif - void MAGNUM_LOCAL compressedSubImageImplementationDefault(Coordinate coordinate, GLint level, const Vector2i& offset, const Vector2i& size, CompressedColorFormat format, Containers::ArrayView data); + void MAGNUM_LOCAL compressedSubImageImplementationDefault(Coordinate coordinate, GLint level, const Vector2i& offset, const Vector2i& size, CompressedPixelFormat format, Containers::ArrayView data); #ifndef MAGNUM_TARGET_GLES - void MAGNUM_LOCAL compressedSubImageImplementationDSA(Coordinate coordinate, GLint level, const Vector2i& offset, const Vector2i& size, CompressedColorFormat format, Containers::ArrayView data); - void MAGNUM_LOCAL compressedSubImageImplementationDSAEXT(Coordinate coordinate, GLint level, const Vector2i& offset, const Vector2i& size, CompressedColorFormat format, Containers::ArrayView data); + void MAGNUM_LOCAL compressedSubImageImplementationDSA(Coordinate coordinate, GLint level, const Vector2i& offset, const Vector2i& size, CompressedPixelFormat format, Containers::ArrayView data); + void MAGNUM_LOCAL compressedSubImageImplementationDSAEXT(Coordinate coordinate, GLint level, const Vector2i& offset, const Vector2i& size, CompressedPixelFormat format, Containers::ArrayView data); #endif }; diff --git a/src/Magnum/CubeMapTextureArray.h b/src/Magnum/CubeMapTextureArray.h index 58a68bbe7..059c05add 100644 --- a/src/Magnum/CubeMapTextureArray.h +++ b/src/Magnum/CubeMapTextureArray.h @@ -58,7 +58,7 @@ texture.setMagnificationFilter(Sampler::Filter::Linear) .setStorage(Math::log2(64)+1, TextureFormat::RGBA8, {64, 64, 24}); for(std::size_t i = 0; i != 4; i += 6) { - Image3D imagePositiveX(ColorFormat::RGBA, ColorType::UnsignedByte, {64, 64, 1}, data); + Image3D imagePositiveX(PixelFormat::RGBA, PixelType::UnsignedByte, {64, 64, 1}, data); // ... texture.setSubImage(0, Vector3i::zAxis(i+0), imagePositiveX); texture.setSubImage(0, Vector3i::zAxis(i+1), imageNegativeX); @@ -387,7 +387,7 @@ class MAGNUM_EXPORT CubeMapTextureArray: public AbstractTexture { * * Convenience alternative to the above, example usage: * @code - * Image3D image = texture.image(0, {ColorFormat::RGBA, ColorType::UnsignedByte}); + * Image3D image = texture.image(0, {PixelFormat::RGBA, PixelType::UnsignedByte}); * @endcode */ Image3D image(Int level, Image3D&& image); @@ -408,7 +408,7 @@ class MAGNUM_EXPORT CubeMapTextureArray: public AbstractTexture { * * Convenience alternative to the above, example usage: * @code - * BufferImage3D image = texture.image(0, {ColorFormat::RGBA, ColorType::UnsignedByte}, BufferUsage::StaticRead); + * BufferImage3D image = texture.image(0, {PixelFormat::RGBA, PixelType::UnsignedByte}, BufferUsage::StaticRead); * @endcode */ BufferImage3D image(Int level, BufferImage3D&& image, BufferUsage usage); @@ -472,7 +472,7 @@ class MAGNUM_EXPORT CubeMapTextureArray: public AbstractTexture { * * Convenience alternative to the above, example usage: * @code - * Image3D image = texture.subImage(0, range, {ColorFormat::RGBA, ColorType::UnsignedByte}); + * Image3D image = texture.subImage(0, range, {PixelFormat::RGBA, PixelType::UnsignedByte}); * @endcode */ Image3D subImage(Int level, const Range3Di& range, Image3D&& image); @@ -494,7 +494,7 @@ class MAGNUM_EXPORT CubeMapTextureArray: public AbstractTexture { * * Convenience alternative to the above, example usage: * @code - * BufferImage3D image = texture.subImage(0, range, {ColorFormat::RGBA, ColorType::UnsignedByte}, BufferUsage::StaticRead); + * BufferImage3D image = texture.subImage(0, range, {PixelFormat::RGBA, PixelType::UnsignedByte}, BufferUsage::StaticRead); * @endcode */ BufferImage3D subImage(Int level, const Range3Di& range, BufferImage3D&& image, BufferUsage usage); diff --git a/src/Magnum/Image.cpp b/src/Magnum/Image.cpp index 9ded95209..f08f803ab 100644 --- a/src/Magnum/Image.cpp +++ b/src/Magnum/Image.cpp @@ -27,7 +27,7 @@ namespace Magnum { -template void Image::setData(ColorFormat format, ColorType type, const VectorTypeFor& size, void* data) { +template void Image::setData(PixelFormat format, PixelType type, const VectorTypeFor& size, void* data) { delete[] _data; _format = format; _type = type; @@ -35,7 +35,7 @@ template void Image::setData(ColorFormat for _data = reinterpret_cast(data); } -template void CompressedImage::setData(CompressedColorFormat format, const VectorTypeFor& size, Containers::Array&& data) { +template void CompressedImage::setData(CompressedPixelFormat format, const VectorTypeFor& size, Containers::Array&& data) { _format = format; _size = size; _data = std::move(data); diff --git a/src/Magnum/Image.h b/src/Magnum/Image.h index da064fa2f..6d7f42ebf 100644 --- a/src/Magnum/Image.h +++ b/src/Magnum/Image.h @@ -58,7 +58,7 @@ template class Image { * Note that the image data are not copied on construction, but they * are deleted on class destruction. */ - explicit Image(ColorFormat format, ColorType type, const VectorTypeFor& size, void* data): _format{format}, _type{type}, _size{size}, _data{reinterpret_cast(data)} {} + explicit Image(PixelFormat format, PixelType type, const VectorTypeFor& size, void* data): _format{format}, _type{type}, _size{size}, _data{reinterpret_cast(data)} {} /** * @brief Constructor @@ -68,7 +68,7 @@ template class Image { * Dimensions are set to zero and data pointer to `nullptr`, call * @ref setData() to fill the image with data. */ - /*implicit*/ Image(ColorFormat format, ColorType type): _format{format}, _type{type}, _data{} {} + /*implicit*/ Image(PixelFormat format, PixelType type): _format{format}, _type{type}, _data{} {} /** @brief Copying is not allowed */ Image(const Image&) = delete; @@ -99,10 +99,10 @@ template class Image { #endif /** @brief Format of pixel data */ - ColorFormat format() const { return _format; } + PixelFormat format() const { return _format; } /** @brief Data type of pixel data */ - ColorType type() const { return _type; } + PixelType type() const { return _type; } /** @brief Pixel size (in bytes) */ std::size_t pixelSize() const { return Implementation::imagePixelSize(_format, _type); } @@ -146,7 +146,7 @@ template class Image { * data are not copied, but they are deleted on destruction. * @see @ref release() */ - void setData(ColorFormat format, ColorType type, const VectorTypeFor& size, void* data); + void setData(PixelFormat format, PixelType type, const VectorTypeFor& size, void* data); /** * @brief Release data storage @@ -158,8 +158,8 @@ template class Image { char* release(); private: - ColorFormat _format; - ColorType _type; + PixelFormat _format; + PixelType _type; Math::Vector _size; char* _data; }; @@ -194,7 +194,7 @@ template class CompressedImage { * @param size Image size * @param data Image data */ - explicit CompressedImage(CompressedColorFormat format, const VectorTypeFor& size, Containers::Array&& data): _format{format}, _size{size}, _data{std::move(data)} {} + explicit CompressedImage(CompressedPixelFormat format, const VectorTypeFor& size, Containers::Array&& data): _format{format}, _size{size}, _data{std::move(data)} {} /** * @brief Constructor @@ -230,7 +230,7 @@ template class CompressedImage { #endif /** @brief Format of compressed data */ - CompressedColorFormat format() const { return _format; } + CompressedPixelFormat format() const { return _format; } /** @brief Image size */ VectorTypeFor size() const { return _size; } @@ -265,7 +265,7 @@ template class CompressedImage { * data are not copied, but they are deleted on destruction. * @see @ref release() */ - void setData(CompressedColorFormat format, const VectorTypeFor& size, Containers::Array&& data); + void setData(CompressedPixelFormat format, const VectorTypeFor& size, Containers::Array&& data); /** * @brief Release data storage @@ -277,7 +277,7 @@ template class CompressedImage { Containers::Array release(); private: - CompressedColorFormat _format; + CompressedPixelFormat _format; Math::Vector _size; Containers::Array _data; }; diff --git a/src/Magnum/ImageView.h b/src/Magnum/ImageView.h index 1a38ce5b5..d3ee0f69b 100644 --- a/src/Magnum/ImageView.h +++ b/src/Magnum/ImageView.h @@ -66,7 +66,7 @@ template class ImageView { * @param size Image size * @param data Image data */ - constexpr explicit ImageView(ColorFormat format, ColorType type, const VectorTypeFor& size, const void* data): _format{format}, _type{type}, _size{size}, _data{reinterpret_cast(data)} {} + constexpr explicit ImageView(PixelFormat format, PixelType type, const VectorTypeFor& size, const void* data): _format{format}, _type{type}, _size{size}, _data{reinterpret_cast(data)} {} /** * @brief Constructor @@ -77,13 +77,13 @@ template class ImageView { * Data pointer is set to `nullptr`, call @ref setData() to fill the * image with data. */ - constexpr explicit ImageView(ColorFormat format, ColorType type, const VectorTypeFor& size): _format{format}, _type{type}, _size{size}, _data{nullptr} {} + constexpr explicit ImageView(PixelFormat format, PixelType type, const VectorTypeFor& size): _format{format}, _type{type}, _size{size}, _data{nullptr} {} /** @brief Format of pixel data */ - ColorFormat format() const { return _format; } + PixelFormat format() const { return _format; } /** @brief Data type of pixel data */ - ColorType type() const { return _type; } + PixelType type() const { return _type; } /** @brief Pixel size (in bytes) */ std::size_t pixelSize() const { return Implementation::imagePixelSize(_format, _type); } @@ -117,8 +117,8 @@ template class ImageView { } private: - ColorFormat _format; - ColorType _type; + PixelFormat _format; + PixelType _type; Math::Vector _size; const char* _data; }; @@ -154,7 +154,7 @@ template class CompressedImageView { * @param size Image size * @param data Image data */ - constexpr explicit CompressedImageView(CompressedColorFormat format, const VectorTypeFor& size, Containers::ArrayView data): _format{format}, _size{size}, _data{reinterpret_cast(data.data()), data.size()} {} + constexpr explicit CompressedImageView(CompressedPixelFormat format, const VectorTypeFor& size, Containers::ArrayView data): _format{format}, _size{size}, _data{reinterpret_cast(data.data()), data.size()} {} /** * @brief Constructor @@ -164,10 +164,10 @@ template class CompressedImageView { * Data pointer is set to `nullptr`, call @ref setData() to fill the * image with data. */ - constexpr explicit CompressedImageView(CompressedColorFormat format, const VectorTypeFor& size): _format{format}, _size{size} {} + constexpr explicit CompressedImageView(CompressedPixelFormat format, const VectorTypeFor& size): _format{format}, _size{size} {} /** @brief Format of compressed data */ - CompressedColorFormat format() const { return _format; } + CompressedPixelFormat format() const { return _format; } /** @brief Image size */ constexpr VectorTypeFor size() const { return _size; } @@ -193,7 +193,7 @@ template class CompressedImageView { } private: - CompressedColorFormat _format; + CompressedPixelFormat _format; Math::Vector _size; Containers::ArrayView _data; }; diff --git a/src/Magnum/Implementation/FramebufferState.h b/src/Magnum/Implementation/FramebufferState.h index 68e39ec1f..360bfaaef 100644 --- a/src/Magnum/Implementation/FramebufferState.h +++ b/src/Magnum/Implementation/FramebufferState.h @@ -81,7 +81,7 @@ struct FramebufferState { void(Renderbuffer::*renderbufferStorageMultisampleImplementation)(GLsizei, RenderbufferFormat, const Vector2i&); #endif - void(*readImplementation)(const Range2Di&, ColorFormat, ColorType, std::size_t, GLvoid*); + void(*readImplementation)(const Range2Di&, PixelFormat, PixelType, std::size_t, GLvoid*); GLuint readBinding, drawBinding, renderbufferBinding; GLint maxDrawBuffers, maxColorAttachments, maxRenderbufferSize; diff --git a/src/Magnum/Implementation/TextureState.h b/src/Magnum/Implementation/TextureState.h index 3114907af..c84ee7565 100644 --- a/src/Magnum/Implementation/TextureState.h +++ b/src/Magnum/Implementation/TextureState.h @@ -69,18 +69,18 @@ struct TextureState { void(AbstractTexture::*storage3DMultisampleImplementation)(GLsizei, TextureFormat, const Vector3i&, GLboolean); #endif #ifndef MAGNUM_TARGET_GLES - void(AbstractTexture::*getImageImplementation)(GLint, ColorFormat, ColorType, std::size_t, GLvoid*); + void(AbstractTexture::*getImageImplementation)(GLint, PixelFormat, PixelType, std::size_t, GLvoid*); void(AbstractTexture::*getCompressedImageImplementation)(GLint, std::size_t, GLvoid*); #endif #ifndef MAGNUM_TARGET_GLES - void(AbstractTexture::*subImage1DImplementation)(GLint, const Math::Vector<1, GLint>&, const Math::Vector<1, GLsizei>&, ColorFormat, ColorType, const GLvoid*); - void(AbstractTexture::*compressedSubImage1DImplementation)(GLint, const Math::Vector<1, GLint>&, const Math::Vector<1, GLsizei>&, CompressedColorFormat, Containers::ArrayView); + void(AbstractTexture::*subImage1DImplementation)(GLint, const Math::Vector<1, GLint>&, const Math::Vector<1, GLsizei>&, PixelFormat, PixelType, const GLvoid*); + void(AbstractTexture::*compressedSubImage1DImplementation)(GLint, const Math::Vector<1, GLint>&, const Math::Vector<1, GLsizei>&, CompressedPixelFormat, Containers::ArrayView); #endif - void(AbstractTexture::*subImage2DImplementation)(GLint, const Vector2i&, const Vector2i&, ColorFormat, ColorType, const GLvoid*); - void(AbstractTexture::*compressedSubImage2DImplementation)(GLint, const Vector2i&, const Vector2i&, CompressedColorFormat, Containers::ArrayView); + void(AbstractTexture::*subImage2DImplementation)(GLint, const Vector2i&, const Vector2i&, PixelFormat, PixelType, const GLvoid*); + void(AbstractTexture::*compressedSubImage2DImplementation)(GLint, const Vector2i&, const Vector2i&, CompressedPixelFormat, Containers::ArrayView); #if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2)) - void(AbstractTexture::*subImage3DImplementation)(GLint, const Vector3i&, const Vector3i&, ColorFormat, ColorType, const GLvoid*); - void(AbstractTexture::*compressedSubImage3DImplementation)(GLint, const Vector3i&, const Vector3i&, CompressedColorFormat, Containers::ArrayView); + void(AbstractTexture::*subImage3DImplementation)(GLint, const Vector3i&, const Vector3i&, PixelFormat, PixelType, const GLvoid*); + void(AbstractTexture::*compressedSubImage3DImplementation)(GLint, const Vector3i&, const Vector3i&, CompressedPixelFormat, Containers::ArrayView); #endif void(AbstractTexture::*invalidateImageImplementation)(GLint); void(AbstractTexture::*invalidateSubImageImplementation)(GLint, const Vector3i&, const Vector3i&); @@ -94,11 +94,11 @@ struct TextureState { Vector2i(CubeMapTexture::*getCubeImageSizeImplementation)(Int); #endif #ifndef MAGNUM_TARGET_GLES - void(CubeMapTexture::*getCubeImageImplementation)(CubeMapTexture::Coordinate, GLint, const Vector2i&, ColorFormat, ColorType, std::size_t, GLvoid*); + void(CubeMapTexture::*getCubeImageImplementation)(CubeMapTexture::Coordinate, GLint, const Vector2i&, PixelFormat, PixelType, std::size_t, GLvoid*); void(CubeMapTexture::*getCompressedCubeImageImplementation)(CubeMapTexture::Coordinate, GLint, const Vector2i&, std::size_t, GLvoid*); #endif - void(CubeMapTexture::*cubeSubImageImplementation)(CubeMapTexture::Coordinate, GLint, const Vector2i&, const Vector2i&, ColorFormat, ColorType, const GLvoid*); - void(CubeMapTexture::*cubeCompressedSubImageImplementation)(CubeMapTexture::Coordinate, GLint, const Vector2i&, const Vector2i&, CompressedColorFormat, Containers::ArrayView); + void(CubeMapTexture::*cubeSubImageImplementation)(CubeMapTexture::Coordinate, GLint, const Vector2i&, const Vector2i&, PixelFormat, PixelType, const GLvoid*); + void(CubeMapTexture::*cubeCompressedSubImageImplementation)(CubeMapTexture::Coordinate, GLint, const Vector2i&, const Vector2i&, CompressedPixelFormat, Containers::ArrayView); GLint maxSize, #if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2)) diff --git a/src/Magnum/Magnum.h b/src/Magnum/Magnum.h index f659a3fb8..c07a452de 100644 --- a/src/Magnum/Magnum.h +++ b/src/Magnum/Magnum.h @@ -471,10 +471,6 @@ template using BasicColor3 CORRADE_DEPRECATED_ALIAS("use Math::Color3 i template using BasicColor4 CORRADE_DEPRECATED_ALIAS("use Math::Color4 instead") = Math::Color4; #endif -enum class ColorFormat: GLenum; -enum class ColorType: GLenum; -enum class CompressedColorFormat: GLenum; - class Context; class CubeMapTexture; @@ -528,6 +524,15 @@ typedef MultisampleTexture<2> MultisampleTexture2D; typedef MultisampleTexture<3> MultisampleTexture2DArray; #endif +enum class PixelFormat: GLenum; +enum class PixelType: GLenum; +enum class CompressedPixelFormat: GLenum; +#ifdef MAGNUM_BUILD_DEPRECATED +typedef CORRADE_DEPRECATED("use PixelFormat instead") PixelFormat ColorFormat; +typedef CORRADE_DEPRECATED("use PixelType instead") PixelType ColorType; +typedef CORRADE_DEPRECATED("use CompressedPixelFormat instead") CompressedPixelFormat CompressedColorFormat; +#endif + /* ObjectFlag, ObjectFlags are used only in conjunction with *::wrap() function */ class PrimitiveQuery; diff --git a/src/Magnum/ColorFormat.cpp b/src/Magnum/PixelFormat.cpp similarity index 89% rename from src/Magnum/ColorFormat.cpp rename to src/Magnum/PixelFormat.cpp index 9fc0b9db0..20953520c 100644 --- a/src/Magnum/ColorFormat.cpp +++ b/src/Magnum/PixelFormat.cpp @@ -23,16 +23,16 @@ DEALINGS IN THE SOFTWARE. */ -#include "ColorFormat.h" +#include "PixelFormat.h" #include namespace Magnum { #ifndef DOXYGEN_GENERATING_OUTPUT -Debug operator<<(Debug debug, const ColorFormat value) { +Debug operator<<(Debug debug, const PixelFormat value) { switch(value) { - #define _c(value) case ColorFormat::value: return debug << "ColorFormat::" #value; + #define _c(value) case PixelFormat::value: return debug << "PixelFormat::" #value; #if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2)) _c(Red) #endif @@ -79,12 +79,12 @@ Debug operator<<(Debug debug, const ColorFormat value) { #undef _c } - return debug << "ColorFormat::(invalid)"; + return debug << "PixelFormat::(invalid)"; } -Debug operator<<(Debug debug, const ColorType value) { +Debug operator<<(Debug debug, const PixelType value) { switch(value) { - #define _c(value) case ColorType::value: return debug << "ColorType::" #value; + #define _c(value) case PixelType::value: return debug << "PixelType::" #value; _c(UnsignedByte) #ifndef MAGNUM_TARGET_GLES2 _c(Byte) @@ -134,12 +134,12 @@ Debug operator<<(Debug debug, const ColorType value) { #undef _c } - return debug << "ColorType::(invalid)"; + return debug << "PixelType::(invalid)"; } -Debug operator<<(Debug debug, const CompressedColorFormat value) { +Debug operator<<(Debug debug, const CompressedPixelFormat value) { switch(value) { - #define _c(value) case CompressedColorFormat::value: return debug << "CompressedColorFormat::" #value; + #define _c(value) case CompressedPixelFormat::value: return debug << "CompressedPixelFormat::" #value; #ifndef MAGNUM_TARGET_GLES _c(Red) _c(RG) @@ -203,7 +203,7 @@ Debug operator<<(Debug debug, const CompressedColorFormat value) { #undef _c } - return debug << "CompressedColorFormat::(invalid)"; + return debug << "CompressedPixelFormat::(invalid)"; } #endif diff --git a/src/Magnum/PixelFormat.h b/src/Magnum/PixelFormat.h new file mode 100644 index 000000000..ae01b043c --- /dev/null +++ b/src/Magnum/PixelFormat.h @@ -0,0 +1,1206 @@ +#ifndef Magnum_PixelFormat_h +#define Magnum_PixelFormat_h +/* + This file is part of Magnum. + + Copyright © 2010, 2011, 2012, 2013, 2014, 2015 + 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 Enum @ref Magnum::PixelFormat, @ref Magnum::PixelType, @ref Magnum::CompressedPixelFormat + */ + +#include "Magnum/Magnum.h" +#include "Magnum/OpenGL.h" +#include "Magnum/visibility.h" + +namespace Magnum { + +/** +@brief Format of pixel data + +Note that some formats can be used only for framebuffer reading (using +@ref AbstractFramebuffer::read()) and some only for texture data (using +@ref Texture::setSubImage() and others), the limitations are mentioned in +documentation of each particular value. + +In most cases you may want to use @ref PixelFormat::Red (for grayscale images), +@ref PixelFormat::RGB or @ref PixelFormat::RGBA along with +@ref PixelType::UnsignedByte, the matching texture format is then +@ref TextureFormat::R8, @ref TextureFormat::RGB8 or @ref TextureFormat::RGBA8. +See documentation of these values for possible limitations when using OpenGL ES +2.0 or WebGL. + +@see @ref Image, @ref ImageView, @ref BufferImage, @ref Trade::ImageData +*/ +enum class PixelFormat: GLenum { + #if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2)) + /** + * Floating-point red channel. + * @requires_gles30 For texture data only, extension + * @es_extension{EXT,texture_rg} in OpenGL ES 2.0. + * @requires_es_extension For framebuffer reading, extension + * @es_extension{EXT,texture_rg} + * @requires_webgl20 For texture data only. Not available in WebGL 1.0, see + * @ref PixelFormat::Luminance for an alternative. + */ + #ifndef MAGNUM_TARGET_GLES2 + Red = GL_RED, + #else + Red = GL_RED_EXT, + #endif + #endif + + #ifndef MAGNUM_TARGET_GLES + /** + * Floating-point green channel. + * @requires_gl Only @ref PixelFormat::Red is available in OpenGL ES or + * WebGL. + */ + Green = GL_GREEN, + + /** + * Floating-point blue channel. + * @requires_gl Only @ref PixelFormat::Red is available in OpenGL ES or + * WebGL. + */ + Blue = GL_BLUE, + #endif + + #if defined(MAGNUM_TARGET_GLES2) || defined(DOXYGEN_GENERATING_OUTPUT) + /** + * Floating-point luminance channel. The value is used for all RGB + * channels. + * @requires_gles20 Not available in ES 3.0, WebGL 2.0 or desktop OpenGL. + * Use @ref PixelFormat::Red instead. + * @deprecated_gl Included for compatibility reasons only, use + * @ref PixelFormat::Red instead. + */ + Luminance = GL_LUMINANCE, + #endif + + #if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2)) + /** + * Floating-point red and green channel. + * @requires_gl30 Extension @extension{ARB,texture_rg} and @extension{EXT,texture_integer} + * @requires_gles30 For texture data only, extension + * @es_extension{EXT,texture_rg} in OpenGL ES 2.0. + * @requires_es_extension For framebuffer reading, extension + * @es_extension{EXT,texture_rg} + * @requires_webgl20 For texture data only. Not available in WebGL 1.0, see + * @ref PixelFormat::LuminanceAlpha for and alternative. + */ + #ifndef MAGNUM_TARGET_GLES2 + RG = GL_RG, + #else + RG = GL_RG_EXT, + #endif + #endif + + #if defined(MAGNUM_TARGET_GLES2) || defined(DOXYGEN_GENERATING_OUTPUT) + /** + * Floating-point luminance and alpha channel. First value is used for all + * RGB channels, second value is used for alpha channel. + * @requires_gles20 Not available in ES 3.0, WebGL 2.0 or desktop OpenGL. + * Use @ref PixelFormat::RG instead. + * @deprecated_gl Included for compatibility reasons only, use + * @ref PixelFormat::RG instead. + */ + LuminanceAlpha = GL_LUMINANCE_ALPHA, + #endif + + /** + * Floating-point RGB. + * @requires_gl Can't be used for framebuffer reading in OpenGL ES or WebGL. + */ + RGB = GL_RGB, + + /** Floating-point RGBA. */ + RGBA = GL_RGBA, + + #ifndef MAGNUM_TARGET_GLES + /** + * Floating-point BGR. + * @requires_gl Only RGB component ordering is available in OpenGL ES and + * WebGL. + */ + BGR = GL_BGR, + #endif + + #ifndef MAGNUM_TARGET_WEBGL + /** + * Floating-point BGRA. + * @requires_es_extension Extension @es_extension{EXT,read_format_bgra} + * for framebuffer reading, extension @es_extension{APPLE,texture_format_BGRA8888} + * or @es_extension{EXT,texture_format_BGRA8888} for texture data. + * @requires_gles Only RGBA component ordering is available in WebGL. + */ + #ifndef MAGNUM_TARGET_GLES + BGRA = GL_BGRA, + #else + BGRA = GL_BGRA_EXT, + #endif + #endif + + #ifndef MAGNUM_TARGET_GLES2 + /** + * Integer red channel. + * @requires_gl30 Extension @extension{EXT,texture_integer} + * @requires_gles30 Only floating-point image data are available in OpenGL + * ES 2.0. + * @requires_webgl20 Only floating-point image data are available in WebGL + * 1.0. + */ + RedInteger = GL_RED_INTEGER, + + #ifndef MAGNUM_TARGET_GLES + /** + * Integer green channel. + * @requires_gl30 Extension @extension{EXT,texture_integer} + * @requires_gl Only @ref PixelFormat::RedInteger is available in OpenGL ES + * 3.0 and WebGL 2.0, only floating-point image data are available in + * OpenGL ES 2.0 and WebGL 1.0. + */ + GreenInteger = GL_GREEN_INTEGER, + + /** + * Integer blue channel. + * @requires_gl30 Extension @extension{EXT,texture_integer} + * @requires_gl Only @ref PixelFormat::RedInteger is available in OpenGL ES + * 3.0 and WebGL 2.0, only floating-point image data are available in + * OpenGL ES 2.0 and WebGL 1.0. + */ + BlueInteger = GL_BLUE_INTEGER, + #endif + + /** + * Integer red and green channel. + * @requires_gl30 Extension @extension{ARB,texture_rg} and @extension{EXT,texture_integer} + * @requires_gl Can't be used for framebuffer reading in OpenGL ES or + * WebGL. + * @requires_gles30 For texture data only, only floating-point image data + * are available in OpenGL ES 2.0. + * @requires_webgl20 For texture data only, only floating-point image data + * are available in WebGL 1.0. + */ + RGInteger = GL_RG_INTEGER, + + /** + * Integer RGB. + * @requires_gl30 Extension @extension{EXT,texture_integer} + * @requires_gl Can't be used for framebuffer reading in OpenGL ES or + * WebGL. + * @requires_gles30 For texture data only, only floating-point image data + * are available in OpenGL ES 2.0. + * @requires_webgl20 For texture data only, only floating-point image data + * are available in WebGL 1.0. + */ + RGBInteger = GL_RGB_INTEGER, + + /** + * Integer RGBA. + * @requires_gl30 Extension @extension{EXT,texture_integer} + * @requires_gles30 Only floating-point image data are available in OpenGL + * ES 2.0. + * @requires_webgl20 Only floating-point image data are available in WebGL + * 1.0. + */ + RGBAInteger = GL_RGBA_INTEGER, + + #ifndef MAGNUM_TARGET_GLES + /** + * Integer BGR. + * @requires_gl30 Extension @extension{EXT,texture_integer} + * @requires_gl Only @ref PixelFormat::RGBInteger is available in OpenGL ES + * 3.0 and WebGL 2.0, only floating-point image data are available in + * OpenGL ES 2.0 and WebGL 1.0. + */ + BGRInteger = GL_BGR_INTEGER, + + /** + * Integer BGRA. + * @requires_gl30 Extension @extension{EXT,texture_integer} + * @requires_gl Only @ref PixelFormat::RGBAInteger is available in OpenGL + * ES 3.0 and WebGL 2.0, only floating-point image data are available + * in OpenGL ES 2.0 and WebGL 1.0. + */ + BGRAInteger = GL_BGRA_INTEGER, + #endif + #endif + + /** + * Depth component. + * @requires_gles30 For texture data only, extension @es_extension{OES,depth_texture} + * or @es_extension{ANGLE,depth_texture} in OpenGL ES 2.0. + * @requires_es_extension For framebuffer reading only, extension + * @es_extension2{NV,read_depth,GL_NV_read_depth_stencil}. + * @requires_webgl20 For texture data only, extension + * @webgl_extension{WEBGL,depth_texture} in WebGL 1.0. + */ + DepthComponent = GL_DEPTH_COMPONENT, + + #ifndef MAGNUM_TARGET_WEBGL + /** + * Stencil index. + * @requires_gl44 Extension @extension{ARB,texture_stencil8} for texture + * data, otherwise for framebuffer reading only. + * @requires_es_extension Extension @es_extension2{NV,read_stencil,GL_NV_read_depth_stencil}, + * for framebuffer reading only. + * @requires_es_extension Extension @es_extension{ANDROID,extension_pack_es31a}/ + * @es_extension{OES,texture_stencil8}, for texture data only. + * @requires_gles Stencil index is not available in WebGL. + */ + #ifndef MAGNUM_TARGET_GLES + StencilIndex = GL_STENCIL_INDEX, + #else + StencilIndex = GL_STENCIL_INDEX_OES, + #endif + #endif + + /** + * Depth and stencil. + * @requires_gl30 Extension @extension{ARB,framebuffer_object} + * @requires_gles30 For texture data only, extension @es_extension{OES,packed_depth_stencil} + * in OpenGL ES 2.0. + * @requires_es_extension For framebuffer reading only, extension + * @es_extension2{NV,read_depth_stencil,GL_NV_read_depth_stencil} + * @requires_webgl20 For texture data only, extension + * @webgl_extension{WEBGL,depth_texture} in WebGL 1.0. + */ + #ifndef MAGNUM_TARGET_GLES2 + DepthStencil = GL_DEPTH_STENCIL + #else + /* Using OES version even though WebGL 1.0 *has* DEPTH_STENCIL constant, + because there are no such headers for it */ + DepthStencil = GL_DEPTH_STENCIL_OES + #endif +}; + +/** +@brief Type of pixel data + +Note that some formats can be used only for framebuffer reading (using +@ref AbstractFramebuffer::read()) and some only for texture data (using +@ref Texture::setSubImage() and others), the limitations are mentioned in +documentation of each particular value. + +In most cases you may want to use @ref PixelType::UnsignedByte along with +@ref PixelFormat::Red (for grayscale images), @ref PixelFormat::RGB or +@ref PixelFormat::RGBA, the matching texture format is then +@ref TextureFormat::R8, @ref TextureFormat::RGB8 or @ref TextureFormat::RGBA8. +See documentation of these values for possible limitations when using OpenGL ES +2.0 or WebGL. + +@see @ref Image, @ref ImageView, @ref BufferImage, @ref Trade::ImageData +*/ +enum class PixelType: GLenum { + /** Each component unsigned byte. */ + UnsignedByte = GL_UNSIGNED_BYTE, + + #ifndef MAGNUM_TARGET_GLES2 + /** + * Each component signed byte. + * @requires_gles30 For texture data only, only @ref PixelType::UnsignedByte + * is available in OpenGL ES 2.0. + * @requires_gl Can't be used for framebuffer reading in OpenGL ES or + * WebGL. + * @requires_webgl20 For texture data only, only @ref PixelType::UnsignedByte + * is available in WebGL 1.0. + */ + Byte = GL_BYTE, + #endif + + /** + * Each component unsigned short. + * @requires_gles30 For texture data only, extension @es_extension{OES,depth_texture} + * or @es_extension{ANGLE,depth_texture} in OpenGL ES 2.0. + * @requires_gl Can't be used for framebuffer reading in OpenGL ES or + * WebGL. + * @requires_webgl20 For texture data only, extension + * @webgl_extension{WEBGL,depth_texture} in WebGL 1.0. + */ + UnsignedShort = GL_UNSIGNED_SHORT, + + #ifndef MAGNUM_TARGET_GLES2 + /** + * Each component signed short. + * @requires_gl Can't be used for framebuffer reading in OpenGL ES or + * WebGL. + * @requires_gles30 For texture data only, only @ref PixelType::UnsignedShort + * is available in OpenGL ES 2.0. + * @requires_webgl20 For texture data only, only @ref PixelType::UnsignedShort + * is available in WebGL 1.0. + */ + Short = GL_SHORT, + #endif + + /** + * Each component unsigned int. + * @requires_gles30 For texture data only, extension @es_extension{OES,depth_texture} + * or @es_extension{ANGLE,depth_texture} in OpenGL ES 2.0. + * @requires_webgl20 For texture data only, extension + * @webgl_extension{WEBGL,depth_texture} in WebGL 1.0. + */ + UnsignedInt = GL_UNSIGNED_INT, + + #ifndef MAGNUM_TARGET_GLES2 + /** + * Each component signed int. + * @requires_gles30 Only @ref PixelType::UnsignedInt is available in OpenGL + * ES 2.0. + * @requires_webgl20 Only @ref PixelType::UnsignedInt is available in WebGL + * 1.0. + */ + Int = GL_INT, + #endif + + /** + * Each component half float. + * @requires_gl30 Extension @extension{ARB,half_float_pixel} + * @requires_gles30 For texture data only, extension + * @es_extension2{OES,texture_half_float,OES_texture_float} in OpenGL + * ES 2.0. + * @requires_webgl20 For texture data only, extension + * @webgl_extension{OES,texture_half_float} in WebGL 1.0. + */ + #ifndef MAGNUM_TARGET_GLES2 + HalfFloat = GL_HALF_FLOAT, + #else + HalfFloat = GL_HALF_FLOAT_OES, + #endif + + /** + * Each component float. + * @requires_gles30 For texture data only, extension @es_extension{OES,texture_float} + * in OpenGL ES 2.0. + * @requires_webgl20 For texture data only, extension @webgl_extension{OES,texture_float} + * in WebGL 1.0. + */ + Float = GL_FLOAT, + + #ifndef MAGNUM_TARGET_GLES + /** + * RGB, unsigned byte, red and green component 3bit, blue component 2bit. + * @requires_gl Packed 12bit types are not available in OpenGL ES or WebGL. + */ + UnsignedByte332 = GL_UNSIGNED_BYTE_3_3_2, + + /** + * BGR, unsigned byte, red and green component 3bit, blue component 2bit. + * @requires_gl Packed 12bit types are not available in OpenGL ES or WebGL. + */ + UnsignedByte233Rev = GL_UNSIGNED_BYTE_2_3_3_REV, + #endif + + /** + * RGB, unsigned byte, red and blue component 5bit, green 6bit. + * @requires_gl Can't be used for framebuffer reading in OpenGL ES or WebGL. + */ + UnsignedShort565 = GL_UNSIGNED_SHORT_5_6_5, + + #ifndef MAGNUM_TARGET_GLES + /** + * BGR, unsigned short, red and blue 5bit, green 6bit. + * @requires_gl Only @ref PixelType::UnsignedShort565 is available in + * OpenGL ES or WebGL. + */ + UnsignedShort565Rev = GL_UNSIGNED_SHORT_5_6_5_REV, + #endif + + /** + * RGBA, unsigned short, each component 4bit. + * @requires_gl Can't be used for framebuffer reading in OpenGL ES or WebGL. + */ + UnsignedShort4444 = GL_UNSIGNED_SHORT_4_4_4_4, + + #ifndef MAGNUM_TARGET_WEBGL + /** + * ABGR, unsigned short, each component 4bit. + * @requires_es_extension For framebuffer reading only, extension + * @es_extension{EXT,read_format_bgra} + * @requires_gles Only RGBA component ordering is available in WebGL. + */ + #ifndef MAGNUM_TARGET_GLES + UnsignedShort4444Rev = GL_UNSIGNED_SHORT_4_4_4_4_REV, + #else + UnsignedShort4444Rev = GL_UNSIGNED_SHORT_4_4_4_4_REV_EXT, + #endif + #endif + + /** + * RGBA, unsigned short, each RGB component 5bit, alpha component 1bit. + * @requires_gl Can't be used for framebuffer reading in OpenGL ES or WebGL. + */ + UnsignedShort5551 = GL_UNSIGNED_SHORT_5_5_5_1, + + #ifndef MAGNUM_TARGET_WEBGL + /** + * ABGR, unsigned short, each RGB component 5bit, alpha component 1bit. + * @requires_es_extension For framebuffer reading only, extension + * @es_extension{EXT,read_format_bgra} + * @requires_gles Not available in WebGL. + */ + #ifndef MAGNUM_TARGET_GLES + UnsignedShort1555Rev = GL_UNSIGNED_SHORT_1_5_5_5_REV, + #else + UnsignedShort1555Rev = GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT, + #endif + #endif + + #ifndef MAGNUM_TARGET_GLES + /** + * RGBA, unsigned int, each component 8bit. + * @requires_gl Use @ref PixelType::UnsignedByte in OpenGL ES and WebGL + * instead. + */ + UnsignedInt8888 = GL_UNSIGNED_INT_8_8_8_8, + + /** + * ABGR, unsigned int, each component 8bit. + * @requires_gl Only RGBA component ordering is available in OpenGL ES and + * WebGL, see @ref PixelType::UnsignedInt8888 for more information. + */ + UnsignedInt8888Rev = GL_UNSIGNED_INT_8_8_8_8_REV, + + /** + * RGBA, unsigned int, each RGB component 10bit, alpha component 2bit. + * @requires_gl Only @ref PixelType::UnsignedInt2101010Rev is available in + * OpenGL ES and WebGL. + */ + UnsignedInt1010102 = GL_UNSIGNED_INT_10_10_10_2, + #endif + + #if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2)) + /** + * ABGR, unsigned int, each RGB component 10bit, alpha component 2bit. + * @requires_gles30 Can't be used for framebuffer reading in OpenGL ES 2.0. + * @requires_gles30 For texture data only, extension + * @es_extension{EXT,texture_type_2_10_10_10_REV} in OpenGL ES 2.0. + * Not available in WebGL 1.0. + * @requires_webgl20 Only RGBA component ordering is available in WebGL + * 1.0. + */ + #ifndef MAGNUM_TARGET_GLES2 + UnsignedInt2101010Rev = GL_UNSIGNED_INT_2_10_10_10_REV, + #else + UnsignedInt2101010Rev = GL_UNSIGNED_INT_2_10_10_10_REV_EXT, + #endif + #endif + + #ifndef MAGNUM_TARGET_GLES2 + /** + * BGR, unsigned int, red and green 11bit float, blue 10bit float. + * @requires_gl30 Extension @extension{EXT,packed_float} + * @requires_gles30 Floating-point types are not available in OpenGL ES + * 2.0. + * @requires_webgl20 Floating-point types are not available in WebGL 1.0. + */ + UnsignedInt10F11F11FRev = GL_UNSIGNED_INT_10F_11F_11F_REV, + + /** + * BGR, unsigned int, each component 9bit + 5bit exponent. + * @requires_gl30 Extension @extension{EXT,texture_shared_exponent} + * @requires_gles30 Only 8bit and 16bit types are available in OpenGL ES + * 2.0. + * @requires_webgl20 Only 8bit and 16bit types are available in WebGL 1.0. + */ + UnsignedInt5999Rev = GL_UNSIGNED_INT_5_9_9_9_REV, + #endif + + /** + * Unsigned int, depth component 24bit, stencil index 8bit. + * @requires_gl30 Extension @extension{ARB,framebuffer_object} + * @requires_gles30 For texture data only, extension + * @es_extension{OES,packed_depth_stencil} in OpenGL ES 2.0. + * @requires_webgl20 For texture data only, extension + * @webgl_extension{WEBGL,depth_texture} in WebGL 1.0. + */ + #ifndef MAGNUM_TARGET_GLES2 + UnsignedInt248 = GL_UNSIGNED_INT_24_8, + #else + UnsignedInt248 = GL_UNSIGNED_INT_24_8_OES, + #endif + + #ifndef MAGNUM_TARGET_GLES2 + /** + * Float + unsigned int, depth component 32bit float, 24bit gap, stencil + * index 8bit. + * @requires_gl30 Extension @extension{ARB,depth_buffer_float} + * @requires_gles30 For texture data only, only @ref PixelType::UnsignedInt248 + * is available in OpenGL ES 2.0. + * @requires_webgl20 For texture data only, only @ref PixelType::UnsignedInt248 + * is available in WebGL 1.0. + */ + Float32UnsignedInt248Rev = GL_FLOAT_32_UNSIGNED_INT_24_8_REV + #endif +}; + +/** +@brief Format of compressed pixel data + +Equivalent to `Compressed*` values of @ref TextureFormat enum. + +@see @ref CompressedImage, @ref CompressedImageView, @ref CompressedBufferImage, + @ref Trade::ImageData +*/ +enum class CompressedPixelFormat: GLenum { + #ifndef MAGNUM_TARGET_GLES + /** + * Compressed red channel, normalized unsigned. + * @requires_gl30 Extension @extension{ARB,texture_rg} + * @requires_gl Generic texture compression is not available in OpenGL ES + * or WebGL. + */ + Red = GL_COMPRESSED_RED, + + /** + * Compressed red and green channel, normalized unsigned. + * @requires_gl30 Extension @extension{ARB,texture_rg} + * @requires_gl Generic texture compression is not available in OpenGL ES + * or WebGL. + */ + RG = GL_COMPRESSED_RG, + + /** + * Compressed RGB, normalized unsigned. + * @requires_gl Generic texture compression is not available in OpenGL ES + * or WebGL. + */ + RGB = GL_COMPRESSED_RGB, + + /** + * Compressed RGBA, normalized unsigned. + * @requires_gl Generic texture compression is not available in OpenGL ES + * or WebGL. + */ + RGBA = GL_COMPRESSED_RGBA, + + /** + * RGTC compressed red channel, normalized unsigned. **Available only for + * 2D, 2D array, cube map and cube map array textures.** + * @requires_gl30 Extension @extension{EXT,texture_compression_rgtc} + * @requires_gl Generic texture compression is not available in OpenGL ES + * or WebGL. + */ + RedRgtc1 = GL_COMPRESSED_RED_RGTC1, + + /** + * RGTC compressed red and green channel, normalized unsigned. **Available + * only for 2D, 2D array, cube map and cube map array textures.** + * @requires_gl30 Extension @extension{EXT,texture_compression_rgtc} + * @requires_gl RGTC texture compression is not available in OpenGL ES or + * WebGL. + */ + RGRgtc2 = GL_COMPRESSED_RG_RGTC2, + + /** + * RGTC compressed red channel, normalized signed. **Available only for 2D, + * 2D array, cube map and cube map array textures.** + * @requires_gl30 Extension @extension{EXT,texture_compression_rgtc} + * @requires_gl RGTC texture compression is not available in OpenGL ES or + * WebGL. + */ + SignedRedRgtc1 = GL_COMPRESSED_SIGNED_RED_RGTC1, + + /** + * RGTC compressed red and green channel, normalized signed. **Available + * only for 2D, 2D array, cube map and cube map array textures.** + * @requires_gl30 Extension @extension{EXT,texture_compression_rgtc} + * @requires_gl RGTC texture compression is not available in OpenGL ES or + * WebGL. + */ + SignedRGRgtc2 = GL_COMPRESSED_SIGNED_RG_RGTC2, + + /** + * BPTC compressed RGB, unsigned float. **Available only on 2D, 3D, 2D + * array, cube map and cube map array textures.** + * @requires_gl42 Extension @extension{ARB,texture_compression_bptc} + * @requires_gl BPTC texture compression is not available in OpenGL ES or + * WebGL. + */ + RGBBptcUnsignedFloat = GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT, + + /** + * BPTC compressed RGB, signed float. **Available only on 2D, 3D, 2D array, + * cube map and cube map array textures.** + * @requires_gl42 Extension @extension{ARB,texture_compression_bptc} + * @requires_gl BPTC texture compression is not available in OpenGL ES or + * WebGL. + */ + RGBBptcSignedFloat = GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT, + + /** + * BPTC compressed RGBA, normalized unsigned. **Available only on 2D, 3D, + * 2D array, cube map and cube map array textures.** + * @requires_gl42 Extension @extension{ARB,texture_compression_bptc} + * @requires_gl BPTC texture compression is not available in OpenGL ES or + * WebGL. + */ + RGBABptcUnorm = GL_COMPRESSED_RGBA_BPTC_UNORM, + + /** + * BPTC compressed sRGBA, normalized unsigned. **Available only on 2D, 3D, + * 2D array, cube map and cube map array textures.** + * @requires_gl42 Extension @extension{ARB,texture_compression_bptc} + * @requires_gl BPTC texture compression is not available in OpenGL ES or + * WebGL. + */ + SRGBAlphaBptcUnorm = GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM, + #endif + + #ifndef MAGNUM_TARGET_GLES2 + /** + * ETC2 compressed RGB, normalized unsigned. **Available only on 2D, 2D + * array, cube map and cube map array textures.** + * @requires_gl43 Extension @extension{ARB,ES3_compatibility} + * @requires_gles30 ETC2 texture compression is not available in OpenGL ES + * 2.0. + */ + RGB8Etc2 = GL_COMPRESSED_RGB8_ETC2, + + /** + * ETC2 compressed sRGB, normalized unsigned. **Available only on 2D, 2D + * array, cube map and cube map array textures.** + * @requires_gl43 Extension @extension{ARB,ES3_compatibility} + * @requires_gles30 ETC2 texture compression is not available in OpenGL ES + * 2.0. + */ + SRGB8Etc2 = GL_COMPRESSED_SRGB8_ETC2, + + /** + * ETC2 compressed RGB with punchthrough (single-bit) alpha, normalized + * unsigned. **Available only on 2D, 2D array, cube map and cube map array + * textures.** + * @requires_gl43 Extension @extension{ARB,ES3_compatibility} + * @requires_gles30 ETC2 texture compression is not available in OpenGL ES + * 2.0. + */ + RGB8PunchthroughAlpha1Etc2 = GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2, + + /** + * ETC2 compressed sRGB with punchthrough (single-bit) alpha, normalized + * unsigned. **Available only on 2D, 2D array, cube map and cube map array + * textures.** + * @requires_gl43 Extension @extension{ARB,ES3_compatibility} + * @requires_gles30 ETC2 texture compression is not available in OpenGL ES + * 2.0. + */ + SRGB8PunchthroughAlpha1Etc2 = GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2, + + /** + * ETC2/EAC compressed RGBA, normalized unsigned. **Available only on 2D, + * 2D array, cube map and cube map array textures.** + * @requires_gl43 Extension @extension{ARB,ES3_compatibility} + * @requires_gles30 ETC2 texture compression is not available in OpenGL ES + * 2.0. + */ + RGBA8Etc2Eac = GL_COMPRESSED_RGBA8_ETC2_EAC, + + /** + * ETC2/EAC compressed sRGB with alpha, normalized unsigned. **Available + * only on 2D, 2D array, cube map and cube map array textures.** + * @requires_gl43 Extension @extension{ARB,ES3_compatibility} + * @requires_gles30 ETC2 texture compression is not available in OpenGL ES + * 2.0. + */ + SRGB8Alpha8Etc2Eac = GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC, + + /** + * EAC compressed red channel, normalized unsigned. **Available only on 2D, + * 2D array, cube map and cube map array textures.** + * @requires_gl43 Extension @extension{ARB,ES3_compatibility} + * @requires_gles30 ETC2 texture compression is not available in OpenGL ES + * 2.0. + */ + R11Eac = GL_COMPRESSED_R11_EAC, + + /** + * EAC compressed red channel, normalized signed. **Available only on 2D, + * 2D array, cube map and cube map array textures.** + * @requires_gl43 Extension @extension{ARB,ES3_compatibility} + * @requires_gles30 ETC2 texture compression is not available in OpenGL ES + * 2.0. + */ + SignedR11Eac = GL_COMPRESSED_SIGNED_R11_EAC, + + /** + * EAC compressed red and green channel, normalized unsigned. **Available + * only on 2D, 2D array, cube map and cube map array textures.** + * @requires_gl43 Extension @extension{ARB,ES3_compatibility} + * @requires_gles30 ETC2 texture compression is not available in OpenGL ES + * 2.0. + */ + RG11Eac = GL_COMPRESSED_RG11_EAC, + + /** + * EAC compressed red and green channel, normalized signed. **Available + * only on 2D, 2D array, cube map and cube map array textures.** + * @requires_gl43 Extension @extension{ARB,ES3_compatibility} + * @requires_gles30 ETC2 texture compression is not available in OpenGL ES + * 2.0. + */ + SignedRG11Eac = GL_COMPRESSED_SIGNED_RG11_EAC, + #endif + + /** + * S3TC DXT1 compressed RGB. **Available only for 2D, 3D, 2D array, cube + * map and cube map array textures.** + * @requires_extension Extension @extension{EXT,texture_compression_s3tc} + * @requires_es_extension Extension @es_extension2{EXT,texture_compression_s3tc,texture_compression_s3tc} + * @requires_webgl_extension Extension @webgl_extension{WEBGL,compressed_texture_s3tc} + */ + RGBS3tcDxt1 = GL_COMPRESSED_RGB_S3TC_DXT1_EXT, + + /** + * S3TC DXT1 compressed RGBA. **Available only for 2D, 3D, 2D array, cube + * map and cube map array textures.** + * @requires_extension Extension @extension{EXT,texture_compression_s3tc} + * @requires_es_extension Extension @es_extension2{EXT,texture_compression_s3tc,texture_compression_s3tc} + * @requires_webgl_extension Extension @webgl_extension{WEBGL,compressed_texture_s3tc} + */ + RGBAS3tcDxt1 = GL_COMPRESSED_RGBA_S3TC_DXT1_EXT, + + /** + * S3TC DXT3 compressed RGBA. **Available only for 2D, 3D, 2D array, cube + * map and cube map array textures.** + * @requires_extension Extension @extension{EXT,texture_compression_s3tc} + * @requires_es_extension Extension @es_extension2{EXT,texture_compression_s3tc,texture_compression_s3tc} + * @requires_webgl_extension Extension @webgl_extension{WEBGL,compressed_texture_s3tc} + */ + RGBAS3tcDxt3 = GL_COMPRESSED_RGBA_S3TC_DXT3_EXT, + + /** + * S3TC DXT5 compressed RGBA. **Available only for 2D, 3D, 2D array, cube + * map and cube map array textures.** + * @requires_extension Extension @extension{EXT,texture_compression_s3tc} + * @requires_es_extension Extension @es_extension2{EXT,texture_compression_s3tc,texture_compression_s3tc} + * @requires_webgl_extension Extension @webgl_extension{WEBGL,compressed_texture_s3tc} + */ + RGBAS3tcDxt5 = GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, + + #ifndef MAGNUM_TARGET_WEBGL + /** + * ASTC compressed RGBA with 4x4 blocks. **Available only on 2D, 3D, 2D + * array, cube map and cube map array textures.** + * @requires_extension Extension @extension3{KHR,texture_compression_astc_ldr,texture_compression_astc_hdr} + * @requires_extension Extension @extension{KHR,texture_compression_astc_hdr} + * for 3D textures and HDR profile + * @requires_es_extension Extension @es_extension{ANDROID,extension_pack_es31a}/ + * @es_extension2{KHR,texture_compression_astc_ldr,texture_compression_astc_hdr} + * @requires_es_extension Extension @es_extension2{KHR,texture_compression_astc_hdr,texture_compression_astc_hdr} + * for 3D textures and HDR profile + * @requires_gles ASTC texture compression is not available in WebGL. + */ + RGBAAstc4x4 = GL_COMPRESSED_RGBA_ASTC_4x4_KHR, + + /** + * ASTC compressed sRGB with alpha with 4x4 blocks. **Available only on 2D, + * 3D, 2D array, cube map and cube map array textures.** + * @requires_extension Extension @extension3{KHR,texture_compression_astc_ldr,texture_compression_astc_hdr} + * @requires_extension Extension @extension{KHR,texture_compression_astc_hdr} + * for 3D textures and HDR profile + * @requires_es_extension Extension @es_extension{ANDROID,extension_pack_es31a}/ + * @es_extension2{KHR,texture_compression_astc_ldr,texture_compression_astc_hdr} + * @requires_es_extension Extension @es_extension2{KHR,texture_compression_astc_hdr,texture_compression_astc_hdr} + * for 3D textures and HDR profile + * @requires_gles ASTC texture compression is not available in WebGL. + */ + SRGB8Alpha8Astc4x4 = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR, + + /** + * ASTC compressed RGBA with 5x4 blocks. **Available only on 2D, 3D, 2D + * array, cube map and cube map array textures.** + * @requires_extension Extension @extension3{KHR,texture_compression_astc_ldr,texture_compression_astc_hdr} + * @requires_extension Extension @extension{KHR,texture_compression_astc_hdr} + * for 3D textures and HDR profile + * @requires_es_extension Extension @es_extension{ANDROID,extension_pack_es31a}/ + * @es_extension2{KHR,texture_compression_astc_ldr,texture_compression_astc_hdr} + * @requires_es_extension Extension @es_extension2{KHR,texture_compression_astc_hdr,texture_compression_astc_hdr} + * for 3D textures and HDR profile + * @requires_gles ASTC texture compression is not available in WebGL. + */ + RGBAAstc5x4 = GL_COMPRESSED_RGBA_ASTC_5x4_KHR, + + /** + * ASTC compressed sRGB with alpha with 5x4 blocks. **Available only on 2D, + * 3D, 2D array, cube map and cube map array textures.** + * @requires_extension Extension @extension3{KHR,texture_compression_astc_ldr,texture_compression_astc_hdr} + * @requires_extension Extension @extension{KHR,texture_compression_astc_hdr} + * for 3D textures and HDR profile + * @requires_es_extension Extension @es_extension{ANDROID,extension_pack_es31a}/ + * @es_extension2{KHR,texture_compression_astc_ldr,texture_compression_astc_hdr} + * @requires_es_extension Extension @es_extension2{KHR,texture_compression_astc_hdr,texture_compression_astc_hdr} + * for 3D textures and HDR profile + * @requires_gles ASTC texture compression is not available in WebGL. + */ + SRGB8Alpha8Astc5x4 = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR, + + /** + * ASTC compressed RGBA with 5x5 blocks. **Available only on 2D, 3D, 2D + * array, cube map and cube map array textures.** + * @requires_extension Extension @extension3{KHR,texture_compression_astc_ldr,texture_compression_astc_hdr} + * @requires_extension Extension @extension{KHR,texture_compression_astc_hdr} + * for 3D textures and HDR profile + * @requires_es_extension Extension @es_extension{ANDROID,extension_pack_es31a}/ + * @es_extension2{KHR,texture_compression_astc_ldr,texture_compression_astc_hdr} + * @requires_es_extension Extension @es_extension2{KHR,texture_compression_astc_hdr,texture_compression_astc_hdr} + * for 3D textures and HDR profile + * @requires_gles ASTC texture compression is not available in WebGL. + */ + RGBAAstc5x5 = GL_COMPRESSED_RGBA_ASTC_5x5_KHR, + + /** + * ASTC compressed sRGB with alpha with 5x5 blocks. **Available only on 2D, + * 3D, 2D array, cube map and cube map array textures.** + * @requires_extension Extension @extension3{KHR,texture_compression_astc_ldr,texture_compression_astc_hdr} + * @requires_extension Extension @extension{KHR,texture_compression_astc_hdr} + * for 3D textures and HDR profile + * @requires_es_extension Extension @es_extension{ANDROID,extension_pack_es31a}/ + * @es_extension2{KHR,texture_compression_astc_ldr,texture_compression_astc_hdr} + * @requires_es_extension Extension @es_extension2{KHR,texture_compression_astc_hdr,texture_compression_astc_hdr} + * for 3D textures and HDR profile + * @requires_gles ASTC texture compression is not available in WebGL. + */ + SRGB8Alpha8Astc5x5 = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR, + + /** + * ASTC compressed RGBA with 6x5 blocks. **Available only on 2D, 3D, 2D + * array, cube map and cube map array textures.** + * @requires_extension Extension @extension3{KHR,texture_compression_astc_ldr,texture_compression_astc_hdr} + * @requires_extension Extension @extension{KHR,texture_compression_astc_hdr} + * for 3D textures and HDR profile + * @requires_es_extension Extension @es_extension{ANDROID,extension_pack_es31a}/ + * @es_extension2{KHR,texture_compression_astc_ldr,texture_compression_astc_hdr} + * @requires_es_extension Extension @es_extension2{KHR,texture_compression_astc_hdr,texture_compression_astc_hdr} + * for 3D textures and HDR profile + * @requires_gles ASTC texture compression is not available in WebGL. + */ + RGBAAstc6x5 = GL_COMPRESSED_RGBA_ASTC_6x5_KHR, + + /** + * ASTC compressed sRGB with alpha with 6x5 blocks. **Available only on 2D, + * 3D, 2D array, cube map and cube map array textures.** + * @requires_extension Extension @extension3{KHR,texture_compression_astc_ldr,texture_compression_astc_hdr} + * @requires_extension Extension @extension{KHR,texture_compression_astc_hdr} + * for 3D textures and HDR profile + * @requires_es_extension Extension @es_extension{ANDROID,extension_pack_es31a}/ + * @es_extension2{KHR,texture_compression_astc_ldr,texture_compression_astc_hdr} + * @requires_es_extension Extension @es_extension2{KHR,texture_compression_astc_hdr,texture_compression_astc_hdr} + * for 3D textures and HDR profile + * @requires_gles ASTC texture compression is not available in WebGL. + */ + SRGB8Alpha8Astc6x5 = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR, + + /** + * ASTC compressed RGBA with 6x6 blocks. **Available only on 2D, 3D, 2D + * array, cube map and cube map array textures.** + * @requires_extension Extension @extension3{KHR,texture_compression_astc_ldr,texture_compression_astc_hdr} + * @requires_extension Extension @extension{KHR,texture_compression_astc_hdr} + * for 3D textures and HDR profile + * @requires_es_extension Extension @es_extension{ANDROID,extension_pack_es31a}/ + * @es_extension2{KHR,texture_compression_astc_ldr,texture_compression_astc_hdr} + * @requires_es_extension Extension @es_extension2{KHR,texture_compression_astc_hdr,texture_compression_astc_hdr} + * for 3D textures and HDR profile + * @requires_gles ASTC texture compression is not available in WebGL. + */ + RGBAAstc6x6 = GL_COMPRESSED_RGBA_ASTC_6x6_KHR, + + /** + * ASTC compressed sRGB with alpha with 6x6 blocks. **Available only on 2D, + * 3D, 2D array, cube map and cube map array textures.** + * @requires_extension Extension @extension3{KHR,texture_compression_astc_ldr,texture_compression_astc_hdr} + * @requires_extension Extension @extension{KHR,texture_compression_astc_hdr} + * for 3D textures and HDR profile + * @requires_es_extension Extension @es_extension{ANDROID,extension_pack_es31a}/ + * @es_extension2{KHR,texture_compression_astc_ldr,texture_compression_astc_hdr} + * @requires_es_extension Extension @es_extension2{KHR,texture_compression_astc_hdr,texture_compression_astc_hdr} + * for 3D textures and HDR profile + * @requires_gles ASTC texture compression is not available in WebGL. + */ + SRGB8Alpha8Astc6x6 = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR, + + /** + * ASTC compressed RGBA with 8x5 blocks. **Available only on 2D, 3D, 2D + * array, cube map and cube map array textures.** + * @requires_extension Extension @extension3{KHR,texture_compression_astc_ldr,texture_compression_astc_hdr} + * @requires_extension Extension @extension{KHR,texture_compression_astc_hdr} + * for 3D textures and HDR profile + * @requires_es_extension Extension @es_extension{ANDROID,extension_pack_es31a}/ + * @es_extension2{KHR,texture_compression_astc_ldr,texture_compression_astc_hdr} + * @requires_es_extension Extension @es_extension2{KHR,texture_compression_astc_hdr,texture_compression_astc_hdr} + * for 3D textures and HDR profile + * @requires_gles ASTC texture compression is not available in WebGL. + */ + RGBAAstc8x5 = GL_COMPRESSED_RGBA_ASTC_8x5_KHR, + + /** + * ASTC compressed sRGB with alpha with 8x5 blocks. **Available only on 2D, + * 3D, 2D array, cube map and cube map array textures.** + * @requires_extension Extension @extension3{KHR,texture_compression_astc_ldr,texture_compression_astc_hdr} + * @requires_extension Extension @extension{KHR,texture_compression_astc_hdr} + * for 3D textures and HDR profile + * @requires_es_extension Extension @es_extension{ANDROID,extension_pack_es31a}/ + * @es_extension2{KHR,texture_compression_astc_ldr,texture_compression_astc_hdr} + * @requires_es_extension Extension @es_extension2{KHR,texture_compression_astc_hdr,texture_compression_astc_hdr} + * for 3D textures and HDR profile + * @requires_gles ASTC texture compression is not available in WebGL. + */ + SRGB8Alpha8Astc8x5 = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR, + + /** + * ASTC compressed RGBA with 8x6 blocks. **Available only on 2D, 3D, 2D + * array, cube map and cube map array textures.** + * @requires_extension Extension @extension3{KHR,texture_compression_astc_ldr,texture_compression_astc_hdr} + * @requires_extension Extension @extension{KHR,texture_compression_astc_hdr} + * for 3D textures and HDR profile + * @requires_es_extension Extension @es_extension{ANDROID,extension_pack_es31a}/ + * @es_extension2{KHR,texture_compression_astc_ldr,texture_compression_astc_hdr} + * @requires_es_extension Extension @es_extension2{KHR,texture_compression_astc_hdr,texture_compression_astc_hdr} + * for 3D textures and HDR profile + * @requires_gles ASTC texture compression is not available in WebGL. + */ + RGBAAstc8x6 = GL_COMPRESSED_RGBA_ASTC_8x6_KHR, + + /** + * ASTC compressed sRGB with alpha with 8x6 blocks. **Available only on 2D, + * 3D, 2D array, cube map and cube map array textures.** + * @requires_extension Extension @extension3{KHR,texture_compression_astc_ldr,texture_compression_astc_hdr} + * @requires_extension Extension @extension{KHR,texture_compression_astc_hdr} + * for 3D textures and HDR profile + * @requires_es_extension Extension @es_extension{ANDROID,extension_pack_es31a}/ + * @es_extension2{KHR,texture_compression_astc_ldr,texture_compression_astc_hdr} + * @requires_es_extension Extension @es_extension2{KHR,texture_compression_astc_hdr,texture_compression_astc_hdr} + * for 3D textures and HDR profile + * @requires_gles ASTC texture compression is not available in WebGL. + */ + SRGB8Alpha8Astc8x6 = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR, + + /** + * ASTC compressed RGBA with 8x8 blocks. **Available only on 2D, 3D, 2D + * array, cube map and cube map array textures.** + * @requires_extension Extension @extension3{KHR,texture_compression_astc_ldr,texture_compression_astc_hdr} + * @requires_extension Extension @extension{KHR,texture_compression_astc_hdr} + * for 3D textures and HDR profile + * @requires_es_extension Extension @es_extension{ANDROID,extension_pack_es31a}/ + * @es_extension2{KHR,texture_compression_astc_ldr,texture_compression_astc_hdr} + * @requires_es_extension Extension @es_extension2{KHR,texture_compression_astc_hdr,texture_compression_astc_hdr} + * for 3D textures and HDR profile + * @requires_gles ASTC texture compression is not available in WebGL. + */ + RGBAAstc8x8 = GL_COMPRESSED_RGBA_ASTC_8x8_KHR, + + /** + * ASTC compressed sRGB with alpha with 8x8 blocks. **Available only on 2D, + * 3D, 2D array, cube map and cube map array textures.** + * @requires_extension Extension @extension3{KHR,texture_compression_astc_ldr,texture_compression_astc_hdr} + * @requires_extension Extension @extension{KHR,texture_compression_astc_hdr} + * for 3D textures and HDR profile + * @requires_es_extension Extension @es_extension{ANDROID,extension_pack_es31a}/ + * @es_extension2{KHR,texture_compression_astc_ldr,texture_compression_astc_hdr} + * @requires_es_extension Extension @es_extension2{KHR,texture_compression_astc_hdr,texture_compression_astc_hdr} + * for 3D textures and HDR profile + * @requires_gles ASTC texture compression is not available in WebGL. + */ + SRGB8Alpha8Astc8x8 = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR, + + /** + * ASTC compressed RGBA with 10x5 blocks. **Available only on 2D, 3D, 2D + * array, cube map and cube map array textures.** + * @requires_extension Extension @extension3{KHR,texture_compression_astc_ldr,texture_compression_astc_hdr} + * @requires_extension Extension @extension{KHR,texture_compression_astc_hdr} + * for 3D textures and HDR profile + * @requires_es_extension Extension @es_extension{ANDROID,extension_pack_es31a}/ + * @es_extension2{KHR,texture_compression_astc_ldr,texture_compression_astc_hdr} + * @requires_es_extension Extension @es_extension2{KHR,texture_compression_astc_hdr,texture_compression_astc_hdr} + * for 3D textures and HDR profile + * @requires_gles ASTC texture compression is not available in WebGL. + */ + RGBAAstc10x5 = GL_COMPRESSED_RGBA_ASTC_10x5_KHR, + + /** + * ASTC compressed sRGB with alpha with 10x5 blocks. **Available only on + * 2D, 3D, 2D array, cube map and cube map array textures.** + * @requires_extension Extension @extension3{KHR,texture_compression_astc_ldr,texture_compression_astc_hdr} + * @requires_extension Extension @extension{KHR,texture_compression_astc_hdr} + * for 3D textures and HDR profile + * @requires_es_extension Extension @es_extension{ANDROID,extension_pack_es31a}/ + * @es_extension2{KHR,texture_compression_astc_ldr,texture_compression_astc_hdr} + * @requires_es_extension Extension @es_extension2{KHR,texture_compression_astc_hdr,texture_compression_astc_hdr} + * for 3D textures and HDR profile + * @requires_gles ASTC texture compression is not available in WebGL. + */ + SRGB8Alpha8Astc10x5 = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR, + + /** + * ASTC compressed RGBA with 10x6 blocks. **Available only on 2D, 3D, 2D + * array, cube map and cube map array textures.** + * @requires_extension Extension @extension3{KHR,texture_compression_astc_ldr,texture_compression_astc_hdr} + * @requires_extension Extension @extension{KHR,texture_compression_astc_hdr} + * for 3D textures and HDR profile + * @requires_es_extension Extension @es_extension{ANDROID,extension_pack_es31a}/ + * @es_extension2{KHR,texture_compression_astc_ldr,texture_compression_astc_hdr} + * @requires_es_extension Extension @es_extension2{KHR,texture_compression_astc_hdr,texture_compression_astc_hdr} + * for 3D textures and HDR profile + * @requires_gles ASTC texture compression is not available in WebGL. + */ + RGBAAstc10x6 = GL_COMPRESSED_RGBA_ASTC_10x6_KHR, + + /** + * ASTC compressed sRGB with alpha with 10x6 blocks. **Available only on + * 2D, 3D, 2D array, cube map and cube map array textures.** + * @requires_extension Extension @extension3{KHR,texture_compression_astc_ldr,texture_compression_astc_hdr} + * @requires_extension Extension @extension{KHR,texture_compression_astc_hdr} + * for 3D textures and HDR profile + * @requires_es_extension Extension @es_extension{ANDROID,extension_pack_es31a}/ + * @es_extension2{KHR,texture_compression_astc_ldr,texture_compression_astc_hdr} + * @requires_es_extension Extension @es_extension2{KHR,texture_compression_astc_hdr,texture_compression_astc_hdr} + * for 3D textures and HDR profile + * @requires_gles ASTC texture compression is not available in WebGL. + */ + SRGB8Alpha8Astc10x6 = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR, + + /** + * ASTC compressed RGBA with 10x8 blocks. **Available only on 2D, 3D, 2D + * array, cube map and cube map array textures.** + * @requires_extension Extension @extension3{KHR,texture_compression_astc_ldr,texture_compression_astc_hdr} + * @requires_extension Extension @extension{KHR,texture_compression_astc_hdr} + * for 3D textures and HDR profile + * @requires_es_extension Extension @es_extension{ANDROID,extension_pack_es31a}/ + * @es_extension2{KHR,texture_compression_astc_ldr,texture_compression_astc_hdr} + * @requires_es_extension Extension @es_extension2{KHR,texture_compression_astc_hdr,texture_compression_astc_hdr} + * for 3D textures and HDR profile + * @requires_gles ASTC texture compression is not available in WebGL. + */ + RGBAAstc10x8 = GL_COMPRESSED_RGBA_ASTC_10x8_KHR, + + /** + * ASTC compressed sRGB with alpha with 10x8 blocks. **Available only on + * 2D, 3D, 2D array, cube map and cube map array textures.** + * @requires_extension Extension @extension3{KHR,texture_compression_astc_ldr,texture_compression_astc_hdr} + * @requires_extension Extension @extension{KHR,texture_compression_astc_hdr} + * for 3D textures and HDR profile + * @requires_es_extension Extension @es_extension{ANDROID,extension_pack_es31a}/ + * @es_extension2{KHR,texture_compression_astc_ldr,texture_compression_astc_hdr} + * @requires_es_extension Extension @es_extension2{KHR,texture_compression_astc_hdr,texture_compression_astc_hdr} + * for 3D textures and HDR profile + * @requires_gles ASTC texture compression is not available in WebGL. + */ + SRGB8Alpha8Astc10x8 = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR, + + /** + * ASTC compressed RGBA with 10x10 blocks. **Available only on 2D, 3D, 2D + * array, cube map and cube map array textures.** + * @requires_extension Extension @extension3{KHR,texture_compression_astc_ldr,texture_compression_astc_hdr} + * @requires_extension Extension @extension{KHR,texture_compression_astc_hdr} + * for 3D textures and HDR profile + * @requires_es_extension Extension @es_extension{ANDROID,extension_pack_es31a}/ + * @es_extension2{KHR,texture_compression_astc_ldr,texture_compression_astc_hdr} + * @requires_es_extension Extension @es_extension2{KHR,texture_compression_astc_hdr,texture_compression_astc_hdr} + * for 3D textures and HDR profile + * @requires_gles ASTC texture compression is not available in WebGL. + */ + RGBAAstc10x10 = GL_COMPRESSED_RGBA_ASTC_10x10_KHR, + + /** + * ASTC compressed sRGB with alpha with 10x10 blocks. **Available only on + * 2D, 3D, 2D array, cube map and cube map array textures.** + * @requires_extension Extension @extension3{KHR,texture_compression_astc_ldr,texture_compression_astc_hdr} + * @requires_extension Extension @extension{KHR,texture_compression_astc_hdr} + * for 3D textures and HDR profile + * @requires_es_extension Extension @es_extension{ANDROID,extension_pack_es31a}/ + * @es_extension2{KHR,texture_compression_astc_ldr,texture_compression_astc_hdr} + * @requires_es_extension Extension @es_extension2{KHR,texture_compression_astc_hdr,texture_compression_astc_hdr} + * for 3D textures and HDR profile + * @requires_gles ASTC texture compression is not available in WebGL. + */ + SRGB8Alpha8Astc10x10 = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR, + + /** + * ASTC compressed RGBA with 12x10 blocks. **Available only on 2D, 3D, 2D + * array, cube map and cube map array textures.** + * @requires_extension Extension @extension3{KHR,texture_compression_astc_ldr,texture_compression_astc_hdr} + * @requires_extension Extension @extension{KHR,texture_compression_astc_hdr} + * for 3D textures and HDR profile + * @requires_es_extension Extension @es_extension{ANDROID,extension_pack_es31a}/ + * @es_extension2{KHR,texture_compression_astc_ldr,texture_compression_astc_hdr} + * @requires_es_extension Extension @es_extension2{KHR,texture_compression_astc_hdr,texture_compression_astc_hdr} + * for 3D textures and HDR profile + * @requires_gles ASTC texture compression is not available in WebGL. + */ + RGBAAstc12x10 = GL_COMPRESSED_RGBA_ASTC_12x10_KHR, + + /** + * ASTC compressed sRGB with alpha with 12x10 blocks. **Available only on + * 2D, 3D, 2D array, cube map and cube map array textures.** + * @requires_extension Extension @extension3{KHR,texture_compression_astc_ldr,texture_compression_astc_hdr} + * @requires_extension Extension @extension{KHR,texture_compression_astc_hdr} + * for 3D textures and HDR profile + * @requires_es_extension Extension @es_extension{ANDROID,extension_pack_es31a}/ + * @es_extension2{KHR,texture_compression_astc_ldr,texture_compression_astc_hdr} + * @requires_es_extension Extension @es_extension2{KHR,texture_compression_astc_hdr,texture_compression_astc_hdr} + * for 3D textures and HDR profile + * @requires_gles ASTC texture compression is not available in WebGL. + */ + SRGB8Alpha8Astc12x10 = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR, + + /** + * ASTC compressed RGBA with 12x12 blocks. **Available only on 2D, 3D, 2D + * array, cube map and cube map array textures.** + * @requires_extension Extension @extension3{KHR,texture_compression_astc_ldr,texture_compression_astc_hdr} + * @requires_extension Extension @extension{KHR,texture_compression_astc_hdr} + * for 3D textures and HDR profile + * @requires_es_extension Extension @es_extension{ANDROID,extension_pack_es31a}/ + * @es_extension2{KHR,texture_compression_astc_ldr,texture_compression_astc_hdr} + * @requires_es_extension Extension @es_extension2{KHR,texture_compression_astc_hdr,texture_compression_astc_hdr} + * for 3D textures and HDR profile + * @requires_gles ASTC texture compression is not available in WebGL. + */ + RGBAAstc12x12 = GL_COMPRESSED_RGBA_ASTC_12x12_KHR, + + /** + * ASTC compressed sRGB with alpha with 12x12 blocks. **Available only on + * 2D, 3D, 2D array, cube map and cube map array textures.** + * @requires_extension Extension @extension3{KHR,texture_compression_astc_ldr,texture_compression_astc_hdr} + * @requires_extension Extension @extension{KHR,texture_compression_astc_hdr} + * for 3D textures and HDR profile + * @requires_es_extension Extension @es_extension{ANDROID,extension_pack_es31a}/ + * @es_extension2{KHR,texture_compression_astc_ldr,texture_compression_astc_hdr} + * @requires_es_extension Extension @es_extension2{KHR,texture_compression_astc_hdr,texture_compression_astc_hdr} + * for 3D textures and HDR profile + * @requires_gles ASTC texture compression is not available in WebGL. + */ + SRGB8Alpha8Astc12x12 = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR, + #endif +}; + +/** @debugoperatorenum{Magnum::PixelFormat} */ +Debug MAGNUM_EXPORT operator<<(Debug debug, PixelFormat value); + +/** @debugoperatorenum{Magnum::PixelType} */ +Debug MAGNUM_EXPORT operator<<(Debug debug, PixelType value); + +/** @debugoperatorenum{Magnum::CompressedPixelFormat} */ +Debug MAGNUM_EXPORT operator<<(Debug debug, CompressedPixelFormat value); + +} + +#endif diff --git a/src/Magnum/PixelStorage.cpp b/src/Magnum/PixelStorage.cpp index 75d8ad64c..3c5e01795 100644 --- a/src/Magnum/PixelStorage.cpp +++ b/src/Magnum/PixelStorage.cpp @@ -27,131 +27,131 @@ #include -#include "Magnum/ColorFormat.h" +#include "Magnum/PixelFormat.h" #include "Magnum/Math/Vector.h" namespace Magnum { namespace Implementation { -std::size_t imagePixelSize(ColorFormat format, ColorType type) { +std::size_t imagePixelSize(PixelFormat format, PixelType type) { std::size_t size = 0; switch(type) { - case ColorType::UnsignedByte: + case PixelType::UnsignedByte: #ifndef MAGNUM_TARGET_GLES2 - case ColorType::Byte: + case PixelType::Byte: #endif size = 1; break; - case ColorType::UnsignedShort: + case PixelType::UnsignedShort: #ifndef MAGNUM_TARGET_GLES2 - case ColorType::Short: + case PixelType::Short: #endif - case ColorType::HalfFloat: + case PixelType::HalfFloat: size = 2; break; - case ColorType::UnsignedInt: + case PixelType::UnsignedInt: #ifndef MAGNUM_TARGET_GLES2 - case ColorType::Int: + case PixelType::Int: #endif - case ColorType::Float: + case PixelType::Float: size = 4; break; #ifndef MAGNUM_TARGET_GLES - case ColorType::UnsignedByte332: - case ColorType::UnsignedByte233Rev: + case PixelType::UnsignedByte332: + case PixelType::UnsignedByte233Rev: return 1; #endif - case ColorType::UnsignedShort565: + case PixelType::UnsignedShort565: #ifndef MAGNUM_TARGET_GLES - case ColorType::UnsignedShort565Rev: + case PixelType::UnsignedShort565Rev: #endif - case ColorType::UnsignedShort4444: + case PixelType::UnsignedShort4444: #ifndef MAGNUM_TARGET_WEBGL - case ColorType::UnsignedShort4444Rev: + case PixelType::UnsignedShort4444Rev: #endif - case ColorType::UnsignedShort5551: + case PixelType::UnsignedShort5551: #ifndef MAGNUM_TARGET_WEBGL - case ColorType::UnsignedShort1555Rev: + case PixelType::UnsignedShort1555Rev: #endif return 2; #ifndef MAGNUM_TARGET_GLES - case ColorType::UnsignedInt8888: - case ColorType::UnsignedInt8888Rev: - case ColorType::UnsignedInt1010102: + case PixelType::UnsignedInt8888: + case PixelType::UnsignedInt8888Rev: + case PixelType::UnsignedInt1010102: #endif #if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2)) - case ColorType::UnsignedInt2101010Rev: + case PixelType::UnsignedInt2101010Rev: #endif #ifndef MAGNUM_TARGET_GLES2 - case ColorType::UnsignedInt10F11F11FRev: - case ColorType::UnsignedInt5999Rev: + case PixelType::UnsignedInt10F11F11FRev: + case PixelType::UnsignedInt5999Rev: #endif - case ColorType::UnsignedInt248: + case PixelType::UnsignedInt248: return 4; #ifndef MAGNUM_TARGET_GLES2 - case ColorType::Float32UnsignedInt248Rev: + case PixelType::Float32UnsignedInt248Rev: return 8; #endif } switch(format) { #if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2)) - case ColorFormat::Red: + case PixelFormat::Red: #endif #ifndef MAGNUM_TARGET_GLES2 - case ColorFormat::RedInteger: + case PixelFormat::RedInteger: #endif #ifndef MAGNUM_TARGET_GLES - case ColorFormat::Green: - case ColorFormat::Blue: - case ColorFormat::GreenInteger: - case ColorFormat::BlueInteger: + case PixelFormat::Green: + case PixelFormat::Blue: + case PixelFormat::GreenInteger: + case PixelFormat::BlueInteger: #endif #ifdef MAGNUM_TARGET_GLES2 - case ColorFormat::Luminance: + case PixelFormat::Luminance: #endif - case ColorFormat::DepthComponent: + case PixelFormat::DepthComponent: #ifndef MAGNUM_TARGET_WEBGL - case ColorFormat::StencilIndex: + case PixelFormat::StencilIndex: #endif return 1*size; #if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2)) - case ColorFormat::RG: + case PixelFormat::RG: #endif #ifndef MAGNUM_TARGET_GLES2 - case ColorFormat::RGInteger: + case PixelFormat::RGInteger: #endif #ifdef MAGNUM_TARGET_GLES2 - case ColorFormat::LuminanceAlpha: + case PixelFormat::LuminanceAlpha: #endif return 2*size; - case ColorFormat::RGB: + case PixelFormat::RGB: #ifndef MAGNUM_TARGET_GLES2 - case ColorFormat::RGBInteger: + case PixelFormat::RGBInteger: #endif #ifndef MAGNUM_TARGET_GLES - case ColorFormat::BGR: - case ColorFormat::BGRInteger: + case PixelFormat::BGR: + case PixelFormat::BGRInteger: #endif return 3*size; - case ColorFormat::RGBA: + case PixelFormat::RGBA: #ifndef MAGNUM_TARGET_GLES2 - case ColorFormat::RGBAInteger: + case PixelFormat::RGBAInteger: #endif #ifndef MAGNUM_TARGET_WEBGL - case ColorFormat::BGRA: + case PixelFormat::BGRA: #endif #ifndef MAGNUM_TARGET_GLES - case ColorFormat::BGRAInteger: + case PixelFormat::BGRAInteger: #endif return 4*size; /* Handled above */ - case ColorFormat::DepthStencil: - CORRADE_ASSERT(false, "AbstractImage::pixelSize(): invalid ColorType specified for depth/stencil ColorFormat", 0); + case PixelFormat::DepthStencil: + CORRADE_ASSERT(false, "AbstractImage::pixelSize(): invalid PixelType specified for depth/stencil PixelFormat", 0); } CORRADE_ASSERT_UNREACHABLE(); } -template std::size_t imageDataSize(const ColorFormat format, const ColorType type, Math::Vector size) { +template std::size_t imageDataSize(const PixelFormat format, const PixelType type, Math::Vector size) { /** @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]*imagePixelSize(format, type) + 3)/4)*4; @@ -161,8 +161,8 @@ template std::size_t imageDataSize(const ColorFormat for return rowSize*size.product(); } -template MAGNUM_EXPORT std::size_t imageDataSize<1>(ColorFormat, ColorType, Math::Vector<1, Int>); -template MAGNUM_EXPORT std::size_t imageDataSize<2>(ColorFormat, ColorType, Math::Vector<2, Int>); -template MAGNUM_EXPORT std::size_t imageDataSize<3>(ColorFormat, ColorType, Math::Vector<3, Int>); +template MAGNUM_EXPORT std::size_t imageDataSize<1>(PixelFormat, PixelType, Math::Vector<1, Int>); +template MAGNUM_EXPORT std::size_t imageDataSize<2>(PixelFormat, PixelType, Math::Vector<2, Int>); +template MAGNUM_EXPORT std::size_t imageDataSize<3>(PixelFormat, PixelType, Math::Vector<3, Int>); }} diff --git a/src/Magnum/PixelStorage.h b/src/Magnum/PixelStorage.h index 79c898564..cd0bf1519 100644 --- a/src/Magnum/PixelStorage.h +++ b/src/Magnum/PixelStorage.h @@ -37,9 +37,9 @@ namespace Magnum { namespace Implementation { - std::size_t MAGNUM_EXPORT imagePixelSize(ColorFormat format, ColorType type); + std::size_t MAGNUM_EXPORT imagePixelSize(PixelFormat format, PixelType type); - template std::size_t imageDataSize(ColorFormat format, ColorType type, Math::Vector size); + template std::size_t imageDataSize(PixelFormat format, PixelType type, Math::Vector size); } } diff --git a/src/Magnum/RectangleTexture.h b/src/Magnum/RectangleTexture.h index 5ddbed1bf..0962c9e7a 100644 --- a/src/Magnum/RectangleTexture.h +++ b/src/Magnum/RectangleTexture.h @@ -48,7 +48,7 @@ See also @ref AbstractTexture documentation for more information. Common usage is to fully configure all texture parameters and then set the data from e.g. @ref Image2D. Example configuration: @code -Image2D image(ColorFormat::RGBA, ColorType::UnsignedByte, {526, 137}, data); +Image2D image(PixelFormat::RGBA, PixelType::UnsignedByte, {526, 137}, data); RectangleTexture texture; texture.setMagnificationFilter(Sampler::Filter::Linear) @@ -290,7 +290,7 @@ class MAGNUM_EXPORT RectangleTexture: public AbstractTexture { * * Convenience alternative to the above, example usage: * @code - * Image2D image = texture.image({ColorFormat::RGBA, ColorType::UnsignedByte}); + * Image2D image = texture.image({PixelFormat::RGBA, PixelType::UnsignedByte}); * @endcode */ Image2D image(Image2D&& image); @@ -309,7 +309,7 @@ class MAGNUM_EXPORT RectangleTexture: public AbstractTexture { * * Convenience alternative to the above, example usage: * @code - * BufferImage2D image = texture.image({ColorFormat::RGBA, ColorType::UnsignedByte}, BufferUsage::StaticRead); + * BufferImage2D image = texture.image({PixelFormat::RGBA, PixelType::UnsignedByte}, BufferUsage::StaticRead); * @endcode */ BufferImage2D image(BufferImage2D&& image, BufferUsage usage); @@ -367,7 +367,7 @@ class MAGNUM_EXPORT RectangleTexture: public AbstractTexture { * * Convenience alternative to the above, example usage: * @code - * Image2D image = texture.subImage(range, {ColorFormat::RGBA, ColorType::UnsignedByte}); + * Image2D image = texture.subImage(range, {PixelFormat::RGBA, PixelType::UnsignedByte}); * @endcode */ Image2D subImage(const Range2Di& range, Image2D&& image); @@ -387,7 +387,7 @@ class MAGNUM_EXPORT RectangleTexture: public AbstractTexture { * * Convenience alternative to the above, example usage: * @code - * BufferImage2D image = texture.subImage(range, {ColorFormat::RGBA, ColorType::UnsignedByte}, BufferUsage::StaticRead); + * BufferImage2D image = texture.subImage(range, {PixelFormat::RGBA, PixelType::UnsignedByte}, BufferUsage::StaticRead); * @endcode */ BufferImage2D subImage(const Range2Di& range, BufferImage2D&& image, BufferUsage usage); diff --git a/src/Magnum/Test/BufferImageGLTest.cpp b/src/Magnum/Test/BufferImageGLTest.cpp index 7eedf22b2..b66f4ed35 100644 --- a/src/Magnum/Test/BufferImageGLTest.cpp +++ b/src/Magnum/Test/BufferImageGLTest.cpp @@ -26,7 +26,7 @@ #include #include "Magnum/BufferImage.h" -#include "Magnum/ColorFormat.h" +#include "Magnum/PixelFormat.h" #include "Magnum/Test/AbstractOpenGLTester.h" namespace Magnum { namespace Test { @@ -59,7 +59,7 @@ BufferImageGLTest::BufferImageGLTest() { void BufferImageGLTest::construct() { const char data[] = { 'a', 0, 0, 0, 'b', 0, 0, 0, 'c', 0, 0, 0 }; - BufferImage2D a(ColorFormat::Red, ColorType::UnsignedByte, {1, 3}, data, BufferUsage::StaticDraw); + BufferImage2D a(PixelFormat::Red, PixelType::UnsignedByte, {1, 3}, data, BufferUsage::StaticDraw); #ifndef MAGNUM_TARGET_GLES const auto imageData = a.buffer().data(); @@ -67,8 +67,8 @@ void BufferImageGLTest::construct() { MAGNUM_VERIFY_NO_ERROR(); - CORRADE_COMPARE(a.format(), ColorFormat::Red); - CORRADE_COMPARE(a.type(), ColorType::UnsignedByte); + CORRADE_COMPARE(a.format(), PixelFormat::Red); + CORRADE_COMPARE(a.type(), PixelType::UnsignedByte); CORRADE_COMPARE(a.size(), Vector2i(1, 3)); /** @todo How to verify the contents in ES? */ @@ -80,7 +80,7 @@ void BufferImageGLTest::construct() { void BufferImageGLTest::constructCompressed() { const char data[] = { 'a', 0, 0, 0, 'b', 0, 0, 0 }; - CompressedBufferImage2D a{CompressedColorFormat::RGBAS3tcDxt1, {4, 4}, data, BufferUsage::StaticDraw}; + CompressedBufferImage2D a{CompressedPixelFormat::RGBAS3tcDxt1, {4, 4}, data, BufferUsage::StaticDraw}; #ifndef MAGNUM_TARGET_GLES const auto imageData = a.buffer().data(); @@ -88,7 +88,7 @@ void BufferImageGLTest::constructCompressed() { MAGNUM_VERIFY_NO_ERROR(); - CORRADE_COMPARE(a.format(), CompressedColorFormat::RGBAS3tcDxt1); + CORRADE_COMPARE(a.format(), CompressedPixelFormat::RGBAS3tcDxt1); CORRADE_COMPARE(a.size(), Vector2i(4, 4)); CORRADE_COMPARE(a.dataSize(), 8); @@ -111,7 +111,7 @@ void BufferImageGLTest::constructCopyCompressed() { void BufferImageGLTest::constructMove() { const char data[4] = { 'a', 'b', 'c', 'd' }; - BufferImage2D a(ColorFormat::Red, ColorType::UnsignedByte, {4, 1}, data, BufferUsage::StaticDraw); + BufferImage2D a(PixelFormat::Red, PixelType::UnsignedByte, {4, 1}, data, BufferUsage::StaticDraw); const Int id = a.buffer().id(); MAGNUM_VERIFY_NO_ERROR(); @@ -122,13 +122,13 @@ void BufferImageGLTest::constructMove() { CORRADE_COMPARE(a.buffer().id(), 0); CORRADE_COMPARE(a.size(), Vector2i()); - CORRADE_COMPARE(b.format(), ColorFormat::Red); - CORRADE_COMPARE(b.type(), ColorType::UnsignedByte); + CORRADE_COMPARE(b.format(), PixelFormat::Red); + CORRADE_COMPARE(b.type(), PixelType::UnsignedByte); CORRADE_COMPARE(b.size(), Vector2i(4, 1)); CORRADE_COMPARE(b.buffer().id(), id); const unsigned short data2[2*4] = { 1, 2, 3, 4, 5, 6, 7, 8 }; - BufferImage2D c(ColorFormat::RGBA, ColorType::UnsignedShort, {1, 2}, data2, BufferUsage::StaticDraw); + BufferImage2D c(PixelFormat::RGBA, PixelType::UnsignedShort, {1, 2}, data2, BufferUsage::StaticDraw); const Int cId = c.buffer().id(); c = std::move(b); @@ -138,15 +138,15 @@ void BufferImageGLTest::constructMove() { CORRADE_COMPARE(b.buffer().id(), cId); CORRADE_COMPARE(b.size(), Vector2i(1, 2)); - CORRADE_COMPARE(c.format(), ColorFormat::Red); - CORRADE_COMPARE(c.type(), ColorType::UnsignedByte); + CORRADE_COMPARE(c.format(), PixelFormat::Red); + CORRADE_COMPARE(c.type(), PixelType::UnsignedByte); CORRADE_COMPARE(c.size(), Vector2i(4, 1)); CORRADE_COMPARE(c.buffer().id(), id); } void BufferImageGLTest::constructMoveCompressed() { const char data[] = { 'a', 0, 0, 0, 'b', 0, 0, 0 }; - CompressedBufferImage2D a{CompressedColorFormat::RGBAS3tcDxt1, {4, 4}, data, BufferUsage::StaticDraw}; + CompressedBufferImage2D a{CompressedPixelFormat::RGBAS3tcDxt1, {4, 4}, data, BufferUsage::StaticDraw}; const Int id = a.buffer().id(); MAGNUM_VERIFY_NO_ERROR(); @@ -158,13 +158,13 @@ void BufferImageGLTest::constructMoveCompressed() { CORRADE_COMPARE(a.size(), Vector2i()); CORRADE_COMPARE(a.dataSize(), 0); - CORRADE_COMPARE(b.format(), CompressedColorFormat::RGBAS3tcDxt1); + CORRADE_COMPARE(b.format(), CompressedPixelFormat::RGBAS3tcDxt1); CORRADE_COMPARE(b.size(), Vector2i(4, 4)); CORRADE_COMPARE(b.dataSize(), 8); CORRADE_COMPARE(b.buffer().id(), id); const unsigned char data2[] = { 'a', 0, 0, 0, 'b', 0, 0, 0, 'c', 0, 0, 0, 'd', 0, 0, 0 }; - CompressedBufferImage2D c{CompressedColorFormat::RGBAS3tcDxt1, {8, 4}, data2, BufferUsage::StaticDraw}; + CompressedBufferImage2D c{CompressedPixelFormat::RGBAS3tcDxt1, {8, 4}, data2, BufferUsage::StaticDraw}; const Int cId = c.buffer().id(); c = std::move(b); @@ -175,7 +175,7 @@ void BufferImageGLTest::constructMoveCompressed() { CORRADE_COMPARE(b.size(), Vector2i(8, 4)); CORRADE_COMPARE(b.dataSize(), 16); - CORRADE_COMPARE(c.format(), CompressedColorFormat::RGBAS3tcDxt1); + CORRADE_COMPARE(c.format(), CompressedPixelFormat::RGBAS3tcDxt1); CORRADE_COMPARE(c.size(), Vector2i(4, 4)); CORRADE_COMPARE(c.dataSize(), 8); CORRADE_COMPARE(c.buffer().id(), id); @@ -183,10 +183,10 @@ void BufferImageGLTest::constructMoveCompressed() { void BufferImageGLTest::setData() { const char data[4] = { 'a', 'b', 'c', 'd' }; - BufferImage2D a(ColorFormat::Red, ColorType::UnsignedByte, {4, 1}, data, BufferUsage::StaticDraw); + BufferImage2D a(PixelFormat::Red, PixelType::UnsignedByte, {4, 1}, data, BufferUsage::StaticDraw); const UnsignedShort data2[2*4] = { 1, 2, 3, 4, 5, 6, 7, 8 }; - a.setData(ColorFormat::RGBA, ColorType::UnsignedShort, {1, 2}, data2, BufferUsage::StaticDraw); + a.setData(PixelFormat::RGBA, PixelType::UnsignedShort, {1, 2}, data2, BufferUsage::StaticDraw); #ifndef MAGNUM_TARGET_GLES const auto imageData = a.buffer().data(); @@ -194,8 +194,8 @@ void BufferImageGLTest::setData() { MAGNUM_VERIFY_NO_ERROR(); - CORRADE_COMPARE(a.format(), ColorFormat::RGBA); - CORRADE_COMPARE(a.type(), ColorType::UnsignedShort); + CORRADE_COMPARE(a.format(), PixelFormat::RGBA); + CORRADE_COMPARE(a.type(), PixelType::UnsignedShort); CORRADE_COMPARE(a.size(), Vector2i(1, 2)); /** @todo How to verify the contents in ES? */ @@ -207,10 +207,10 @@ void BufferImageGLTest::setData() { void BufferImageGLTest::setDataCompressed() { const char data[] = { 'a', 0, 0, 0, 'b', 0, 0, 0 }; - CompressedBufferImage2D a{CompressedColorFormat::RGBAS3tcDxt1, {4, 4}, data, BufferUsage::StaticDraw}; + CompressedBufferImage2D a{CompressedPixelFormat::RGBAS3tcDxt1, {4, 4}, data, BufferUsage::StaticDraw}; const char data2[] = { 'a', 0, 0, 0, 'b', 0, 0, 0, 'c', 0, 0, 0, 'd', 0, 0, 0 }; - a.setData(CompressedColorFormat::RGBAS3tcDxt3, {8, 4}, data2, BufferUsage::StaticDraw); + a.setData(CompressedPixelFormat::RGBAS3tcDxt3, {8, 4}, data2, BufferUsage::StaticDraw); #ifndef MAGNUM_TARGET_GLES const auto imageData = a.buffer().data(); @@ -218,7 +218,7 @@ void BufferImageGLTest::setDataCompressed() { MAGNUM_VERIFY_NO_ERROR(); - CORRADE_COMPARE(a.format(), CompressedColorFormat::RGBAS3tcDxt3); + CORRADE_COMPARE(a.format(), CompressedPixelFormat::RGBAS3tcDxt3); CORRADE_COMPARE(a.size(), Vector2i(8, 4)); CORRADE_COMPARE(a.dataSize(), 16); diff --git a/src/Magnum/Test/CubeMapTextureArrayGLTest.cpp b/src/Magnum/Test/CubeMapTextureArrayGLTest.cpp index 3f344ff9e..1afd22358 100644 --- a/src/Magnum/Test/CubeMapTextureArrayGLTest.cpp +++ b/src/Magnum/Test/CubeMapTextureArrayGLTest.cpp @@ -26,9 +26,9 @@ #include #include "Magnum/BufferImage.h" -#include "Magnum/ColorFormat.h" #include "Magnum/CubeMapTextureArray.h" #include "Magnum/Image.h" +#include "Magnum/PixelFormat.h" #include "Magnum/TextureFormat.h" #include "Magnum/Math/Color.h" #include "Magnum/Math/Range.h" @@ -388,13 +388,13 @@ void CubeMapTextureArrayGLTest::image() { CubeMapTextureArray texture; texture.setImage(0, TextureFormat::RGBA8, - ImageView3D(ColorFormat::RGBA, ColorType::UnsignedByte, {2, 2, 6}, Data)); + ImageView3D(PixelFormat::RGBA, PixelType::UnsignedByte, {2, 2, 6}, Data)); MAGNUM_VERIFY_NO_ERROR(); /** @todo How to test this on ES? */ #ifndef MAGNUM_TARGET_GLES - Image3D image = texture.image(0, {ColorFormat::RGBA, ColorType::UnsignedByte}); + Image3D image = texture.image(0, {PixelFormat::RGBA, PixelType::UnsignedByte}); MAGNUM_VERIFY_NO_ERROR(); @@ -417,7 +417,7 @@ void CubeMapTextureArrayGLTest::compressedImage() { CORRADE_SKIP(Extensions::GL::EXT::texture_compression_s3tc::string() + std::string(" is not supported.")); CubeMapTextureArray texture; - texture.setCompressedImage(0, CompressedImageView3D{CompressedColorFormat::RGBAS3tcDxt3, + texture.setCompressedImage(0, CompressedImageView3D{CompressedPixelFormat::RGBAS3tcDxt3, {4, 4, 6}, CompressedData}); MAGNUM_VERIFY_NO_ERROR(); @@ -445,13 +445,13 @@ void CubeMapTextureArrayGLTest::imageBuffer() { CubeMapTextureArray texture; texture.setImage(0, TextureFormat::RGBA8, - BufferImage3D(ColorFormat::RGBA, ColorType::UnsignedByte, {2, 2, 6}, Data, BufferUsage::StaticDraw)); + BufferImage3D(PixelFormat::RGBA, PixelType::UnsignedByte, {2, 2, 6}, Data, BufferUsage::StaticDraw)); MAGNUM_VERIFY_NO_ERROR(); /** @todo How to test this on ES? */ #ifndef MAGNUM_TARGET_GLES - BufferImage3D image = texture.image(0, {ColorFormat::RGBA, ColorType::UnsignedByte}, BufferUsage::StaticRead); + BufferImage3D image = texture.image(0, {PixelFormat::RGBA, PixelType::UnsignedByte}, BufferUsage::StaticRead); const auto imageData = image.buffer().data(); MAGNUM_VERIFY_NO_ERROR(); @@ -473,7 +473,7 @@ void CubeMapTextureArrayGLTest::compressedImageBuffer() { CORRADE_SKIP(Extensions::GL::EXT::texture_compression_s3tc::string() + std::string(" is not supported.")); CubeMapTextureArray texture; - texture.setCompressedImage(0, CompressedBufferImage3D{CompressedColorFormat::RGBAS3tcDxt3, + texture.setCompressedImage(0, CompressedBufferImage3D{CompressedPixelFormat::RGBAS3tcDxt3, {4, 4, 6}, CompressedData, BufferUsage::StaticDraw}); MAGNUM_VERIFY_NO_ERROR(); @@ -627,15 +627,15 @@ void CubeMapTextureArrayGLTest::subImage() { CubeMapTextureArray texture; texture.setImage(0, TextureFormat::RGBA8, - ImageView3D(ColorFormat::RGBA, ColorType::UnsignedByte, {4, 4, 6}, Zero)); + ImageView3D(PixelFormat::RGBA, PixelType::UnsignedByte, {4, 4, 6}, Zero)); texture.setSubImage(0, Vector3i(1), - ImageView3D(ColorFormat::RGBA, ColorType::UnsignedByte, {2, 2, 4}, SubData)); + ImageView3D(PixelFormat::RGBA, PixelType::UnsignedByte, {2, 2, 4}, SubData)); MAGNUM_VERIFY_NO_ERROR(); /** @todo How to test this on ES? */ #ifndef MAGNUM_TARGET_GLES - Image3D image = texture.image(0, {ColorFormat::RGBA, ColorType::UnsignedByte}); + Image3D image = texture.image(0, {PixelFormat::RGBA, PixelType::UnsignedByte}); MAGNUM_VERIFY_NO_ERROR(); @@ -658,10 +658,10 @@ void CubeMapTextureArrayGLTest::compressedSubImage() { CORRADE_SKIP(Extensions::GL::EXT::texture_compression_s3tc::string() + std::string(" is not supported.")); CubeMapTextureArray texture; - texture.setCompressedImage(0, CompressedImageView3D{CompressedColorFormat::RGBAS3tcDxt3, + texture.setCompressedImage(0, CompressedImageView3D{CompressedPixelFormat::RGBAS3tcDxt3, {12, 12, 6}, CompressedZero}); texture.setCompressedSubImage(0, {4, 4, 1}, - CompressedImageView3D{CompressedColorFormat::RGBAS3tcDxt3, Vector3i{4}, CompressedSubData}); + CompressedImageView3D{CompressedPixelFormat::RGBAS3tcDxt3, Vector3i{4}, CompressedSubData}); MAGNUM_VERIFY_NO_ERROR(); @@ -688,15 +688,15 @@ void CubeMapTextureArrayGLTest::subImageBuffer() { CubeMapTextureArray texture; texture.setImage(0, TextureFormat::RGBA8, - ImageView3D(ColorFormat::RGBA, ColorType::UnsignedByte, {4, 4, 6}, Zero)); + ImageView3D(PixelFormat::RGBA, PixelType::UnsignedByte, {4, 4, 6}, Zero)); texture.setSubImage(0, Vector3i(1), - BufferImage3D(ColorFormat::RGBA, ColorType::UnsignedByte, {2, 2, 4}, SubData, BufferUsage::StaticDraw)); + BufferImage3D(PixelFormat::RGBA, PixelType::UnsignedByte, {2, 2, 4}, SubData, BufferUsage::StaticDraw)); MAGNUM_VERIFY_NO_ERROR(); /** @todo How to test this on ES? */ #ifndef MAGNUM_TARGET_GLES - BufferImage3D image = texture.image(0, {ColorFormat::RGBA, ColorType::UnsignedByte}, BufferUsage::StaticRead); + BufferImage3D image = texture.image(0, {PixelFormat::RGBA, PixelType::UnsignedByte}, BufferUsage::StaticRead); const auto imageData = image.buffer().data(); MAGNUM_VERIFY_NO_ERROR(); @@ -718,10 +718,10 @@ void CubeMapTextureArrayGLTest::compressedSubImageBuffer() { CORRADE_SKIP(Extensions::GL::EXT::texture_compression_s3tc::string() + std::string(" is not supported.")); CubeMapTextureArray texture; - texture.setCompressedImage(0, CompressedImageView3D{CompressedColorFormat::RGBAS3tcDxt3, + texture.setCompressedImage(0, CompressedImageView3D{CompressedPixelFormat::RGBAS3tcDxt3, {12, 12, 6}, CompressedZero}); texture.setCompressedSubImage(0, {4, 4, 1}, - CompressedBufferImage3D(CompressedColorFormat::RGBAS3tcDxt3, Vector3i{4}, CompressedSubData, BufferUsage::StaticDraw)); + CompressedBufferImage3D(CompressedPixelFormat::RGBAS3tcDxt3, Vector3i{4}, CompressedSubData, BufferUsage::StaticDraw)); MAGNUM_VERIFY_NO_ERROR(); @@ -746,11 +746,11 @@ void CubeMapTextureArrayGLTest::subImageQuery() { CubeMapTextureArray texture; texture.setStorage(1, TextureFormat::RGBA8, {4, 4, 6}) - .setSubImage(0, {}, ImageView3D{ColorFormat::RGBA, ColorType::UnsignedByte, {4, 4, 6}, SubDataComplete}); + .setSubImage(0, {}, ImageView3D{PixelFormat::RGBA, PixelType::UnsignedByte, {4, 4, 6}, SubDataComplete}); MAGNUM_VERIFY_NO_ERROR(); - Image3D image = texture.subImage(0, Range3Di::fromSize(Vector3i{1}, {2, 2, 4}), {ColorFormat::RGBA, ColorType::UnsignedByte}); + Image3D image = texture.subImage(0, Range3Di::fromSize(Vector3i{1}, {2, 2, 4}), {PixelFormat::RGBA, PixelType::UnsignedByte}); MAGNUM_VERIFY_NO_ERROR(); @@ -768,11 +768,11 @@ void CubeMapTextureArrayGLTest::subImageQueryBuffer() { CubeMapTextureArray texture; texture.setStorage(1, TextureFormat::RGBA8, {4, 4, 6}) - .setSubImage(0, {}, ImageView3D{ColorFormat::RGBA, ColorType::UnsignedByte, {4, 4, 6}, SubDataComplete}); + .setSubImage(0, {}, ImageView3D{PixelFormat::RGBA, PixelType::UnsignedByte, {4, 4, 6}, SubDataComplete}); MAGNUM_VERIFY_NO_ERROR(); - BufferImage3D image = texture.subImage(0, Range3Di::fromSize(Vector3i{1}, {2, 2, 4}), {ColorFormat::RGBA, ColorType::UnsignedByte}, BufferUsage::StaticRead); + BufferImage3D image = texture.subImage(0, Range3Di::fromSize(Vector3i{1}, {2, 2, 4}), {PixelFormat::RGBA, PixelType::UnsignedByte}, BufferUsage::StaticRead); const auto imageData = image.buffer().data(); MAGNUM_VERIFY_NO_ERROR(); @@ -795,7 +795,7 @@ void CubeMapTextureArrayGLTest::generateMipmap() { CubeMapTextureArray texture; texture.setImage(0, TextureFormat::RGBA8, - ImageView3D(ColorFormat::RGBA, ColorType::UnsignedByte, {32, 32, 24})); + ImageView3D(PixelFormat::RGBA, PixelType::UnsignedByte, {32, 32, 24})); CORRADE_COMPARE(texture.imageSize(0), Vector3i(32, 32, 24)); CORRADE_COMPARE(texture.imageSize(1), Vector3i(0)); diff --git a/src/Magnum/Test/CubeMapTextureGLTest.cpp b/src/Magnum/Test/CubeMapTextureGLTest.cpp index 4e8b6bb6b..b4de2a517 100644 --- a/src/Magnum/Test/CubeMapTextureGLTest.cpp +++ b/src/Magnum/Test/CubeMapTextureGLTest.cpp @@ -29,9 +29,9 @@ #ifndef MAGNUM_TARGET_GLES2 #include "Magnum/BufferImage.h" #endif -#include "Magnum/ColorFormat.h" #include "Magnum/CubeMapTexture.h" #include "Magnum/Image.h" +#include "Magnum/PixelFormat.h" #include "Magnum/TextureFormat.h" #include "Magnum/Math/Color.h" #include "Magnum/Math/Range.h" @@ -423,11 +423,11 @@ void CubeMapTextureGLTest::imageFull() { CubeMapTexture texture; texture.setStorage(1, TextureFormat::RGBA8, Vector2i{2, 2}) - .setSubImage(0, {}, ImageView3D{ColorFormat::RGBA, ColorType::UnsignedByte, {2, 2, 6}, DataFull}); + .setSubImage(0, {}, ImageView3D{PixelFormat::RGBA, PixelType::UnsignedByte, {2, 2, 6}, DataFull}); MAGNUM_VERIFY_NO_ERROR(); - Image3D image = texture.image(0, {ColorFormat::RGBA, ColorType::UnsignedByte}); + Image3D image = texture.image(0, {PixelFormat::RGBA, PixelType::UnsignedByte}); MAGNUM_VERIFY_NO_ERROR(); @@ -445,7 +445,7 @@ void CubeMapTextureGLTest::compressedImageFull() { CubeMapTexture texture; texture.setStorage(1, TextureFormat::CompressedRGBAS3tcDxt3, Vector2i{4}) - .setCompressedSubImage(0, {}, CompressedImageView3D{CompressedColorFormat::RGBAS3tcDxt3, {4, 4, 6}, CompressedDataFull}); + .setCompressedSubImage(0, {}, CompressedImageView3D{CompressedPixelFormat::RGBAS3tcDxt3, {4, 4, 6}, CompressedDataFull}); MAGNUM_VERIFY_NO_ERROR(); @@ -465,11 +465,11 @@ void CubeMapTextureGLTest::imageFullBuffer() { CubeMapTexture texture; texture.setStorage(1, TextureFormat::RGBA8, Vector2i{2}) - .setSubImage(0, {}, BufferImage3D{ColorFormat::RGBA, ColorType::UnsignedByte, {2, 2, 6}, DataFull, BufferUsage::StaticDraw}); + .setSubImage(0, {}, BufferImage3D{PixelFormat::RGBA, PixelType::UnsignedByte, {2, 2, 6}, DataFull, BufferUsage::StaticDraw}); MAGNUM_VERIFY_NO_ERROR(); - BufferImage3D image = texture.image(0, {ColorFormat::RGBA, ColorType::UnsignedByte}, BufferUsage::StaticRead); + BufferImage3D image = texture.image(0, {PixelFormat::RGBA, PixelType::UnsignedByte}, BufferUsage::StaticRead); MAGNUM_VERIFY_NO_ERROR(); @@ -486,7 +486,7 @@ void CubeMapTextureGLTest::compressedImageFullBuffer() { CubeMapTexture texture; texture.setStorage(1, TextureFormat::CompressedRGBAS3tcDxt3, Vector2i{4}) - .setCompressedSubImage(0, {}, CompressedBufferImage3D{CompressedColorFormat::RGBAS3tcDxt3, {4, 4, 6}, CompressedDataFull, BufferUsage::StaticDraw}); + .setCompressedSubImage(0, {}, CompressedBufferImage3D{CompressedPixelFormat::RGBAS3tcDxt3, {4, 4, 6}, CompressedDataFull, BufferUsage::StaticDraw}); MAGNUM_VERIFY_NO_ERROR(); @@ -516,13 +516,13 @@ namespace { void CubeMapTextureGLTest::image() { CubeMapTexture texture; texture.setImage(CubeMapTexture::Coordinate::PositiveX, 0, TextureFormat::RGBA8, - ImageView2D(ColorFormat::RGBA, ColorType::UnsignedByte, Vector2i(2), Data)); + ImageView2D(PixelFormat::RGBA, PixelType::UnsignedByte, Vector2i(2), Data)); MAGNUM_VERIFY_NO_ERROR(); /** @todo How to test this on ES? */ #ifndef MAGNUM_TARGET_GLES - Image2D image = texture.image(CubeMapTexture::Coordinate::PositiveX, 0, {ColorFormat::RGBA, ColorType::UnsignedByte}); + Image2D image = texture.image(CubeMapTexture::Coordinate::PositiveX, 0, {PixelFormat::RGBA, PixelType::UnsignedByte}); MAGNUM_VERIFY_NO_ERROR(); @@ -544,7 +544,7 @@ void CubeMapTextureGLTest::compressedImage() { CubeMapTexture texture; texture.setCompressedImage(CubeMapTexture::Coordinate::PositiveX, 0, - CompressedImageView2D{CompressedColorFormat::RGBAS3tcDxt3, Vector2i{4}, CompressedData}); + CompressedImageView2D{CompressedPixelFormat::RGBAS3tcDxt3, Vector2i{4}, CompressedData}); MAGNUM_VERIFY_NO_ERROR(); @@ -564,13 +564,13 @@ void CubeMapTextureGLTest::compressedImage() { void CubeMapTextureGLTest::imageBuffer() { CubeMapTexture texture; texture.setImage(CubeMapTexture::Coordinate::PositiveX, 0, TextureFormat::RGBA8, - BufferImage2D(ColorFormat::RGBA, ColorType::UnsignedByte, Vector2i(2), Data, BufferUsage::StaticDraw)); + BufferImage2D(PixelFormat::RGBA, PixelType::UnsignedByte, Vector2i(2), Data, BufferUsage::StaticDraw)); MAGNUM_VERIFY_NO_ERROR(); /** @todo How to test this on ES? */ #ifndef MAGNUM_TARGET_GLES - BufferImage2D image = texture.image(CubeMapTexture::Coordinate::PositiveX, 0, {ColorFormat::RGBA, ColorType::UnsignedByte}, BufferUsage::StaticRead); + BufferImage2D image = texture.image(CubeMapTexture::Coordinate::PositiveX, 0, {PixelFormat::RGBA, PixelType::UnsignedByte}, BufferUsage::StaticRead); const auto imageData = image.buffer().data(); MAGNUM_VERIFY_NO_ERROR(); @@ -591,7 +591,7 @@ void CubeMapTextureGLTest::compressedImageBuffer() { CubeMapTexture texture; texture.setCompressedImage(CubeMapTexture::Coordinate::PositiveX, 0, - CompressedBufferImage2D{CompressedColorFormat::RGBAS3tcDxt3, Vector2i{4}, CompressedData, BufferUsage::StaticDraw}); + CompressedBufferImage2D{CompressedPixelFormat::RGBAS3tcDxt3, Vector2i{4}, CompressedData, BufferUsage::StaticDraw}); MAGNUM_VERIFY_NO_ERROR(); @@ -649,15 +649,15 @@ namespace { void CubeMapTextureGLTest::subImage() { CubeMapTexture texture; texture.setImage(CubeMapTexture::Coordinate::PositiveX, 0, TextureFormat::RGBA8, - ImageView2D(ColorFormat::RGBA, ColorType::UnsignedByte, Vector2i(4), Zero)); + ImageView2D(PixelFormat::RGBA, PixelType::UnsignedByte, Vector2i(4), Zero)); texture.setSubImage(CubeMapTexture::Coordinate::PositiveX, 0, Vector2i(1), - ImageView2D(ColorFormat::RGBA, ColorType::UnsignedByte, Vector2i(2), Data)); + ImageView2D(PixelFormat::RGBA, PixelType::UnsignedByte, Vector2i(2), Data)); MAGNUM_VERIFY_NO_ERROR(); /** @todo How to test this on ES? */ #ifndef MAGNUM_TARGET_GLES - Image2D image = texture.image(CubeMapTexture::Coordinate::PositiveX, 0, {ColorFormat::RGBA, ColorType::UnsignedByte}); + Image2D image = texture.image(CubeMapTexture::Coordinate::PositiveX, 0, {PixelFormat::RGBA, PixelType::UnsignedByte}); MAGNUM_VERIFY_NO_ERROR(); @@ -679,9 +679,9 @@ void CubeMapTextureGLTest::compressedSubImage() { CubeMapTexture texture; texture.setCompressedImage(CubeMapTexture::Coordinate::PositiveX, 0, - CompressedImageView2D{CompressedColorFormat::RGBAS3tcDxt3, Vector2i{12}, CompressedZero}); + CompressedImageView2D{CompressedPixelFormat::RGBAS3tcDxt3, Vector2i{12}, CompressedZero}); texture.setCompressedSubImage(CubeMapTexture::Coordinate::PositiveX, 0, Vector2i{4}, - CompressedImageView2D{CompressedColorFormat::RGBAS3tcDxt3, Vector2i{4}, CompressedData}); + CompressedImageView2D{CompressedPixelFormat::RGBAS3tcDxt3, Vector2i{4}, CompressedData}); MAGNUM_VERIFY_NO_ERROR(); @@ -701,15 +701,15 @@ void CubeMapTextureGLTest::compressedSubImage() { void CubeMapTextureGLTest::subImageBuffer() { CubeMapTexture texture; texture.setImage(CubeMapTexture::Coordinate::PositiveX, 0, TextureFormat::RGBA8, - ImageView2D(ColorFormat::RGBA, ColorType::UnsignedByte, Vector2i(4), Zero)); + ImageView2D(PixelFormat::RGBA, PixelType::UnsignedByte, Vector2i(4), Zero)); texture.setSubImage(CubeMapTexture::Coordinate::PositiveX, 0, Vector2i(1), - BufferImage2D(ColorFormat::RGBA, ColorType::UnsignedByte, Vector2i(2), Data, BufferUsage::StaticDraw)); + BufferImage2D(PixelFormat::RGBA, PixelType::UnsignedByte, Vector2i(2), Data, BufferUsage::StaticDraw)); MAGNUM_VERIFY_NO_ERROR(); /** @todo How to test this on ES? */ #ifndef MAGNUM_TARGET_GLES - BufferImage2D image = texture.image(CubeMapTexture::Coordinate::PositiveX, 0, {ColorFormat::RGBA, ColorType::UnsignedByte}, BufferUsage::StaticRead); + BufferImage2D image = texture.image(CubeMapTexture::Coordinate::PositiveX, 0, {PixelFormat::RGBA, PixelType::UnsignedByte}, BufferUsage::StaticRead); const auto imageData = image.buffer().data(); MAGNUM_VERIFY_NO_ERROR(); @@ -730,9 +730,9 @@ void CubeMapTextureGLTest::compressedSubImageBuffer() { CubeMapTexture texture; texture.setCompressedImage(CubeMapTexture::Coordinate::PositiveX, 0, - CompressedImageView2D{CompressedColorFormat::RGBAS3tcDxt3, Vector2i{12}, CompressedZero}); + CompressedImageView2D{CompressedPixelFormat::RGBAS3tcDxt3, Vector2i{12}, CompressedZero}); texture.setCompressedSubImage(CubeMapTexture::Coordinate::PositiveX, 0, Vector2i{4}, - CompressedBufferImage2D{CompressedColorFormat::RGBAS3tcDxt3, Vector2i{4}, CompressedData, BufferUsage::StaticDraw}); + CompressedBufferImage2D{CompressedPixelFormat::RGBAS3tcDxt3, Vector2i{4}, CompressedData, BufferUsage::StaticDraw}); MAGNUM_VERIFY_NO_ERROR(); @@ -759,11 +759,11 @@ void CubeMapTextureGLTest::subImageQuery() { CubeMapTexture texture; texture.setStorage(1, TextureFormat::RGBA8, Vector2i{4}) - .setSubImage(0, {}, ImageView3D{ColorFormat::RGBA, ColorType::UnsignedByte, {4, 4, 1}, SubDataComplete}); + .setSubImage(0, {}, ImageView3D{PixelFormat::RGBA, PixelType::UnsignedByte, {4, 4, 1}, SubDataComplete}); MAGNUM_VERIFY_NO_ERROR(); - Image3D image = texture.subImage(0, Range3Di::fromSize({1, 1, 0}, {2, 2, 1}), {ColorFormat::RGBA, ColorType::UnsignedByte}); + Image3D image = texture.subImage(0, Range3Di::fromSize({1, 1, 0}, {2, 2, 1}), {PixelFormat::RGBA, PixelType::UnsignedByte}); MAGNUM_VERIFY_NO_ERROR(); @@ -782,11 +782,11 @@ void CubeMapTextureGLTest::subImageQueryBuffer() { CubeMapTexture texture; texture.setStorage(1, TextureFormat::RGBA8, Vector2i{4}) - .setSubImage(0, {}, ImageView3D{ColorFormat::RGBA, ColorType::UnsignedByte, {4, 4, 1}, SubDataComplete}); + .setSubImage(0, {}, ImageView3D{PixelFormat::RGBA, PixelType::UnsignedByte, {4, 4, 1}, SubDataComplete}); MAGNUM_VERIFY_NO_ERROR(); - BufferImage3D image = texture.subImage(0, Range3Di::fromSize({1, 1, 0}, {2, 2, 1}), {ColorFormat::RGBA, ColorType::UnsignedByte}, BufferUsage::StaticRead); + BufferImage3D image = texture.subImage(0, Range3Di::fromSize({1, 1, 0}, {2, 2, 1}), {PixelFormat::RGBA, PixelType::UnsignedByte}, BufferUsage::StaticRead); const auto imageData = image.buffer().data(); MAGNUM_VERIFY_NO_ERROR(); @@ -799,17 +799,17 @@ void CubeMapTextureGLTest::subImageQueryBuffer() { void CubeMapTextureGLTest::generateMipmap() { CubeMapTexture texture; texture.setImage(CubeMapTexture::Coordinate::PositiveX, 0, TextureFormat::RGBA8, - ImageView2D(ColorFormat::RGBA, ColorType::UnsignedByte, Vector2i(32))); + ImageView2D(PixelFormat::RGBA, PixelType::UnsignedByte, Vector2i(32))); texture.setImage(CubeMapTexture::Coordinate::PositiveY, 0, TextureFormat::RGBA8, - ImageView2D(ColorFormat::RGBA, ColorType::UnsignedByte, Vector2i(32))); + ImageView2D(PixelFormat::RGBA, PixelType::UnsignedByte, Vector2i(32))); texture.setImage(CubeMapTexture::Coordinate::PositiveZ, 0, TextureFormat::RGBA8, - ImageView2D(ColorFormat::RGBA, ColorType::UnsignedByte, Vector2i(32))); + ImageView2D(PixelFormat::RGBA, PixelType::UnsignedByte, Vector2i(32))); texture.setImage(CubeMapTexture::Coordinate::NegativeX, 0, TextureFormat::RGBA8, - ImageView2D(ColorFormat::RGBA, ColorType::UnsignedByte, Vector2i(32))); + ImageView2D(PixelFormat::RGBA, PixelType::UnsignedByte, Vector2i(32))); texture.setImage(CubeMapTexture::Coordinate::NegativeY, 0, TextureFormat::RGBA8, - ImageView2D(ColorFormat::RGBA, ColorType::UnsignedByte, Vector2i(32))); + ImageView2D(PixelFormat::RGBA, PixelType::UnsignedByte, Vector2i(32))); texture.setImage(CubeMapTexture::Coordinate::NegativeZ, 0, TextureFormat::RGBA8, - ImageView2D(ColorFormat::RGBA, ColorType::UnsignedByte, Vector2i(32))); + ImageView2D(PixelFormat::RGBA, PixelType::UnsignedByte, Vector2i(32))); /** @todo How to test this on ES? */ #ifndef MAGNUM_TARGET_GLES diff --git a/src/Magnum/Test/FormatTest.cpp b/src/Magnum/Test/FormatTest.cpp index 9259d7465..f29d2c772 100644 --- a/src/Magnum/Test/FormatTest.cpp +++ b/src/Magnum/Test/FormatTest.cpp @@ -26,46 +26,46 @@ #include #include -#include "Magnum/ColorFormat.h" +#include "Magnum/PixelFormat.h" namespace Magnum { namespace Test { struct FormatTest: TestSuite::Tester { explicit FormatTest(); - void debugColorFormat(); - void debugColorType(); - void debugCompressedColorFormat(); + void debugPixelFormat(); + void debugPixelType(); + void debugCompressedPixelFormat(); }; FormatTest::FormatTest() { - addTests({&FormatTest::debugColorFormat, - &FormatTest::debugColorType, - &FormatTest::debugCompressedColorFormat}); + addTests({&FormatTest::debugPixelFormat, + &FormatTest::debugPixelType, + &FormatTest::debugCompressedPixelFormat}); } -void FormatTest::debugColorFormat() { +void FormatTest::debugPixelFormat() { std::ostringstream out; - Debug(&out) << ColorFormat::RGBA; - CORRADE_COMPARE(out.str(), "ColorFormat::RGBA\n"); + Debug(&out) << PixelFormat::RGBA; + CORRADE_COMPARE(out.str(), "PixelFormat::RGBA\n"); } -void FormatTest::debugColorType() { +void FormatTest::debugPixelType() { std::ostringstream out; - Debug(&out) << ColorType::UnsignedByte; - CORRADE_COMPARE(out.str(), "ColorType::UnsignedByte\n"); + Debug(&out) << PixelType::UnsignedByte; + CORRADE_COMPARE(out.str(), "PixelType::UnsignedByte\n"); } -void FormatTest::debugCompressedColorFormat() { +void FormatTest::debugCompressedPixelFormat() { #ifdef MAGNUM_TARGET_GLES CORRADE_SKIP("No enum value available"); #else std::ostringstream out; - Debug(&out) << CompressedColorFormat::RGBBptcUnsignedFloat; - CORRADE_COMPARE(out.str(), "CompressedColorFormat::RGBBptcUnsignedFloat\n"); + Debug(&out) << CompressedPixelFormat::RGBBptcUnsignedFloat; + CORRADE_COMPARE(out.str(), "CompressedPixelFormat::RGBBptcUnsignedFloat\n"); #endif } diff --git a/src/Magnum/Test/FramebufferGLTest.cpp b/src/Magnum/Test/FramebufferGLTest.cpp index 8671eaf1b..0689f3248 100644 --- a/src/Magnum/Test/FramebufferGLTest.cpp +++ b/src/Magnum/Test/FramebufferGLTest.cpp @@ -24,11 +24,11 @@ */ #include "Magnum/configure.h" -#include "Magnum/ColorFormat.h" #include "Magnum/Context.h" #include "Magnum/Extensions.h" #include "Magnum/Framebuffer.h" #include "Magnum/Image.h" +#include "Magnum/PixelFormat.h" #include "Magnum/Renderbuffer.h" #include "Magnum/RenderbufferFormat.h" #include "Magnum/Texture.h" @@ -860,7 +860,7 @@ void FramebufferGLTest::read() { Renderer::setClearStencil(67); framebuffer.clear(FramebufferClear::Color|FramebufferClear::Depth|FramebufferClear::Stencil); - Image2D colorImage = framebuffer.read(Range2Di::fromSize({16, 8}, {8, 16}), {ColorFormat::RGBA, ColorType::UnsignedByte}); + Image2D colorImage = framebuffer.read(Range2Di::fromSize({16, 8}, {8, 16}), {PixelFormat::RGBA, PixelType::UnsignedByte}); MAGNUM_VERIFY_NO_ERROR(); CORRADE_COMPARE(colorImage.size(), Vector2i(8, 16)); @@ -874,7 +874,7 @@ void FramebufferGLTest::read() { Debug() << "Using" << Extensions::GL::NV::read_depth::string(); #endif - Image2D depthImage = framebuffer.read({{}, Vector2i{1}}, {ColorFormat::DepthComponent, ColorType::UnsignedShort}); + Image2D depthImage = framebuffer.read({{}, Vector2i{1}}, {PixelFormat::DepthComponent, PixelType::UnsignedShort}); MAGNUM_VERIFY_NO_ERROR(); CORRADE_COMPARE(depthImage.data()[0], 48352); @@ -888,7 +888,7 @@ void FramebufferGLTest::read() { Debug() << "Using" << Extensions::GL::NV::read_stencil::string(); #endif - Image2D stencilImage = framebuffer.read({{}, Vector2i{1}}, {ColorFormat::StencilIndex, ColorType::UnsignedByte}); + Image2D stencilImage = framebuffer.read({{}, Vector2i{1}}, {PixelFormat::StencilIndex, PixelType::UnsignedByte}); MAGNUM_VERIFY_NO_ERROR(); CORRADE_COMPARE(stencilImage.data()[0], 67); @@ -902,7 +902,7 @@ void FramebufferGLTest::read() { Debug() << "Using" << Extensions::GL::NV::read_depth_stencil::string(); #endif - Image2D depthStencilImage = framebuffer.read({{}, Vector2i{1}}, {ColorFormat::DepthStencil, ColorType::UnsignedInt248}); + Image2D depthStencilImage = framebuffer.read({{}, Vector2i{1}}, {PixelFormat::DepthStencil, PixelType::UnsignedInt248}); MAGNUM_VERIFY_NO_ERROR(); /** @todo This will probably fail on different systems */ @@ -937,7 +937,7 @@ void FramebufferGLTest::readBuffer() { Renderer::setClearStencil(67); framebuffer.clear(FramebufferClear::Color|FramebufferClear::Depth|FramebufferClear::Stencil); - BufferImage2D colorImage = framebuffer.read(Range2Di::fromSize({16, 8}, {8, 16}), {ColorFormat::RGBA, ColorType::UnsignedByte}, BufferUsage::StaticRead); + BufferImage2D colorImage = framebuffer.read(Range2Di::fromSize({16, 8}, {8, 16}), {PixelFormat::RGBA, PixelType::UnsignedByte}, BufferUsage::StaticRead); CORRADE_COMPARE(colorImage.size(), Vector2i(8, 16)); MAGNUM_VERIFY_NO_ERROR(); @@ -986,14 +986,14 @@ void FramebufferGLTest::blit() { b.clear(FramebufferClear::Color); /* The framebuffer should be black before */ - Image2D imageBefore = b.read({{}, Vector2i{1}}, {ColorFormat::RGBA, ColorType::UnsignedByte}); + Image2D imageBefore = b.read({{}, Vector2i{1}}, {PixelFormat::RGBA, PixelType::UnsignedByte}); MAGNUM_VERIFY_NO_ERROR(); CORRADE_COMPARE(imageBefore.data()[0], Color4ub()); /* And have given color after */ Framebuffer::blit(a, b, a.viewport(), FramebufferBlit::Color); - Image2D imageAfter = b.read({{}, Vector2i{1}}, {ColorFormat::RGBA, ColorType::UnsignedByte}); + Image2D imageAfter = b.read({{}, Vector2i{1}}, {PixelFormat::RGBA, PixelType::UnsignedByte}); MAGNUM_VERIFY_NO_ERROR(); CORRADE_COMPARE(imageAfter.data()[0], Color4ub(128, 64, 32, 17)); diff --git a/src/Magnum/Test/ImageTest.cpp b/src/Magnum/Test/ImageTest.cpp index d818c9ae4..ef24bb5f9 100644 --- a/src/Magnum/Test/ImageTest.cpp +++ b/src/Magnum/Test/ImageTest.cpp @@ -25,8 +25,8 @@ #include -#include "Magnum/ColorFormat.h" #include "Magnum/Image.h" +#include "Magnum/PixelFormat.h" namespace Magnum { namespace Test { @@ -66,19 +66,19 @@ ImageTest::ImageTest() { void ImageTest::construct() { auto data = new char[3]; - Image2D a(ColorFormat::Red, ColorType::UnsignedByte, {1, 3}, data); + Image2D a(PixelFormat::Red, PixelType::UnsignedByte, {1, 3}, data); - CORRADE_COMPARE(a.format(), ColorFormat::Red); - CORRADE_COMPARE(a.type(), ColorType::UnsignedByte); + CORRADE_COMPARE(a.format(), PixelFormat::Red); + CORRADE_COMPARE(a.type(), PixelType::UnsignedByte); CORRADE_COMPARE(a.size(), Vector2i(1, 3)); CORRADE_COMPARE(a.data(), data); } void ImageTest::constructCompressed() { auto data = new char[8]; - CompressedImage2D a{CompressedColorFormat::RGBAS3tcDxt1, {4, 4}, Containers::Array{data, 8}}; + CompressedImage2D a{CompressedPixelFormat::RGBAS3tcDxt1, {4, 4}, Containers::Array{data, 8}}; - CORRADE_COMPARE(a.format(), CompressedColorFormat::RGBAS3tcDxt1); + CORRADE_COMPARE(a.format(), CompressedPixelFormat::RGBAS3tcDxt1); CORRADE_COMPARE(a.size(), Vector2i(4, 4)); CORRADE_COMPARE(a.data(), data); CORRADE_COMPARE(a.data().size(), 8); @@ -96,52 +96,52 @@ void ImageTest::constructCopyCompressed() { void ImageTest::constructMove() { auto data = new char[3]; - Image2D a(ColorFormat::Red, ColorType::UnsignedByte, {1, 3}, data); + Image2D a(PixelFormat::Red, PixelType::UnsignedByte, {1, 3}, data); Image2D b(std::move(a)); CORRADE_COMPARE(a.data(), nullptr); CORRADE_COMPARE(a.size(), Vector2i()); - CORRADE_COMPARE(b.format(), ColorFormat::Red); - CORRADE_COMPARE(b.type(), ColorType::UnsignedByte); + CORRADE_COMPARE(b.format(), PixelFormat::Red); + CORRADE_COMPARE(b.type(), PixelType::UnsignedByte); CORRADE_COMPARE(b.size(), Vector2i(1, 3)); CORRADE_COMPARE(b.data(), data); auto data2 = new char[12*4*2]; - Image2D c(ColorFormat::RGBA, ColorType::UnsignedShort, {2, 6}, data2); + Image2D c(PixelFormat::RGBA, PixelType::UnsignedShort, {2, 6}, data2); c = std::move(b); CORRADE_COMPARE(b.data(), data2); CORRADE_COMPARE(b.size(), Vector2i(2, 6)); - CORRADE_COMPARE(c.format(), ColorFormat::Red); - CORRADE_COMPARE(c.type(), ColorType::UnsignedByte); + CORRADE_COMPARE(c.format(), PixelFormat::Red); + CORRADE_COMPARE(c.type(), PixelType::UnsignedByte); CORRADE_COMPARE(c.size(), Vector2i(1, 3)); CORRADE_COMPARE(c.data(), data); } void ImageTest::constructMoveCompressed() { auto data = new char[8]; - CompressedImage2D a{CompressedColorFormat::RGBAS3tcDxt1, {4, 4}, Containers::Array{data, 8}}; + CompressedImage2D a{CompressedPixelFormat::RGBAS3tcDxt1, {4, 4}, Containers::Array{data, 8}}; CompressedImage2D b{std::move(a)}; CORRADE_COMPARE(a.data(), nullptr); CORRADE_COMPARE(a.size(), Vector2i()); - CORRADE_COMPARE(b.format(), CompressedColorFormat::RGBAS3tcDxt1); + CORRADE_COMPARE(b.format(), CompressedPixelFormat::RGBAS3tcDxt1); CORRADE_COMPARE(b.size(), Vector2i(4, 4)); CORRADE_COMPARE(b.data(), data); CORRADE_COMPARE(b.data().size(), 8); auto data2 = new char[16]; - CompressedImage2D c{CompressedColorFormat::RGBAS3tcDxt3, {8, 4}, Containers::Array{data2, 16}}; + CompressedImage2D c{CompressedPixelFormat::RGBAS3tcDxt3, {8, 4}, Containers::Array{data2, 16}}; c = std::move(b); CORRADE_COMPARE_AS(b.data(), data2, char*); CORRADE_COMPARE(b.data().size(), 16); CORRADE_COMPARE(b.size(), Vector2i(8, 4)); - CORRADE_COMPARE(c.format(), CompressedColorFormat::RGBAS3tcDxt1); + CORRADE_COMPARE(c.format(), CompressedPixelFormat::RGBAS3tcDxt1); CORRADE_COMPARE(c.size(), Vector2i(4, 4)); CORRADE_COMPARE(c.data(), data); CORRADE_COMPARE(c.data().size(), 8); @@ -149,23 +149,23 @@ void ImageTest::constructMoveCompressed() { void ImageTest::setData() { auto data = new char[3]; - Image2D a(ColorFormat::Red, ColorType::UnsignedByte, {1, 3}, data); + Image2D a(PixelFormat::Red, PixelType::UnsignedByte, {1, 3}, data); auto data2 = new char[2*4]; - a.setData(ColorFormat::RGBA, ColorType::UnsignedShort, {2, 1}, data2); + a.setData(PixelFormat::RGBA, PixelType::UnsignedShort, {2, 1}, data2); - CORRADE_COMPARE(a.format(), ColorFormat::RGBA); - CORRADE_COMPARE(a.type(), ColorType::UnsignedShort); + CORRADE_COMPARE(a.format(), PixelFormat::RGBA); + CORRADE_COMPARE(a.type(), PixelType::UnsignedShort); CORRADE_COMPARE(a.size(), Vector2i(2, 1)); CORRADE_COMPARE(a.data(), data2); } void ImageTest::setDataCompressed() { auto data = new char[8]; - CompressedImage2D a{CompressedColorFormat::RGBAS3tcDxt1, {4, 4}, Containers::Array{data, 8}}; + CompressedImage2D a{CompressedPixelFormat::RGBAS3tcDxt1, {4, 4}, Containers::Array{data, 8}}; auto data2 = new char[16]; - a.setData(CompressedColorFormat::RGBAS3tcDxt3, {8, 4}, Containers::Array{data2, 16}); + a.setData(CompressedPixelFormat::RGBAS3tcDxt3, {8, 4}, Containers::Array{data2, 16}); - CORRADE_COMPARE(a.format(), CompressedColorFormat::RGBAS3tcDxt3); + CORRADE_COMPARE(a.format(), CompressedPixelFormat::RGBAS3tcDxt3); CORRADE_COMPARE(a.size(), Vector2i(8, 4)); CORRADE_COMPARE(a.data(), data2); CORRADE_COMPARE(a.data().size(), 16); @@ -173,11 +173,11 @@ void ImageTest::setDataCompressed() { void ImageTest::toReference() { auto data = new char[3]; - const Image2D a(ColorFormat::Red, ColorType::UnsignedByte, {1, 3}, data); + const Image2D a(PixelFormat::Red, PixelType::UnsignedByte, {1, 3}, data); ImageView2D b = a; - CORRADE_COMPARE(b.format(), ColorFormat::Red); - CORRADE_COMPARE(b.type(), ColorType::UnsignedByte); + CORRADE_COMPARE(b.format(), PixelFormat::Red); + CORRADE_COMPARE(b.type(), PixelType::UnsignedByte); CORRADE_COMPARE(b.size(), Vector2i(1, 3)); CORRADE_COMPARE(b.data(), data); @@ -193,10 +193,10 @@ void ImageTest::toReference() { void ImageTest::toReferenceCommpressed() { auto data = new char[8]; - const CompressedImage2D a{CompressedColorFormat::RGBAS3tcDxt1, {4, 4}, Containers::Array{data, 8}}; + const CompressedImage2D a{CompressedPixelFormat::RGBAS3tcDxt1, {4, 4}, Containers::Array{data, 8}}; CompressedImageView2D b = a; - CORRADE_COMPARE(b.format(), CompressedColorFormat::RGBAS3tcDxt1); + CORRADE_COMPARE(b.format(), CompressedPixelFormat::RGBAS3tcDxt1); CORRADE_COMPARE(b.size(), Vector2i(4, 4)); CORRADE_COMPARE(b.data(), data); CORRADE_COMPARE(b.data().size(), 8); @@ -213,7 +213,7 @@ void ImageTest::toReferenceCommpressed() { void ImageTest::release() { char data[] = {'c', 'a', 'f', 'e'}; - Image2D a(ColorFormat::Red, ColorType::UnsignedByte, {1, 4}, data); + Image2D a(PixelFormat::Red, PixelType::UnsignedByte, {1, 4}, data); const char* const pointer = a.release(); CORRADE_COMPARE(pointer, data); @@ -223,7 +223,7 @@ void ImageTest::release() { void ImageTest::releaseCompressed() { char data[8]; - CompressedImage2D a{CompressedColorFormat::RGBAS3tcDxt1, {4, 4}, Containers::Array{data, 8}}; + CompressedImage2D a{CompressedPixelFormat::RGBAS3tcDxt1, {4, 4}, Containers::Array{data, 8}}; const char* const pointer = a.release().release(); CORRADE_COMPARE(pointer, data); diff --git a/src/Magnum/Test/ImageViewTest.cpp b/src/Magnum/Test/ImageViewTest.cpp index fcef7c7a2..e3bc71512 100644 --- a/src/Magnum/Test/ImageViewTest.cpp +++ b/src/Magnum/Test/ImageViewTest.cpp @@ -25,8 +25,8 @@ #include -#include "Magnum/ColorFormat.h" #include "Magnum/ImageView.h" +#include "Magnum/PixelFormat.h" namespace Magnum { namespace Test { @@ -50,42 +50,42 @@ ImageViewTest::ImageViewTest() { void ImageViewTest::construct() { const char data[3]{}; - ImageView2D a(ColorFormat::Red, ColorType::UnsignedByte, {1, 3}, data); + ImageView2D a(PixelFormat::Red, PixelType::UnsignedByte, {1, 3}, data); - CORRADE_COMPARE(a.format(), ColorFormat::Red); - CORRADE_COMPARE(a.type(), ColorType::UnsignedByte); + CORRADE_COMPARE(a.format(), PixelFormat::Red); + CORRADE_COMPARE(a.type(), PixelType::UnsignedByte); CORRADE_COMPARE(a.size(), Vector2i(1, 3)); CORRADE_COMPARE(a.data(), data); } void ImageViewTest::constructCompressed() { const char data[8]{}; - CompressedImageView2D a{CompressedColorFormat::RGBAS3tcDxt1, {4, 4}, data}; + CompressedImageView2D a{CompressedPixelFormat::RGBAS3tcDxt1, {4, 4}, data}; - CORRADE_COMPARE(a.format(), CompressedColorFormat::RGBAS3tcDxt1); + CORRADE_COMPARE(a.format(), CompressedPixelFormat::RGBAS3tcDxt1); CORRADE_COMPARE(a.size(), Vector2i(4, 4)); CORRADE_COMPARE(a.data(), data); } void ImageViewTest::setData() { const char data[3]{}; - ImageView2D a(ColorFormat::Red, ColorType::UnsignedByte, {1, 3}, data); + ImageView2D a(PixelFormat::Red, PixelType::UnsignedByte, {1, 3}, data); const char data2[8]{}; a.setData(data2); - CORRADE_COMPARE(a.format(), ColorFormat::Red); - CORRADE_COMPARE(a.type(), ColorType::UnsignedByte); + CORRADE_COMPARE(a.format(), PixelFormat::Red); + CORRADE_COMPARE(a.type(), PixelType::UnsignedByte); CORRADE_COMPARE(a.size(), Vector2i(1, 3)); CORRADE_COMPARE(a.data(), data2); } void ImageViewTest::setDataCompressed() { const char data[8]{}; - CompressedImageView2D a{CompressedColorFormat::RGBAS3tcDxt1, {4, 4}, data}; + CompressedImageView2D a{CompressedPixelFormat::RGBAS3tcDxt1, {4, 4}, data}; const char data2[16]{}; a.setData(data2); - CORRADE_COMPARE(a.format(), CompressedColorFormat::RGBAS3tcDxt1); + CORRADE_COMPARE(a.format(), CompressedPixelFormat::RGBAS3tcDxt1); CORRADE_COMPARE(a.size(), Vector2i(4, 4)); CORRADE_COMPARE(a.data(), data2); } diff --git a/src/Magnum/Test/MeshGLTest.cpp b/src/Magnum/Test/MeshGLTest.cpp index 57e882b50..334b2ad04 100644 --- a/src/Magnum/Test/MeshGLTest.cpp +++ b/src/Magnum/Test/MeshGLTest.cpp @@ -25,11 +25,11 @@ #include "Magnum/AbstractShaderProgram.h" #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/PixelFormat.h" #include "Magnum/Renderbuffer.h" #include "Magnum/RenderbufferFormat.h" #include "Magnum/Shader.h" @@ -372,7 +372,7 @@ namespace { struct Checker { Checker(AbstractShaderProgram&& shader, RenderbufferFormat format, Mesh& mesh); - template T get(ColorFormat format, ColorType type); + template T get(PixelFormat format, PixelType type); Renderbuffer renderbuffer; Framebuffer framebuffer; @@ -500,7 +500,7 @@ Checker::Checker(AbstractShaderProgram&& shader, RenderbufferFormat format, Mesh .draw(shader); } -template T Checker::get(ColorFormat format, ColorType type) { +template T Checker::get(PixelFormat format, PixelType type) { return framebuffer.read({{}, Vector2i{1}}, {format, type}).data()[0]; } #endif @@ -525,7 +525,7 @@ void MeshGLTest::addVertexBufferUnsignedInt() { MAGNUM_VERIFY_NO_ERROR(); const auto value = Checker(IntegerShader("uint"), RenderbufferFormat::R32UI, mesh) - .get(ColorFormat::RedInteger, ColorType::UnsignedInt); + .get(PixelFormat::RedInteger, PixelType::UnsignedInt); MAGNUM_VERIFY_NO_ERROR(); CORRADE_COMPARE(value, 35681); @@ -550,7 +550,7 @@ void MeshGLTest::addVertexBufferInt() { MAGNUM_VERIFY_NO_ERROR(); const auto value = Checker(IntegerShader("int"), RenderbufferFormat::R32I, mesh) - .get(ColorFormat::RedInteger, ColorType::Int); + .get(PixelFormat::RedInteger, PixelType::Int); MAGNUM_VERIFY_NO_ERROR(); CORRADE_COMPARE(value, 27530); @@ -576,7 +576,7 @@ void MeshGLTest::addVertexBufferFloat() { #else RenderbufferFormat::RGBA4, #endif - mesh).get(ColorFormat::RGBA, ColorType::UnsignedByte); + mesh).get(PixelFormat::RGBA, PixelType::UnsignedByte); MAGNUM_VERIFY_NO_ERROR(); CORRADE_COMPARE(value, 96); @@ -600,7 +600,7 @@ void MeshGLTest::addVertexBufferDouble() { MAGNUM_VERIFY_NO_ERROR(); const auto value = Checker(DoubleShader("double", "float", "float(value)"), - RenderbufferFormat::R16, mesh).get(ColorFormat::Red, ColorType::UnsignedShort); + RenderbufferFormat::R16, mesh).get(PixelFormat::Red, PixelType::UnsignedShort); MAGNUM_VERIFY_NO_ERROR(); CORRADE_COMPARE(value, 45828); @@ -627,7 +627,7 @@ void MeshGLTest::addVertexBufferVectorNui() { MAGNUM_VERIFY_NO_ERROR(); const auto value = Checker(IntegerShader("uvec3"), RenderbufferFormat::RGBA32UI, mesh) - .get(ColorFormat::RGBAInteger, ColorType::UnsignedInt); + .get(PixelFormat::RGBAInteger, PixelType::UnsignedInt); MAGNUM_VERIFY_NO_ERROR(); CORRADE_COMPARE(value, Vector3ui(27592, 157, 25)); @@ -652,7 +652,7 @@ void MeshGLTest::addVertexBufferVectorNi() { MAGNUM_VERIFY_NO_ERROR(); const auto value = Checker(IntegerShader("ivec2"), RenderbufferFormat::RG32I, mesh) - .get(ColorFormat::RGInteger, ColorType::Int); + .get(PixelFormat::RGInteger, PixelType::Int); MAGNUM_VERIFY_NO_ERROR(); CORRADE_COMPARE(value, Vector2i(27592, -157)); @@ -678,7 +678,7 @@ void MeshGLTest::addVertexBufferVectorN() { #else RenderbufferFormat::RGBA4, #endif - mesh).get(ColorFormat::RGBA, ColorType::UnsignedByte); + mesh).get(PixelFormat::RGBA, PixelType::UnsignedByte); MAGNUM_VERIFY_NO_ERROR(); CORRADE_COMPARE(value, Color3ub(96, 24, 156)); @@ -705,7 +705,7 @@ void MeshGLTest::addVertexBufferVectorNd() { MAGNUM_VERIFY_NO_ERROR(); const auto value = Checker(DoubleShader("dvec4", "vec4", "vec4(value)"), - RenderbufferFormat::RGBA16, mesh).get>(ColorFormat::RGBA, ColorType::UnsignedShort); + RenderbufferFormat::RGBA16, mesh).get>(PixelFormat::RGBA, PixelType::UnsignedShort); MAGNUM_VERIFY_NO_ERROR(); CORRADE_COMPARE(value, Math::Vector4(315, 65201, 2576, 12)); @@ -731,7 +731,7 @@ void MeshGLTest::addVertexBufferMatrixNxN() { 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); + RenderbufferFormat::RGBA8, mesh).get(PixelFormat::RGBA, PixelType::UnsignedByte); MAGNUM_VERIFY_NO_ERROR(); CORRADE_COMPARE(value, Color3ub(96, 24, 156)); @@ -760,7 +760,7 @@ void MeshGLTest::addVertexBufferMatrixNxNd() { 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); + RenderbufferFormat::RGBA16, mesh).get>(PixelFormat::RGB, PixelType::UnsignedShort); MAGNUM_VERIFY_NO_ERROR(); @@ -793,7 +793,7 @@ void MeshGLTest::addVertexBufferMatrixMxN() { 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); + RenderbufferFormat::RGBA8, mesh).get(PixelFormat::RGBA, PixelType::UnsignedByte); MAGNUM_VERIFY_NO_ERROR(); CORRADE_COMPARE(value, Color3ub(96, 24, 156)); @@ -823,7 +823,7 @@ void MeshGLTest::addVertexBufferMatrixMxNd() { 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); + RenderbufferFormat::RGBA16, mesh).get>(PixelFormat::RGB, PixelType::UnsignedShort); MAGNUM_VERIFY_NO_ERROR(); @@ -856,7 +856,7 @@ void MeshGLTest::addVertexBufferUnsignedIntWithUnsignedShort() { MAGNUM_VERIFY_NO_ERROR(); const auto value = Checker(IntegerShader("uint"), RenderbufferFormat::R16UI, mesh) - .get(ColorFormat::RedInteger, ColorType::UnsignedShort); + .get(PixelFormat::RedInteger, PixelType::UnsignedShort); MAGNUM_VERIFY_NO_ERROR(); CORRADE_COMPARE(value, 16583); @@ -881,7 +881,7 @@ void MeshGLTest::addVertexBufferUnsignedIntWithShort() { MAGNUM_VERIFY_NO_ERROR(); const auto value = Checker(IntegerShader("uint"), RenderbufferFormat::R16I, mesh) - .get(ColorFormat::RedInteger, ColorType::Short); + .get(PixelFormat::RedInteger, PixelType::Short); MAGNUM_VERIFY_NO_ERROR(); CORRADE_COMPARE(value, 16583); @@ -906,7 +906,7 @@ void MeshGLTest::addVertexBufferIntWithUnsignedShort() { MAGNUM_VERIFY_NO_ERROR(); const auto value = Checker(IntegerShader("int"), RenderbufferFormat::R16UI, mesh) - .get(ColorFormat::RedInteger, ColorType::UnsignedShort); + .get(PixelFormat::RedInteger, PixelType::UnsignedShort); MAGNUM_VERIFY_NO_ERROR(); CORRADE_COMPARE(value, 16583); @@ -931,7 +931,7 @@ void MeshGLTest::addVertexBufferIntWithShort() { MAGNUM_VERIFY_NO_ERROR(); const auto value = Checker(IntegerShader("int"), RenderbufferFormat::R16I, mesh) - .get(ColorFormat::RedInteger, ColorType::Short); + .get(PixelFormat::RedInteger, PixelType::Short); MAGNUM_VERIFY_NO_ERROR(); CORRADE_COMPARE(value, -16583); @@ -975,7 +975,7 @@ void MeshGLTest::addVertexBufferFloatWithDouble() { 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); + RenderbufferFormat::RGBA8, mesh).get(PixelFormat::RGBA, PixelType::UnsignedShort); MAGNUM_VERIFY_NO_ERROR(); CORRADE_COMPARE(value, 186); @@ -1063,7 +1063,7 @@ void MeshGLTest::addVertexBufferLessVectorComponents() { #else RenderbufferFormat::RGBA4, #endif - mesh).get(ColorFormat::RGBA, ColorType::UnsignedByte); + mesh).get(PixelFormat::RGBA, PixelType::UnsignedByte); MAGNUM_VERIFY_NO_ERROR(); CORRADE_COMPARE(value, Color4ub(96, 24, 156, 255)); @@ -1088,7 +1088,7 @@ void MeshGLTest::addVertexBufferNormalized() { #else RenderbufferFormat::RGBA4, #endif - mesh).get(ColorFormat::RGBA, ColorType::UnsignedByte); + mesh).get(PixelFormat::RGBA, PixelType::UnsignedByte); MAGNUM_VERIFY_NO_ERROR(); CORRADE_COMPARE(value, Color3ub(32, 156, 228)); @@ -1114,7 +1114,7 @@ void MeshGLTest::addVertexBufferBGRA() { MAGNUM_VERIFY_NO_ERROR(); const auto value = Checker(FloatShader("vec4", "valueInterpolated"), - RenderbufferFormat::RGBA8, mesh).get(ColorFormat::RGBA, ColorType::UnsignedByte); + RenderbufferFormat::RGBA8, mesh).get(PixelFormat::RGBA, PixelType::UnsignedByte); MAGNUM_VERIFY_NO_ERROR(); CORRADE_COMPARE(value, Color4ub(156, 24, 96, 225)); @@ -1200,7 +1200,7 @@ void MeshGLTest::addVertexBufferMultiple() { #else RenderbufferFormat::RGBA4, #endif - mesh).get(ColorFormat::RGBA, ColorType::UnsignedByte); + mesh).get(PixelFormat::RGBA, PixelType::UnsignedByte); MAGNUM_VERIFY_NO_ERROR(); CORRADE_COMPARE(value, Color4ub(64 + 15 + 97, 17 + 164 + 28, 56 + 17, 255)); @@ -1243,7 +1243,7 @@ void MeshGLTest::addVertexBufferMultipleGaps() { #else RenderbufferFormat::RGBA4, #endif - mesh).get(ColorFormat::RGBA, ColorType::UnsignedByte); + mesh).get(PixelFormat::RGBA, PixelType::UnsignedByte); MAGNUM_VERIFY_NO_ERROR(); CORRADE_COMPARE(value, Color4ub(64 + 15 + 97, 17 + 164 + 28, 56 + 17, 255)); @@ -1324,7 +1324,7 @@ void MeshGLTest::setIndexBuffer() { #else RenderbufferFormat::RGBA4, #endif - mesh).get(ColorFormat::RGBA, ColorType::UnsignedByte); + mesh).get(PixelFormat::RGBA, PixelType::UnsignedByte); MAGNUM_VERIFY_NO_ERROR(); CORRADE_COMPARE(value, indexedResult); @@ -1351,7 +1351,7 @@ void MeshGLTest::setIndexBufferRange() { #else RenderbufferFormat::RGBA4, #endif - mesh).get(ColorFormat::RGBA, ColorType::UnsignedByte); + mesh).get(PixelFormat::RGBA, PixelType::UnsignedByte); MAGNUM_VERIFY_NO_ERROR(); CORRADE_COMPARE(value, indexedResult); @@ -1383,7 +1383,7 @@ void MeshGLTest::setIndexBufferUnsignedInt() { #else RenderbufferFormat::RGBA4, #endif - mesh).get(ColorFormat::RGBA, ColorType::UnsignedByte); + mesh).get(PixelFormat::RGBA, PixelType::UnsignedByte); MAGNUM_VERIFY_NO_ERROR(); CORRADE_COMPARE(value, indexedResult); @@ -1410,7 +1410,7 @@ void MeshGLTest::setBaseVertex() { MAGNUM_VERIFY_NO_ERROR(); const auto value = Checker(MultipleShader{}, RenderbufferFormat::RGBA8, - mesh).get(ColorFormat::RGBA, ColorType::UnsignedByte); + mesh).get(PixelFormat::RGBA, PixelType::UnsignedByte); MAGNUM_VERIFY_NO_ERROR(); CORRADE_COMPARE(value, indexedResult); @@ -1450,7 +1450,7 @@ void MeshGLTest::setInstanceCount() { #else RenderbufferFormat::RGBA4, #endif - mesh).get(ColorFormat::RGBA, ColorType::UnsignedByte); + mesh).get(PixelFormat::RGBA, PixelType::UnsignedByte); MAGNUM_VERIFY_NO_ERROR(); CORRADE_COMPARE(value, 96); @@ -1491,7 +1491,7 @@ void MeshGLTest::setInstanceCountIndexed() { #else RenderbufferFormat::RGBA4, #endif - mesh).get(ColorFormat::RGBA, ColorType::UnsignedByte); + mesh).get(PixelFormat::RGBA, PixelType::UnsignedByte); MAGNUM_VERIFY_NO_ERROR(); CORRADE_COMPARE(value, indexedResult); @@ -1525,7 +1525,7 @@ void MeshGLTest::setInstanceCountBaseInstance() { const auto value = Checker(FloatShader("float", "vec4(valueInterpolated, 0.0, 0.0, 0.0)"), RenderbufferFormat::RGBA8, - mesh).get(ColorFormat::RGBA, ColorType::UnsignedByte); + mesh).get(PixelFormat::RGBA, PixelType::UnsignedByte); MAGNUM_VERIFY_NO_ERROR(); CORRADE_COMPARE(value, 96); @@ -1559,7 +1559,7 @@ void MeshGLTest::setInstanceCountBaseInstanceIndexed() { MAGNUM_VERIFY_NO_ERROR(); const auto value = Checker(MultipleShader{}, RenderbufferFormat::RGBA8, - mesh).get(ColorFormat::RGBA, ColorType::UnsignedByte); + mesh).get(PixelFormat::RGBA, PixelType::UnsignedByte); MAGNUM_VERIFY_NO_ERROR(); CORRADE_COMPARE(value, indexedResult); @@ -1593,7 +1593,7 @@ void MeshGLTest::setInstanceCountBaseVertex() { MAGNUM_VERIFY_NO_ERROR(); const auto value = Checker(MultipleShader{}, RenderbufferFormat::RGBA8, - mesh).get(ColorFormat::RGBA, ColorType::UnsignedByte); + mesh).get(PixelFormat::RGBA, PixelType::UnsignedByte); MAGNUM_VERIFY_NO_ERROR(); CORRADE_COMPARE(value, indexedResult); @@ -1630,7 +1630,7 @@ void MeshGLTest::setInstanceCountBaseVertexBaseInstance() { MAGNUM_VERIFY_NO_ERROR(); const auto value = Checker(MultipleShader{}, RenderbufferFormat::RGBA8, - mesh).get(ColorFormat::RGBA, ColorType::UnsignedByte); + mesh).get(PixelFormat::RGBA, PixelType::UnsignedByte); MAGNUM_VERIFY_NO_ERROR(); CORRADE_COMPARE(value, indexedResult); @@ -1674,7 +1674,7 @@ void MeshGLTest::addVertexBufferInstancedFloat() { #else RenderbufferFormat::RGBA4, #endif - mesh).get(ColorFormat::RGBA, ColorType::UnsignedByte); + mesh).get(PixelFormat::RGBA, PixelType::UnsignedByte); MAGNUM_VERIFY_NO_ERROR(); CORRADE_COMPARE(value, 96); @@ -1710,7 +1710,7 @@ void MeshGLTest::addVertexBufferInstancedInteger() { MAGNUM_VERIFY_NO_ERROR(); const auto value = Checker(IntegerShader("uint"), RenderbufferFormat::R32UI, mesh) - .get(ColorFormat::RedInteger, ColorType::UnsignedInt); + .get(PixelFormat::RedInteger, PixelType::UnsignedInt); MAGNUM_VERIFY_NO_ERROR(); CORRADE_COMPARE(value, 35681); @@ -1745,7 +1745,7 @@ void MeshGLTest::addVertexBufferInstancedDouble() { MAGNUM_VERIFY_NO_ERROR(); const auto value = Checker(DoubleShader("double", "float", "float(value)"), - RenderbufferFormat::R16, mesh).get(ColorFormat::Red, ColorType::UnsignedShort); + RenderbufferFormat::R16, mesh).get(PixelFormat::Red, PixelType::UnsignedShort); MAGNUM_VERIFY_NO_ERROR(); CORRADE_COMPARE(value, 45828); @@ -1756,7 +1756,7 @@ namespace { struct MultiChecker { MultiChecker(AbstractShaderProgram&& shader, Mesh& mesh); - template T get(ColorFormat format, ColorType type); + template T get(PixelFormat format, PixelType type); Renderbuffer renderbuffer; Framebuffer framebuffer; @@ -1793,7 +1793,7 @@ MultiChecker::MultiChecker(AbstractShaderProgram&& shader, Mesh& mesh): framebuf MeshView::draw(shader, {a, b}); } -template T MultiChecker::get(ColorFormat format, ColorType type) { +template T MultiChecker::get(PixelFormat format, PixelType type) { return framebuffer.read({{}, Vector2i{1}}, {format, type}).data()[0]; } #endif @@ -1816,7 +1816,7 @@ void MeshGLTest::multiDraw() { MAGNUM_VERIFY_NO_ERROR(); const auto value = MultiChecker(FloatShader("float", "vec4(valueInterpolated, 0.0, 0.0, 0.0)"), - mesh).get(ColorFormat::RGBA, ColorType::UnsignedByte); + mesh).get(PixelFormat::RGBA, PixelType::UnsignedByte); MAGNUM_VERIFY_NO_ERROR(); CORRADE_COMPARE(value, 96); @@ -1842,7 +1842,7 @@ void MeshGLTest::multiDrawIndexed() { MAGNUM_VERIFY_NO_ERROR(); - const auto value = MultiChecker(MultipleShader{}, mesh).get(ColorFormat::RGBA, ColorType::UnsignedByte); + const auto value = MultiChecker(MultipleShader{}, mesh).get(PixelFormat::RGBA, PixelType::UnsignedByte); MAGNUM_VERIFY_NO_ERROR(); CORRADE_COMPARE(value, indexedResult); @@ -1868,7 +1868,7 @@ void MeshGLTest::multiDrawBaseVertex() { MAGNUM_VERIFY_NO_ERROR(); - const auto value = MultiChecker(MultipleShader{}, mesh).get(ColorFormat::RGBA, ColorType::UnsignedByte); + const auto value = MultiChecker(MultipleShader{}, mesh).get(PixelFormat::RGBA, PixelType::UnsignedByte); MAGNUM_VERIFY_NO_ERROR(); CORRADE_COMPARE(value, indexedResult); diff --git a/src/Magnum/Test/PixelStorageTest.cpp b/src/Magnum/Test/PixelStorageTest.cpp index a17abd8ca..1f56f4176 100644 --- a/src/Magnum/Test/PixelStorageTest.cpp +++ b/src/Magnum/Test/PixelStorageTest.cpp @@ -26,7 +26,7 @@ #include #include "Magnum/Image.h" -#include "Magnum/ColorFormat.h" +#include "Magnum/PixelFormat.h" #include "Magnum/PixelStorage.h" namespace Magnum { namespace Test { @@ -44,20 +44,20 @@ PixelStorageTest::PixelStorageTest() { } void PixelStorageTest::pixelSize() { - CORRADE_COMPARE(Implementation::imagePixelSize(ColorFormat::RGBA, ColorType::UnsignedInt), 4*4); - CORRADE_COMPARE(Implementation::imagePixelSize(ColorFormat::DepthComponent, ColorType::UnsignedShort), 2); - CORRADE_COMPARE(Implementation::imagePixelSize(ColorFormat::StencilIndex, ColorType::UnsignedByte), 1); - CORRADE_COMPARE(Implementation::imagePixelSize(ColorFormat::DepthStencil, ColorType::UnsignedInt248), 4); + CORRADE_COMPARE(Implementation::imagePixelSize(PixelFormat::RGBA, PixelType::UnsignedInt), 4*4); + CORRADE_COMPARE(Implementation::imagePixelSize(PixelFormat::DepthComponent, PixelType::UnsignedShort), 2); + CORRADE_COMPARE(Implementation::imagePixelSize(PixelFormat::StencilIndex, PixelType::UnsignedByte), 1); + CORRADE_COMPARE(Implementation::imagePixelSize(PixelFormat::DepthStencil, PixelType::UnsignedInt248), 4); } void PixelStorageTest::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(PixelFormat::RGBA, PixelType::UnsignedByte).dataSize({}), 0); + CORRADE_COMPARE(Image2D(PixelFormat::Red, PixelType::UnsignedByte).dataSize({4, 2}), 8); + CORRADE_COMPARE(Image2D(PixelFormat::Red, PixelType::UnsignedByte).dataSize({2, 4}), 16); + CORRADE_COMPARE(Image2D(PixelFormat::RGBA, PixelType::UnsignedByte).dataSize(Vector2i(1)), 4); - CORRADE_COMPARE(Image2D(ColorFormat::RGBA, ColorType::UnsignedShort).dataSize({16, 8}), + CORRADE_COMPARE(Image2D(PixelFormat::RGBA, PixelType::UnsignedShort).dataSize({16, 8}), 4*2*16*8); } diff --git a/src/Magnum/Test/RectangleTextureGLTest.cpp b/src/Magnum/Test/RectangleTextureGLTest.cpp index 7a90e0841..2ebd01aba 100644 --- a/src/Magnum/Test/RectangleTextureGLTest.cpp +++ b/src/Magnum/Test/RectangleTextureGLTest.cpp @@ -28,8 +28,8 @@ #include "Magnum/configure.h" #include "Magnum/BufferImage.h" -#include "Magnum/ColorFormat.h" #include "Magnum/Image.h" +#include "Magnum/PixelFormat.h" #include "Magnum/RectangleTexture.h" #include "Magnum/TextureFormat.h" #include "Magnum/Math/Color.h" @@ -261,11 +261,11 @@ void RectangleTextureGLTest::image() { RectangleTexture texture; texture.setImage(TextureFormat::RGBA8, - ImageView2D(ColorFormat::RGBA, ColorType::UnsignedByte, Vector2i(2), Data)); + ImageView2D(PixelFormat::RGBA, PixelType::UnsignedByte, Vector2i(2), Data)); MAGNUM_VERIFY_NO_ERROR(); - Image2D image = texture.image({ColorFormat::RGBA, ColorType::UnsignedByte}); + Image2D image = texture.image({PixelFormat::RGBA, PixelType::UnsignedByte}); MAGNUM_VERIFY_NO_ERROR(); @@ -285,11 +285,11 @@ void RectangleTextureGLTest::imageBuffer() { RectangleTexture texture; texture.setImage(TextureFormat::RGBA8, - BufferImage2D(ColorFormat::RGBA, ColorType::UnsignedByte, Vector2i(2), Data, BufferUsage::StaticDraw)); + BufferImage2D(PixelFormat::RGBA, PixelType::UnsignedByte, Vector2i(2), Data, BufferUsage::StaticDraw)); MAGNUM_VERIFY_NO_ERROR(); - BufferImage2D image = texture.image({ColorFormat::RGBA, ColorType::UnsignedByte}, BufferUsage::StaticRead); + BufferImage2D image = texture.image({PixelFormat::RGBA, PixelType::UnsignedByte}, BufferUsage::StaticRead); const auto imageData = image.buffer().data(); MAGNUM_VERIFY_NO_ERROR(); @@ -319,13 +319,13 @@ void RectangleTextureGLTest::subImage() { RectangleTexture texture; texture.setImage(TextureFormat::RGBA8, - ImageView2D(ColorFormat::RGBA, ColorType::UnsignedByte, Vector2i(4), Zero)); + ImageView2D(PixelFormat::RGBA, PixelType::UnsignedByte, Vector2i(4), Zero)); texture.setSubImage(Vector2i(1), - ImageView2D(ColorFormat::RGBA, ColorType::UnsignedByte, Vector2i(2), Data)); + ImageView2D(PixelFormat::RGBA, PixelType::UnsignedByte, Vector2i(2), Data)); MAGNUM_VERIFY_NO_ERROR(); - Image2D image = texture.image({ColorFormat::RGBA, ColorType::UnsignedByte}); + Image2D image = texture.image({PixelFormat::RGBA, PixelType::UnsignedByte}); MAGNUM_VERIFY_NO_ERROR(); @@ -345,13 +345,13 @@ void RectangleTextureGLTest::subImageBuffer() { RectangleTexture texture; texture.setImage(TextureFormat::RGBA8, - ImageView2D(ColorFormat::RGBA, ColorType::UnsignedByte, Vector2i(4), Zero)); + ImageView2D(PixelFormat::RGBA, PixelType::UnsignedByte, Vector2i(4), Zero)); texture.setSubImage(Vector2i(1), - BufferImage2D(ColorFormat::RGBA, ColorType::UnsignedByte, Vector2i(2), Data, BufferUsage::StaticDraw)); + BufferImage2D(PixelFormat::RGBA, PixelType::UnsignedByte, Vector2i(2), Data, BufferUsage::StaticDraw)); MAGNUM_VERIFY_NO_ERROR(); - BufferImage2D image = texture.image({ColorFormat::RGBA, ColorType::UnsignedByte}, BufferUsage::StaticRead); + BufferImage2D image = texture.image({PixelFormat::RGBA, PixelType::UnsignedByte}, BufferUsage::StaticRead); const auto imageData = image.buffer().data(); MAGNUM_VERIFY_NO_ERROR(); @@ -372,11 +372,11 @@ void RectangleTextureGLTest::subImageQuery() { RectangleTexture texture; texture.setStorage(TextureFormat::RGBA8, Vector2i{4}) - .setSubImage({}, ImageView2D{ColorFormat::RGBA, ColorType::UnsignedByte, Vector2i{4}, SubDataComplete}); + .setSubImage({}, ImageView2D{PixelFormat::RGBA, PixelType::UnsignedByte, Vector2i{4}, SubDataComplete}); MAGNUM_VERIFY_NO_ERROR(); - Image2D image = texture.subImage(Range2Di::fromSize(Vector2i{1}, Vector2i{2}), {ColorFormat::RGBA, ColorType::UnsignedByte}); + Image2D image = texture.subImage(Range2Di::fromSize(Vector2i{1}, Vector2i{2}), {PixelFormat::RGBA, PixelType::UnsignedByte}); MAGNUM_VERIFY_NO_ERROR(); @@ -394,11 +394,11 @@ void RectangleTextureGLTest::subImageQueryBuffer() { RectangleTexture texture; texture.setStorage(TextureFormat::RGBA8, Vector2i{4}) - .setSubImage({}, ImageView2D{ColorFormat::RGBA, ColorType::UnsignedByte, Vector2i{4}, SubDataComplete}); + .setSubImage({}, ImageView2D{PixelFormat::RGBA, PixelType::UnsignedByte, Vector2i{4}, SubDataComplete}); MAGNUM_VERIFY_NO_ERROR(); - BufferImage2D image = texture.subImage(Range2Di::fromSize(Vector2i{1}, Vector2i{2}), {ColorFormat::RGBA, ColorType::UnsignedByte}, BufferUsage::StaticRead); + BufferImage2D image = texture.subImage(Range2Di::fromSize(Vector2i{1}, Vector2i{2}), {PixelFormat::RGBA, PixelType::UnsignedByte}, BufferUsage::StaticRead); const auto imageData = image.buffer().data(); MAGNUM_VERIFY_NO_ERROR(); diff --git a/src/Magnum/Test/TextureArrayGLTest.cpp b/src/Magnum/Test/TextureArrayGLTest.cpp index 27125e8c4..3142be92a 100644 --- a/src/Magnum/Test/TextureArrayGLTest.cpp +++ b/src/Magnum/Test/TextureArrayGLTest.cpp @@ -27,8 +27,8 @@ #include "Magnum/configure.h" #include "Magnum/BufferImage.h" -#include "Magnum/ColorFormat.h" #include "Magnum/Image.h" +#include "Magnum/PixelFormat.h" #include "Magnum/TextureArray.h" #include "Magnum/TextureFormat.h" #include "Magnum/Math/Color.h" @@ -667,11 +667,11 @@ void TextureArrayGLTest::image1D() { Texture1DArray texture; texture.setImage(0, TextureFormat::RGBA8, - ImageView2D(ColorFormat::RGBA, ColorType::UnsignedByte, Vector2i(2), Data1D)); + ImageView2D(PixelFormat::RGBA, PixelType::UnsignedByte, Vector2i(2), Data1D)); MAGNUM_VERIFY_NO_ERROR(); - Image2D image = texture.image(0, {ColorFormat::RGBA, ColorType::UnsignedByte}); + Image2D image = texture.image(0, {PixelFormat::RGBA, PixelType::UnsignedByte}); MAGNUM_VERIFY_NO_ERROR(); @@ -691,11 +691,11 @@ void TextureArrayGLTest::image1DBuffer() { Texture1DArray texture; texture.setImage(0, TextureFormat::RGBA8, - BufferImage2D(ColorFormat::RGBA, ColorType::UnsignedByte, Vector2i(2), Data1D, BufferUsage::StaticDraw)); + BufferImage2D(PixelFormat::RGBA, PixelType::UnsignedByte, Vector2i(2), Data1D, BufferUsage::StaticDraw)); MAGNUM_VERIFY_NO_ERROR(); - BufferImage2D image = texture.image(0, {ColorFormat::RGBA, ColorType::UnsignedByte}, BufferUsage::StaticRead); + BufferImage2D image = texture.image(0, {PixelFormat::RGBA, PixelType::UnsignedByte}, BufferUsage::StaticRead); const auto imageData = image.buffer().data(); MAGNUM_VERIFY_NO_ERROR(); @@ -736,13 +736,13 @@ void TextureArrayGLTest::image2D() { Texture2DArray texture; texture.setImage(0, TextureFormat::RGBA8, - ImageView3D(ColorFormat::RGBA, ColorType::UnsignedByte, Vector3i(2), Data2D)); + ImageView3D(PixelFormat::RGBA, PixelType::UnsignedByte, Vector3i(2), Data2D)); MAGNUM_VERIFY_NO_ERROR(); /** @todo How to test this on ES? */ #ifndef MAGNUM_TARGET_GLES - Image3D image = texture.image(0, {ColorFormat::RGBA, ColorType::UnsignedByte}); + Image3D image = texture.image(0, {PixelFormat::RGBA, PixelType::UnsignedByte}); MAGNUM_VERIFY_NO_ERROR(); @@ -767,7 +767,7 @@ void TextureArrayGLTest::compressedImage2D() { #endif Texture2DArray texture; - texture.setCompressedImage(0, CompressedImageView3D{CompressedColorFormat::RGBAS3tcDxt3, + texture.setCompressedImage(0, CompressedImageView3D{CompressedPixelFormat::RGBAS3tcDxt3, {4, 4, 2}, CompressedData2D}); MAGNUM_VERIFY_NO_ERROR(); @@ -792,13 +792,13 @@ void TextureArrayGLTest::image2DBuffer() { Texture2DArray texture; texture.setImage(0, TextureFormat::RGBA8, - BufferImage3D(ColorFormat::RGBA, ColorType::UnsignedByte, Vector3i(2), Data2D, BufferUsage::StaticDraw)); + BufferImage3D(PixelFormat::RGBA, PixelType::UnsignedByte, Vector3i(2), Data2D, BufferUsage::StaticDraw)); MAGNUM_VERIFY_NO_ERROR(); /** @todo How to test this on ES? */ #ifndef MAGNUM_TARGET_GLES - BufferImage3D image = texture.image(0, {ColorFormat::RGBA, ColorType::UnsignedByte}, BufferUsage::StaticRead); + BufferImage3D image = texture.image(0, {PixelFormat::RGBA, PixelType::UnsignedByte}, BufferUsage::StaticRead); const auto imageData = image.buffer().data(); MAGNUM_VERIFY_NO_ERROR(); @@ -822,7 +822,7 @@ void TextureArrayGLTest::compressedImage2DBuffer() { #endif Texture2DArray texture; - texture.setCompressedImage(0, CompressedImageView3D{CompressedColorFormat::RGBAS3tcDxt3, + texture.setCompressedImage(0, CompressedImageView3D{CompressedPixelFormat::RGBAS3tcDxt3, {4, 4, 2}, CompressedData2D}); MAGNUM_VERIFY_NO_ERROR(); @@ -855,13 +855,13 @@ void TextureArrayGLTest::subImage1D() { Texture1DArray texture; texture.setImage(0, TextureFormat::RGBA8, - ImageView2D(ColorFormat::RGBA, ColorType::UnsignedByte, Vector2i(4), Zero1D)); + ImageView2D(PixelFormat::RGBA, PixelType::UnsignedByte, Vector2i(4), Zero1D)); texture.setSubImage(0, Vector2i(1), - ImageView2D(ColorFormat::RGBA, ColorType::UnsignedByte, Vector2i(2), Data1D)); + ImageView2D(PixelFormat::RGBA, PixelType::UnsignedByte, Vector2i(2), Data1D)); MAGNUM_VERIFY_NO_ERROR(); - Image2D image = texture.image(0, {ColorFormat::RGBA, ColorType::UnsignedByte}); + Image2D image = texture.image(0, {PixelFormat::RGBA, PixelType::UnsignedByte}); MAGNUM_VERIFY_NO_ERROR(); @@ -881,13 +881,13 @@ void TextureArrayGLTest::subImage1DBuffer() { Texture1DArray texture; texture.setImage(0, TextureFormat::RGBA8, - ImageView2D(ColorFormat::RGBA, ColorType::UnsignedByte, Vector2i(4), Zero1D)); + ImageView2D(PixelFormat::RGBA, PixelType::UnsignedByte, Vector2i(4), Zero1D)); texture.setSubImage(0, Vector2i(1), - BufferImage2D(ColorFormat::RGBA, ColorType::UnsignedByte, Vector2i(2), Data1D, BufferUsage::StaticDraw)); + BufferImage2D(PixelFormat::RGBA, PixelType::UnsignedByte, Vector2i(2), Data1D, BufferUsage::StaticDraw)); MAGNUM_VERIFY_NO_ERROR(); - BufferImage2D image = texture.image(0, {ColorFormat::RGBA, ColorType::UnsignedByte}, BufferUsage::StaticRead); + BufferImage2D image = texture.image(0, {PixelFormat::RGBA, PixelType::UnsignedByte}, BufferUsage::StaticRead); const auto imageData = image.buffer().data(); MAGNUM_VERIFY_NO_ERROR(); @@ -908,11 +908,11 @@ void TextureArrayGLTest::subImage1DQuery() { Texture1DArray texture; texture.setStorage(1, TextureFormat::RGBA8, Vector2i{4}) - .setSubImage(0, {}, ImageView2D{ColorFormat::RGBA, ColorType::UnsignedByte, Vector2i{4}, SubData1DComplete}); + .setSubImage(0, {}, ImageView2D{PixelFormat::RGBA, PixelType::UnsignedByte, Vector2i{4}, SubData1DComplete}); MAGNUM_VERIFY_NO_ERROR(); - Image2D image = texture.subImage(0, Range2Di::fromSize(Vector2i{1}, Vector2i{2}), {ColorFormat::RGBA, ColorType::UnsignedByte}); + Image2D image = texture.subImage(0, Range2Di::fromSize(Vector2i{1}, Vector2i{2}), {PixelFormat::RGBA, PixelType::UnsignedByte}); MAGNUM_VERIFY_NO_ERROR(); @@ -929,11 +929,11 @@ void TextureArrayGLTest::subImage1DQueryBuffer() { Texture1DArray texture; texture.setStorage(1, TextureFormat::RGBA8, Vector2i{4}) - .setSubImage(0, {}, ImageView2D{ColorFormat::RGBA, ColorType::UnsignedByte, Vector2i{4}, SubData1DComplete}); + .setSubImage(0, {}, ImageView2D{PixelFormat::RGBA, PixelType::UnsignedByte, Vector2i{4}, SubData1DComplete}); MAGNUM_VERIFY_NO_ERROR(); - BufferImage2D image = texture.subImage(0, Range2Di::fromSize(Vector2i{1}, Vector2i{2}), {ColorFormat::RGBA, ColorType::UnsignedByte}, BufferUsage::StaticRead); + BufferImage2D image = texture.subImage(0, Range2Di::fromSize(Vector2i{1}, Vector2i{2}), {PixelFormat::RGBA, PixelType::UnsignedByte}, BufferUsage::StaticRead); const auto imageData = image.buffer().data(); MAGNUM_VERIFY_NO_ERROR(); @@ -1011,15 +1011,15 @@ void TextureArrayGLTest::subImage2D() { Texture2DArray texture; texture.setImage(0, TextureFormat::RGBA8, - ImageView3D(ColorFormat::RGBA, ColorType::UnsignedByte, Vector3i(4), Zero2D)); + ImageView3D(PixelFormat::RGBA, PixelType::UnsignedByte, Vector3i(4), Zero2D)); texture.setSubImage(0, Vector3i(1), - ImageView3D(ColorFormat::RGBA, ColorType::UnsignedByte, Vector3i(2), Data2D)); + ImageView3D(PixelFormat::RGBA, PixelType::UnsignedByte, Vector3i(2), Data2D)); MAGNUM_VERIFY_NO_ERROR(); /** @todo How to test this on ES? */ #ifndef MAGNUM_TARGET_GLES - Image3D image = texture.image(0, {ColorFormat::RGBA, ColorType::UnsignedByte}); + Image3D image = texture.image(0, {PixelFormat::RGBA, PixelType::UnsignedByte}); MAGNUM_VERIFY_NO_ERROR(); @@ -1043,9 +1043,9 @@ void TextureArrayGLTest::compressedSubImage2D() { #endif Texture2DArray texture; - texture.setCompressedImage(0, CompressedImageView3D{CompressedColorFormat::RGBAS3tcDxt3, + texture.setCompressedImage(0, CompressedImageView3D{CompressedPixelFormat::RGBAS3tcDxt3, Vector3i{12, 4, 4}, CompressedZero2D}); - texture.setCompressedSubImage(0, {4, 0, 1}, CompressedImageView3D(CompressedColorFormat::RGBAS3tcDxt3, + texture.setCompressedSubImage(0, {4, 0, 1}, CompressedImageView3D(CompressedPixelFormat::RGBAS3tcDxt3, {4, 4, 2}, CompressedData2D)); MAGNUM_VERIFY_NO_ERROR(); @@ -1069,15 +1069,15 @@ void TextureArrayGLTest::subImage2DBuffer() { Texture2DArray texture; texture.setImage(0, TextureFormat::RGBA8, - ImageView3D(ColorFormat::RGBA, ColorType::UnsignedByte, Vector3i(4), Zero2D)); + ImageView3D(PixelFormat::RGBA, PixelType::UnsignedByte, Vector3i(4), Zero2D)); texture.setSubImage(0, Vector3i(1), - BufferImage3D(ColorFormat::RGBA, ColorType::UnsignedByte, Vector3i(2), Data2D, BufferUsage::StaticDraw)); + BufferImage3D(PixelFormat::RGBA, PixelType::UnsignedByte, Vector3i(2), Data2D, BufferUsage::StaticDraw)); MAGNUM_VERIFY_NO_ERROR(); /** @todo How to test this on ES? */ #ifndef MAGNUM_TARGET_GLES - BufferImage3D image = texture.image(0, {ColorFormat::RGBA, ColorType::UnsignedByte}, BufferUsage::StaticRead); + BufferImage3D image = texture.image(0, {PixelFormat::RGBA, PixelType::UnsignedByte}, BufferUsage::StaticRead); const auto imageData = image.buffer().data(); MAGNUM_VERIFY_NO_ERROR(); @@ -1101,9 +1101,9 @@ void TextureArrayGLTest::compressedSubImage2DBuffer() { #endif Texture2DArray texture; - texture.setCompressedImage(0, CompressedImageView3D{CompressedColorFormat::RGBAS3tcDxt3, + texture.setCompressedImage(0, CompressedImageView3D{CompressedPixelFormat::RGBAS3tcDxt3, Vector3i{12, 4, 4}, CompressedZero2D}); - texture.setCompressedSubImage(0, {4, 0, 1}, CompressedImageView3D(CompressedColorFormat::RGBAS3tcDxt3, + texture.setCompressedSubImage(0, {4, 0, 1}, CompressedImageView3D(CompressedPixelFormat::RGBAS3tcDxt3, {4, 4, 2}, CompressedData2D)); MAGNUM_VERIFY_NO_ERROR(); @@ -1128,11 +1128,11 @@ void TextureArrayGLTest::subImage2DQuery() { Texture2DArray texture; texture.setStorage(1, TextureFormat::RGBA8, Vector3i{4}) - .setSubImage(0, {}, ImageView3D{ColorFormat::RGBA, ColorType::UnsignedByte, Vector3i{4}, SubData2DComplete}); + .setSubImage(0, {}, ImageView3D{PixelFormat::RGBA, PixelType::UnsignedByte, Vector3i{4}, SubData2DComplete}); MAGNUM_VERIFY_NO_ERROR(); - Image3D image = texture.subImage(0, Range3Di::fromSize(Vector3i{1}, Vector3i{2}), {ColorFormat::RGBA, ColorType::UnsignedByte}); + Image3D image = texture.subImage(0, Range3Di::fromSize(Vector3i{1}, Vector3i{2}), {PixelFormat::RGBA, PixelType::UnsignedByte}); MAGNUM_VERIFY_NO_ERROR(); @@ -1149,11 +1149,11 @@ void TextureArrayGLTest::subImage2DQueryBuffer() { Texture2DArray texture; texture.setStorage(1, TextureFormat::RGBA8, Vector3i{4}) - .setSubImage(0, {}, ImageView3D{ColorFormat::RGBA, ColorType::UnsignedByte, Vector3i{4}, SubData2DComplete}); + .setSubImage(0, {}, ImageView3D{PixelFormat::RGBA, PixelType::UnsignedByte, Vector3i{4}, SubData2DComplete}); MAGNUM_VERIFY_NO_ERROR(); - BufferImage3D image = texture.subImage(0, Range3Di::fromSize(Vector3i{1}, Vector3i{2}), {ColorFormat::RGBA, ColorType::UnsignedByte}, BufferUsage::StaticRead); + BufferImage3D image = texture.subImage(0, Range3Di::fromSize(Vector3i{1}, Vector3i{2}), {PixelFormat::RGBA, PixelType::UnsignedByte}, BufferUsage::StaticRead); const auto imageData = image.buffer().data(); MAGNUM_VERIFY_NO_ERROR(); @@ -1170,7 +1170,7 @@ void TextureArrayGLTest::generateMipmap1D() { Texture1DArray texture; texture.setImage(0, TextureFormat::RGBA8, - ImageView2D(ColorFormat::RGBA, ColorType::UnsignedByte, Vector2i(32))); + ImageView2D(PixelFormat::RGBA, PixelType::UnsignedByte, Vector2i(32))); CORRADE_COMPARE(texture.imageSize(0), Vector2i(32)); CORRADE_COMPARE(texture.imageSize(1), Vector2i( 0)); @@ -1200,7 +1200,7 @@ void TextureArrayGLTest::generateMipmap2D() { Texture2DArray texture; texture.setImage(0, TextureFormat::RGBA8, - ImageView3D(ColorFormat::RGBA, ColorType::UnsignedByte, Vector3i(32))); + ImageView3D(PixelFormat::RGBA, PixelType::UnsignedByte, Vector3i(32))); /** @todo How to test this on ES? */ #ifndef MAGNUM_TARGET_GLES diff --git a/src/Magnum/Test/TextureGLTest.cpp b/src/Magnum/Test/TextureGLTest.cpp index d7a7be222..02db82a48 100644 --- a/src/Magnum/Test/TextureGLTest.cpp +++ b/src/Magnum/Test/TextureGLTest.cpp @@ -29,8 +29,8 @@ #ifndef MAGNUM_TARGET_GLES2 #include "Magnum/BufferImage.h" #endif -#include "Magnum/ColorFormat.h" #include "Magnum/Image.h" +#include "Magnum/PixelFormat.h" #include "Magnum/Texture.h" #include "Magnum/TextureFormat.h" #include "Magnum/Math/Color.h" @@ -907,11 +907,11 @@ namespace { void TextureGLTest::image1D() { Texture1D texture; texture.setImage(0, TextureFormat::RGBA8, - ImageView1D(ColorFormat::RGBA, ColorType::UnsignedByte, 2, Data1D)); + ImageView1D(PixelFormat::RGBA, PixelType::UnsignedByte, 2, Data1D)); MAGNUM_VERIFY_NO_ERROR(); - Image1D image = texture.image(0, {ColorFormat::RGBA, ColorType::UnsignedByte}); + Image1D image = texture.image(0, {PixelFormat::RGBA, PixelType::UnsignedByte}); MAGNUM_VERIFY_NO_ERROR(); @@ -928,11 +928,11 @@ void TextureGLTest::compressedImage1D() { void TextureGLTest::image1DBuffer() { Texture1D texture; texture.setImage(0, TextureFormat::RGBA8, - BufferImage1D(ColorFormat::RGBA, ColorType::UnsignedByte, 2, Data1D, BufferUsage::StaticDraw)); + BufferImage1D(PixelFormat::RGBA, PixelType::UnsignedByte, 2, Data1D, BufferUsage::StaticDraw)); MAGNUM_VERIFY_NO_ERROR(); - BufferImage1D image = texture.image(0, {ColorFormat::RGBA, ColorType::UnsignedByte}, BufferUsage::StaticDraw); + BufferImage1D image = texture.image(0, {PixelFormat::RGBA, PixelType::UnsignedByte}, BufferUsage::StaticDraw); const auto imageData = image.buffer().data(); MAGNUM_VERIFY_NO_ERROR(); @@ -962,13 +962,13 @@ namespace { void TextureGLTest::image2D() { Texture2D texture; texture.setImage(0, TextureFormat::RGBA8, - ImageView2D(ColorFormat::RGBA, ColorType::UnsignedByte, Vector2i(2), Data2D)); + ImageView2D(PixelFormat::RGBA, PixelType::UnsignedByte, Vector2i(2), Data2D)); MAGNUM_VERIFY_NO_ERROR(); /** @todo How to test this on ES? */ #ifndef MAGNUM_TARGET_GLES - Image2D image = texture.image(0, {ColorFormat::RGBA, ColorType::UnsignedByte}); + Image2D image = texture.image(0, {PixelFormat::RGBA, PixelType::UnsignedByte}); MAGNUM_VERIFY_NO_ERROR(); @@ -989,7 +989,7 @@ void TextureGLTest::compressedImage2D() { #endif Texture2D texture; - texture.setCompressedImage(0, CompressedImageView2D{CompressedColorFormat::RGBAS3tcDxt3, + texture.setCompressedImage(0, CompressedImageView2D{CompressedPixelFormat::RGBAS3tcDxt3, Vector2i{4}, CompressedData2D}); MAGNUM_VERIFY_NO_ERROR(); @@ -1011,13 +1011,13 @@ void TextureGLTest::compressedImage2D() { void TextureGLTest::image2DBuffer() { Texture2D texture; texture.setImage(0, TextureFormat::RGBA8, - BufferImage2D(ColorFormat::RGBA, ColorType::UnsignedByte, Vector2i(2), Data2D, BufferUsage::StaticDraw)); + BufferImage2D(PixelFormat::RGBA, PixelType::UnsignedByte, Vector2i(2), Data2D, BufferUsage::StaticDraw)); MAGNUM_VERIFY_NO_ERROR(); /** @todo How to test this on ES? */ #ifndef MAGNUM_TARGET_GLES - BufferImage2D image = texture.image(0, {ColorFormat::RGBA, ColorType::UnsignedByte}, BufferUsage::StaticRead); + BufferImage2D image = texture.image(0, {PixelFormat::RGBA, PixelType::UnsignedByte}, BufferUsage::StaticRead); const auto imageData = image.buffer().data(); MAGNUM_VERIFY_NO_ERROR(); @@ -1037,7 +1037,7 @@ void TextureGLTest::compressedImage2DBuffer() { #endif Texture2D texture; - texture.setCompressedImage(0, CompressedBufferImage2D{CompressedColorFormat::RGBAS3tcDxt3, + texture.setCompressedImage(0, CompressedBufferImage2D{CompressedPixelFormat::RGBAS3tcDxt3, Vector2i{4}, CompressedData2D, BufferUsage::StaticDraw}); MAGNUM_VERIFY_NO_ERROR(); @@ -1085,13 +1085,13 @@ void TextureGLTest::image3D() { Texture3D texture; texture.setImage(0, TextureFormat::RGBA8, - ImageView3D(ColorFormat::RGBA, ColorType::UnsignedByte, Vector3i(2), Data3D)); + ImageView3D(PixelFormat::RGBA, PixelType::UnsignedByte, Vector3i(2), Data3D)); MAGNUM_VERIFY_NO_ERROR(); /** @todo How to test this on ES? */ #ifndef MAGNUM_TARGET_GLES - Image3D image = texture.image(0, {ColorFormat::RGBA, ColorType::UnsignedByte}); + Image3D image = texture.image(0, {PixelFormat::RGBA, PixelType::UnsignedByte}); MAGNUM_VERIFY_NO_ERROR(); @@ -1116,7 +1116,7 @@ void TextureGLTest::compressedImage3D() { #endif Texture3D texture; - texture.setCompressedImage(0, CompressedImageView3D{CompressedColorFormat::RGBAS3tcDxt3, + texture.setCompressedImage(0, CompressedImageView3D{CompressedPixelFormat::RGBAS3tcDxt3, Vector3i{4}, CompressedData3D}); MAGNUM_VERIFY_NO_ERROR(); @@ -1137,13 +1137,13 @@ void TextureGLTest::compressedImage3D() { void TextureGLTest::image3DBuffer() { Texture3D texture; texture.setImage(0, TextureFormat::RGBA8, - BufferImage3D(ColorFormat::RGBA, ColorType::UnsignedByte, Vector3i(2), Data3D, BufferUsage::StaticDraw)); + BufferImage3D(PixelFormat::RGBA, PixelType::UnsignedByte, Vector3i(2), Data3D, BufferUsage::StaticDraw)); MAGNUM_VERIFY_NO_ERROR(); /** @todo How to test this on ES? */ #ifndef MAGNUM_TARGET_GLES - BufferImage3D image = texture.image(0, {ColorFormat::RGBA, ColorType::UnsignedByte}, BufferUsage::StaticRead); + BufferImage3D image = texture.image(0, {PixelFormat::RGBA, PixelType::UnsignedByte}, BufferUsage::StaticRead); const auto imageData = image.buffer().data(); MAGNUM_VERIFY_NO_ERROR(); @@ -1163,7 +1163,7 @@ void TextureGLTest::compressedImage3DBuffer() { #endif Texture3D texture; - texture.setCompressedImage(0, CompressedBufferImage3D{CompressedColorFormat::RGBAS3tcDxt3, + texture.setCompressedImage(0, CompressedBufferImage3D{CompressedPixelFormat::RGBAS3tcDxt3, Vector3i{4}, CompressedData3D, BufferUsage::StaticDraw}); MAGNUM_VERIFY_NO_ERROR(); @@ -1191,13 +1191,13 @@ namespace { void TextureGLTest::subImage1D() { Texture1D texture; texture.setImage(0, TextureFormat::RGBA8, - ImageView1D(ColorFormat::RGBA, ColorType::UnsignedByte, 4, Zero1D)); + ImageView1D(PixelFormat::RGBA, PixelType::UnsignedByte, 4, Zero1D)); texture.setSubImage(0, 1, - ImageView1D(ColorFormat::RGBA, ColorType::UnsignedByte, 2, Data1D)); + ImageView1D(PixelFormat::RGBA, PixelType::UnsignedByte, 2, Data1D)); MAGNUM_VERIFY_NO_ERROR(); - Image1D image = texture.image(0, {ColorFormat::RGBA, ColorType::UnsignedByte}); + Image1D image = texture.image(0, {PixelFormat::RGBA, PixelType::UnsignedByte}); MAGNUM_VERIFY_NO_ERROR(); @@ -1214,13 +1214,13 @@ void TextureGLTest::compressedSubImage1D() { void TextureGLTest::subImage1DBuffer() { Texture1D texture; texture.setImage(0, TextureFormat::RGBA8, - ImageView1D(ColorFormat::RGBA, ColorType::UnsignedByte, 4, Zero1D)); + ImageView1D(PixelFormat::RGBA, PixelType::UnsignedByte, 4, Zero1D)); texture.setSubImage(0, 1, - BufferImage1D(ColorFormat::RGBA, ColorType::UnsignedByte, 2, Data1D, BufferUsage::StaticDraw)); + BufferImage1D(PixelFormat::RGBA, PixelType::UnsignedByte, 2, Data1D, BufferUsage::StaticDraw)); MAGNUM_VERIFY_NO_ERROR(); - BufferImage1D image = texture.image(0, {ColorFormat::RGBA, ColorType::UnsignedByte}, BufferUsage::StaticRead); + BufferImage1D image = texture.image(0, {PixelFormat::RGBA, PixelType::UnsignedByte}, BufferUsage::StaticRead); const auto imageData = image.buffer().data(); MAGNUM_VERIFY_NO_ERROR(); @@ -1239,11 +1239,11 @@ void TextureGLTest::subImage1DQuery() { Texture1D texture; texture.setStorage(1, TextureFormat::RGBA8, 4) - .setSubImage(0, {}, ImageView1D{ColorFormat::RGBA, ColorType::UnsignedByte, 4, SubData1DComplete}); + .setSubImage(0, {}, ImageView1D{PixelFormat::RGBA, PixelType::UnsignedByte, 4, SubData1DComplete}); MAGNUM_VERIFY_NO_ERROR(); - Image1D image = texture.subImage(0, Range1Di::fromSize(1, 2), {ColorFormat::RGBA, ColorType::UnsignedByte}); + Image1D image = texture.subImage(0, Range1Di::fromSize(1, 2), {PixelFormat::RGBA, PixelType::UnsignedByte}); MAGNUM_VERIFY_NO_ERROR(); @@ -1258,11 +1258,11 @@ void TextureGLTest::subImage1DQueryBuffer() { Texture1D texture; texture.setStorage(1, TextureFormat::RGBA8, 4) - .setSubImage(0, {}, ImageView1D{ColorFormat::RGBA, ColorType::UnsignedByte, 4, SubData1DComplete}); + .setSubImage(0, {}, ImageView1D{PixelFormat::RGBA, PixelType::UnsignedByte, 4, SubData1DComplete}); MAGNUM_VERIFY_NO_ERROR(); - BufferImage1D image = texture.subImage(0, Range1Di::fromSize(1, 2), {ColorFormat::RGBA, ColorType::UnsignedByte}, BufferUsage::StaticRead); + BufferImage1D image = texture.subImage(0, Range1Di::fromSize(1, 2), {PixelFormat::RGBA, PixelType::UnsignedByte}, BufferUsage::StaticRead); const auto imageData = image.buffer().data(); MAGNUM_VERIFY_NO_ERROR(); @@ -1299,15 +1299,15 @@ namespace { void TextureGLTest::subImage2D() { Texture2D texture; texture.setImage(0, TextureFormat::RGBA8, - ImageView2D(ColorFormat::RGBA, ColorType::UnsignedByte, Vector2i(4), Zero2D)); + ImageView2D(PixelFormat::RGBA, PixelType::UnsignedByte, Vector2i(4), Zero2D)); texture.setSubImage(0, Vector2i(1), - ImageView2D(ColorFormat::RGBA, ColorType::UnsignedByte, Vector2i(2), Data2D)); + ImageView2D(PixelFormat::RGBA, PixelType::UnsignedByte, Vector2i(2), Data2D)); MAGNUM_VERIFY_NO_ERROR(); /** @todo How to test this on ES? */ #ifndef MAGNUM_TARGET_GLES - Image2D image = texture.image(0, {ColorFormat::RGBA, ColorType::UnsignedByte}); + Image2D image = texture.image(0, {PixelFormat::RGBA, PixelType::UnsignedByte}); MAGNUM_VERIFY_NO_ERROR(); @@ -1328,9 +1328,9 @@ void TextureGLTest::compressedSubImage2D() { #endif Texture2D texture; - texture.setCompressedImage(0, CompressedImageView2D{CompressedColorFormat::RGBAS3tcDxt3, + texture.setCompressedImage(0, CompressedImageView2D{CompressedPixelFormat::RGBAS3tcDxt3, {12, 4}, CompressedZero2D}); - texture.setCompressedSubImage(0, {4, 0}, CompressedImageView2D(CompressedColorFormat::RGBAS3tcDxt3, + texture.setCompressedSubImage(0, {4, 0}, CompressedImageView2D(CompressedPixelFormat::RGBAS3tcDxt3, Vector2i{4}, CompressedData2D)); MAGNUM_VERIFY_NO_ERROR(); @@ -1351,15 +1351,15 @@ void TextureGLTest::compressedSubImage2D() { void TextureGLTest::subImage2DBuffer() { Texture2D texture; texture.setImage(0, TextureFormat::RGBA8, - ImageView2D(ColorFormat::RGBA, ColorType::UnsignedByte, Vector2i(4), Zero2D)); + ImageView2D(PixelFormat::RGBA, PixelType::UnsignedByte, Vector2i(4), Zero2D)); texture.setSubImage(0, Vector2i(1), - BufferImage2D(ColorFormat::RGBA, ColorType::UnsignedByte, Vector2i(2), Data2D, BufferUsage::StaticDraw)); + BufferImage2D(PixelFormat::RGBA, PixelType::UnsignedByte, Vector2i(2), Data2D, BufferUsage::StaticDraw)); MAGNUM_VERIFY_NO_ERROR(); /** @todo How to test this on ES? */ #ifndef MAGNUM_TARGET_GLES - BufferImage2D image = texture.image(0, {ColorFormat::RGBA, ColorType::UnsignedByte}, BufferUsage::StaticRead); + BufferImage2D image = texture.image(0, {PixelFormat::RGBA, PixelType::UnsignedByte}, BufferUsage::StaticRead); const auto imageData = image.buffer().data(); MAGNUM_VERIFY_NO_ERROR(); @@ -1379,9 +1379,9 @@ void TextureGLTest::compressedSubImage2DBuffer() { #endif Texture2D texture; - texture.setCompressedImage(0, CompressedImageView2D{CompressedColorFormat::RGBAS3tcDxt3, + texture.setCompressedImage(0, CompressedImageView2D{CompressedPixelFormat::RGBAS3tcDxt3, {12, 4}, CompressedZero2D}); - texture.setCompressedSubImage(0, {4, 0}, CompressedBufferImage2D{CompressedColorFormat::RGBAS3tcDxt3, + texture.setCompressedSubImage(0, {4, 0}, CompressedBufferImage2D{CompressedPixelFormat::RGBAS3tcDxt3, Vector2i{4}, CompressedData2D, BufferUsage::StaticDraw}); MAGNUM_VERIFY_NO_ERROR(); @@ -1405,11 +1405,11 @@ void TextureGLTest::subImage2DQuery() { Texture2D texture; texture.setStorage(1, TextureFormat::RGBA8, Vector2i{4}) - .setSubImage(0, {}, ImageView2D{ColorFormat::RGBA, ColorType::UnsignedByte, Vector2i{4}, SubData2DComplete}); + .setSubImage(0, {}, ImageView2D{PixelFormat::RGBA, PixelType::UnsignedByte, Vector2i{4}, SubData2DComplete}); MAGNUM_VERIFY_NO_ERROR(); - Image2D image = texture.subImage(0, Range2Di::fromSize(Vector2i{1}, Vector2i{2}), {ColorFormat::RGBA, ColorType::UnsignedByte}); + Image2D image = texture.subImage(0, Range2Di::fromSize(Vector2i{1}, Vector2i{2}), {PixelFormat::RGBA, PixelType::UnsignedByte}); MAGNUM_VERIFY_NO_ERROR(); @@ -1424,11 +1424,11 @@ void TextureGLTest::subImage2DQueryBuffer() { Texture2D texture; texture.setStorage(1, TextureFormat::RGBA8, Vector2i{4}) - .setSubImage(0, {}, ImageView2D{ColorFormat::RGBA, ColorType::UnsignedByte, Vector2i{4}, SubData2DComplete}); + .setSubImage(0, {}, ImageView2D{PixelFormat::RGBA, PixelType::UnsignedByte, Vector2i{4}, SubData2DComplete}); MAGNUM_VERIFY_NO_ERROR(); - BufferImage2D image = texture.subImage(0, Range2Di::fromSize(Vector2i{1}, Vector2i{2}), {ColorFormat::RGBA, ColorType::UnsignedByte}, BufferUsage::StaticRead); + BufferImage2D image = texture.subImage(0, Range2Di::fromSize(Vector2i{1}, Vector2i{2}), {PixelFormat::RGBA, PixelType::UnsignedByte}, BufferUsage::StaticRead); const auto imageData = image.buffer().data(); MAGNUM_VERIFY_NO_ERROR(); @@ -1507,15 +1507,15 @@ void TextureGLTest::subImage3D() { Texture3D texture; texture.setImage(0, TextureFormat::RGBA8, - ImageView3D(ColorFormat::RGBA, ColorType::UnsignedByte, Vector3i(4), Zero3D)); + ImageView3D(PixelFormat::RGBA, PixelType::UnsignedByte, Vector3i(4), Zero3D)); texture.setSubImage(0, Vector3i(1), - ImageView3D(ColorFormat::RGBA, ColorType::UnsignedByte, Vector3i(2), Data3D)); + ImageView3D(PixelFormat::RGBA, PixelType::UnsignedByte, Vector3i(2), Data3D)); MAGNUM_VERIFY_NO_ERROR(); /** @todo How to test this on ES? */ #ifndef MAGNUM_TARGET_GLES - Image3D image = texture.image(0, {ColorFormat::RGBA, ColorType::UnsignedByte}); + Image3D image = texture.image(0, {PixelFormat::RGBA, PixelType::UnsignedByte}); MAGNUM_VERIFY_NO_ERROR(); @@ -1540,9 +1540,9 @@ void TextureGLTest::compressedSubImage3D() { #endif Texture3D texture; - texture.setCompressedImage(0, CompressedImageView3D{CompressedColorFormat::RGBAS3tcDxt3, + texture.setCompressedImage(0, CompressedImageView3D{CompressedPixelFormat::RGBAS3tcDxt3, {12, 4, 4}, CompressedZero3D}); - texture.setCompressedSubImage(0, {4, 0, 0}, CompressedImageView3D(CompressedColorFormat::RGBAS3tcDxt3, + texture.setCompressedSubImage(0, {4, 0, 0}, CompressedImageView3D(CompressedPixelFormat::RGBAS3tcDxt3, Vector3i{4}, CompressedData3D)); MAGNUM_VERIFY_NO_ERROR(); @@ -1563,15 +1563,15 @@ void TextureGLTest::compressedSubImage3D() { void TextureGLTest::subImage3DBuffer() { Texture3D texture; texture.setImage(0, TextureFormat::RGBA8, - ImageView3D(ColorFormat::RGBA, ColorType::UnsignedByte, Vector3i(4), Zero3D)); + ImageView3D(PixelFormat::RGBA, PixelType::UnsignedByte, Vector3i(4), Zero3D)); texture.setSubImage(0, Vector3i(1), - BufferImage3D(ColorFormat::RGBA, ColorType::UnsignedByte, Vector3i(2), Data3D, BufferUsage::StaticDraw)); + BufferImage3D(PixelFormat::RGBA, PixelType::UnsignedByte, Vector3i(2), Data3D, BufferUsage::StaticDraw)); MAGNUM_VERIFY_NO_ERROR(); /** @todo How to test this on ES? */ #ifndef MAGNUM_TARGET_GLES - BufferImage3D image = texture.image(0, {ColorFormat::RGBA, ColorType::UnsignedByte}, BufferUsage::StaticRead); + BufferImage3D image = texture.image(0, {PixelFormat::RGBA, PixelType::UnsignedByte}, BufferUsage::StaticRead); const auto imageData = image.buffer().data(); MAGNUM_VERIFY_NO_ERROR(); @@ -1591,9 +1591,9 @@ void TextureGLTest::compressedSubImage3DBuffer() { #endif Texture3D texture; - texture.setCompressedImage(0, CompressedImageView3D{CompressedColorFormat::RGBAS3tcDxt3, + texture.setCompressedImage(0, CompressedImageView3D{CompressedPixelFormat::RGBAS3tcDxt3, {12, 4, 4}, CompressedZero3D}); - texture.setCompressedSubImage(0, {4, 0, 0}, CompressedImageView3D(CompressedColorFormat::RGBAS3tcDxt3, + texture.setCompressedSubImage(0, {4, 0, 0}, CompressedImageView3D(CompressedPixelFormat::RGBAS3tcDxt3, Vector3i{4}, CompressedData3D)); MAGNUM_VERIFY_NO_ERROR(); @@ -1617,11 +1617,11 @@ void TextureGLTest::subImage3DQuery() { Texture3D texture; texture.setStorage(1, TextureFormat::RGBA8, Vector3i{4}) - .setSubImage(0, {}, ImageView3D{ColorFormat::RGBA, ColorType::UnsignedByte, Vector3i{4}, SubData3DComplete}); + .setSubImage(0, {}, ImageView3D{PixelFormat::RGBA, PixelType::UnsignedByte, Vector3i{4}, SubData3DComplete}); MAGNUM_VERIFY_NO_ERROR(); - Image3D image = texture.subImage(0, Range3Di::fromSize(Vector3i{1}, Vector3i{2}), {ColorFormat::RGBA, ColorType::UnsignedByte}); + Image3D image = texture.subImage(0, Range3Di::fromSize(Vector3i{1}, Vector3i{2}), {PixelFormat::RGBA, PixelType::UnsignedByte}); MAGNUM_VERIFY_NO_ERROR(); @@ -1636,11 +1636,11 @@ void TextureGLTest::subImage3DQueryBuffer() { Texture3D texture; texture.setStorage(1, TextureFormat::RGBA8, Vector3i{4}) - .setSubImage(0, {}, ImageView3D{ColorFormat::RGBA, ColorType::UnsignedByte, Vector3i{4}, SubData3DComplete}); + .setSubImage(0, {}, ImageView3D{PixelFormat::RGBA, PixelType::UnsignedByte, Vector3i{4}, SubData3DComplete}); MAGNUM_VERIFY_NO_ERROR(); - BufferImage3D image = texture.subImage(0, Range3Di::fromSize(Vector3i{1}, Vector3i{2}), {ColorFormat::RGBA, ColorType::UnsignedByte}, BufferUsage::StaticRead); + BufferImage3D image = texture.subImage(0, Range3Di::fromSize(Vector3i{1}, Vector3i{2}), {PixelFormat::RGBA, PixelType::UnsignedByte}, BufferUsage::StaticRead); const auto imageData = image.buffer().data(); MAGNUM_VERIFY_NO_ERROR(); @@ -1655,7 +1655,7 @@ void TextureGLTest::generateMipmap1D() { Texture1D texture; texture.setImage(0, TextureFormat::RGBA8, - ImageView1D(ColorFormat::RGBA, ColorType::UnsignedByte, 32)); + ImageView1D(PixelFormat::RGBA, PixelType::UnsignedByte, 32)); CORRADE_COMPARE(texture.imageSize(0), 32); CORRADE_COMPARE(texture.imageSize(1), 0); @@ -1683,7 +1683,7 @@ void TextureGLTest::generateMipmap2D() { Texture2D texture; texture.setImage(0, TextureFormat::RGBA8, - ImageView2D(ColorFormat::RGBA, ColorType::UnsignedByte, Vector2i(32))); + ImageView2D(PixelFormat::RGBA, PixelType::UnsignedByte, Vector2i(32))); /** @todo How to test this on ES? */ #ifndef MAGNUM_TARGET_GLES @@ -1719,7 +1719,7 @@ void TextureGLTest::generateMipmap3D() { Texture3D texture; texture.setImage(0, TextureFormat::RGBA8, - ImageView3D(ColorFormat::RGBA, ColorType::UnsignedByte, Vector3i(32))); + ImageView3D(PixelFormat::RGBA, PixelType::UnsignedByte, Vector3i(32))); /** @todo How to test this on ES? */ #ifndef MAGNUM_TARGET_GLES diff --git a/src/Magnum/Text/DistanceFieldGlyphCache.cpp b/src/Magnum/Text/DistanceFieldGlyphCache.cpp index f780ea656..0fbd1984c 100644 --- a/src/Magnum/Text/DistanceFieldGlyphCache.cpp +++ b/src/Magnum/Text/DistanceFieldGlyphCache.cpp @@ -25,12 +25,12 @@ #include "DistanceFieldGlyphCache.h" -#ifndef CORRADE_NO_ASSERT -#include "Magnum/ColorFormat.h" -#endif #include "Magnum/Context.h" #include "Magnum/Extensions.h" #include "Magnum/ImageView.h" +#ifndef CORRADE_NO_ASSERT +#include "Magnum/PixelFormat.h" +#endif #include "Magnum/TextureFormat.h" #include "Magnum/TextureTools/DistanceField.h" @@ -62,21 +62,21 @@ DistanceFieldGlyphCache::DistanceFieldGlyphCache(const Vector2i& originalSize, c void DistanceFieldGlyphCache::setImage(const Vector2i& offset, const ImageView2D& image) { #if !(defined(MAGNUM_TARGET_GLES) && defined(MAGNUM_TARGET_GLES2)) const TextureFormat internalFormat = TextureFormat::R8; - CORRADE_ASSERT(image.format() == ColorFormat::Red, - "Text::DistanceFieldGlyphCache::setImage(): expected" << ColorFormat::Red << "but got" << image.format(), ); + CORRADE_ASSERT(image.format() == PixelFormat::Red, + "Text::DistanceFieldGlyphCache::setImage(): expected" << PixelFormat::Red << "but got" << image.format(), ); #else TextureFormat internalFormat; #ifndef MAGNUM_TARGET_WEBGL if(Context::current()->isExtensionSupported()) { internalFormat = TextureFormat::Red; - CORRADE_ASSERT(image.format() == ColorFormat::Red, - "Text::DistanceFieldGlyphCache::setImage(): expected" << ColorFormat::Red << "but got" << image.format(), ); + CORRADE_ASSERT(image.format() == PixelFormat::Red, + "Text::DistanceFieldGlyphCache::setImage(): expected" << PixelFormat::Red << "but got" << image.format(), ); } else #endif { internalFormat = TextureFormat::Luminance; - CORRADE_ASSERT(image.format() == ColorFormat::Luminance, - "Text::DistanceFieldGlyphCache::setImage(): expected" << ColorFormat::Luminance << "but got" << image.format(), ); + CORRADE_ASSERT(image.format() == PixelFormat::Luminance, + "Text::DistanceFieldGlyphCache::setImage(): expected" << PixelFormat::Luminance << "but got" << image.format(), ); } #endif @@ -92,19 +92,19 @@ void DistanceFieldGlyphCache::setImage(const Vector2i& offset, const ImageView2D void DistanceFieldGlyphCache::setDistanceFieldImage(const Vector2i& offset, const ImageView2D& image) { #if !(defined(MAGNUM_TARGET_GLES) && defined(MAGNUM_TARGET_GLES2)) - CORRADE_ASSERT(image.format() == ColorFormat::Red, - "Text::DistanceFieldGlyphCache::setDistanceFieldImage(): expected" << ColorFormat::Red << "but got" << image.format(), ); + CORRADE_ASSERT(image.format() == PixelFormat::Red, + "Text::DistanceFieldGlyphCache::setDistanceFieldImage(): expected" << PixelFormat::Red << "but got" << image.format(), ); #else #ifndef MAGNUM_TARGET_WEBGL if(Context::current()->isExtensionSupported()) - CORRADE_ASSERT(image.format() == ColorFormat::Red, - "Text::DistanceFieldGlyphCache::setDistanceFieldImage(): expected" << ColorFormat::Red << "but got" << image.format(), ); + CORRADE_ASSERT(image.format() == PixelFormat::Red, + "Text::DistanceFieldGlyphCache::setDistanceFieldImage(): expected" << PixelFormat::Red << "but got" << image.format(), ); else #endif { /* Luminance is not renderable in most cases */ - CORRADE_ASSERT(image.format() == ColorFormat::RGB, - "Text::DistanceFieldGlyphCache::setDistanceFieldImage(): expected" << ColorFormat::RGB << "but got" << image.format(), ); + CORRADE_ASSERT(image.format() == PixelFormat::RGB, + "Text::DistanceFieldGlyphCache::setDistanceFieldImage(): expected" << PixelFormat::RGB << "but got" << image.format(), ); } #endif diff --git a/src/Magnum/Texture.h b/src/Magnum/Texture.h index 06f37c37b..f02c5daed 100644 --- a/src/Magnum/Texture.h +++ b/src/Magnum/Texture.h @@ -70,7 +70,7 @@ Common usage is to fully configure all texture parameters and then set the data from e.g. @ref Image. Example configuration of high quality texture with trilinear anisotropic filtering, i.e. the best you can ask for: @code -Image2D image(ColorFormat::RGBA, ColorType::UnsignedByte, {4096, 4096}, data); +Image2D image(PixelFormat::RGBA, PixelType::UnsignedByte, {4096, 4096}, data); Texture2D texture; texture.setMagnificationFilter(Sampler::Filter::Linear) @@ -598,7 +598,7 @@ template class Texture: public AbstractTexture { * @fn_gl_extension{TextureStorage3D,EXT,direct_state_access}, * eventually @fn_gl{ActiveTexture}, @fn_gl{BindTexture} and * @fn_gl{TexStorage1D}/@fn_gl{TexStorage2D}/@fn_gl{TexStorage3D} - * @todo allow the user to specify ColorType explicitly to avoid + * @todo allow the user to specify PixelType explicitly to avoid * issues in WebGL (see setSubImage()) */ Texture& setStorage(Int levels, TextureFormat internalFormat, const VectorTypeFor& size) { @@ -667,7 +667,7 @@ template class Texture: public AbstractTexture { * * Convenience alternative to the above, example usage: * @code - * Image2D image = texture.image(0, {ColorFormat::RGBA, ColorType::UnsignedByte}); + * Image2D image = texture.image(0, {PixelFormat::RGBA, PixelType::UnsignedByte}); * @endcode */ Image image(Int level, Image&& image); @@ -692,7 +692,7 @@ template class Texture: public AbstractTexture { * * Convenience alternative to the above, example usage: * @code - * BufferImage2D image = texture.image(0, {ColorFormat::RGBA, ColorType::UnsignedByte}, BufferUsage::StaticRead); + * BufferImage2D image = texture.image(0, {PixelFormat::RGBA, PixelType::UnsignedByte}, BufferUsage::StaticRead); * @endcode */ BufferImage image(Int level, BufferImage&& image, BufferUsage usage); @@ -786,7 +786,7 @@ template class Texture: public AbstractTexture { * * Convenience alternative to the above, example usage: * @code - * Image2D image = texture.subImage(0, rect, {ColorFormat::RGBA, ColorType::UnsignedByte}); + * Image2D image = texture.subImage(0, rect, {PixelFormat::RGBA, PixelType::UnsignedByte}); * @endcode */ Image subImage(Int level, const RangeTypeFor& range, Image&& image); @@ -812,7 +812,7 @@ template class Texture: public AbstractTexture { * * Convenience alternative to the above, example usage: * @code - * BufferImage2D image = texture.subImage(0, rect, {ColorFormat::RGBA, ColorType::UnsignedByte}, BufferUsage::StaticRead); + * BufferImage2D image = texture.subImage(0, rect, {PixelFormat::RGBA, PixelType::UnsignedByte}, BufferUsage::StaticRead); * @endcode */ BufferImage subImage(Int level, const RangeTypeFor& range, BufferImage&& image, BufferUsage usage); @@ -938,10 +938,10 @@ template class Texture: public AbstractTexture { * @fn_gl_extension{TextureSubImage3D,EXT,direct_state_access}, * eventually @fn_gl{ActiveTexture}, @fn_gl{BindTexture} and * @fn_gl{TexSubImage1D} / @fn_gl{TexSubImage2D} / @fn_gl{TexSubImage3D} - * @requires_gles In @ref MAGNUM_TARGET_WEBGL "WebGL" the @ref ColorType + * @requires_gles In @ref MAGNUM_TARGET_WEBGL "WebGL" the @ref PixelType * of data passed in @p image must match the original one * specified in @ref setImage(). It means that you might not be - * able to use @ref setStorage() as it uses implicit @ref ColorType + * able to use @ref setStorage() as it uses implicit @ref PixelType * value. */ Texture& setSubImage(Int level, const VectorTypeFor& offset, const ImageView& image) { diff --git a/src/Magnum/TextureArray.h b/src/Magnum/TextureArray.h index 9b95b18a1..12e31abd5 100644 --- a/src/Magnum/TextureArray.h +++ b/src/Magnum/TextureArray.h @@ -74,7 +74,7 @@ calling @ref setStorage() and then specify each layer separately using texture.setStorage(levels, TextureFormat::RGBA8, {64, 64, 16}); for(std::size_t i = 0; i != 16; ++i) { - Image3D image(ColorFormat::RGBA, ColorType::UnsignedByte, {64, 64, 1}, ...); + Image3D image(PixelFormat::RGBA, PixelType::UnsignedByte, {64, 64, 1}, ...); texture.setSubImage(0, Vector3i::zAxis(i), image); } @endcode @@ -409,7 +409,7 @@ template class TextureArray: public AbstractTexture { * * Convenience alternative to the above, example usage: * @code - * Image3D image = texture.image(0, {ColorFormat::RGBA, ColorType::UnsignedByte}); + * Image3D image = texture.image(0, {PixelFormat::RGBA, PixelType::UnsignedByte}); * @endcode */ Image image(Int level, Image&& image); @@ -431,7 +431,7 @@ template class TextureArray: public AbstractTexture { * * Convenience alternative to the above, example usage: * @code - * BufferImage3D image = texture.image(0, {ColorFormat::RGBA, ColorType::UnsignedByte}, BufferUsage::StaticRead); + * BufferImage3D image = texture.image(0, {PixelFormat::RGBA, PixelType::UnsignedByte}, BufferUsage::StaticRead); * @endcode */ BufferImage image(Int level, BufferImage&& image, BufferUsage usage); @@ -497,7 +497,7 @@ template class TextureArray: public AbstractTexture { * * Convenience alternative to the above, example usage: * @code - * Image3D image = texture.subImage(0, range, {ColorFormat::RGBA, ColorType::UnsignedByte}); + * Image3D image = texture.subImage(0, range, {PixelFormat::RGBA, PixelType::UnsignedByte}); * @endcode */ Image subImage(Int level, const RangeTypeFor& range, Image&& image); @@ -519,7 +519,7 @@ template class TextureArray: public AbstractTexture { * * Convenience alternative to the above, example usage: * @code - * BufferImage3D image = texture.subImage(0, range, {ColorFormat::RGBA, ColorType::UnsignedByte}, BufferUsage::StaticRead); + * BufferImage3D image = texture.subImage(0, range, {PixelFormat::RGBA, PixelType::UnsignedByte}, BufferUsage::StaticRead); * @endcode */ BufferImage subImage(Int level, const RangeTypeFor& range, BufferImage&& image, BufferUsage usage); diff --git a/src/Magnum/TextureFormat.h b/src/Magnum/TextureFormat.h index b25d2f295..31e4fa5ad 100644 --- a/src/Magnum/TextureFormat.h +++ b/src/Magnum/TextureFormat.h @@ -38,8 +38,8 @@ namespace Magnum { In most cases you may want to use @ref TextureFormat::R8 (for grayscale textures), @ref TextureFormat::RGB8 or @ref TextureFormat::RGBA8. The matching -color format is then @ref ColorFormat::Red, @ref ColorFormat::RGB or -@ref ColorFormat::RGBA along with @ref ColorType::UnsignedByte. See +color format is then @ref PixelFormat::Red, @ref PixelFormat::RGB or +@ref PixelFormat::RGBA along with @ref PixelType::UnsignedByte. See documentation of these values for possible limitations when using OpenGL ES 2.0 or WebGL. diff --git a/src/Magnum/TextureTools/distancefieldconverter.cpp b/src/Magnum/TextureTools/distancefieldconverter.cpp index cbb385560..5b9027b10 100644 --- a/src/Magnum/TextureTools/distancefieldconverter.cpp +++ b/src/Magnum/TextureTools/distancefieldconverter.cpp @@ -28,8 +28,8 @@ #include #include "Magnum/Math/Range.h" -#include "Magnum/ColorFormat.h" #include "Magnum/Image.h" +#include "Magnum/PixelFormat.h" #include "Magnum/Renderer.h" #include "Magnum/Texture.h" #include "Magnum/TextureFormat.h" @@ -71,7 +71,7 @@ Arguments: - `--output-size "X Y"` -- size of output image - `--radius N` -- distance field computation radius -Images with @ref ColorFormat::Red, @ref ColorFormat::RGB or @ref ColorFormat::RGBA +Images with @ref PixelFormat::Red, @ref PixelFormat::RGB or @ref PixelFormat::RGBA are accepted on input. The resulting image can be then used with @ref Shaders::DistanceFieldVector @@ -136,9 +136,9 @@ int DistanceFieldConverter::exec() { /* Decide about internal format */ TextureFormat internalFormat; - if(image->format() == ColorFormat::Red) internalFormat = TextureFormat::R8; - else if(image->format() == ColorFormat::RGB) internalFormat = TextureFormat::RGB8; - else if(image->format() == ColorFormat::RGBA) internalFormat = TextureFormat::RGBA8; + if(image->format() == PixelFormat::Red) internalFormat = TextureFormat::R8; + else if(image->format() == PixelFormat::RGB) internalFormat = TextureFormat::RGB8; + else if(image->format() == PixelFormat::RGBA) internalFormat = TextureFormat::RGBA8; else { Error() << "Unsupported image format" << image->format(); return 1; @@ -163,7 +163,7 @@ int DistanceFieldConverter::exec() { TextureTools::distanceField(input, output, {{}, args.value("output-size")}, args.value("radius"), image->size()); /* Save image */ - Image2D result(ColorFormat::Red, ColorType::UnsignedByte); + Image2D result(PixelFormat::Red, PixelType::UnsignedByte); output.image(0, result); if(!converter->exportToFile(result, args.value("output"))) { Error() << "Cannot save file" << args.value("output"); diff --git a/src/Magnum/Trade/ImageData.cpp b/src/Magnum/Trade/ImageData.cpp index 70099a900..18a121382 100644 --- a/src/Magnum/Trade/ImageData.cpp +++ b/src/Magnum/Trade/ImageData.cpp @@ -27,17 +27,17 @@ namespace Magnum { namespace Trade { -template ColorFormat ImageData::format() const { +template PixelFormat ImageData::format() const { CORRADE_ASSERT(!_compressed, "Trade::ImageData::format(): the image is compressed", {}); return _format; } -template ColorType ImageData::type() const { +template PixelType ImageData::type() const { CORRADE_ASSERT(!_compressed, "Trade::ImageData::type(): the image is compressed", {}); return _type; } -template CompressedColorFormat ImageData::compressedFormat() const { +template CompressedPixelFormat ImageData::compressedFormat() const { CORRADE_ASSERT(_compressed, "Trade::ImageData::format(): the image is not compressed", {}); return _compressedFormat; } diff --git a/src/Magnum/Trade/ImageData.h b/src/Magnum/Trade/ImageData.h index 8345a697e..c90058774 100644 --- a/src/Magnum/Trade/ImageData.h +++ b/src/Magnum/Trade/ImageData.h @@ -66,7 +66,7 @@ template class ImageData { * Note that the image data are not copied on construction, but they * are deleted on class destruction. */ - explicit ImageData(ColorFormat format, ColorType type, const VectorTypeFor& size, void* data): _compressed{false}, _format{format}, _type{type}, _size{size}, _data{reinterpret_cast(data), dataSize(size)} {} + explicit ImageData(PixelFormat format, PixelType type, const VectorTypeFor& size, void* data): _compressed{false}, _format{format}, _type{type}, _size{size}, _data{reinterpret_cast(data), dataSize(size)} {} /** * @brief Construct compressed image data @@ -77,7 +77,7 @@ template class ImageData { * Note that the image data are not copied on construction, but they * are deleted on class destruction. */ - explicit ImageData(CompressedColorFormat format, const VectorTypeFor& size, Containers::Array&& data): _compressed{true}, _compressedFormat{format}, _size{size}, _data{std::move(data)} {} + explicit ImageData(CompressedPixelFormat format, const VectorTypeFor& size, Containers::Array&& data): _compressed{true}, _compressedFormat{format}, _size{size}, _data{std::move(data)} {} /** @brief Copying is not allowed */ ImageData(const ImageData&) = delete; @@ -136,7 +136,7 @@ template class ImageData { * The image is expected to be uncompressed. * @see @ref isCompressed() */ - ColorFormat format() const; + PixelFormat format() const; /** * @brief Data type of pixel data @@ -144,7 +144,7 @@ template class ImageData { * The image is expected to be uncompressed. * @see @ref isCompressed() */ - ColorType type() const; + PixelType type() const; /** * @brief Format of compressed data @@ -152,7 +152,7 @@ template class ImageData { * The image is expected to be compressed. * @see @ref isCompressed() */ - CompressedColorFormat compressedFormat() const; + CompressedPixelFormat compressedFormat() const; /** * @brief Pixel size (in bytes) @@ -206,10 +206,10 @@ template class ImageData { private: bool _compressed; union { - ColorFormat _format; - CompressedColorFormat _compressedFormat; + PixelFormat _format; + CompressedPixelFormat _compressedFormat; }; - ColorType _type; + PixelType _type; Math::Vector _size; Containers::Array _data; }; diff --git a/src/Magnum/Trade/Test/AbstractImageConverterTest.cpp b/src/Magnum/Trade/Test/AbstractImageConverterTest.cpp index 6d2428bdd..92c619b0c 100644 --- a/src/Magnum/Trade/Test/AbstractImageConverterTest.cpp +++ b/src/Magnum/Trade/Test/AbstractImageConverterTest.cpp @@ -28,8 +28,8 @@ #include #include -#include "Magnum/ColorFormat.h" #include "Magnum/ImageView.h" +#include "Magnum/PixelFormat.h" #include "Magnum/Trade/AbstractImageConverter.h" #include "configure.h" @@ -62,7 +62,7 @@ void AbstractImageConverterTest::exportToFile() { /* doExportToFile() should call doExportToData() */ DataExporter exporter; - ImageView2D image(ColorFormat::RGBA, ColorType::UnsignedByte, {0xfe, 0xed}, nullptr); + ImageView2D image(PixelFormat::RGBA, PixelType::UnsignedByte, {0xfe, 0xed}, nullptr); CORRADE_VERIFY(exporter.exportToFile(image, Utility::Directory::join(TRADE_TEST_OUTPUT_DIR, "image.out"))); CORRADE_COMPARE_AS(Utility::Directory::join(TRADE_TEST_OUTPUT_DIR, "image.out"), "\xFE\xED", TestSuite::Compare::FileToString); diff --git a/src/Magnum/Trade/Test/ImageDataTest.cpp b/src/Magnum/Trade/Test/ImageDataTest.cpp index ca2140249..40b5dd5c7 100644 --- a/src/Magnum/Trade/Test/ImageDataTest.cpp +++ b/src/Magnum/Trade/Test/ImageDataTest.cpp @@ -25,7 +25,7 @@ #include -#include "Magnum/ColorFormat.h" +#include "Magnum/PixelFormat.h" #include "Magnum/Trade/ImageData.h" namespace Magnum { namespace Trade { namespace Test { @@ -61,21 +61,21 @@ ImageDataTest::ImageDataTest() { void ImageDataTest::construct() { auto data = new char[3]; - Trade::ImageData2D a(ColorFormat::Red, ColorType::UnsignedByte, {1, 3}, data); + Trade::ImageData2D a(PixelFormat::Red, PixelType::UnsignedByte, {1, 3}, data); CORRADE_VERIFY(!a.isCompressed()); - CORRADE_COMPARE(a.format(), ColorFormat::Red); - CORRADE_COMPARE(a.type(), ColorType::UnsignedByte); + CORRADE_COMPARE(a.format(), PixelFormat::Red); + CORRADE_COMPARE(a.type(), PixelType::UnsignedByte); CORRADE_COMPARE(a.size(), Vector2i(1, 3)); CORRADE_COMPARE(a.data(), data); } void ImageDataTest::constructCompressed() { auto data = new char[8]; - Trade::ImageData2D a{CompressedColorFormat::RGBAS3tcDxt1, {4, 4}, Containers::Array{data, 8}}; + Trade::ImageData2D a{CompressedPixelFormat::RGBAS3tcDxt1, {4, 4}, Containers::Array{data, 8}}; CORRADE_VERIFY(a.isCompressed()); - CORRADE_COMPARE(a.compressedFormat(), CompressedColorFormat::RGBAS3tcDxt1); + CORRADE_COMPARE(a.compressedFormat(), CompressedPixelFormat::RGBAS3tcDxt1); CORRADE_COMPARE(a.size(), Vector2i(4, 4)); CORRADE_COMPARE(a.data(), data); CORRADE_COMPARE(a.data().size(), 8); @@ -88,48 +88,48 @@ void ImageDataTest::constructCopy() { void ImageDataTest::constructMove() { auto data = new char[3]; - Trade::ImageData2D a(ColorFormat::Red, ColorType::UnsignedByte, {1, 3}, data); + Trade::ImageData2D a(PixelFormat::Red, PixelType::UnsignedByte, {1, 3}, data); Trade::ImageData2D b(std::move(a)); CORRADE_COMPARE(a.data(), nullptr); CORRADE_COMPARE(a.size(), Vector2i()); CORRADE_VERIFY(!b.isCompressed()); - CORRADE_COMPARE(b.format(), ColorFormat::Red); - CORRADE_COMPARE(b.type(), ColorType::UnsignedByte); + CORRADE_COMPARE(b.format(), PixelFormat::Red); + CORRADE_COMPARE(b.type(), PixelType::UnsignedByte); CORRADE_COMPARE(b.size(), Vector2i(1, 3)); CORRADE_COMPARE(b.data(), data); auto data2 = new char[3]; - Trade::ImageData2D c(ColorFormat::RGBA, ColorType::UnsignedShort, {2, 6}, data2); + Trade::ImageData2D c(PixelFormat::RGBA, PixelType::UnsignedShort, {2, 6}, data2); c = std::move(b); CORRADE_COMPARE(b.data(), data2); CORRADE_COMPARE(b.size(), Vector2i(2, 6)); CORRADE_VERIFY(!c.isCompressed()); - CORRADE_COMPARE(c.format(), ColorFormat::Red); - CORRADE_COMPARE(c.type(), ColorType::UnsignedByte); + CORRADE_COMPARE(c.format(), PixelFormat::Red); + CORRADE_COMPARE(c.type(), PixelType::UnsignedByte); CORRADE_COMPARE(c.size(), Vector2i(1, 3)); CORRADE_COMPARE(c.data(), data); } void ImageDataTest::constructMoveCompressed() { auto data = new char[8]; - Trade::ImageData2D a{CompressedColorFormat::RGBAS3tcDxt1, {4, 4}, Containers::Array{data, 8}}; + Trade::ImageData2D a{CompressedPixelFormat::RGBAS3tcDxt1, {4, 4}, Containers::Array{data, 8}}; Trade::ImageData2D b{std::move(a)}; CORRADE_COMPARE(a.data(), nullptr); CORRADE_COMPARE(a.size(), Vector2i()); CORRADE_VERIFY(b.isCompressed()); - CORRADE_COMPARE(b.compressedFormat(), CompressedColorFormat::RGBAS3tcDxt1); + CORRADE_COMPARE(b.compressedFormat(), CompressedPixelFormat::RGBAS3tcDxt1); CORRADE_COMPARE(b.size(), Vector2i(4, 4)); CORRADE_COMPARE(b.data(), data); CORRADE_COMPARE(b.data().size(), 8); auto data2 = new char[16]; - Trade::ImageData2D c{CompressedColorFormat::RGBAS3tcDxt3, {8, 4}, Containers::Array{data2, 16}}; + Trade::ImageData2D c{CompressedPixelFormat::RGBAS3tcDxt3, {8, 4}, Containers::Array{data2, 16}}; c = std::move(b); CORRADE_COMPARE_AS(b.data(), data2, char*); @@ -137,7 +137,7 @@ void ImageDataTest::constructMoveCompressed() { CORRADE_COMPARE(b.size(), Vector2i(8, 4)); CORRADE_VERIFY(c.isCompressed()); - CORRADE_COMPARE(c.compressedFormat(), CompressedColorFormat::RGBAS3tcDxt1); + CORRADE_COMPARE(c.compressedFormat(), CompressedPixelFormat::RGBAS3tcDxt1); CORRADE_COMPARE(c.size(), Vector2i(4, 4)); CORRADE_COMPARE(c.data(), data); CORRADE_COMPARE(c.data().size(), 8); @@ -145,11 +145,11 @@ void ImageDataTest::constructMoveCompressed() { void ImageDataTest::toReference() { auto data = new char[3]; - const Trade::ImageData2D a(ColorFormat::Red, ColorType::UnsignedByte, {1, 3}, data); + const Trade::ImageData2D a(PixelFormat::Red, PixelType::UnsignedByte, {1, 3}, data); ImageView2D b = a; - CORRADE_COMPARE(b.format(), ColorFormat::Red); - CORRADE_COMPARE(b.type(), ColorType::UnsignedByte); + CORRADE_COMPARE(b.format(), PixelFormat::Red); + CORRADE_COMPARE(b.type(), PixelType::UnsignedByte); CORRADE_COMPARE(b.size(), Vector2i(1, 3)); CORRADE_COMPARE(b.data(), data); @@ -165,10 +165,10 @@ void ImageDataTest::toReference() { void ImageDataTest::toReferenceCompressed() { auto data = new char[8]; - const Trade::ImageData2D a{CompressedColorFormat::RGBAS3tcDxt1, {4, 4}, Containers::Array{data, 8}}; + const Trade::ImageData2D a{CompressedPixelFormat::RGBAS3tcDxt1, {4, 4}, Containers::Array{data, 8}}; CompressedImageView2D b = a; - CORRADE_COMPARE(b.format(), CompressedColorFormat::RGBAS3tcDxt1); + CORRADE_COMPARE(b.format(), CompressedPixelFormat::RGBAS3tcDxt1); CORRADE_COMPARE(b.size(), Vector2i(4, 4)); CORRADE_COMPARE(b.data(), data); CORRADE_COMPARE(b.data().size(), 8); @@ -185,7 +185,7 @@ void ImageDataTest::toReferenceCompressed() { void ImageDataTest::release() { char data[] = {'b', 'e', 'e', 'r'}; - Trade::ImageData2D a(ColorFormat::Red, ColorType::UnsignedByte, {1, 4}, data); + Trade::ImageData2D a(PixelFormat::Red, PixelType::UnsignedByte, {1, 4}, data); const char* const pointer = a.release().release(); CORRADE_COMPARE(pointer, data); @@ -195,7 +195,7 @@ void ImageDataTest::release() { void ImageDataTest::releaseCompressed() { char data[8]; - Trade::ImageData2D a{CompressedColorFormat::RGBAS3tcDxt1, {4, 4}, Containers::Array{data, 8}}; + Trade::ImageData2D a{CompressedPixelFormat::RGBAS3tcDxt1, {4, 4}, Containers::Array{data, 8}}; const char* const pointer = a.release().release(); CORRADE_COMPARE(pointer, data); diff --git a/src/MagnumPlugins/MagnumFontConverter/MagnumFontConverter.cpp b/src/MagnumPlugins/MagnumFontConverter/MagnumFontConverter.cpp index 9e110baf0..efa11a6ee 100644 --- a/src/MagnumPlugins/MagnumFontConverter/MagnumFontConverter.cpp +++ b/src/MagnumPlugins/MagnumFontConverter/MagnumFontConverter.cpp @@ -29,8 +29,8 @@ #include #include -#include "Magnum/ColorFormat.h" #include "Magnum/Image.h" +#include "Magnum/PixelFormat.h" #include "Magnum/Text/GlyphCache.h" #include "Magnum/Text/AbstractFont.h" #include "MagnumPlugins/TgaImageConverter/TgaImageConverter.h" @@ -104,7 +104,7 @@ std::vector>> MagnumFontConverter std::copy(confStr.begin(), confStr.end(), confData.begin()); /* Save cache image */ - Image2D image(ColorFormat::Red, ColorType::UnsignedByte); + Image2D image(PixelFormat::Red, PixelType::UnsignedByte); cache.texture().image(0, image); auto tgaData = Trade::TgaImageConverter().exportToData(image); diff --git a/src/MagnumPlugins/MagnumFontConverter/Test/MagnumFontConverterGLTest.cpp b/src/MagnumPlugins/MagnumFontConverter/Test/MagnumFontConverterGLTest.cpp index 56c3ccf6c..7db3ff572 100644 --- a/src/MagnumPlugins/MagnumFontConverter/Test/MagnumFontConverterGLTest.cpp +++ b/src/MagnumPlugins/MagnumFontConverter/Test/MagnumFontConverterGLTest.cpp @@ -26,8 +26,8 @@ #include #include -#include "Magnum/ColorFormat.h" #include "Magnum/Extensions.h" +#include "Magnum/PixelFormat.h" #include "Magnum/TextureFormat.h" #include "Magnum/Test/AbstractOpenGLTester.h" #include "Magnum/Text/GlyphCache.h" @@ -117,8 +117,8 @@ void MagnumFontConverterGLTest::exportFont() { std::optional image = importer.image2D(0); CORRADE_VERIFY(image); CORRADE_COMPARE(image->size(), Vector2i(256)); - CORRADE_COMPARE(image->format(), ColorFormat::Red); - CORRADE_COMPARE(image->type(), ColorType::UnsignedByte); + CORRADE_COMPARE(image->format(), PixelFormat::Red); + CORRADE_COMPARE(image->type(), PixelType::UnsignedByte); } }}} diff --git a/src/MagnumPlugins/TgaImageConverter/Test/TgaImageConverterTest.cpp b/src/MagnumPlugins/TgaImageConverter/Test/TgaImageConverterTest.cpp index 03bc46262..9742db607 100644 --- a/src/MagnumPlugins/TgaImageConverter/Test/TgaImageConverterTest.cpp +++ b/src/MagnumPlugins/TgaImageConverter/Test/TgaImageConverterTest.cpp @@ -29,8 +29,8 @@ #include #include -#include "Magnum/ColorFormat.h" #include "Magnum/Image.h" +#include "Magnum/PixelFormat.h" #include "Magnum/Trade/ImageData.h" #include "MagnumPlugins/TgaImageConverter/TgaImageConverter.h" #include "MagnumPlugins/TgaImporter/TgaImporter.h" @@ -56,7 +56,7 @@ namespace { 5, 6, 7, 6, 7, 8 }; - const ImageView2D original(ColorFormat::RGB, ColorType::UnsignedByte, {2, 3}, originalData); + const ImageView2D original(PixelFormat::RGB, PixelType::UnsignedByte, {2, 3}, originalData); } TgaImageConverterTest::TgaImageConverterTest() { @@ -67,25 +67,25 @@ TgaImageConverterTest::TgaImageConverterTest() { } void TgaImageConverterTest::wrongFormat() { - ImageView2D image(ColorFormat::RG, ColorType::UnsignedByte, {}, nullptr); + ImageView2D image(PixelFormat::RG, PixelType::UnsignedByte, {}, nullptr); std::ostringstream out; Error::setOutput(&out); const auto data = TgaImageConverter().exportToData(image); CORRADE_VERIFY(!data); - CORRADE_COMPARE(out.str(), "Trade::TgaImageConverter::exportToData(): unsupported color format ColorFormat::RG\n"); + CORRADE_COMPARE(out.str(), "Trade::TgaImageConverter::exportToData(): unsupported color format PixelFormat::RG\n"); } void TgaImageConverterTest::wrongType() { - ImageView2D image(ColorFormat::Red, ColorType::Float, {}, nullptr); + ImageView2D image(PixelFormat::Red, PixelType::Float, {}, nullptr); std::ostringstream out; Error::setOutput(&out); const auto data = TgaImageConverter().exportToData(image); CORRADE_VERIFY(!data); - CORRADE_COMPARE(out.str(), "Trade::TgaImageConverter::exportToData(): unsupported color type ColorType::Float\n"); + CORRADE_COMPARE(out.str(), "Trade::TgaImageConverter::exportToData(): unsupported color type PixelType::Float\n"); } void TgaImageConverterTest::data() { @@ -97,8 +97,8 @@ void TgaImageConverterTest::data() { CORRADE_VERIFY(converted); CORRADE_COMPARE(converted->size(), Vector2i(2, 3)); - CORRADE_COMPARE(converted->format(), ColorFormat::RGB); - CORRADE_COMPARE(converted->type(), ColorType::UnsignedByte); + CORRADE_COMPARE(converted->format(), PixelFormat::RGB); + CORRADE_COMPARE(converted->type(), PixelType::UnsignedByte); CORRADE_COMPARE((std::string{converted->data(), 2*3*3}), (std::string{original.data(), 2*3*3})); } diff --git a/src/MagnumPlugins/TgaImageConverter/TgaImageConverter.cpp b/src/MagnumPlugins/TgaImageConverter/TgaImageConverter.cpp index 46746b758..82c9a3d6a 100644 --- a/src/MagnumPlugins/TgaImageConverter/TgaImageConverter.cpp +++ b/src/MagnumPlugins/TgaImageConverter/TgaImageConverter.cpp @@ -31,8 +31,8 @@ #include #include -#include "Magnum/ColorFormat.h" #include "Magnum/Image.h" +#include "Magnum/PixelFormat.h" #include "Magnum/Math/Swizzle.h" #include "Magnum/Math/Vector4.h" #include "MagnumPlugins/TgaImporter/TgaHeader.h" @@ -46,13 +46,13 @@ TgaImageConverter::TgaImageConverter(PluginManager::AbstractManager& manager, st auto TgaImageConverter::doFeatures() const -> Features { return Feature::ConvertData; } Containers::Array TgaImageConverter::doExportToData(const ImageView2D& image) const { - if(image.format() != ColorFormat::RGB && - image.format() != ColorFormat::RGBA + if(image.format() != PixelFormat::RGB && + image.format() != PixelFormat::RGBA #if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2)) - && image.format() != ColorFormat::Red + && image.format() != PixelFormat::Red #endif #ifdef MAGNUM_TARGET_GLES2 - && image.format() != ColorFormat::Luminance + && image.format() != PixelFormat::Luminance #endif ) { @@ -60,7 +60,7 @@ Containers::Array TgaImageConverter::doExportToData(const ImageView2D& ima return nullptr; } - if(image.type() != ColorType::UnsignedByte) { + if(image.type() != PixelType::UnsignedByte) { Error() << "Trade::TgaImageConverter::exportToData(): unsupported color type" << image.type(); return nullptr; } @@ -72,15 +72,15 @@ Containers::Array TgaImageConverter::doExportToData(const ImageView2D& ima /* Fill header */ auto header = reinterpret_cast(data.begin()); switch(image.format()) { - case ColorFormat::RGB: - case ColorFormat::RGBA: + case PixelFormat::RGB: + case PixelFormat::RGBA: header->imageType = 2; break; #if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2)) - case ColorFormat::Red: + case PixelFormat::Red: #endif #ifdef MAGNUM_TARGET_GLES2 - case ColorFormat::Luminance: + case PixelFormat::Luminance: #endif header->imageType = 3; break; @@ -93,11 +93,11 @@ Containers::Array TgaImageConverter::doExportToData(const ImageView2D& ima /* Fill data */ std::copy(image.data(), image.data()+pixelSize*image.size().product(), data.begin()+sizeof(TgaHeader)); - if(image.format() == ColorFormat::RGB) { + if(image.format() == PixelFormat::RGB) { auto pixels = reinterpret_cast*>(data.begin()+sizeof(TgaHeader)); std::transform(pixels, pixels + image.size().product(), pixels, [](Math::Vector3 pixel) { return Math::swizzle<'b', 'g', 'r'>(pixel); }); - } else if(image.format() == ColorFormat::RGBA) { + } else if(image.format() == PixelFormat::RGBA) { auto pixels = reinterpret_cast*>(data.begin()+sizeof(TgaHeader)); std::transform(pixels, pixels + image.size().product(), pixels, [](Math::Vector4 pixel) { return Math::swizzle<'b', 'g', 'r', 'a'>(pixel); }); diff --git a/src/MagnumPlugins/TgaImageConverter/TgaImageConverter.h b/src/MagnumPlugins/TgaImageConverter/TgaImageConverter.h index d674660e8..85f4e2c60 100644 --- a/src/MagnumPlugins/TgaImageConverter/TgaImageConverter.h +++ b/src/MagnumPlugins/TgaImageConverter/TgaImageConverter.h @@ -51,9 +51,9 @@ namespace Magnum { namespace Trade { /** @brief TGA image converter plugin -Supports images with format @ref ColorFormat::RGB, @ref ColorFormat::RGBA or -@ref ColorFormat::Red (or @ref ColorFormat::Luminance in OpenGL ES 2.0 and -WebGL 1.0) and type @ref ColorType::UnsignedByte. +Supports images with format @ref PixelFormat::RGB, @ref PixelFormat::RGBA or +@ref PixelFormat::Red (or @ref PixelFormat::Luminance in OpenGL ES 2.0 and +WebGL 1.0) and type @ref PixelType::UnsignedByte. This plugin is built if `WITH_TGAIMAGECONVERTER` is enabled when building Magnum. To use dynamic plugin, you need to load `TgaImageConverter` plugin diff --git a/src/MagnumPlugins/TgaImporter/Test/TgaImporterTest.cpp b/src/MagnumPlugins/TgaImporter/Test/TgaImporterTest.cpp index 2f49b1a11..b7c837049 100644 --- a/src/MagnumPlugins/TgaImporter/Test/TgaImporterTest.cpp +++ b/src/MagnumPlugins/TgaImporter/Test/TgaImporterTest.cpp @@ -29,7 +29,7 @@ #include #include -#include "Magnum/ColorFormat.h" +#include "Magnum/PixelFormat.h" #include "Magnum/Trade/ImageData.h" #include "MagnumPlugins/TgaImporter/TgaImporter.h" @@ -146,9 +146,9 @@ void TgaImporterTest::colorBits24() { std::optional image = importer.image2D(0); CORRADE_VERIFY(image); - CORRADE_COMPARE(image->format(), ColorFormat::RGB); + CORRADE_COMPARE(image->format(), PixelFormat::RGB); CORRADE_COMPARE(image->size(), Vector2i(2, 3)); - CORRADE_COMPARE(image->type(), ColorType::UnsignedByte); + CORRADE_COMPARE(image->type(), PixelType::UnsignedByte); CORRADE_COMPARE_AS(image->data(), Containers::ArrayView{pixels}, TestSuite::Compare::Container); } @@ -170,9 +170,9 @@ void TgaImporterTest::colorBits32() { std::optional image = importer.image2D(0); CORRADE_VERIFY(image); - CORRADE_COMPARE(image->format(), ColorFormat::RGBA); + CORRADE_COMPARE(image->format(), PixelFormat::RGBA); CORRADE_COMPARE(image->size(), Vector2i(2, 3)); - CORRADE_COMPARE(image->type(), ColorType::UnsignedByte); + CORRADE_COMPARE(image->type(), PixelType::UnsignedByte); CORRADE_COMPARE_AS(image->data(), Containers::ArrayView{pixels}, TestSuite::Compare::Container); } @@ -190,12 +190,12 @@ void TgaImporterTest::grayscaleBits8() { std::optional image = importer.image2D(0); CORRADE_VERIFY(image); #ifndef MAGNUM_TARGET_GLES2 - CORRADE_COMPARE(image->format(), ColorFormat::Red); + CORRADE_COMPARE(image->format(), PixelFormat::Red); #else - CORRADE_COMPARE(image->format(), ColorFormat::Luminance); + CORRADE_COMPARE(image->format(), PixelFormat::Luminance); #endif CORRADE_COMPARE(image->size(), Vector2i(2, 3)); - CORRADE_COMPARE(image->type(), ColorType::UnsignedByte); + CORRADE_COMPARE(image->type(), PixelType::UnsignedByte); CORRADE_COMPARE_AS(image->data(), Containers::ArrayView{data}.suffix(18), TestSuite::Compare::Container); } @@ -224,12 +224,12 @@ void TgaImporterTest::file() { std::optional image = importer.image2D(0); CORRADE_VERIFY(image); #ifndef MAGNUM_TARGET_GLES2 - CORRADE_COMPARE(image->format(), ColorFormat::Red); + CORRADE_COMPARE(image->format(), PixelFormat::Red); #else - CORRADE_COMPARE(image->format(), ColorFormat::Luminance); + CORRADE_COMPARE(image->format(), PixelFormat::Luminance); #endif CORRADE_COMPARE(image->size(), Vector2i(2, 3)); - CORRADE_COMPARE(image->type(), ColorType::UnsignedByte); + CORRADE_COMPARE(image->type(), PixelType::UnsignedByte); CORRADE_COMPARE_AS(image->data(), Containers::ArrayView{data}.suffix(18), TestSuite::Compare::Container); } diff --git a/src/MagnumPlugins/TgaImporter/TgaImporter.cpp b/src/MagnumPlugins/TgaImporter/TgaImporter.cpp index 09324ea8c..263eade48 100644 --- a/src/MagnumPlugins/TgaImporter/TgaImporter.cpp +++ b/src/MagnumPlugins/TgaImporter/TgaImporter.cpp @@ -31,7 +31,7 @@ #include #include -#include "Magnum/ColorFormat.h" +#include "Magnum/PixelFormat.h" #include "Magnum/Math/Swizzle.h" #include "Magnum/Math/Vector4.h" #include "Magnum/Trade/ImageData.h" @@ -91,7 +91,7 @@ std::optional TgaImporter::doImage2D(UnsignedInt) { header.height = Utility::Endianness::littleEndian(header.height); /* Image format */ - ColorFormat format; + PixelFormat format; if(header.colorMapType != 0) { Error() << "Trade::TgaImporter::image2D(): paletted files are not supported"; return std::nullopt; @@ -101,10 +101,10 @@ std::optional TgaImporter::doImage2D(UnsignedInt) { if(header.imageType == 2) { switch(header.bpp) { case 24: - format = ColorFormat::RGB; + format = PixelFormat::RGB; break; case 32: - format = ColorFormat::RGBA; + format = PixelFormat::RGBA; break; default: Error() << "Trade::TgaImporter::image2D(): unsupported color bits-per-pixel:" << header.bpp; @@ -115,11 +115,11 @@ std::optional TgaImporter::doImage2D(UnsignedInt) { } else if(header.imageType == 3) { #if defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL) format = Context::current() && Context::current()->isExtensionSupported() ? - ColorFormat::Red : ColorFormat::Luminance; + PixelFormat::Red : PixelFormat::Luminance; #elif !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2)) - format = ColorFormat::Red; + format = PixelFormat::Red; #else - format = ColorFormat::Luminance; + format = PixelFormat::Luminance; #endif if(header.bpp != 8) { Error() << "Trade::TgaImporter::image2D(): unsupported grayscale bits-per-pixel:" << header.bpp; @@ -138,17 +138,17 @@ std::optional TgaImporter::doImage2D(UnsignedInt) { Vector2i size(header.width, header.height); - if(format == ColorFormat::RGB) { + if(format == PixelFormat::RGB) { auto pixels = reinterpret_cast*>(data); std::transform(pixels, pixels + size.product(), pixels, [](Math::Vector3 pixel) { return Math::swizzle<'b', 'g', 'r'>(pixel); }); - } else if(format == ColorFormat::RGBA) { + } else if(format == PixelFormat::RGBA) { auto pixels = reinterpret_cast*>(data); std::transform(pixels, pixels + size.product(), pixels, [](Math::Vector4 pixel) { return Math::swizzle<'b', 'g', 'r', 'a'>(pixel); }); } - return ImageData2D(format, ColorType::UnsignedByte, size, data); + return ImageData2D(format, PixelType::UnsignedByte, size, data); } }} diff --git a/src/MagnumPlugins/TgaImporter/TgaImporter.h b/src/MagnumPlugins/TgaImporter/TgaImporter.h index 158f8e267..4c3e80c71 100644 --- a/src/MagnumPlugins/TgaImporter/TgaImporter.h +++ b/src/MagnumPlugins/TgaImporter/TgaImporter.h @@ -62,11 +62,11 @@ of another plugin, you need to request `TgaImporter` component of `Magnum` package in CMake and link to `${MAGNUM_TGAIMPORTER_LIBRARIES}`. See @ref building, @ref cmake and @ref plugins for more information. -The images are imported with @ref ColorType::UnsignedByte and @ref ColorFormat::RGB, -@ref ColorFormat::RGBA or @ref ColorFormat::Red, respectively. Grayscale images +The images are imported with @ref PixelType::UnsignedByte and @ref PixelFormat::RGB, +@ref PixelFormat::RGBA or @ref PixelFormat::Red, respectively. Grayscale images require extension @extension{ARB,texture_rg}. In OpenGL ES 2.0, if @es_extension{EXT,texture_rg} is not supported and in WebGL 1.0, grayscale -images use @ref ColorFormat::Luminance instead of @ref ColorFormat::Red. +images use @ref PixelFormat::Luminance instead of @ref PixelFormat::Red. */ class MAGNUM_TGAIMPORTER_EXPORT TgaImporter: public AbstractImporter { public: