From 11522ac0cf28a2f830a784186616968e1c6f667a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Thu, 23 Jan 2014 20:07:34 +0100 Subject: [PATCH] Get rid of pointers in internal texture implementation. --- src/Magnum/AbstractTexture.cpp | 114 +++++++++++++++---------------- src/Magnum/AbstractTexture.h | 48 ++++++------- src/Magnum/CubeMapTexture.h | 18 ++--- src/Magnum/CubeMapTextureArray.h | 16 ++--- src/Magnum/Texture.h | 16 ++--- 5 files changed, 106 insertions(+), 106 deletions(-) diff --git a/src/Magnum/AbstractTexture.cpp b/src/Magnum/AbstractTexture.cpp index b0d43a9bc..a60870426 100644 --- a/src/Magnum/AbstractTexture.cpp +++ b/src/Magnum/AbstractTexture.cpp @@ -906,7 +906,7 @@ void AbstractTexture::invalidateSubImageImplementationARB(GLint level, const Vec #ifndef DOXYGEN_GENERATING_OUTPUT #ifndef MAGNUM_TARGET_GLES template void AbstractTexture::image(GLenum target, GLint level, Image& image) { - const Math::Vector size = DataHelper::imageSize(this, target, level); + const Math::Vector size = DataHelper::imageSize(*this, target, level); const std::size_t dataSize = size.product()*image.pixelSize(); char* data = new char[dataSize]; (this->*Context::current()->state().texture->getImageImplementation)(target, level, image.format(), image.type(), dataSize, data); @@ -918,7 +918,7 @@ template void MAGNUM_EXPORT AbstractTexture::image<2>(GLenum, GLint, Image<2>&); template void MAGNUM_EXPORT AbstractTexture::image<3>(GLenum, GLint, Image<3>&); template void AbstractTexture::image(GLenum target, GLint level, BufferImage& image, BufferUsage usage) { - const Math::Vector size = DataHelper::imageSize(this, target, level); + const Math::Vector size = DataHelper::imageSize(*this, target, level); const std::size_t dataSize = size.product()*image.pixelSize(); if(image.size() != size) image.setData(image.format(), image.type(), size, nullptr, usage); @@ -935,162 +935,162 @@ template void MAGNUM_EXPORT AbstractTexture::image<3>(GLenum, GLint, BufferImage #ifndef DOXYGEN_GENERATING_OUTPUT #ifndef MAGNUM_TARGET_GLES -Math::Vector<1, GLint> AbstractTexture::DataHelper<1>::imageSize(AbstractTexture* texture, GLenum target, GLint level) { +Math::Vector<1, GLint> AbstractTexture::DataHelper<1>::imageSize(AbstractTexture& texture, const GLenum target, const GLint level) { Math::Vector<1, GLint> value; - (texture->*Context::current()->state().texture->getLevelParameterivImplementation)(target, level, GL_TEXTURE_WIDTH, &value[0]); + (texture.*Context::current()->state().texture->getLevelParameterivImplementation)(target, level, GL_TEXTURE_WIDTH, &value[0]); return value; } -Vector2i AbstractTexture::DataHelper<2>::imageSize(AbstractTexture* texture, GLenum target, GLint level) { +Vector2i AbstractTexture::DataHelper<2>::imageSize(AbstractTexture& texture, const GLenum target, const GLint level) { const Implementation::TextureState& state = *Context::current()->state().texture; Vector2i value; - (texture->*state.getLevelParameterivImplementation)(target, level, GL_TEXTURE_WIDTH, &value[0]); - (texture->*state.getLevelParameterivImplementation)(target, level, GL_TEXTURE_HEIGHT, &value[1]); + (texture.*state.getLevelParameterivImplementation)(target, level, GL_TEXTURE_WIDTH, &value[0]); + (texture.*state.getLevelParameterivImplementation)(target, level, GL_TEXTURE_HEIGHT, &value[1]); return value; } -Vector3i AbstractTexture::DataHelper<3>::imageSize(AbstractTexture* texture, GLenum target, GLint level) { +Vector3i AbstractTexture::DataHelper<3>::imageSize(AbstractTexture& texture, const GLenum target, const GLint level) { const Implementation::TextureState& state = *Context::current()->state().texture; Vector3i value; - (texture->*state.getLevelParameterivImplementation)(target, level, GL_TEXTURE_WIDTH, &value[0]); - (texture->*state.getLevelParameterivImplementation)(target, level, GL_TEXTURE_HEIGHT, &value[1]); - (texture->*state.getLevelParameterivImplementation)(target, level, GL_TEXTURE_DEPTH, &value[2]); + (texture.*state.getLevelParameterivImplementation)(target, level, GL_TEXTURE_WIDTH, &value[0]); + (texture.*state.getLevelParameterivImplementation)(target, level, GL_TEXTURE_HEIGHT, &value[1]); + (texture.*state.getLevelParameterivImplementation)(target, level, GL_TEXTURE_DEPTH, &value[2]); return value; } #endif #ifndef MAGNUM_TARGET_GLES -void AbstractTexture::DataHelper<1>::setStorage(AbstractTexture* const texture, const GLenum target, const GLsizei levels, const TextureFormat internalFormat, const Math::Vector< 1, GLsizei >& size) { - (texture->*Context::current()->state().texture->storage1DImplementation)(target, levels, internalFormat, size); +void AbstractTexture::DataHelper<1>::setStorage(AbstractTexture& texture, const GLenum target, const GLsizei levels, const TextureFormat internalFormat, const Math::Vector< 1, GLsizei >& size) { + (texture.*Context::current()->state().texture->storage1DImplementation)(target, levels, internalFormat, size); } #endif -void AbstractTexture::DataHelper<2>::setStorage(AbstractTexture* const texture, const GLenum target, const GLsizei levels, const TextureFormat internalFormat, const Vector2i& size) { - (texture->*Context::current()->state().texture->storage2DImplementation)(target, levels, internalFormat, size); +void AbstractTexture::DataHelper<2>::setStorage(AbstractTexture& texture, const GLenum target, const GLsizei levels, const TextureFormat internalFormat, const Vector2i& size) { + (texture.*Context::current()->state().texture->storage2DImplementation)(target, levels, internalFormat, size); } -void AbstractTexture::DataHelper<3>::setStorage(AbstractTexture* const texture, const GLenum target, const GLsizei levels, const TextureFormat internalFormat, const Vector3i& size) { - (texture->*Context::current()->state().texture->storage3DImplementation)(target, levels, internalFormat, size); +void AbstractTexture::DataHelper<3>::setStorage(AbstractTexture& texture, const GLenum target, const GLsizei levels, const TextureFormat internalFormat, const Vector3i& size) { + (texture.*Context::current()->state().texture->storage3DImplementation)(target, levels, internalFormat, size); } #ifndef MAGNUM_TARGET_GLES -void AbstractTexture::DataHelper<1>::setImage(AbstractTexture* const texture, const GLenum target, const GLint level, const TextureFormat internalFormat, const ImageReference1D& image) { +void AbstractTexture::DataHelper<1>::setImage(AbstractTexture& texture, const GLenum target, const GLint level, const TextureFormat internalFormat, const ImageReference1D& image) { Buffer::unbind(Buffer::Target::PixelUnpack); - (texture->*Context::current()->state().texture->image1DImplementation)(target, level, internalFormat, image.size(), image.format(), image.type(), image.data()); + (texture.*Context::current()->state().texture->image1DImplementation)(target, level, internalFormat, image.size(), image.format(), image.type(), image.data()); } -void AbstractTexture::DataHelper<1>::setImage(AbstractTexture* const texture, const GLenum target, const GLint level, const TextureFormat internalFormat, BufferImage1D& image) { +void AbstractTexture::DataHelper<1>::setImage(AbstractTexture& texture, const GLenum target, const GLint level, const TextureFormat internalFormat, BufferImage1D& image) { image.buffer().bind(Buffer::Target::PixelUnpack); - (texture->*Context::current()->state().texture->image1DImplementation)(target, level, internalFormat, image.size(), image.format(), image.type(), nullptr); + (texture.*Context::current()->state().texture->image1DImplementation)(target, level, internalFormat, image.size(), image.format(), image.type(), nullptr); } -void AbstractTexture::DataHelper<1>::setSubImage(AbstractTexture* const texture, const GLenum target, const GLint level, const Math::Vector<1, GLint>& offset, const ImageReference1D& image) { +void AbstractTexture::DataHelper<1>::setSubImage(AbstractTexture& texture, const GLenum target, const GLint level, const Math::Vector<1, GLint>& offset, const ImageReference1D& image) { Buffer::unbind(Buffer::Target::PixelUnpack); - (texture->*Context::current()->state().texture->subImage1DImplementation)(target, level, offset, image.size(), image.format(), image.type(), image.data()); + (texture.*Context::current()->state().texture->subImage1DImplementation)(target, level, offset, image.size(), image.format(), image.type(), image.data()); } -void AbstractTexture::DataHelper<1>::setSubImage(AbstractTexture* const texture, const GLenum target, const GLint level, const Math::Vector<1, GLint>& offset, BufferImage1D& image) { +void AbstractTexture::DataHelper<1>::setSubImage(AbstractTexture& texture, const GLenum target, const GLint level, const Math::Vector<1, GLint>& offset, BufferImage1D& image) { image.buffer().bind(Buffer::Target::PixelUnpack); - (texture->*Context::current()->state().texture->subImage1DImplementation)(target, level, offset, image.size(), image.format(), image.type(), nullptr); + (texture.*Context::current()->state().texture->subImage1DImplementation)(target, level, offset, image.size(), image.format(), image.type(), nullptr); } #endif -void AbstractTexture::DataHelper<2>::setImage(AbstractTexture* const texture, const GLenum target, const GLint level, const TextureFormat internalFormat, const ImageReference2D& image) { +void AbstractTexture::DataHelper<2>::setImage(AbstractTexture& texture, const GLenum target, const GLint level, const TextureFormat internalFormat, const ImageReference2D& image) { #ifndef MAGNUM_TARGET_GLES2 Buffer::unbind(Buffer::Target::PixelUnpack); #endif - (texture->*Context::current()->state().texture->image2DImplementation)(target, level, internalFormat, image.size(), image.format(), image.type(), image.data()); + (texture.*Context::current()->state().texture->image2DImplementation)(target, level, internalFormat, image.size(), image.format(), image.type(), image.data()); } #ifndef MAGNUM_TARGET_GLES2 -void AbstractTexture::DataHelper<2>::setImage(AbstractTexture* const texture, const GLenum target, const GLint level, const TextureFormat internalFormat, BufferImage2D& image) { +void AbstractTexture::DataHelper<2>::setImage(AbstractTexture& texture, const GLenum target, const GLint level, const TextureFormat internalFormat, BufferImage2D& image) { image.buffer().bind(Buffer::Target::PixelUnpack); - (texture->*Context::current()->state().texture->image2DImplementation)(target, level, internalFormat, image.size(), image.format(), image.type(), nullptr); + (texture.*Context::current()->state().texture->image2DImplementation)(target, level, internalFormat, image.size(), image.format(), image.type(), nullptr); } #endif -void AbstractTexture::DataHelper<2>::setSubImage(AbstractTexture* const texture, const GLenum target, const GLint level, const Vector2i& offset, const ImageReference2D& image) { +void AbstractTexture::DataHelper<2>::setSubImage(AbstractTexture& texture, const GLenum target, const GLint level, const Vector2i& offset, const ImageReference2D& image) { #ifndef MAGNUM_TARGET_GLES2 Buffer::unbind(Buffer::Target::PixelUnpack); #endif - (texture->*Context::current()->state().texture->subImage2DImplementation)(target, level, offset, image.size(), image.format(), image.type(), image.data()); + (texture.*Context::current()->state().texture->subImage2DImplementation)(target, level, offset, image.size(), image.format(), image.type(), image.data()); } #ifndef MAGNUM_TARGET_GLES2 -void AbstractTexture::DataHelper<2>::setSubImage(AbstractTexture* const texture, const GLenum target, const GLint level, const Vector2i& offset, BufferImage2D& image) { +void AbstractTexture::DataHelper<2>::setSubImage(AbstractTexture& texture, const GLenum target, const GLint level, const Vector2i& offset, BufferImage2D& image) { image.buffer().bind(Buffer::Target::PixelUnpack); - (texture->*Context::current()->state().texture->subImage2DImplementation)(target, level, offset, image.size(), image.format(), image.type(), nullptr); + (texture.*Context::current()->state().texture->subImage2DImplementation)(target, level, offset, image.size(), image.format(), image.type(), nullptr); } #endif -void AbstractTexture::DataHelper<3>::setImage(AbstractTexture* const texture, const GLenum target, const GLint level, const TextureFormat internalFormat, const ImageReference3D& image) { +void AbstractTexture::DataHelper<3>::setImage(AbstractTexture& texture, const GLenum target, const GLint level, const TextureFormat internalFormat, const ImageReference3D& image) { #ifndef MAGNUM_TARGET_GLES2 Buffer::unbind(Buffer::Target::PixelUnpack); #endif - (texture->*Context::current()->state().texture->image3DImplementation)(target, level, internalFormat, image.size(), image.format(), image.type(), image.data()); + (texture.*Context::current()->state().texture->image3DImplementation)(target, level, internalFormat, image.size(), image.format(), image.type(), image.data()); } #ifndef MAGNUM_TARGET_GLES2 -void AbstractTexture::DataHelper<3>::setImage(AbstractTexture* const texture, const GLenum target, const GLint level, const TextureFormat internalFormat, BufferImage3D& image) { +void AbstractTexture::DataHelper<3>::setImage(AbstractTexture& texture, const GLenum target, const GLint level, const TextureFormat internalFormat, BufferImage3D& image) { image.buffer().bind(Buffer::Target::PixelUnpack); - (texture->*Context::current()->state().texture->image3DImplementation)(target, level, internalFormat, image.size(), image.format(), image.type(), nullptr); + (texture.*Context::current()->state().texture->image3DImplementation)(target, level, internalFormat, image.size(), image.format(), image.type(), nullptr); } #endif -void AbstractTexture::DataHelper<3>::setSubImage(AbstractTexture* const texture, const GLenum target, const GLint level, const Vector3i& offset, const ImageReference3D& image) { +void AbstractTexture::DataHelper<3>::setSubImage(AbstractTexture& texture, const GLenum target, const GLint level, const Vector3i& offset, const ImageReference3D& image) { #ifndef MAGNUM_TARGET_GLES2 Buffer::unbind(Buffer::Target::PixelUnpack); #endif - (texture->*Context::current()->state().texture->subImage3DImplementation)(target, level, offset, image.size(), image.format(), image.type(), image.data()); + (texture.*Context::current()->state().texture->subImage3DImplementation)(target, level, offset, image.size(), image.format(), image.type(), image.data()); } #ifndef MAGNUM_TARGET_GLES2 -void AbstractTexture::DataHelper<3>::setSubImage(AbstractTexture* const texture, const GLenum target, const GLint level, const Vector3i& offset, BufferImage3D& image) { +void AbstractTexture::DataHelper<3>::setSubImage(AbstractTexture& texture, const GLenum target, const GLint level, const Vector3i& offset, BufferImage3D& image) { image.buffer().bind(Buffer::Target::PixelUnpack); - (texture->*Context::current()->state().texture->subImage3DImplementation)(target, level, offset, image.size(), image.format(), image.type(), nullptr); + (texture.*Context::current()->state().texture->subImage3DImplementation)(target, level, offset, image.size(), image.format(), image.type(), nullptr); } #endif #ifndef MAGNUM_TARGET_GLES -void AbstractTexture::DataHelper<1>::invalidateSubImage(AbstractTexture* const texture, const GLint level, const Math::Vector<1, GLint>& offset, const Math::Vector<1, GLint>& size) { - (texture->*Context::current()->state().texture->invalidateSubImageImplementation)(level, {offset[0], 0, 0}, {size[0], 1, 1}); +void AbstractTexture::DataHelper<1>::invalidateSubImage(AbstractTexture& texture, const GLint level, const Math::Vector<1, GLint>& offset, const Math::Vector<1, GLint>& size) { + (texture.*Context::current()->state().texture->invalidateSubImageImplementation)(level, {offset[0], 0, 0}, {size[0], 1, 1}); } #endif -void AbstractTexture::DataHelper<2>::invalidateSubImage(AbstractTexture* const texture, const GLint level, const Vector2i& offset, const Vector2i& size) { - (texture->*Context::current()->state().texture->invalidateSubImageImplementation)(level, {offset, 0}, {size, 1}); +void AbstractTexture::DataHelper<2>::invalidateSubImage(AbstractTexture& texture, const GLint level, const Vector2i& offset, const Vector2i& size) { + (texture.*Context::current()->state().texture->invalidateSubImageImplementation)(level, {offset, 0}, {size, 1}); } -void AbstractTexture::DataHelper<3>::invalidateSubImage(AbstractTexture* const texture, const GLint level, const Vector3i& offset, const Vector3i& size) { - (texture->*Context::current()->state().texture->invalidateSubImageImplementation)(level, offset, size); +void AbstractTexture::DataHelper<3>::invalidateSubImage(AbstractTexture& texture, const GLint level, const Vector3i& offset, const Vector3i& size) { + (texture.*Context::current()->state().texture->invalidateSubImageImplementation)(level, offset, size); } #ifndef MAGNUM_TARGET_GLES -void AbstractTexture::DataHelper<1>::setWrapping(AbstractTexture* const texture, const Array1D& wrapping) { - (texture->*Context::current()->state().texture->parameteriImplementation)(GL_TEXTURE_WRAP_S, GLint(wrapping.x())); +void AbstractTexture::DataHelper<1>::setWrapping(AbstractTexture& texture, const Array1D& wrapping) { + (texture.*Context::current()->state().texture->parameteriImplementation)(GL_TEXTURE_WRAP_S, GLint(wrapping.x())); } #endif -void AbstractTexture::DataHelper<2>::setWrapping(AbstractTexture* texture, const Array2D& wrapping) { +void AbstractTexture::DataHelper<2>::setWrapping(AbstractTexture& texture, const Array2D& wrapping) { #ifndef MAGNUM_TARGET_GLES - CORRADE_ASSERT(texture->_target != GL_TEXTURE_RECTANGLE || ((wrapping.x() == Sampler::Wrapping::ClampToEdge || wrapping.x() == Sampler::Wrapping::ClampToBorder) && (wrapping.y() == Sampler::Wrapping::ClampToEdge || wrapping.y() == Sampler::Wrapping::ClampToBorder)), "Texture2D::setWrapping(): rectangle texture must be clamped to border or to edge", ); + CORRADE_ASSERT(texture._target != GL_TEXTURE_RECTANGLE || ((wrapping.x() == Sampler::Wrapping::ClampToEdge || wrapping.x() == Sampler::Wrapping::ClampToBorder) && (wrapping.y() == Sampler::Wrapping::ClampToEdge || wrapping.y() == Sampler::Wrapping::ClampToBorder)), "Texture2D::setWrapping(): rectangle texture must be clamped to border or to edge", ); #endif const Implementation::TextureState& state = *Context::current()->state().texture; - (texture->*state.parameteriImplementation)(GL_TEXTURE_WRAP_S, GLint(wrapping.x())); - (texture->*state.parameteriImplementation)(GL_TEXTURE_WRAP_T, GLint(wrapping.y())); + (texture.*state.parameteriImplementation)(GL_TEXTURE_WRAP_S, GLint(wrapping.x())); + (texture.*state.parameteriImplementation)(GL_TEXTURE_WRAP_T, GLint(wrapping.y())); } -void AbstractTexture::DataHelper<3>::setWrapping(AbstractTexture* texture, const Array3D& wrapping) { +void AbstractTexture::DataHelper<3>::setWrapping(AbstractTexture& texture, const Array3D& wrapping) { const Implementation::TextureState& state = *Context::current()->state().texture; - (texture->*state.parameteriImplementation)(GL_TEXTURE_WRAP_S, GLint(wrapping.x())); - (texture->*state.parameteriImplementation)(GL_TEXTURE_WRAP_T, GLint(wrapping.y())); + (texture.*state.parameteriImplementation)(GL_TEXTURE_WRAP_S, GLint(wrapping.x())); + (texture.*state.parameteriImplementation)(GL_TEXTURE_WRAP_T, GLint(wrapping.y())); #ifndef MAGNUM_TARGET_GLES - (texture->*state.parameteriImplementation)(GL_TEXTURE_WRAP_R, GLint(wrapping.z())); + (texture.*state.parameteriImplementation)(GL_TEXTURE_WRAP_R, GLint(wrapping.z())); #endif } #endif diff --git a/src/Magnum/AbstractTexture.h b/src/Magnum/AbstractTexture.h index ac3ac20ed..17a5e2815 100644 --- a/src/Magnum/AbstractTexture.h +++ b/src/Magnum/AbstractTexture.h @@ -451,19 +451,19 @@ template<> struct MAGNUM_EXPORT AbstractTexture::DataHelper<1> { constexpr static Target target() { return Target::Texture1D; } - static Math::Vector<1, GLint> imageSize(AbstractTexture* texture, GLenum target, GLint level); + static Math::Vector<1, GLint> imageSize(AbstractTexture& texture, GLenum target, GLint level); - static void setWrapping(AbstractTexture* texture, const Array1D& wrapping); + static void setWrapping(AbstractTexture& texture, const Array1D& wrapping); - static void setStorage(AbstractTexture* texture, GLenum target, GLsizei levels, TextureFormat internalFormat, const Math::Vector<1, GLsizei>& size); + static void setStorage(AbstractTexture& texture, GLenum target, GLsizei levels, TextureFormat internalFormat, const Math::Vector<1, GLsizei>& size); - static void setImage(AbstractTexture* texture, GLenum target, GLint level, TextureFormat internalFormat, const ImageReference1D& image); - static void setImage(AbstractTexture* texture, GLenum target, GLint level, TextureFormat internalFormat, BufferImage1D& image); + static void setImage(AbstractTexture& texture, GLenum target, GLint level, TextureFormat internalFormat, const ImageReference1D& image); + static void setImage(AbstractTexture& texture, GLenum target, GLint level, TextureFormat internalFormat, BufferImage1D& image); - static void setSubImage(AbstractTexture* texture, GLenum target, GLint level, const Math::Vector<1, GLint>& offset, const ImageReference1D& image); - static void setSubImage(AbstractTexture* texture, GLenum target, GLint level, const Math::Vector<1, GLint>& offset, BufferImage1D& image); + static void setSubImage(AbstractTexture& texture, GLenum target, GLint level, const Math::Vector<1, GLint>& offset, const ImageReference1D& image); + static void setSubImage(AbstractTexture& texture, GLenum target, GLint level, const Math::Vector<1, GLint>& offset, BufferImage1D& image); - static void invalidateSubImage(AbstractTexture* texture, GLint level, const Math::Vector<1, GLint>& offset, const Math::Vector<1, GLint>& size); + static void invalidateSubImage(AbstractTexture& texture, GLint level, const Math::Vector<1, GLint>& offset, const Math::Vector<1, GLint>& size); }; #endif template<> struct MAGNUM_EXPORT AbstractTexture::DataHelper<2> { @@ -479,24 +479,24 @@ template<> struct MAGNUM_EXPORT AbstractTexture::DataHelper<2> { constexpr static Target target() { return Target::Texture2D; } #ifndef MAGNUM_TARGET_GLES - static Vector2i imageSize(AbstractTexture* texture, GLenum target, GLint level); + static Vector2i imageSize(AbstractTexture& texture, GLenum target, GLint level); #endif - static void setWrapping(AbstractTexture* texture, const Array2D& wrapping); + static void setWrapping(AbstractTexture& texture, const Array2D& wrapping); - static void setStorage(AbstractTexture* texture, GLenum target, GLsizei levels, TextureFormat internalFormat, const Vector2i& size); + static void setStorage(AbstractTexture& texture, GLenum target, GLsizei levels, TextureFormat internalFormat, const Vector2i& size); - static void setImage(AbstractTexture* texture, GLenum target, GLint level, TextureFormat internalFormat, const ImageReference2D& image); + static void setImage(AbstractTexture& texture, GLenum target, GLint level, TextureFormat internalFormat, const ImageReference2D& image); #ifndef MAGNUM_TARGET_GLES2 - static void setImage(AbstractTexture* texture, GLenum target, GLint level, TextureFormat internalFormat, BufferImage2D& image); + static void setImage(AbstractTexture& texture, GLenum target, GLint level, TextureFormat internalFormat, BufferImage2D& image); #endif - static void setSubImage(AbstractTexture* texture, GLenum target, GLint level, const Vector2i& offset, const ImageReference2D& image); + static void setSubImage(AbstractTexture& texture, GLenum target, GLint level, const Vector2i& offset, const ImageReference2D& image); #ifndef MAGNUM_TARGET_GLES2 - static void setSubImage(AbstractTexture* texture, GLenum target, GLint level, const Vector2i& offset, BufferImage2D& image); + static void setSubImage(AbstractTexture& texture, GLenum target, GLint level, const Vector2i& offset, BufferImage2D& image); #endif - static void invalidateSubImage(AbstractTexture* texture, GLint level, const Vector2i& offset, const Vector2i& size); + static void invalidateSubImage(AbstractTexture& texture, GLint level, const Vector2i& offset, const Vector2i& size); }; template<> struct MAGNUM_EXPORT AbstractTexture::DataHelper<3> { enum class Target: GLenum { @@ -514,24 +514,24 @@ template<> struct MAGNUM_EXPORT AbstractTexture::DataHelper<3> { constexpr static Target target() { return Target::Texture3D; } #ifndef MAGNUM_TARGET_GLES - static Vector3i imageSize(AbstractTexture* texture, GLenum target, GLint level); + static Vector3i imageSize(AbstractTexture& texture, GLenum target, GLint level); #endif - static void setWrapping(AbstractTexture* texture, const Array3D& wrapping); + static void setWrapping(AbstractTexture& texture, const Array3D& wrapping); - static void setStorage(AbstractTexture* texture, GLenum target, GLsizei levels, TextureFormat internalFormat, const Vector3i& size); + static void setStorage(AbstractTexture& texture, GLenum target, GLsizei levels, TextureFormat internalFormat, const Vector3i& size); - static void setImage(AbstractTexture* texture, GLenum target, GLint level, TextureFormat internalFormat, const ImageReference3D& image); + static void setImage(AbstractTexture& texture, GLenum target, GLint level, TextureFormat internalFormat, const ImageReference3D& image); #ifndef MAGNUM_TARGET_GLES2 - static void setImage(AbstractTexture* texture, GLenum target, GLint level, TextureFormat internalFormat, BufferImage3D& image); + static void setImage(AbstractTexture& texture, GLenum target, GLint level, TextureFormat internalFormat, BufferImage3D& image); #endif - static void setSubImage(AbstractTexture* texture, GLenum target, GLint level, const Vector3i& offset, const ImageReference3D& image); + static void setSubImage(AbstractTexture& texture, GLenum target, GLint level, const Vector3i& offset, const ImageReference3D& image); #ifndef MAGNUM_TARGET_GLES2 - static void setSubImage(AbstractTexture* texture, GLenum target, GLint level, const Vector3i& offset, BufferImage3D& image); + static void setSubImage(AbstractTexture& texture, GLenum target, GLint level, const Vector3i& offset, BufferImage3D& image); #endif - static void invalidateSubImage(AbstractTexture* texture, GLint level, const Vector3i& offset, const Vector3i& size); + static void invalidateSubImage(AbstractTexture& texture, GLint level, const Vector3i& offset, const Vector3i& size); }; #endif diff --git a/src/Magnum/CubeMapTexture.h b/src/Magnum/CubeMapTexture.h index b162f1ac8..1cd6401cd 100644 --- a/src/Magnum/CubeMapTexture.h +++ b/src/Magnum/CubeMapTexture.h @@ -103,7 +103,7 @@ class CubeMapTexture: public AbstractTexture { * See @ref Texture::setWrapping() for more information. */ CubeMapTexture& setWrapping(const Array3D& wrapping) { - DataHelper<3>::setWrapping(this, wrapping); + DataHelper<3>::setWrapping(*this, wrapping); return *this; } @@ -117,7 +117,7 @@ class CubeMapTexture: public AbstractTexture { * @requires_gl %Texture image queries are not available in OpenGL ES. */ Vector2i imageSize(Coordinate coordinate, Int level) { - return DataHelper<2>::imageSize(this, GLenum(coordinate), level); + return DataHelper<2>::imageSize(*this, GLenum(coordinate), level); } #endif @@ -127,7 +127,7 @@ class CubeMapTexture: public AbstractTexture { * See @ref Texture::setStorage() for more information. */ CubeMapTexture& setStorage(Int levels, TextureFormat internalFormat, const Vector2i& size) { - DataHelper<2>::setStorage(this, _target, levels, internalFormat, size); + DataHelper<2>::setStorage(*this, _target, levels, internalFormat, size); return *this; } @@ -173,14 +173,14 @@ class CubeMapTexture: public AbstractTexture { * See @ref Texture::setImage() for more information. */ CubeMapTexture& setImage(Coordinate coordinate, Int level, TextureFormat internalFormat, const ImageReference2D& image) { - DataHelper<2>::setImage(this, GLenum(coordinate), level, internalFormat, image); + DataHelper<2>::setImage(*this, GLenum(coordinate), level, internalFormat, image); return *this; } #ifndef MAGNUM_TARGET_GLES2 /** @overload */ CubeMapTexture& setImage(Coordinate coordinate, Int level, TextureFormat internalFormat, BufferImage2D& image) { - DataHelper<2>::setImage(this, GLenum(coordinate), level, internalFormat, image); + DataHelper<2>::setImage(*this, GLenum(coordinate), level, internalFormat, image); return *this; } @@ -202,20 +202,20 @@ class CubeMapTexture: public AbstractTexture { * See @ref Texture::setSubImage() for more information. */ CubeMapTexture& setSubImage(Coordinate coordinate, Int level, const Vector2i& offset, const ImageReference2D& image) { - DataHelper<2>::setSubImage(this, GLenum(coordinate), level, offset, image); + DataHelper<2>::setSubImage(*this, GLenum(coordinate), level, offset, image); return *this; } #ifndef MAGNUM_TARGET_GLES2 /** @overload */ CubeMapTexture& setSubImage(Coordinate coordinate, Int level, const Vector2i& offset, BufferImage2D& image) { - DataHelper<2>::setSubImage(this, GLenum(coordinate), level, offset, image); + DataHelper<2>::setSubImage(*this, GLenum(coordinate), level, offset, image); return *this; } /** @overload */ CubeMapTexture& setSubImage(Coordinate coordinate, Int level, const Vector2i& offset, BufferImage2D&& image) { - DataHelper<2>::setSubImage(this, GLenum(coordinate), level, offset, image); + DataHelper<2>::setSubImage(*this, GLenum(coordinate), level, offset, image); return *this; } #endif @@ -233,7 +233,7 @@ class CubeMapTexture: public AbstractTexture { * See @ref Texture::invalidateSubImage() for more information. */ void invalidateSubImage(Int level, const Vector3i& offset, const Vector3i& size) { - DataHelper<3>::invalidateSubImage(this, level, offset, size); + DataHelper<3>::invalidateSubImage(*this, level, offset, size); } /* Overloads to remove WTF-factor from method chaining order */ diff --git a/src/Magnum/CubeMapTextureArray.h b/src/Magnum/CubeMapTextureArray.h index 85b5c2f68..4767d67a7 100644 --- a/src/Magnum/CubeMapTextureArray.h +++ b/src/Magnum/CubeMapTextureArray.h @@ -94,7 +94,7 @@ class CubeMapTextureArray: public AbstractTexture { * See @ref Texture::setWrapping() for more information. */ CubeMapTextureArray& setWrapping(const Array3D& wrapping) { - DataHelper<3>::setWrapping(this, wrapping); + DataHelper<3>::setWrapping(*this, wrapping); return *this; } @@ -105,7 +105,7 @@ class CubeMapTextureArray: public AbstractTexture { * See @ref Texture::imageSize() for more information. */ Vector3i imageSize(Int level) { - return DataHelper<3>::imageSize(this, GL_TEXTURE_CUBE_MAP_ARRAY, level); + return DataHelper<3>::imageSize(*this, GL_TEXTURE_CUBE_MAP_ARRAY, level); } /** @@ -115,7 +115,7 @@ class CubeMapTextureArray: public AbstractTexture { * @ref Texture::setStorage() for more information. */ CubeMapTextureArray& setStorage(Int levels, TextureFormat internalFormat, const Vector3i& size) { - DataHelper<3>::setStorage(this, _target, levels, internalFormat, size); + DataHelper<3>::setStorage(*this, _target, levels, internalFormat, size); return *this; } @@ -163,13 +163,13 @@ class CubeMapTextureArray: public AbstractTexture { * See @ref Texture::setImage() for more information. */ CubeMapTextureArray& setImage(Int level, TextureFormat internalFormat, const ImageReference3D& image) { - DataHelper<3>::setImage(this, GL_TEXTURE_CUBE_MAP_ARRAY, level, internalFormat, image); + DataHelper<3>::setImage(*this, GL_TEXTURE_CUBE_MAP_ARRAY, level, internalFormat, image); return *this; } /** @overload */ CubeMapTextureArray& setImage(Int level, TextureFormat internalFormat, BufferImage3D& image) { - DataHelper<3>::setImage(this, GL_TEXTURE_CUBE_MAP_ARRAY, level, internalFormat, image); + DataHelper<3>::setImage(*this, GL_TEXTURE_CUBE_MAP_ARRAY, level, internalFormat, image); return *this; } @@ -192,13 +192,13 @@ class CubeMapTextureArray: public AbstractTexture { * See @ref Texture::setSubImage() for more information. */ CubeMapTextureArray& setSubImage(Int level, const Vector3i& offset, const ImageReference3D& image) { - DataHelper<3>::setSubImage(this, GL_TEXTURE_CUBE_MAP_ARRAY, level, offset, image); + DataHelper<3>::setSubImage(*this, GL_TEXTURE_CUBE_MAP_ARRAY, level, offset, image); return *this; } /** @overload */ CubeMapTextureArray& setSubImage(Int level, const Vector3i& offset, BufferImage3D& image) { - DataHelper<3>::setSubImage(this, GL_TEXTURE_CUBE_MAP_ARRAY, level, offset, image); + DataHelper<3>::setSubImage(*this, GL_TEXTURE_CUBE_MAP_ARRAY, level, offset, image); return *this; } @@ -219,7 +219,7 @@ class CubeMapTextureArray: public AbstractTexture { * See @ref Texture::invalidateSubImage() for more information. */ void invalidateSubImage(Int level, const Vector3i& offset, const Vector3i& size) { - DataHelper<3>::invalidateSubImage(this, level, offset, size); + DataHelper<3>::invalidateSubImage(*this, level, offset, size); } /* Overloads to remove WTF-factor from method chaining order */ diff --git a/src/Magnum/Texture.h b/src/Magnum/Texture.h index f7f2f2928..fd0832316 100644 --- a/src/Magnum/Texture.h +++ b/src/Magnum/Texture.h @@ -246,7 +246,7 @@ template class Texture: public AbstractTexture { * @requires_gl %Texture image queries are not available in OpenGL ES. */ typename DimensionTraits::VectorType imageSize(Int level) { - return DataHelper::imageSize(this, _target, level); + return DataHelper::imageSize(*this, _target, level); } #endif @@ -268,7 +268,7 @@ template class Texture: public AbstractTexture { * @def_gl{TEXTURE_WRAP_R} */ Texture& setWrapping(const Array& wrapping) { - DataHelper::setWrapping(this, wrapping); + DataHelper::setWrapping(*this, wrapping); return *this; } @@ -301,7 +301,7 @@ template class Texture: public AbstractTexture { * @fn_gl_extension{TextureImage3D,EXT,direct_state_access}. */ Texture& setStorage(Int levels, TextureFormat internalFormat, const typename DimensionTraits::VectorType& size) { - DataHelper::setStorage(this, _target, levels, internalFormat, size); + DataHelper::setStorage(*this, _target, levels, internalFormat, size); return *this; } @@ -368,14 +368,14 @@ template class Texture: public AbstractTexture { * @fn_gl_extension{TextureImage3D,EXT,direct_state_access} */ Texture& setImage(Int level, TextureFormat internalFormat, const ImageReference& image) { - DataHelper::setImage(this, _target, level, internalFormat, image); + DataHelper::setImage(*this, _target, level, internalFormat, image); return *this; } #ifndef MAGNUM_TARGET_GLES2 /** @overload */ Texture& setImage(Int level, TextureFormat internalFormat, BufferImage& image) { - DataHelper::setImage(this, _target, level, internalFormat, image); + DataHelper::setImage(*this, _target, level, internalFormat, image); return *this; } @@ -403,14 +403,14 @@ template class Texture: public AbstractTexture { * @fn_gl_extension{TextureSubImage3D,EXT,direct_state_access} */ Texture& setSubImage(Int level, const typename DimensionTraits::VectorType& offset, const ImageReference& image) { - DataHelper::setSubImage(this, _target, level, offset, image); + DataHelper::setSubImage(*this, _target, level, offset, image); return *this; } #ifndef MAGNUM_TARGET_GLES2 /** @overload */ Texture& setSubImage(Int level, const typename DimensionTraits::VectorType& offset, BufferImage& image) { - DataHelper::setSubImage(this, _target, level, offset, image); + DataHelper::setSubImage(*this, _target, level, offset, image); return *this; } @@ -431,7 +431,7 @@ template class Texture: public AbstractTexture { * @see @ref invalidateImage(), @fn_gl{InvalidateTexSubImage} */ void invalidateSubImage(Int level, const typename DimensionTraits::VectorType& offset, const typename DimensionTraits::VectorType& size) { - DataHelper::invalidateSubImage(this, level, offset, size); + DataHelper::invalidateSubImage(*this, level, offset, size); } /* Overloads to remove WTF-factor from method chaining order */