51 OwnedByParent = 0x0001,
52 UsePreprocess = 0x0002,
57 OwnsGeometry = 0x00010000,
58 OwnsMaterial = 0x00020000,
59 OwnsOpaqueMaterial = 0x00040000,
62 IsVisitableNode = 0x01000000
64 , InternalReserved = 0x01000000
67 Q_DECLARE_FLAGS(Flags, Flag)
70 DirtySubtreeBlocked = 0x0080,
72 DirtyNodeAdded = 0x0400,
73 DirtyNodeRemoved = 0x0800,
74 DirtyGeometry = 0x1000,
75 DirtyMaterial = 0x2000,
76 DirtyOpacity = 0x4000,
78 DirtyForceUpdate = 0x8000,
80 DirtyUsePreprocess = UsePreprocess,
82 DirtyPropagationMask = DirtyMatrix
88 Q_DECLARE_FLAGS(DirtyState, DirtyStateBit)
93 QSGNode *parent()
const {
return m_parent; }
95 void removeChildNode(QSGNode *node);
96 void removeAllChildNodes();
97 void prependChildNode(QSGNode *node);
98 void appendChildNode(QSGNode *node);
99 void insertChildNodeBefore(QSGNode *node, QSGNode *before);
100 void insertChildNodeAfter(QSGNode *node, QSGNode *after);
101 void reparentChildNodesTo(QSGNode *newParent);
103 int childCount()
const;
104 QSGNode *childAtIndex(
int i)
const;
105 QSGNode *firstChild()
const {
return m_firstChild; }
106 QSGNode *lastChild()
const {
return m_lastChild; }
107 QSGNode *nextSibling()
const {
return m_nextSibling; }
108 QSGNode* previousSibling()
const {
return m_previousSibling; }
110 inline NodeType type()
const {
return m_type; }
112 QT_DEPRECATED
void clearDirty() { }
113 void markDirty(DirtyState bits);
114 QT_DEPRECATED DirtyState dirtyState()
const {
return { }; }
116 virtual bool isSubtreeBlocked()
const;
118 Flags flags()
const {
return m_nodeFlags; }
119 void setFlag(Flag,
bool =
true);
120 void setFlags(Flags,
bool =
true);
122 virtual void preprocess() { }
125 QSGNode(NodeType type);
126 QSGNode(QSGNodePrivate &dd, NodeType type);
129 friend class QSGRootNode;
130 friend class QSGBatchRenderer::Renderer;
131 friend class QSGRenderer;
136 QSGNode *m_parent =
nullptr;
137 NodeType m_type = BasicNodeType;
138 QSGNode *m_firstChild =
nullptr;
139 QSGNode *m_lastChild =
nullptr;
140 QSGNode *m_nextSibling =
nullptr;
141 QSGNode *m_previousSibling =
nullptr;
142 int m_subtreeRenderableCount = 0;
147 friend class QSGNodePrivate;
149 QScopedPointer<QSGNodePrivate> d_ptr;
157 ~QSGBasicGeometryNode() override;
159 void setGeometry(QSGGeometry *geometry);
160 const QSGGeometry *geometry()
const {
return m_geometry; }
161 QSGGeometry *geometry() {
return m_geometry; }
163 const QMatrix4x4 *matrix()
const {
return m_matrix; }
164 const QSGClipNode *clipList()
const {
return m_clip_list; }
166 void setRendererMatrix(
const QMatrix4x4 *m) { m_matrix = m; }
167 void setRendererClipList(
const QSGClipNode *c) { m_clip_list = c; }
170 QSGBasicGeometryNode(NodeType type);
171 QSGBasicGeometryNode(QSGBasicGeometryNodePrivate &dd, NodeType type);
174 friend class QSGNodeUpdater;
176 QSGGeometry *m_geometry;
178 Q_DECL_UNUSED_MEMBER
int m_reserved_start_index;
179 Q_DECL_UNUSED_MEMBER
int m_reserved_end_index;
181 const QMatrix4x4 *m_matrix;
182 const QSGClipNode *m_clip_list;
191 ~QSGGeometryNode() override;
193 void setMaterial(QSGMaterial *material);
194 QSGMaterial *material()
const {
return m_material; }
196 void setOpaqueMaterial(QSGMaterial *material);
197 QSGMaterial *opaqueMaterial()
const {
return m_opaque_material; }
199 QSGMaterial *activeMaterial()
const;
201 void setRenderOrder(
int order);
202 int renderOrder()
const {
return m_render_order; }
204 void setInheritedOpacity(qreal opacity);
205 qreal inheritedOpacity()
const {
return m_opacity; }
208 QSGGeometryNode(QSGGeometryNodePrivate &dd);
211 friend class QSGNodeUpdater;
213 int m_render_order = 0;
214 QSGMaterial *m_material =
nullptr;
215 QSGMaterial *m_opaque_material =
nullptr;
296 virtual ~QSGNodeVisitor();
299 virtual void enterTransformNode(QSGTransformNode *) {}
300 virtual void leaveTransformNode(QSGTransformNode *) {}
301 virtual void enterClipNode(QSGClipNode *) {}
302 virtual void leaveClipNode(QSGClipNode *) {}
303 virtual void enterGeometryNode(QSGGeometryNode *) {}
304 virtual void leaveGeometryNode(QSGGeometryNode *) {}
305 virtual void enterOpacityNode(QSGOpacityNode *) {}
306 virtual void leaveOpacityNode(QSGOpacityNode *) {}
307 virtual void visitNode(QSGNode *n);
308 virtual void visitChildren(QSGNode *n);