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#ifndef QT3DRENDER_QTEXTUREDATAUPDATE_H
5#define QT3DRENDER_QTEXTUREDATAUPDATE_H
6
7#include <Qt3DRender/qt3drender_global.h>
8#include <Qt3DRender/qabstracttexture.h>
9
10#include <QtCore/qshareddata.h>
11
12QT_BEGIN_NAMESPACE
13
14namespace Qt3DRender {
15
16class QTextureDataUpdate;
17class QTextureDataUpdatePrivate;
18
19Q_3DRENDERSHARED_EXPORT bool operator==(const QTextureDataUpdate &lhs, const QTextureDataUpdate &rhs) noexcept;
20
21class Q_3DRENDERSHARED_EXPORT QTextureDataUpdate
22{
23public:
24 QTextureDataUpdate();
25 QTextureDataUpdate(const QTextureDataUpdate &other);
26 QTextureDataUpdate &operator=(const QTextureDataUpdate &other);
27 QTextureDataUpdate &operator=(QTextureDataUpdate &&other) noexcept
28 { swap(other); return *this; }
29 ~QTextureDataUpdate();
30
31 void swap(QTextureDataUpdate &other) noexcept { d_ptr.swap(other&: other.d_ptr); }
32
33 int x() const;
34 int y() const;
35 int z() const;
36 int layer() const;
37 int mipLevel() const;
38 QAbstractTexture::CubeMapFace face() const;
39 QTextureImageDataPtr data() const;
40
41 void setX(int x);
42 void setY(int y);
43 void setZ(int z);
44 void setLayer(int layer);
45 void setMipLevel(int mipLevel);
46 void setFace(QAbstractTexture::CubeMapFace face);
47 void setData(const QTextureImageDataPtr &data);
48
49private:
50 friend Q_3DRENDERSHARED_EXPORT bool operator==(const QTextureDataUpdate &lhs, const QTextureDataUpdate &rhs) noexcept;
51 Q_DECLARE_PRIVATE(QTextureDataUpdate)
52 QExplicitlySharedDataPointer<QTextureDataUpdatePrivate> d_ptr;
53};
54QT3D_DECLARE_TYPEINFO(Qt3DRender, QTextureDataUpdate, Q_RELOCATABLE_TYPE)
55
56inline bool operator!=(const QTextureDataUpdate &lhs, const QTextureDataUpdate &rhs) noexcept
57{ return !operator==(lhs, rhs); }
58
59inline void swap(QTextureDataUpdate &lhs, QTextureDataUpdate &rhs) noexcept { return lhs.swap(other&: rhs); }
60
61} // Qt3DRender
62
63QT_END_NAMESPACE
64
65Q_DECLARE_METATYPE(Qt3DRender::QTextureDataUpdate)
66
67
68#endif // QT3DRENDER_QTEXTUREDATAUPDATE_H
69

source code of qt3d/src/render/texture/qtexturedataupdate.h