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);
13 setGeometry(new QSGGeometry(attributes(), 0, 0));
14
15 updateMaterial();
16}
17
18void QSGCurveFillNode::updateMaterial()
19{
20 m_material.reset(new QSGCurveFillMaterial(this));
21 setMaterial(m_material.data());
22}
23
25{
27 if (g->indexType() != QSGGeometry::UnsignedIntType) {
28 g = new QSGGeometry(attributes(),
29 m_uncookedVertexes.size(),
30 m_uncookedIndexes.size(),
33 } else {
34 g->allocate(m_uncookedVertexes.size(), m_uncookedIndexes.size());
35 }
36
37 g->setDrawingMode(QSGGeometry::DrawTriangles);
38 memcpy(g->vertexData(),
39 m_uncookedVertexes.constData(),
40 g->vertexCount() * g->sizeOfVertex());
41 memcpy(g->indexData(),
42 m_uncookedIndexes.constData(),
43 g->indexCount() * g->sizeOfIndex());
44
45 m_uncookedIndexes.clear();
46 m_uncookedVertexes.clear();
47}
48
49const QSGGeometry::AttributeSet &QSGCurveFillNode::attributes()
50{
51 static QSGGeometry::Attribute data[] = {
56 };
57 static QSGGeometry::AttributeSet attrs = { 4, sizeof(CurveNodeVertex), data };
58 return attrs;
59}
60
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:762
void cookGeometry() override
void setMaterial(QSGMaterial *material)
Sets the material of this geometry node to material.
Definition qsgnode.cpp:925
The QSGGeometry class provides low-level storage for graphics primitives in the \l{Qt Quick Scene Gra...
Definition qsggeometry.h:15
@ UsePreprocess
Definition qsgnode.h:52
@ 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:584
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.