210 : m_nodeFlags(OwnedByParent)
227 , m_subtreeRenderableCount(
type == GeometryNodeType ||
type == RenderNodeType ? 1 : 0)
228 , m_nodeFlags(OwnedByParent)
245 , m_subtreeRenderableCount(
type == GeometryNodeType ||
type == RenderNodeType ? 1 : 0)
246 , m_nodeFlags(OwnedByParent)
260 static bool atexit_registered =
false;
261 if (!atexit_registered) {
263 atexit_registered =
true;
268#ifdef QSG_RUNTIME_DESCRIPTION
286 qDebug(
"Node destroyed after qt_print_node_count() was called.");
340void QSGNode::destroy()
346 while (m_firstChild) {
354 Q_ASSERT(m_firstChild ==
nullptr && m_lastChild ==
nullptr);
368 Q_ASSERT_X(!node->m_parent,
"QSGNode::prependChildNode",
"QSGNode already has a parent");
373 Q_ASSERT_X(
g->material(),
"QSGNode::prependChildNode",
"QSGGeometryNode is missing material");
374 Q_ASSERT_X(
g->geometry(),
"QSGNode::prependChildNode",
"QSGGeometryNode is missing geometry");
379 m_firstChild->m_previousSibling = node;
382 node->m_nextSibling = m_firstChild;
384 node->m_parent =
this;
399 Q_ASSERT_X(!node->m_parent,
"QSGNode::appendChildNode",
"QSGNode already has a parent");
404 Q_ASSERT_X(
g->material(),
"QSGNode::appendChildNode",
"QSGGeometryNode is missing material");
405 Q_ASSERT_X(
g->geometry(),
"QSGNode::appendChildNode",
"QSGGeometryNode is missing geometry");
410 m_lastChild->m_nextSibling = node;
413 node->m_previousSibling = m_lastChild;
415 node->m_parent =
this;
432 Q_ASSERT_X(!node->m_parent,
"QSGNode::insertChildNodeBefore",
"QSGNode already has a parent");
433 Q_ASSERT_X(before && before->m_parent ==
this,
"QSGNode::insertChildNodeBefore",
"The parent of \'before\' is wrong");
438 Q_ASSERT_X(
g->material(),
"QSGNode::insertChildNodeBefore",
"QSGGeometryNode is missing material");
439 Q_ASSERT_X(
g->geometry(),
"QSGNode::insertChildNodeBefore",
"QSGGeometryNode is missing geometry");
443 QSGNode *previous = before->m_previousSibling;
445 previous->m_nextSibling = node;
448 node->m_previousSibling = previous;
449 node->m_nextSibling = before;
450 before->m_previousSibling = node;
451 node->m_parent =
this;
468 Q_ASSERT_X(!node->m_parent,
"QSGNode::insertChildNodeAfter",
"QSGNode already has a parent");
469 Q_ASSERT_X(after && after->m_parent ==
this,
"QSGNode::insertChildNodeAfter",
"The parent of \'after\' is wrong");
474 Q_ASSERT_X(
g->material(),
"QSGNode::insertChildNodeAfter",
"QSGGeometryNode is missing material");
475 Q_ASSERT_X(
g->geometry(),
"QSGNode::insertChildNodeAfter",
"QSGGeometryNode is missing geometry");
481 next->m_previousSibling = node;
484 node->m_nextSibling =
next;
485 node->m_previousSibling = after;
486 after->m_nextSibling = node;
487 node->m_parent =
this;
503 QSGNode *previous = node->m_previousSibling;
506 previous->m_nextSibling =
next;
510 next->m_previousSibling = previous;
512 m_lastChild = previous;
513 node->m_previousSibling =
nullptr;
514 node->m_nextSibling =
nullptr;
517 node->m_parent =
nullptr;
527 while (m_firstChild) {
529 m_firstChild = node->m_nextSibling;
530 node->m_nextSibling =
nullptr;
532 m_firstChild->m_previousSibling =
nullptr;
534 m_lastChild =
nullptr;
536 node->m_parent =
nullptr;
560 n =
n->m_nextSibling;
571 n =
n->m_nextSibling;
586 if (
bool(m_nodeFlags &
f) ==
enabled)
605 Flags oldFlags = m_nodeFlags;
624 int renderableCountDiff = 0;
626 renderableCountDiff += m_subtreeRenderableCount;
628 renderableCountDiff -= m_subtreeRenderableCount;
632 p->m_subtreeRenderableCount += renderableCountDiff;
641#ifdef QSG_RUNTIME_DESCRIPTION
856 delete m_opaque_material;
910 m_render_order =
order;
931 if (m_material !=
nullptr && m_opaque_material == m_material)
932 qWarning(
"QSGGeometryNode: using same material for both opaque and translucent");
959 delete m_opaque_material;
962 if (m_opaque_material !=
nullptr && m_opaque_material == m_material)
963 qWarning(
"QSGGeometryNode: using same material for both opaque and translucent");
987 if (m_opaque_material && m_opacity > 0.999)
988 return m_opaque_material;
1004 Q_ASSERT(opacity >= 0 && opacity <= 1);
1005 m_opacity = opacity;
1039 , m_is_rectangular(
false)
1081 m_is_rectangular = rectHint;
1188 m_combined_matrix =
matrix;
1225 while (!m_renderers.
isEmpty())
1237void QSGRootNode::notifyNodeChange(
QSGNode *node, DirtyState
state)
1239 for (
int i=0;
i<m_renderers.
size(); ++
i) {
1385 switch (
n->type()) {
1422#ifndef QT_NO_DEBUG_STREAM
1426 d <<
"Geometry(null)";
1437 switch (
g->drawingMode()) {
1444 d <<
"#V:" <<
g->vertexCount() <<
"#I:" <<
g->indexCount();
1447 float x1 = 1e10,
x2 = -1e10,
y1=1e10,
y2=-1e10;
1448 int stride =
g->sizeOfVertex();
1449 for (
int i = 0;
i <
g->vertexCount(); ++
i) {
1459 d <<
"x1=" <<
x1 <<
"y1=" <<
y1 <<
"x2=" <<
x2 <<
"y2=" <<
y2;
1464 d <<
"materialtype=" <<
n->material()->type();
1468#ifdef QSG_RUNTIME_DESCRIPTION
1477 d <<
"ClipNode(null)";
1482 if (
n->childCount())
1483 d <<
"children=" <<
n->childCount();
1485 d <<
"is rect?" << (
n->isRectangular() ?
"yes" :
"no");
1488#ifdef QSG_RUNTIME_DESCRIPTION
1491 d << (
n->isSubtreeBlocked() ?
"*BLOCKED*" :
"");
1498 d <<
"TransformNode(null)";
1502 d <<
"TransformNode(";
1506 else if (
m.determinant() == 1 &&
m(0, 0) == 1 &&
m(1, 1) == 1 &&
m(2, 2) == 1)
1507 d <<
"translate" <<
m(0, 3) <<
m(1, 3) <<
m(2, 3);
1509 d <<
"det=" <<
n->matrix().determinant();
1510#ifdef QSG_RUNTIME_DESCRIPTION
1513 d << (
n->isSubtreeBlocked() ?
"*BLOCKED*" :
"");
1521 d <<
"OpacityNode(null)";
1524 d <<
"OpacityNode(";
1526 d <<
"opacity=" <<
n->opacity()
1527 <<
"combined=" <<
n->combinedOpacity()
1528 << (
n->isSubtreeBlocked() ?
"*BLOCKED*" :
"");
1529#ifdef QSG_RUNTIME_DESCRIPTION
1540 d <<
"RootNode(null)";
1544 d <<
"RootNode" <<
Qt::hex << (
const void *)
n << (
n->isSubtreeBlocked() ?
"*BLOCKED*" :
"");
1545#ifdef QSG_RUNTIME_DESCRIPTION
1560 switch (
n->type()) {
1562 d << static_cast<const QSGGeometryNode *>(
n);
1565 d << static_cast<const QSGTransformNode *>(
n);
1568 d << static_cast<const QSGClipNode *>(
n);
1571 d << static_cast<const QSGRootNode *>(
n);
1574 d << static_cast<const QSGOpacityNode *>(
n);
1578 <<
"flags=" << (
int)
n->flags() <<
Qt::dec
1579 << (
n->isSubtreeBlocked() ?
"*BLOCKED*" :
"");
1580#ifdef QSG_RUNTIME_DESCRIPTION
1587 <<
"flags=" << (
int)
n->flags() <<
Qt::dec
1588 << (
n->isSubtreeBlocked() ?
"*BLOCKED*" :
"");
1589#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...
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.
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