1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QSGTEXTUREMATERIAL_H
5#define QSGTEXTUREMATERIAL_H
6
7#include <QtQuick/qsgmaterial.h>
8#include <QtQuick/qsgtexture.h>
9
10QT_BEGIN_NAMESPACE
11
12class Q_QUICK_EXPORT QSGOpaqueTextureMaterial : public QSGMaterial
13{
14public:
15 QSGOpaqueTextureMaterial();
16
17 QSGMaterialType *type() const override;
18 QSGMaterialShader *createShader(QSGRendererInterface::RenderMode renderMode) const override;
19 int compare(const QSGMaterial *other) const override;
20
21 void setTexture(QSGTexture *texture);
22 QSGTexture *texture() const { return m_texture; }
23
24 void setMipmapFiltering(QSGTexture::Filtering filteringType) { m_mipmap_filtering = filteringType; }
25 QSGTexture::Filtering mipmapFiltering() const { return QSGTexture::Filtering(m_mipmap_filtering); }
26
27 void setFiltering(QSGTexture::Filtering filteringType) { m_filtering = filteringType; }
28 QSGTexture::Filtering filtering() const { return QSGTexture::Filtering(m_filtering); }
29
30 void setHorizontalWrapMode(QSGTexture::WrapMode mode) { m_horizontal_wrap = mode; }
31 QSGTexture::WrapMode horizontalWrapMode() const { return QSGTexture::WrapMode(m_horizontal_wrap); }
32
33 void setVerticalWrapMode(QSGTexture::WrapMode mode) { m_vertical_wrap = mode; }
34 QSGTexture::WrapMode verticalWrapMode() const { return QSGTexture::WrapMode(m_vertical_wrap); }
35
36 void setAnisotropyLevel(QSGTexture::AnisotropyLevel level) { m_anisotropy_level = level; }
37 QSGTexture::AnisotropyLevel anisotropyLevel() const { return QSGTexture::AnisotropyLevel(m_anisotropy_level); }
38
39protected:
40 QSGTexture *m_texture;
41
42 uint m_filtering: 2;
43 uint m_mipmap_filtering: 2;
44 uint m_horizontal_wrap : 1;
45 uint m_vertical_wrap: 1;
46 uint m_anisotropy_level : 3;
47 uint m_reserved : 23;
48};
49
50
51class Q_QUICK_EXPORT QSGTextureMaterial : public QSGOpaqueTextureMaterial
52{
53public:
54 QSGMaterialType *type() const override;
55 QSGMaterialShader *createShader(QSGRendererInterface::RenderMode renderMode) const override;
56};
57
58QT_END_NAMESPACE
59
60#endif
61

source code of qtdeclarative/src/quick/scenegraph/util/qsgtexturematerial.h