1 /****************************************************************************
2 **
3 ** Copyright (C) 2008-2012 NVIDIA Corporation.
4 ** Copyright (C) 2019 The Qt Company Ltd.
5 ** Contact: https://www.qt.io/licensing/
6 **
7 ** This file is part of Qt Quick 3D.
8 **
9 ** $QT_BEGIN_LICENSE:GPL$
10 ** Commercial License Usage
11 ** Licensees holding valid commercial Qt licenses may use this file in
12 ** accordance with the commercial license agreement provided with the
13 ** Software or, alternatively, in accordance with the terms contained in
14 ** a written agreement between you and The Qt Company. For licensing terms
15 ** and conditions see https://www.qt.io/terms-conditions. For further
16 ** information use the contact form at https://www.qt.io/contact-us.
17 **
18 ** GNU General Public License Usage
19 ** Alternatively, this file may be used under the terms of the GNU
20 ** General Public License version 3 or (at your option) any later version
21 ** approved by the KDE Free Qt Foundation. The licenses are as published by
22 ** the Free Software Foundation and appearing in the file LICENSE.GPL3
23 ** included in the packaging of this file. Please review the following
24 ** information to ensure the GNU General Public License requirements will
25 ** be met: https://www.gnu.org/licenses/gpl-3.0.html.
26 **
27 ** $QT_END_LICENSE$
28 **
29 ****************************************************************************/
30 
31 #ifndef QSSG_RENDER_IMAGE_TEXTURE_DATA_H
32 #define QSSG_RENDER_IMAGE_TEXTURE_DATA_H
33 
34 //
35 //  W A R N I N G
36 //  -------------
37 //
38 // This file is not part of the Qt API.  It exists purely as an
39 // implementation detail.  This header file may change from version to
40 // version without notice, or even be removed.
41 //
42 // We mean it.
43 //
44 
45 #include <QtQuick3DRender/private/qssgrendertexture2d_p.h>
46 
47 QT_BEGIN_NAMESPACE
48 // forward declararion
49 class QSSGRenderPrefilterTexture;
50 
51 enum class QSSGImageTextureFlagValue
52 {
53     HasTransparency = 1,
54     InvertUVCoords = 1 << 1,
55     PreMultiplied = 1 << 2,
56 };
57 
58 struct QSSGRenderImageTextureFlags : public QFlags<QSSGImageTextureFlagValue>
59 {
hasTransparencyQSSGRenderImageTextureFlags60     bool hasTransparency() const { return this->operator&(QSSGImageTextureFlagValue::HasTransparency); }
setHasTransparencyQSSGRenderImageTextureFlags61     void setHasTransparency(bool inValue) { setFlag(QSSGImageTextureFlagValue::HasTransparency, inValue); }
62 
isInvertUVCoordsQSSGRenderImageTextureFlags63     bool isInvertUVCoords() const { return this->operator&(QSSGImageTextureFlagValue::InvertUVCoords); }
setInvertUVCoordsQSSGRenderImageTextureFlags64     void setInvertUVCoords(bool inValue) { setFlag(QSSGImageTextureFlagValue::InvertUVCoords, inValue); }
65 
isPreMultipliedQSSGRenderImageTextureFlags66     bool isPreMultiplied() const { return this->operator&(QSSGImageTextureFlagValue::PreMultiplied); }
setPreMultipliedQSSGRenderImageTextureFlags67     void setPreMultiplied(bool inValue) { setFlag(QSSGImageTextureFlagValue::PreMultiplied, inValue); }
68 };
69 
70 struct QSSGRenderImageTextureData
71 {
72     QSSGRef<QSSGRenderTexture2D> m_texture;
73     QSSGRenderImageTextureFlags m_textureFlags;
74     QSSGRef<QSSGRenderPrefilterTexture> m_bsdfMipMap;
75 
76     QSSGRenderImageTextureData();
77     ~QSSGRenderImageTextureData();
78 
79     bool operator!=(const QSSGRenderImageTextureData &inOther)
80     {
81         return m_texture != inOther.m_texture || m_textureFlags != inOther.m_textureFlags || m_bsdfMipMap != inOther.m_bsdfMipMap;
82     }
83 };
84 QT_END_NAMESPACE
85 
86 #endif
87