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/qssgrendernode_p.h>
21
22QT_BEGIN_NAMESPACE
23
24struct Q_QUICK3DRUNTIMERENDER_EXPORT QSSGRenderInstanceTableEntry {
25 QVector4D row0;
26 QVector4D row1;
27 QVector4D row2;
28 QVector4D color;
29 QVector4D instanceData;
30};
31
32struct Q_QUICK3DRUNTIMERENDER_EXPORT QSSGRenderInstanceTable : public QSSGRenderNode
33{
34 QSSGRenderInstanceTable() : QSSGRenderNode(QSSGRenderGraphObject::Type::ModelInstance) {}
35
36 int count() const { return instanceCount; }
37 qsizetype dataSize() const { return table.size(); }
38 const void *constData() const { return table.constData(); }
39 void setData(const QByteArray &data, int count, int stride) { table = data; instanceCount = count; instanceStride = stride; ++instanceSerial; }
40 void setInstanceCountOverride(int count) { instanceCount = count; }
41 int serial() const { return instanceSerial; }
42 int stride() const { return instanceStride; }
43 bool hasTransparency() { return transparency; }
44 void setHasTransparency( bool t) { transparency = t; }
45 void setDepthSorting(bool enable) { depthSorting = enable; }
46 bool isDepthSortingEnabled() { return depthSorting; }
47 QMatrix4x4 getTransform(int index) const;
48
49private:
50 int instanceCount = 0;
51 int instanceSerial = 0;
52 int instanceStride = 0;
53 bool transparency = false;
54 bool depthSorting = false;
55 QByteArray table;
56};
57
58QT_END_NAMESPACE
59
60#endif // QSSGRENDERINDEXTABLE_P_H
61

source code of qtquick3d/src/runtimerender/graphobjects/qssgrenderinstancetable_p.h