123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148 | // Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB).// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only#ifndef QABSTRACTOPENGLTEXTURE_P_H#define QABSTRACTOPENGLTEXTURE_P_H//// W A R N I N G// -------------//// This file is not part of the Qt API. It exists purely as an// implementation detail. This header file may change from version to// version without notice, or even be removed.//// We mean it.//#ifndef QT_NO_OPENGL#include <QtOpenGL/qtopenglglobal.h>#include"private/qobject_p.h"#include"qopengltexture.h"#include"qopengl.h"#include <cmath>namespace{inlinedoubleqLog2(const double x){returnstd::log(x) /std::log(2.0);}} QT_BEGIN_NAMESPACE class QOpenGLContext;class QOpenGLTextureHelper;class QOpenGLFunctions;class QOpenGLTexturePrivate {public:QOpenGLTexturePrivate(QOpenGLTexture::Target textureTarget, QOpenGLTexture *qq);~QOpenGLTexturePrivate();Q_DECLARE_PUBLIC(QOpenGLTexture)voidresetFuncs(QOpenGLTextureHelper *funcs);voidinitializeOpenGLFunctions();boolcreate();voiddestroy();voidbind();voidbind(uint unit,QOpenGLTexture::TextureUnitReset reset =QOpenGLTexture::DontResetTextureUnit);voidrelease();voidrelease(uint unit,QOpenGLTexture::TextureUnitReset reset =QOpenGLTexture::DontResetTextureUnit);boolisBound()const;boolisBound(uint unit)const;voidallocateStorage(QOpenGLTexture::PixelFormat pixelFormat,QOpenGLTexture::PixelType pixelType);voidallocateMutableStorage(QOpenGLTexture::PixelFormat pixelFormat,QOpenGLTexture::PixelType pixelType);voidallocateImmutableStorage();voidsetData(int mipLevel,int layer,int layerCount,QOpenGLTexture::CubeMapFace cubeFace,QOpenGLTexture::PixelFormat sourceFormat,QOpenGLTexture::PixelType sourceType,const void*data,const QOpenGLPixelTransferOptions *const options);voidsetData(int xOffset,int yOffset,int zOffset,int width,int height,int depth,int mipLevel,int layer,int layerCount,QOpenGLTexture::CubeMapFace cubeFace,QOpenGLTexture::PixelFormat sourceFormat,QOpenGLTexture::PixelType sourceType,const void*data,const QOpenGLPixelTransferOptions *const options);voidsetCompressedData(int mipLevel,int layer,int layerCount,QOpenGLTexture::CubeMapFace cubeFace,int dataSize,const void*data,const QOpenGLPixelTransferOptions *const options);voidsetWrapMode(QOpenGLTexture::WrapMode mode);voidsetWrapMode(QOpenGLTexture::CoordinateDirection direction,QOpenGLTexture::WrapMode mode);QOpenGLTexture::WrapMode wrapMode(QOpenGLTexture::CoordinateDirection direction)const; QOpenGLTexture *createTextureView(QOpenGLTexture::Target target,QOpenGLTexture::TextureFormat viewFormat,int minimumMipmapLevel,int maximumMipmapLevel,int minimumLayer,int maximumLayer)const;intevaluateMipLevels()const;inlineintmaximumMipLevelCount()const{return1+std::floor(qLog2(qMax(dimensions[0],qMax(dimensions[1], dimensions[2]))));}staticinlineintmipLevelSize(int mipLevel,int baseLevelSize){returnstd::floor(double(qMax(1, baseLevelSize >> mipLevel)));}boolisUsingImmutableStorage()const; QOpenGLTexture *q_ptr; QOpenGLContext *context;QOpenGLTexture::Target target;QOpenGLTexture::BindingTarget bindingTarget; GLuint textureId;QOpenGLTexture::TextureFormat format;QOpenGLTexture::TextureFormatClass formatClass;int dimensions[3];int requestedMipLevels;int mipLevels;int layers;int faces;int samples;bool fixedSamplePositions;int baseLevel;int maxLevel;QOpenGLTexture::SwizzleValue swizzleMask[4];QOpenGLTexture::DepthStencilMode depthStencilMode;QOpenGLTexture::ComparisonFunction comparisonFunction;QOpenGLTexture::ComparisonMode comparisonMode;QOpenGLTexture::Filter minFilter;QOpenGLTexture::Filter magFilter;float maxAnisotropy;QOpenGLTexture::WrapMode wrapModes[3]; QVariantList borderColor;float minLevelOfDetail;float maxLevelOfDetail;float levelOfDetailBias;bool textureView;bool autoGenerateMipMaps;bool storageAllocated; QOpenGLTextureHelper *texFuncs; QOpenGLFunctions *functions;QOpenGLTexture::Features features;}; QT_END_NAMESPACE #undef Q_CALL_MEMBER_FUNCTION#endif// QT_NO_OPENGL#endif// QABSTRACTOPENGLTEXTURE_P_H
|