1// Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#include "qtexturewrapmode.h"
5#include <private/qobject_p.h>
6
7QT_BEGIN_NAMESPACE
8
9namespace Qt3DRender {
10
11class QTextureWrapModePrivate : public QObjectPrivate
12{
13public:
14 QTextureWrapModePrivate()
15 : QObjectPrivate()
16 , m_x(QTextureWrapMode::ClampToEdge)
17 , m_y(QTextureWrapMode::ClampToEdge)
18 , m_z(QTextureWrapMode::ClampToEdge)
19 {
20 }
21
22 Q_DECLARE_PUBLIC(QTextureWrapMode)
23 QTextureWrapMode::WrapMode m_x;
24 QTextureWrapMode::WrapMode m_y;
25 QTextureWrapMode::WrapMode m_z;
26};
27
28/*!
29 \class Qt3DRender::QTextureWrapMode
30 \inmodule Qt3DRender
31 \since 5.5
32
33 \brief Defines the wrap mode a Qt3DRender::QAbstractTexture
34 should apply to a texture.
35 */
36
37QTextureWrapMode::QTextureWrapMode(WrapMode wrapMode, QObject *parent)
38 : QObject(*new QTextureWrapModePrivate, parent)
39{
40 d_func()->m_x = wrapMode;
41 d_func()->m_y = wrapMode;
42 d_func()->m_z = wrapMode;
43}
44
45/*!
46 Contrusts a new Qt3DRender::QTextureWrapMode instance with the wrap mode to apply to
47 each dimension \a x, \a y \a z of the texture and \a parent as parent.
48 */
49QTextureWrapMode::QTextureWrapMode(WrapMode x,WrapMode y, WrapMode z, QObject *parent)
50 : QObject(*new QTextureWrapModePrivate, parent)
51{
52 d_func()->m_x = x;
53 d_func()->m_y = y;
54 d_func()->m_z = z;
55}
56
57/*! \internal */
58QTextureWrapMode::~QTextureWrapMode()
59{
60}
61
62/*!
63 Sets the wrap mode of the x dimension to \a x.
64 */
65void QTextureWrapMode::setX(WrapMode x)
66{
67 Q_D(QTextureWrapMode);
68 if (d->m_x != x) {
69 d->m_x = x;
70 emit xChanged(x);
71 }
72}
73
74/*!
75 \property QTextureWrapMode::x
76
77 Returns the wrap mode of the x dimension.
78 */
79QTextureWrapMode::WrapMode QTextureWrapMode::x() const
80{
81 Q_D(const QTextureWrapMode);
82 return d->m_x;
83}
84
85/*!
86 \enum Qt3DRender::QTextureWrapMode::WrapMode
87
88 Specifies the type of text wrapping.
89 Possible values:
90
91 \value Repeat
92 \value MirroredRepeat
93 \value ClampToEdge
94 \value ClampToBorder
95*/
96
97
98/*!
99 Sets the wrap mode of the y dimension to \a y.
100 \note this is not available on 1D textures.
101 */
102void QTextureWrapMode::setY(WrapMode y)
103{
104 Q_D(QTextureWrapMode);
105 if (d->m_y != y) {
106 d->m_y = y;
107 emit yChanged(y);
108 }
109}
110
111/*!
112 \property QTextureWrapMode::y
113
114 Returns the wrap mode of the y dimension.
115 */
116QTextureWrapMode::WrapMode QTextureWrapMode::y() const
117{
118 Q_D(const QTextureWrapMode);
119 return d->m_y;
120}
121
122/*!
123 Sets the wrap mode of the z dimension to \a z.
124 \note this is only available on 3D textures.
125 */
126void QTextureWrapMode::setZ(WrapMode z)
127{
128 Q_D(QTextureWrapMode);
129 if (d->m_z != z) {
130 d->m_z = z;
131 emit zChanged(z);
132 }
133}
134
135/*!
136 \property QTextureWrapMode::z
137
138 Returns the wrap mode of the z dimension.
139 */
140QTextureWrapMode::WrapMode QTextureWrapMode::z() const
141{
142 Q_D(const QTextureWrapMode);
143 return d->m_z;
144}
145
146} // namespace Qt3DRender
147
148QT_END_NAMESPACE
149
150#include "moc_qtexturewrapmode.cpp"
151

source code of qt3d/src/render/texture/qtexturewrapmode.cpp