212 : m_nodeFlags(OwnedByParent)
229 , m_subtreeRenderableCount(
type == GeometryNodeType ||
type == RenderNodeType ? 1 : 0)
230 , m_nodeFlags(OwnedByParent)
247 , m_subtreeRenderableCount(
type == GeometryNodeType ||
type == RenderNodeType ? 1 : 0)
248 , m_nodeFlags(OwnedByParent)
260 if (lcQsgLeak().isDebugEnabled()) {
262 static bool atexit_registered =
false;
263 if (!atexit_registered) {
265 atexit_registered =
true;
270#ifdef QSG_RUNTIME_DESCRIPTION
285 if (lcQsgLeak().isDebugEnabled()) {
288 qCDebug(lcQsgLeak,
"Node destroyed after qt_print_node_count() was called.");
342void QSGNode::destroy()
348 while (m_firstChild) {
356 Q_ASSERT(m_firstChild ==
nullptr && m_lastChild ==
nullptr);
370 Q_ASSERT_X(!node->m_parent,
"QSGNode::prependChildNode",
"QSGNode already has a parent");
375 Q_ASSERT_X(
g->material(),
"QSGNode::prependChildNode",
"QSGGeometryNode is missing material");
376 Q_ASSERT_X(
g->geometry(),
"QSGNode::prependChildNode",
"QSGGeometryNode is missing geometry");
381 m_firstChild->m_previousSibling = node;
384 node->m_nextSibling = m_firstChild;
386 node->m_parent =
this;
401 Q_ASSERT_X(!node->m_parent,
"QSGNode::appendChildNode",
"QSGNode already has a parent");
406 Q_ASSERT_X(
g->material(),
"QSGNode::appendChildNode",
"QSGGeometryNode is missing material");
407 Q_ASSERT_X(
g->geometry(),
"QSGNode::appendChildNode",
"QSGGeometryNode is missing geometry");
412 m_lastChild->m_nextSibling = node;
415 node->m_previousSibling = m_lastChild;
417 node->m_parent =
this;
434 Q_ASSERT_X(!node->m_parent,
"QSGNode::insertChildNodeBefore",
"QSGNode already has a parent");
435 Q_ASSERT_X(before && before->m_parent ==
this,
"QSGNode::insertChildNodeBefore",
"The parent of \'before\' is wrong");
440 Q_ASSERT_X(
g->material(),
"QSGNode::insertChildNodeBefore",
"QSGGeometryNode is missing material");
441 Q_ASSERT_X(
g->geometry(),
"QSGNode::insertChildNodeBefore",
"QSGGeometryNode is missing geometry");
445 QSGNode *previous = before->m_previousSibling;
447 previous->m_nextSibling = node;
450 node->m_previousSibling = previous;
451 node->m_nextSibling = before;
452 before->m_previousSibling = node;
453 node->m_parent =
this;
470 Q_ASSERT_X(!node->m_parent,
"QSGNode::insertChildNodeAfter",
"QSGNode already has a parent");
471 Q_ASSERT_X(after && after->m_parent ==
this,
"QSGNode::insertChildNodeAfter",
"The parent of \'after\' is wrong");
476 Q_ASSERT_X(
g->material(),
"QSGNode::insertChildNodeAfter",
"QSGGeometryNode is missing material");
477 Q_ASSERT_X(
g->geometry(),
"QSGNode::insertChildNodeAfter",
"QSGGeometryNode is missing geometry");
483 next->m_previousSibling = node;
486 node->m_nextSibling =
next;
487 node->m_previousSibling = after;
488 after->m_nextSibling = node;
489 node->m_parent =
this;
505 QSGNode *previous = node->m_previousSibling;
508 previous->m_nextSibling =
next;
512 next->m_previousSibling = previous;
514 m_lastChild = previous;
515 node->m_previousSibling =
nullptr;
516 node->m_nextSibling =
nullptr;
519 node->m_parent =
nullptr;
529 while (m_firstChild) {
531 m_firstChild = node->m_nextSibling;
532 node->m_nextSibling =
nullptr;
534 m_firstChild->m_previousSibling =
nullptr;
536 m_lastChild =
nullptr;
538 node->m_parent =
nullptr;
562 n =
n->m_nextSibling;
573 n =
n->m_nextSibling;
588 if (
bool(m_nodeFlags &
f) ==
enabled)
607 Flags oldFlags = m_nodeFlags;
626 int renderableCountDiff = 0;
628 renderableCountDiff += m_subtreeRenderableCount;
630 renderableCountDiff -= m_subtreeRenderableCount;
634 p->m_subtreeRenderableCount += renderableCountDiff;
643#ifdef QSG_RUNTIME_DESCRIPTION
858 delete m_opaque_material;
912 m_render_order =
order;
933 if (m_material !=
nullptr && m_opaque_material == m_material)
934 qWarning(
"QSGGeometryNode: using same material for both opaque and translucent");
961 delete m_opaque_material;
964 if (m_opaque_material !=
nullptr && m_opaque_material == m_material)
965 qWarning(
"QSGGeometryNode: using same material for both opaque and translucent");
989 if (m_opaque_material && m_opacity > 0.999)
990 return m_opaque_material;
1006 Q_ASSERT(opacity >= 0 && opacity <= 1);
1007 m_opacity = opacity;
1041 , m_is_rectangular(
false)
1083 m_is_rectangular = rectHint;
1190 m_combined_matrix =
matrix;
1227 while (!m_renderers.
isEmpty())
1239void QSGRootNode::notifyNodeChange(
QSGNode *node, DirtyState
state)
1241 for (
int i=0;
i<m_renderers.
size(); ++
i) {
1387 switch (
n->type()) {
1424#ifndef QT_NO_DEBUG_STREAM
1428 d <<
"Geometry(null)";
1439 switch (
g->drawingMode()) {
1449 float x1 = 1e10,
x2 = -1e10,
y1=1e10,
y2=-1e10;
1450 int stride =
g->sizeOfVertex();
1451 for (
int i = 0;
i <
g->vertexCount(); ++
i) {
1461 d <<
"x1=" <<
x1 <<
"y1=" <<
y1 <<
"x2=" <<
x2 <<
"y2=" <<
y2;
1466 d <<
"materialtype=" <<
n->material()->type();
1470#ifdef QSG_RUNTIME_DESCRIPTION
1479 d <<
"ClipNode(null)";
1484 if (
n->childCount())
1485 d <<
"children=" <<
n->childCount();
1487 d <<
"is rect?" << (
n->isRectangular() ?
"yes" :
"no");
1490#ifdef QSG_RUNTIME_DESCRIPTION
1493 d << (
n->isSubtreeBlocked() ?
"*BLOCKED*" :
"");
1500 d <<
"TransformNode(null)";
1504 d <<
"TransformNode(";
1508 else if (
m.determinant() == 1 &&
m(0, 0) == 1 &&
m(1, 1) == 1 &&
m(2, 2) == 1)
1509 d <<
"translate" <<
m(0, 3) <<
m(1, 3) <<
m(2, 3);
1511 d <<
"det=" <<
n->matrix().determinant();
1512#ifdef QSG_RUNTIME_DESCRIPTION
1515 d << (
n->isSubtreeBlocked() ?
"*BLOCKED*" :
"");
1523 d <<
"OpacityNode(null)";
1526 d <<
"OpacityNode(";
1528 d <<
"opacity=" <<
n->opacity()
1529 <<
"combined=" <<
n->combinedOpacity()
1530 << (
n->isSubtreeBlocked() ?
"*BLOCKED*" :
"");
1531#ifdef QSG_RUNTIME_DESCRIPTION
1542 d <<
"RootNode(null)";
1546 d <<
"RootNode" <<
Qt::hex << (
const void *)
n << (
n->isSubtreeBlocked() ?
"*BLOCKED*" :
"");
1547#ifdef QSG_RUNTIME_DESCRIPTION
1562 switch (
n->type()) {
1564 d << static_cast<const QSGGeometryNode *>(
n);
1567 d << static_cast<const QSGTransformNode *>(
n);
1570 d << static_cast<const QSGClipNode *>(
n);
1573 d << static_cast<const QSGRootNode *>(
n);
1576 d << static_cast<const QSGOpacityNode *>(
n);
1580 <<
"flags=" << (
int)
n->flags() <<
Qt::dec
1581 << (
n->isSubtreeBlocked() ?
"*BLOCKED*" :
"");
1582#ifdef QSG_RUNTIME_DESCRIPTION
1589 <<
"flags=" << (
int)
n->flags() <<
Qt::dec
1590 << (
n->isSubtreeBlocked() ?
"*BLOCKED*" :
"");
1591#ifdef QSG_RUNTIME_DESCRIPTION
qsizetype size() const noexcept
bool isEmpty() const noexcept
const T & constLast() const noexcept
const_reference at(qsizetype i) const noexcept
The QMatrix4x4 class represents a 4x4 transformation matrix in 3D space.
\inmodule QtCore\reentrant
void setRootNode(QSGRootNode *node)
Sets the node as the root of the QSGNode scene that you want to render.
virtual void nodeChanged(QSGNode *node, QSGNode::DirtyState state)=0
The QSGBasicGeometryNode class serves as a baseclass for geometry based nodes.
QSGBasicGeometryNode(NodeType type)
Creates a new basic geometry node of type type.
const QSGGeometry * geometry() const
Returns this node's geometry.
void setGeometry(QSGGeometry *geometry)
Sets the geometry of this node to geometry.
~QSGBasicGeometryNode() override
Deletes this QSGBasicGeometryNode.
The QSGClipNode class implements the clipping functionality in the scene graph.
QSGClipNode()
Creates a new QSGClipNode without a geometry.
void setClipRect(const QRectF &)
Sets the clip rect of this clip node to rect.
void setIsRectangular(bool rectHint)
Sets whether this clip node has a rectangular clip to rectHint.
~QSGClipNode() override
Deletes this QSGClipNode.
The QSGGeometryNode class is used for all rendered content in the scene graph.
void setRenderOrder(int order)
Sets the render order of this node to be order.
QSGMaterial * material() const
Returns the material of the QSGGeometryNode.
QSGMaterial * activeMaterial() const
Returns the material which should currently be used for geometry node.
QSGGeometryNode()
Creates a new geometry node without geometry and material.
void setMaterial(QSGMaterial *material)
Sets the material of this geometry node to material.
~QSGGeometryNode() override
Deletes this geometry node.
void setInheritedOpacity(qreal opacity)
Sets the inherited opacity of this geometry to opacity.
void setOpaqueMaterial(QSGMaterial *material)
Sets the opaque material of this geometry to material.
The QSGGeometry class provides low-level storage for graphics primitives in the \l{Qt Quick Scene Gra...
int vertexCount() const
Returns the number of vertices in this geometry object.
The QSGMaterial class encapsulates rendering state for a shader program.
static QString description(const QSGNode *node)
static void setDescription(QSGNode *node, const QString &description)
virtual void enterOpacityNode(QSGOpacityNode *)
virtual void leaveGeometryNode(QSGGeometryNode *)
virtual void enterTransformNode(QSGTransformNode *)
virtual void visitChildren(QSGNode *n)
virtual void leaveTransformNode(QSGTransformNode *)
virtual ~QSGNodeVisitor()
virtual void leaveOpacityNode(QSGOpacityNode *)
virtual void visitNode(QSGNode *n)
virtual void leaveClipNode(QSGClipNode *)
virtual void enterClipNode(QSGClipNode *)
virtual void enterGeometryNode(QSGGeometryNode *)
\group qtquick-scenegraph-nodes \title Qt Quick Scene Graph Node classes
void removeChildNode(QSGNode *node)
Removes node from this node's list of children.
QSGNode * childAtIndex(int i) const
Returns the child at index i.
void prependChildNode(QSGNode *node)
Prepends node to this node's the list of children.
Flags flags() const
Returns the set of flags for this node.
void reparentChildNodesTo(QSGNode *newParent)
int childCount() const
Returns the number of child nodes.
virtual bool isSubtreeBlocked() const
Returns whether this node and its subtree is available for use.
Flag
The QSGNode::Flag enum describes flags on the QSGNode.
void appendChildNode(QSGNode *node)
Appends node to this node's list of children.
QT_DEPRECATED DirtyState dirtyState() const
void insertChildNodeBefore(QSGNode *node, QSGNode *before)
Inserts node to this node's list of children before the node specified with before.
friend class QSGNodePrivate
NodeType
Can be used to figure out the type of node.
void insertChildNodeAfter(QSGNode *node, QSGNode *after)
Inserts node to this node's list of children after the node specified with after.
virtual ~QSGNode()
Destroys the node.
QSGNode * parent() const
Returns the parent node of this node.
QSGNode * firstChild() const
Returns the first child of this node.
void markDirty(DirtyState bits)
Notifies all connected renderers that the node has dirty bits.
void setFlags(Flags, bool=true)
Sets the flags f on this node if enabled is true; otherwise clears the flags.
QSGNode()
Constructs a new node.
NodeType type() const
Returns the type of this node.
void setFlag(Flag, bool=true)
Sets the flag f on this node if enabled is true; otherwise clears the flag.
void removeAllChildNodes()
Removes all child nodes from this node's list of children.
QScopedPointer< QSGNodePrivate > d_ptr
The QSGOpacityNode class is used to change opacity of nodes.
qreal opacity() const
Returns this opacity node's opacity.
~QSGOpacityNode() override
Deletes the opacity node.
QSGOpacityNode()
Constructs an opacity node with a default opacity of 1.
void setCombinedOpacity(qreal opacity)
Sets the combined opacity of this node to opacity.
void setOpacity(qreal opacity)
Sets the opacity of this node to opacity.
bool isSubtreeBlocked() const override
For performance reasons, we block the subtree when the opacity is below a certain threshold.
The QSGRootNode is the toplevel root of any scene graph.
~QSGRootNode() override
Deletes the root node.
QSGRootNode()
Creates a new root node.
bool isNull() const noexcept
Returns true if this object refers to \nullptr.
void reset(T *other=nullptr) noexcept(noexcept(Cleanup::cleanup(std::declval< T * >())))
Deletes the existing object it is pointing to (if any), and sets its pointer to other.
\macro QT_RESTRICTED_CAST_FROM_ASCII
Combined button and popup list for selecting options.
QTextStream & hex(QTextStream &stream)
Calls QTextStream::setIntegerBase(16) on stream and returns stream.
QTextStream & dec(QTextStream &stream)
Calls QTextStream::setIntegerBase(10) on stream and returns stream.
#define qCDebug(category,...)
#define Q_DECLARE_LOGGING_CATEGORY(name)
constexpr const T & qMin(const T &a, const T &b)
constexpr const T & qMax(const T &a, const T &b)
GLint GLint GLint GLint GLint x
[0]
GLuint GLfloat GLfloat GLfloat GLfloat y1
GLuint GLfloat GLfloat GLfloat x1
GLenum GLenum GLsizei count
GLenum GLenum GLsizei const GLuint GLboolean enabled
const void GLsizei GLsizei stride
GLfixed GLfixed GLfixed y2
GLenum GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const void * bits
GLfixed GLfixed GLint GLint order
#define Q_ASSERT_X(cond, x, msg)
void qsgnode_set_description(QSGNode *node, const QString &description)
static void qt_print_node_count()
static QT_BEGIN_NAMESPACE int qt_node_count
QDebug operator<<(QDebug d, const QSGGeometryNode *n)
const qreal OPACITY_THRESHOLD