1 | /**************************************************************************** |
---|---|
2 | ** |
3 | ** Copyright (C) 2019 Klaralvdalens Datakonsult AB (KDAB). |
4 | ** Contact: https://www.qt.io/licensing/ |
5 | ** |
6 | ** This file is part of the Qt3D module of the Qt Toolkit. |
7 | ** |
8 | ** $QT_BEGIN_LICENSE:LGPL$ |
9 | ** Commercial License Usage |
10 | ** Licensees holding valid commercial Qt licenses may use this file in |
11 | ** accordance with the commercial license agreement provided with the |
12 | ** Software or, alternatively, in accordance with the terms contained in |
13 | ** a written agreement between you and The Qt Company. For licensing terms |
14 | ** and conditions see https://www.qt.io/terms-conditions. For further |
15 | ** information use the contact form at https://www.qt.io/contact-us. |
16 | ** |
17 | ** GNU Lesser General Public License Usage |
18 | ** Alternatively, this file may be used under the terms of the GNU Lesser |
19 | ** General Public License version 3 as published by the Free Software |
20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the |
21 | ** packaging of this file. Please review the following information to |
22 | ** ensure the GNU Lesser General Public License version 3 requirements |
23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. |
24 | ** |
25 | ** GNU General Public License Usage |
26 | ** Alternatively, this file may be used under the terms of the GNU |
27 | ** General Public License version 2.0 or (at your option) the GNU General |
28 | ** Public license version 3 or any later version approved by the KDE Free |
29 | ** Qt Foundation. The licenses are as published by the Free Software |
30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 |
31 | ** included in the packaging of this file. Please review the following |
32 | ** information to ensure the GNU General Public License requirements will |
33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and |
34 | ** https://www.gnu.org/licenses/gpl-3.0.html. |
35 | ** |
36 | ** $QT_END_LICENSE$ |
37 | ** |
38 | ****************************************************************************/ |
39 | |
40 | #include "qtexturedataupdate.h" |
41 | #include "qtexturedataupdate_p.h" |
42 | #include <iostream> |
43 | |
44 | QT_BEGIN_NAMESPACE |
45 | |
46 | namespace Qt3DRender |
47 | { |
48 | |
49 | static bool operator==(const QTextureDataUpdatePrivate &lhs, const QTextureDataUpdatePrivate &rhs) noexcept |
50 | { |
51 | return lhs.m_x == rhs.m_x && |
52 | lhs.m_y == rhs.m_y && |
53 | lhs.m_z == rhs.m_z && |
54 | lhs.m_layer == rhs.m_layer && |
55 | lhs.m_mipLevel == rhs.m_mipLevel && |
56 | lhs.m_face == rhs.m_face && |
57 | lhs.m_data == rhs.m_data; |
58 | } |
59 | |
60 | /*! |
61 | \class Qt3DRender::QTextureDataUpdate |
62 | \inmodule Qt3DRender |
63 | \brief QTextureDataUpdate holds content and information required to perform |
64 | partial updates of a texture content. |
65 | |
66 | The actual data content is contained in a QTextureImageDataPtr member. |
67 | Additional members allow to specify the x, y, z offset of the content update |
68 | as well as the eventual layer, mipLevel and face. |
69 | |
70 | \sa QAbstractTexture |
71 | \since 5.14 |
72 | */ |
73 | |
74 | QTextureDataUpdate::QTextureDataUpdate() |
75 | : d_ptr(new QTextureDataUpdatePrivate()) |
76 | { |
77 | } |
78 | |
79 | QTextureDataUpdate::QTextureDataUpdate(const QTextureDataUpdate &other) |
80 | = default; |
81 | |
82 | QTextureDataUpdate &QTextureDataUpdate::operator=(const QTextureDataUpdate &other) |
83 | = default; |
84 | |
85 | QTextureDataUpdate::~QTextureDataUpdate() |
86 | = default; |
87 | |
88 | bool operator==(const QTextureDataUpdate &lhs, const QTextureDataUpdate &rhs) noexcept |
89 | { |
90 | return *lhs.d_func() == *rhs.d_func(); |
91 | } |
92 | |
93 | int QTextureDataUpdate::x() const |
94 | { |
95 | Q_D(const QTextureDataUpdate); |
96 | return d->m_x; |
97 | } |
98 | |
99 | int QTextureDataUpdate::y() const |
100 | { |
101 | Q_D(const QTextureDataUpdate); |
102 | return d->m_y; |
103 | } |
104 | |
105 | int QTextureDataUpdate::z() const |
106 | { |
107 | Q_D(const QTextureDataUpdate); |
108 | return d->m_z; |
109 | } |
110 | |
111 | int QTextureDataUpdate::layer() const |
112 | { |
113 | Q_D(const QTextureDataUpdate); |
114 | return d->m_layer; |
115 | } |
116 | |
117 | int QTextureDataUpdate::mipLevel() const |
118 | { |
119 | Q_D(const QTextureDataUpdate); |
120 | return d->m_mipLevel; |
121 | } |
122 | |
123 | QAbstractTexture::CubeMapFace QTextureDataUpdate::face() const |
124 | { |
125 | Q_D(const QTextureDataUpdate); |
126 | return d->m_face; |
127 | } |
128 | |
129 | QTextureImageDataPtr QTextureDataUpdate::data() const |
130 | { |
131 | Q_D(const QTextureDataUpdate); |
132 | return d->m_data; |
133 | } |
134 | |
135 | void QTextureDataUpdate::setX(int x) |
136 | { |
137 | d_ptr.detach(); |
138 | Q_D(QTextureDataUpdate); |
139 | d->m_x = x; |
140 | } |
141 | |
142 | void QTextureDataUpdate::setY(int y) |
143 | { |
144 | d_ptr.detach(); |
145 | Q_D(QTextureDataUpdate); |
146 | d->m_y = y; |
147 | } |
148 | |
149 | void QTextureDataUpdate::setZ(int z) |
150 | { |
151 | d_ptr.detach(); |
152 | Q_D(QTextureDataUpdate); |
153 | d->m_z = z; |
154 | } |
155 | |
156 | void QTextureDataUpdate::setLayer(int layer) |
157 | { |
158 | d_ptr.detach(); |
159 | Q_D(QTextureDataUpdate); |
160 | d->m_layer = layer; |
161 | } |
162 | |
163 | void QTextureDataUpdate::setMipLevel(int mipLevel) |
164 | { |
165 | d_ptr.detach(); |
166 | Q_D(QTextureDataUpdate); |
167 | d->m_mipLevel = mipLevel; |
168 | } |
169 | |
170 | void QTextureDataUpdate::setFace(QAbstractTexture::CubeMapFace face) |
171 | { |
172 | d_ptr.detach(); |
173 | Q_D(QTextureDataUpdate); |
174 | d->m_face = face; |
175 | } |
176 | |
177 | void QTextureDataUpdate::setData(const QTextureImageDataPtr &data) |
178 | { |
179 | d_ptr.detach(); |
180 | Q_D(QTextureDataUpdate); |
181 | d->m_data = data; |
182 | } |
183 | |
184 | } // Qt3DRender |
185 | |
186 | QT_END_NAMESPACE |
187 |