52 OwnedByParent = 0x0001,
53 UsePreprocess = 0x0002,
58 OwnsGeometry = 0x00010000,
59 OwnsMaterial = 0x00020000,
60 OwnsOpaqueMaterial = 0x00040000,
63 IsVisitableNode = 0x01000000
65 , InternalReserved = 0x01000000
68 Q_DECLARE_FLAGS(Flags, Flag)
71 DirtySubtreeBlocked = 0x0080,
73 DirtyNodeAdded = 0x0400,
74 DirtyNodeRemoved = 0x0800,
75 DirtyGeometry = 0x1000,
76 DirtyMaterial = 0x2000,
77 DirtyOpacity = 0x4000,
79 DirtyForceUpdate = 0x8000,
81 DirtyUsePreprocess = UsePreprocess,
83 DirtyPropagationMask = DirtyMatrix
89 Q_DECLARE_FLAGS(DirtyState, DirtyStateBit)
94 QSGNode *parent()
const {
return m_parent; }
96 void removeChildNode(QSGNode *node);
97 void removeAllChildNodes();
98 void prependChildNode(QSGNode *node);
99 void appendChildNode(QSGNode *node);
100 void insertChildNodeBefore(QSGNode *node, QSGNode *before);
101 void insertChildNodeAfter(QSGNode *node, QSGNode *after);
102 void reparentChildNodesTo(QSGNode *newParent);
104 int childCount()
const;
105 QSGNode *childAtIndex(
int i)
const;
106 QSGNode *firstChild()
const {
return m_firstChild; }
107 QSGNode *lastChild()
const {
return m_lastChild; }
108 QSGNode *nextSibling()
const {
return m_nextSibling; }
109 QSGNode* previousSibling()
const {
return m_previousSibling; }
111 inline NodeType type()
const {
return m_type; }
113 QT_DEPRECATED
void clearDirty() { }
114 void markDirty(DirtyState bits);
115 QT_DEPRECATED DirtyState dirtyState()
const {
return { }; }
117 virtual bool isSubtreeBlocked()
const;
119 Flags flags()
const {
return m_nodeFlags; }
120 void setFlag(Flag,
bool =
true);
121 void setFlags(Flags,
bool =
true);
123 virtual void preprocess() { }
126 QSGNode(NodeType type);
127 QSGNode(QSGNodePrivate &dd, NodeType type);
130 friend class QSGRootNode;
131 friend class QSGBatchRenderer::Renderer;
132 friend class QSGRenderer;
137 QSGNode *m_parent =
nullptr;
138 NodeType m_type = BasicNodeType;
139 QSGNode *m_firstChild =
nullptr;
140 QSGNode *m_lastChild =
nullptr;
141 QSGNode *m_nextSibling =
nullptr;
142 QSGNode *m_previousSibling =
nullptr;
143 int m_subtreeRenderableCount = 0;
148 friend class QSGNodePrivate;
150 QScopedPointer<QSGNodePrivate> d_ptr;
158 ~QSGBasicGeometryNode() override;
160 void setGeometry(QSGGeometry *geometry);
161 const QSGGeometry *geometry()
const {
return m_geometry; }
162 QSGGeometry *geometry() {
return m_geometry; }
164 const QMatrix4x4 *matrix()
const {
return m_matrix; }
165 const QSGClipNode *clipList()
const {
return m_clip_list; }
167 void setRendererMatrix(
const QMatrix4x4 *m) { m_matrix = m; }
168 void setRendererClipList(
const QSGClipNode *c) { m_clip_list = c; }
171 QSGBasicGeometryNode(NodeType type);
172 QSGBasicGeometryNode(QSGBasicGeometryNodePrivate &dd, NodeType type);
175 friend class QSGNodeUpdater;
177 QSGGeometry *m_geometry;
179 Q_DECL_UNUSED_MEMBER
int m_reserved_start_index;
180 Q_DECL_UNUSED_MEMBER
int m_reserved_end_index;
182 const QMatrix4x4 *m_matrix;
183 const QSGClipNode *m_clip_list;
192 ~QSGGeometryNode() override;
194 void setMaterial(QSGMaterial *material);
195 QSGMaterial *material()
const {
return m_material; }
197 void setOpaqueMaterial(QSGMaterial *material);
198 QSGMaterial *opaqueMaterial()
const {
return m_opaque_material; }
200 QSGMaterial *activeMaterial()
const;
202 void setRenderOrder(
int order);
203 int renderOrder()
const {
return m_render_order; }
205 void setInheritedOpacity(qreal opacity);
206 qreal inheritedOpacity()
const {
return m_opacity; }
209 QSGGeometryNode(QSGGeometryNodePrivate &dd);
212 friend class QSGNodeUpdater;
214 int m_render_order = 0;
215 QSGMaterial *m_material =
nullptr;
216 QSGMaterial *m_opaque_material =
nullptr;
297 virtual ~QSGNodeVisitor();
300 virtual void enterTransformNode(QSGTransformNode *) {}
301 virtual void leaveTransformNode(QSGTransformNode *) {}
302 virtual void enterClipNode(QSGClipNode *) {}
303 virtual void leaveClipNode(QSGClipNode *) {}
304 virtual void enterGeometryNode(QSGGeometryNode *) {}
305 virtual void leaveGeometryNode(QSGGeometryNode *) {}
306 virtual void enterOpacityNode(QSGOpacityNode *) {}
307 virtual void leaveOpacityNode(QSGOpacityNode *) {}
308 virtual void visitNode(QSGNode *n);
309 virtual void visitChildren(QSGNode *n);