Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qssgrenderroot_p.h
Go to the documentation of this file.
1// Copyright (C) 2025 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4#ifndef QSSGRENDERROOT_P_H
5#define QSSGRENDERROOT_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QtQuick3DRuntimeRender/private/qssgrendernode_p.h>
19
20#include <QtGui/qmatrix4x4.h>
21
22#include <memory>
23
25
27
28class Q_QUICK3DRUNTIMERENDER_EXPORT QSSGRenderRoot final : public QSSGRenderNode
29{
30public:
31 QSSGRenderRoot();
32 ~QSSGRenderRoot();
33
34 enum class DirtyFlag : quint8
35 {
36 TreeDirty = 0x1
37 };
38 using FlagT = std::underlying_type_t<DirtyFlag>;
39
40 static constexpr DirtyFlag DirtyMask { std::numeric_limits<FlagT>::max() };
41
42 [[nodiscard]] bool isDirty(DirtyFlag dirtyFlag = DirtyMask) const
43 {
44 return ((m_rootDirtyFlags & FlagT(dirtyFlag)) != 0)
45 || ((dirtyFlag == DirtyMask) && QSSGRenderNode::isDirty());
46 }
47 void markDirty(DirtyFlag dirtyFlag);
48 void clearDirty(DirtyFlag dirtyFlag);
49
50 [[nodiscard]] const std::shared_ptr<QSSGGlobalRenderNodeData> &globalNodeData() const
51 {
52 return m_gnd;
53 }
54
55 // This is the starting point when indexing the nodes.
56 // By default it is 0, which means the first version when
57 // indexing will be 1. The start version can be set to a
58 // different value when needed. For example we'll set this
59 // to the last version of the layer node when the window
60 // changes, as that avoids accidentally re-using the same
61 // version when re-indexing the layer node, as that can cause
62 // issues.
63 void setStartVersion(quint32 startVersion)
64 {
65 m_startVersion = startVersion;
66 }
67
68 [[nodiscard]] quint32 startVersion() const
69 {
70 return m_startVersion;
71 }
72
73 [[nodiscard]] static QSSGRenderRoot *get(QSSGRenderRoot **ref)
74 {
75 return (ref && *ref) ? *ref : nullptr;
76 }
77
78 void reindex();
79
80private:
81 QSSGRenderRoot *self = this;
82 quint32 m_startVersion = 0;
83 std::shared_ptr<QSSGGlobalRenderNodeData> m_gnd;
84 FlagT m_rootDirtyFlags = FlagT(DirtyFlag::TreeDirty);
85};
86
87QT_END_NAMESPACE
88
89#endif // QSSGRENDERROOT_P_H