375d4849cf980d07fe2650f326c61aae3ae8014a
[profile/ivi/qtdeclarative.git] / src / declarative / scenegraph / util / qsgtexturematerial.h
1 /****************************************************************************
2 **
3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
4 ** All rights reserved.
5 ** Contact: Nokia Corporation (qt-info@nokia.com)
6 **
7 ** This file is part of the QtDeclarative module of the Qt Toolkit.
8 **
9 ** $QT_BEGIN_LICENSE:LGPL$
10 ** No Commercial Usage
11 ** This file contains pre-release code and may not be distributed.
12 ** You may use this file in accordance with the terms and conditions
13 ** contained in the Technology Preview License Agreement accompanying
14 ** this package.
15 **
16 ** GNU Lesser General Public License Usage
17 ** Alternatively, this file may be used under the terms of the GNU Lesser
18 ** General Public License version 2.1 as published by the Free Software
19 ** Foundation and appearing in the file LICENSE.LGPL included in the
20 ** packaging of this file.  Please review the following information to
21 ** ensure the GNU Lesser General Public License version 2.1 requirements
22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
23 **
24 ** In addition, as a special exception, Nokia gives you certain additional
25 ** rights.  These rights are described in the Nokia Qt LGPL Exception
26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
27 **
28 ** If you have questions regarding the use of this file, please contact
29 ** Nokia at qt-info@nokia.com.
30 **
31 **
32 **
33 **
34 **
35 **
36 **
37 **
38 ** $QT_END_LICENSE$
39 **
40 ****************************************************************************/
41
42 #ifndef TEXTUREMATERIAL_H
43 #define TEXTUREMATERIAL_H
44
45 #include "qsgmaterial.h"
46 #include <qsgtexture.h>
47
48 QT_BEGIN_HEADER
49
50 QT_BEGIN_NAMESPACE
51
52 QT_MODULE(Declarative)
53
54
55 class Q_DECLARATIVE_EXPORT QSGOpaqueTextureMaterial : public QSGMaterial
56 {
57 public:
58     QSGOpaqueTextureMaterial();
59
60     virtual QSGMaterialType *type() const;
61     virtual QSGMaterialShader *createShader() const;
62     virtual int compare(const QSGMaterial *other) const;
63
64     void setTexture(QSGTexture *texture);
65     QSGTexture *texture() const { return m_texture; }
66
67     void setMipmapFiltering(QSGTexture::Filtering filtering) { m_mipmap_filtering = filtering; }
68     QSGTexture::Filtering mipmapFiltering() const { return (QSGTexture::Filtering) m_mipmap_filtering; }
69
70     void setFiltering(QSGTexture::Filtering filtering) { m_filtering = filtering; }
71     QSGTexture::Filtering filtering() const { return (QSGTexture::Filtering)  m_filtering; }
72
73     void setHorizontalWrapMode(QSGTexture::WrapMode mode) { m_horizontal_wrap = mode; }
74     QSGTexture::WrapMode horizontalWrapMode() const { return (QSGTexture::WrapMode) m_horizontal_wrap; }
75
76     void setVerticalWrapMode(QSGTexture::WrapMode mode) { m_vertical_wrap = mode; }
77     QSGTexture::WrapMode verticalWrapMode() const { return (QSGTexture::WrapMode) m_vertical_wrap; }
78
79 protected:
80     QSGTexture *m_texture;
81
82     uint m_filtering: 2;
83     uint m_mipmap_filtering: 2;
84     uint m_horizontal_wrap : 1;
85     uint m_vertical_wrap: 1;
86
87     uint m_reserved : 26;
88 };
89
90
91 class Q_DECLARATIVE_EXPORT QSGTextureMaterial : public QSGOpaqueTextureMaterial
92 {
93 public:
94     virtual QSGMaterialType *type() const;
95     virtual QSGMaterialShader *createShader() const;
96 };
97
98 QT_END_NAMESPACE
99
100 QT_END_HEADER
101
102 #endif // TEXTUREMATERIAL_H