Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qsgcurvefillnode.cpp
Go to the documentation of this file.
1// Copyright (C) 2023 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
6
8
10{
11 setFlag(OwnsGeometry, true);
12 setGeometry(new QSGGeometry(attributes(), 0, 0));
13
14 updateMaterial();
15}
16
17void QSGCurveFillNode::updateMaterial()
18{
19 m_material.reset(new QSGCurveFillMaterial(this));
20 setMaterial(m_material.data());
21}
22
24{
26 if (g->indexType() != QSGGeometry::UnsignedIntType) {
27 g = new QSGGeometry(attributes(),
28 m_uncookedVertexes.size(),
29 m_uncookedIndexes.size(),
32 } else {
33 g->allocate(m_uncookedVertexes.size(), m_uncookedIndexes.size());
34 }
35
36 g->setDrawingMode(QSGGeometry::DrawTriangles);
37 memcpy(g->vertexData(),
38 m_uncookedVertexes.constData(),
39 g->vertexCount() * g->sizeOfVertex());
40 memcpy(g->indexData(),
41 m_uncookedIndexes.constData(),
42 g->indexCount() * g->sizeOfIndex());
43
44 m_uncookedIndexes.clear();
45 m_uncookedVertexes.clear();
46}
47
48const QSGGeometry::AttributeSet &QSGCurveFillNode::attributes()
49{
50 static QSGGeometry::Attribute data[] = {
55 };
56 static QSGGeometry::AttributeSet attrs = { 4, sizeof(CurveNodeVertex), data };
57 return attrs;
58}
59
const QSGGeometry * geometry() const
Returns this node's geometry.
Definition qsgnode.h:160
void setGeometry(QSGGeometry *geometry)
Sets the geometry of this node to geometry.
Definition qsgnode.cpp:764
void cookGeometry() override
void setMaterial(QSGMaterial *material)
Sets the material of this geometry node to material.
Definition qsgnode.cpp:927
The QSGGeometry class provides low-level storage for graphics primitives in the \l{Qt Quick Scene Gra...
Definition qsggeometry.h:15
@ OwnsGeometry
Definition qsgnode.h:57
void setFlag(Flag, bool=true)
Sets the flag f on this node if enabled is true; otherwise clears the flag.
Definition qsgnode.cpp:586
T * data() const noexcept
Returns the value of the pointer referenced by this object.
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.
Combined button and popup list for selecting options.
static struct AttrInfo attrs[]
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLboolean GLboolean g
The QSGGeometry::AttributeSet describes how the vertices in a QSGGeometry are built up.
Definition qsggeometry.h:73
The QSGGeometry::Attribute describes a single vertex attribute in a QSGGeometry.
Definition qsggeometry.h:58
static Attribute createWithAttributeType(int pos, int tupleSize, int primitiveType, AttributeType attributeType)
Creates a new QSGGeometry::Attribute for attribute register pos with tupleSize.