1 | // Copyright (C) 2019 The Qt Company Ltd. |
---|---|
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only |
3 | |
4 | |
5 | #ifndef QSSGRENDERINDEXTABLE_P_H |
6 | #define QSSGRENDERINDEXTABLE_P_H |
7 | |
8 | |
9 | // |
10 | // W A R N I N G |
11 | // ------------- |
12 | // |
13 | // This file is not part of the Qt API. It exists purely as an |
14 | // implementation detail. This header file may change from version to |
15 | // version without notice, or even be removed. |
16 | // |
17 | // We mean it. |
18 | // |
19 | |
20 | #include <QtQuick3DRuntimeRender/private/qssgrendergraphobject_p.h> |
21 | |
22 | #include <QtGui/qvectornd.h> |
23 | #include <QtGui/qmatrix4x4.h> |
24 | |
25 | QT_BEGIN_NAMESPACE |
26 | |
27 | struct Q_QUICK3DRUNTIMERENDER_EXPORT QSSGRenderInstanceTableEntry { |
28 | QVector4D row0; |
29 | QVector4D row1; |
30 | QVector4D row2; |
31 | QVector4D color; |
32 | QVector4D instanceData; |
33 | }; |
34 | |
35 | struct Q_QUICK3DRUNTIMERENDER_EXPORT QSSGRenderInstanceTable : public QSSGRenderGraphObject |
36 | { |
37 | QSSGRenderInstanceTable() : QSSGRenderGraphObject(QSSGRenderGraphObject::Type::ModelInstance, FlagT(Flags::HasGraphicsResources)) {} |
38 | |
39 | int count() const { return instanceCount; } |
40 | qsizetype dataSize() const { return table.size(); } |
41 | const void *constData() const { return table.constData(); } |
42 | void setData(const QByteArray &data, int count, int stride) { table = data; instanceCount = count; instanceStride = stride; ++instanceSerial; } |
43 | void setInstanceCountOverride(int count) { instanceCount = count; } |
44 | int serial() const { return instanceSerial; } |
45 | int stride() const { return instanceStride; } |
46 | bool hasTransparency() { return transparency; } |
47 | void setHasTransparency( bool t) { transparency = t; } |
48 | void setDepthSorting(bool enable) { depthSorting = enable; } |
49 | bool isDepthSortingEnabled() { return depthSorting; } |
50 | QMatrix4x4 getTransform(int index) const; |
51 | |
52 | private: |
53 | int instanceCount = 0; |
54 | int instanceSerial = 0; |
55 | int instanceStride = 0; |
56 | bool transparency = false; |
57 | bool depthSorting = false; |
58 | QByteArray table; |
59 | }; |
60 | |
61 | QT_END_NAMESPACE |
62 | |
63 | #endif // QSSGRENDERINDEXTABLE_P_H |
64 |