1 | // Copyright (C) 2019 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 "qtexturedataupdate.h" |
5 | #include "qtexturedataupdate_p.h" |
6 | #include <iostream> |
7 | |
8 | QT_BEGIN_NAMESPACE |
9 | |
10 | namespace Qt3DRender |
11 | { |
12 | |
13 | static bool operator==(const QTextureDataUpdatePrivate &lhs, const QTextureDataUpdatePrivate &rhs) noexcept |
14 | { |
15 | return lhs.m_x == rhs.m_x && |
16 | lhs.m_y == rhs.m_y && |
17 | lhs.m_z == rhs.m_z && |
18 | lhs.m_layer == rhs.m_layer && |
19 | lhs.m_mipLevel == rhs.m_mipLevel && |
20 | lhs.m_face == rhs.m_face && |
21 | lhs.m_data == rhs.m_data; |
22 | } |
23 | |
24 | /*! |
25 | \class Qt3DRender::QTextureDataUpdate |
26 | \inmodule Qt3DRender |
27 | \brief QTextureDataUpdate holds content and information required to perform |
28 | partial updates of a texture content. |
29 | |
30 | The actual data content is contained in a QTextureImageDataPtr member. |
31 | Additional members allow to specify the x, y, z offset of the content update |
32 | as well as the eventual layer, mipLevel and face. |
33 | |
34 | \sa QAbstractTexture |
35 | \since 5.14 |
36 | */ |
37 | |
38 | QTextureDataUpdate::QTextureDataUpdate() |
39 | : d_ptr(new QTextureDataUpdatePrivate()) |
40 | { |
41 | } |
42 | |
43 | QTextureDataUpdate::QTextureDataUpdate(const QTextureDataUpdate &other) |
44 | = default; |
45 | |
46 | QTextureDataUpdate &QTextureDataUpdate::operator=(const QTextureDataUpdate &other) |
47 | = default; |
48 | |
49 | QTextureDataUpdate::~QTextureDataUpdate() |
50 | = default; |
51 | |
52 | bool operator==(const QTextureDataUpdate &lhs, const QTextureDataUpdate &rhs) noexcept |
53 | { |
54 | return *lhs.d_func() == *rhs.d_func(); |
55 | } |
56 | |
57 | int QTextureDataUpdate::x() const |
58 | { |
59 | Q_D(const QTextureDataUpdate); |
60 | return d->m_x; |
61 | } |
62 | |
63 | int QTextureDataUpdate::y() const |
64 | { |
65 | Q_D(const QTextureDataUpdate); |
66 | return d->m_y; |
67 | } |
68 | |
69 | int QTextureDataUpdate::z() const |
70 | { |
71 | Q_D(const QTextureDataUpdate); |
72 | return d->m_z; |
73 | } |
74 | |
75 | int QTextureDataUpdate::layer() const |
76 | { |
77 | Q_D(const QTextureDataUpdate); |
78 | return d->m_layer; |
79 | } |
80 | |
81 | int QTextureDataUpdate::mipLevel() const |
82 | { |
83 | Q_D(const QTextureDataUpdate); |
84 | return d->m_mipLevel; |
85 | } |
86 | |
87 | QAbstractTexture::CubeMapFace QTextureDataUpdate::face() const |
88 | { |
89 | Q_D(const QTextureDataUpdate); |
90 | return d->m_face; |
91 | } |
92 | |
93 | QTextureImageDataPtr QTextureDataUpdate::data() const |
94 | { |
95 | Q_D(const QTextureDataUpdate); |
96 | return d->m_data; |
97 | } |
98 | |
99 | void QTextureDataUpdate::setX(int x) |
100 | { |
101 | d_ptr.detach(); |
102 | Q_D(QTextureDataUpdate); |
103 | d->m_x = x; |
104 | } |
105 | |
106 | void QTextureDataUpdate::setY(int y) |
107 | { |
108 | d_ptr.detach(); |
109 | Q_D(QTextureDataUpdate); |
110 | d->m_y = y; |
111 | } |
112 | |
113 | void QTextureDataUpdate::setZ(int z) |
114 | { |
115 | d_ptr.detach(); |
116 | Q_D(QTextureDataUpdate); |
117 | d->m_z = z; |
118 | } |
119 | |
120 | void QTextureDataUpdate::setLayer(int layer) |
121 | { |
122 | d_ptr.detach(); |
123 | Q_D(QTextureDataUpdate); |
124 | d->m_layer = layer; |
125 | } |
126 | |
127 | void QTextureDataUpdate::setMipLevel(int mipLevel) |
128 | { |
129 | d_ptr.detach(); |
130 | Q_D(QTextureDataUpdate); |
131 | d->m_mipLevel = mipLevel; |
132 | } |
133 | |
134 | void QTextureDataUpdate::setFace(QAbstractTexture::CubeMapFace face) |
135 | { |
136 | d_ptr.detach(); |
137 | Q_D(QTextureDataUpdate); |
138 | d->m_face = face; |
139 | } |
140 | |
141 | void QTextureDataUpdate::setData(const QTextureImageDataPtr &data) |
142 | { |
143 | d_ptr.detach(); |
144 | Q_D(QTextureDataUpdate); |
145 | d->m_data = data; |
146 | } |
147 | |
148 | } // Qt3DRender |
149 | |
150 | QT_END_NAMESPACE |
151 |