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
QSGGeometry Class Reference

The QSGGeometry class provides low-level storage for graphics primitives in the \l{Qt Quick Scene Graph}. More...

#include <qsggeometry.h>

+ Collaboration diagram for QSGGeometry:

Classes

class  Attribute
 The QSGGeometry::Attribute describes a single vertex attribute in a QSGGeometry. More...
 
class  AttributeSet
 The QSGGeometry::AttributeSet describes how the vertices in a QSGGeometry are built up. More...
 
class  ColoredPoint2D
 The QSGGeometry::ColoredPoint2D struct is a convenience struct for accessing 2D Points with a color. More...
 
class  Point2D
 The QSGGeometry::Point2D struct is a convenience struct for accessing 2D Points. More...
 
class  TexturedPoint2D
 The QSGGeometry::TexturedPoint2D struct is a convenience struct for accessing 2D Points with texture coordinates. More...
 

Public Types

enum  AttributeType {
  UnknownAttribute , PositionAttribute , ColorAttribute , TexCoordAttribute ,
  TexCoord1Attribute , TexCoord2Attribute
}
 This enum identifies several attribute types. More...
 
enum  DataPattern { AlwaysUploadPattern = 0 , StreamPattern = 1 , DynamicPattern = 2 , StaticPattern = 3 }
 The DataPattern enum is used to specify the use pattern for the vertex and index data in a geometry object. More...
 
enum  DrawingMode {
  DrawPoints = 0x0000 , DrawLines = 0x0001 , DrawLineLoop = 0x0002 , DrawLineStrip = 0x0003 ,
  DrawTriangles = 0x0004 , DrawTriangleStrip = 0x0005 , DrawTriangleFan = 0x0006
}
 Specifies the drawing mode, also called primitive topology. More...
 
enum  Type {
  ByteType = 0x1400 , UnsignedByteType = 0x1401 , ShortType = 0x1402 , UnsignedShortType = 0x1403 ,
  IntType = 0x1404 , UnsignedIntType = 0x1405 , FloatType = 0x1406 , Bytes2Type = 0x1407 ,
  Bytes3Type = 0x1408 , Bytes4Type = 0x1409 , DoubleType = 0x140A
}
 Specifies the component type in the vertex data. More...
 

Public Member Functions

 QSGGeometry (const QSGGeometry::AttributeSet &attribs, int vertexCount, int indexCount=0, int indexType=UnsignedShortType)
 Constructs a geometry object based on attributes.
 
virtual ~QSGGeometry ()
 Destroys the geometry object and the vertex and index data it has allocated.
 
void setDrawingMode (unsigned int mode)
 Sets the mode to be used for drawing this geometry.
 
unsigned int drawingMode () const
 Returns the drawing mode of this geometry.
 
void allocate (int vertexCount, int indexCount=0)
 Resizes the vertex and index data of this geometry object to fit vertexCount vertices and indexCount indices.
 
int vertexCount () const
 Returns the number of vertices in this geometry object.
 
voidvertexData ()
 Returns a pointer to the raw vertex data of this geometry object.
 
Point2DvertexDataAsPoint2D ()
 Convenience function to access the vertex data as a mutable array of QSGGeometry::Point2D.
 
TexturedPoint2DvertexDataAsTexturedPoint2D ()
 Convenience function to access the vertex data as a mutable array of QSGGeometry::TexturedPoint2D.
 
ColoredPoint2DvertexDataAsColoredPoint2D ()
 Convenience function to access the vertex data as a mutable array of QSGGeometry::ColoredPoint2D.
 
const voidvertexData () const
 Returns a pointer to the raw vertex data of this geometry object.
 
const Point2DvertexDataAsPoint2D () const
 Convenience function to access the vertex data as an immutable array of QSGGeometry::Point2D.
 
const TexturedPoint2DvertexDataAsTexturedPoint2D () const
 Convenience function to access the vertex data as an immutable array of QSGGeometry::TexturedPoint2D.
 
const ColoredPoint2DvertexDataAsColoredPoint2D () const
 Convenience function to access the vertex data as an immutable array of QSGGeometry::ColoredPoint2D.
 
int indexType () const
 Returns the primitive type used for indices in this geometry object.
 
int indexCount () const
 Returns the number of indices in this geometry object.
 
voidindexData ()
 Returns a pointer to the raw index data of this geometry object.
 
uintindexDataAsUInt ()
 Convenience function to access the index data as a mutable array of 32-bit unsigned integers.
 
quint16indexDataAsUShort ()
 Convenience function to access the index data as a mutable array of 16-bit unsigned integers.
 
int sizeOfIndex () const
 Returns the byte size of the index type.
 
const voidindexData () const
 Returns a pointer to the raw index data of this geometry object.
 
const uintindexDataAsUInt () const
 Convenience function to access the index data as an immutable array of 32-bit unsigned integers.
 
const quint16indexDataAsUShort () const
 Convenience function to access the index data as an immutable array of 16-bit unsigned integers.
 
int attributeCount () const
 Returns the number of attributes in the attrbute set used by this geometry.
 
const Attributeattributes () const
 Returns an array with the attributes of this geometry.
 
int sizeOfVertex () const
 Returns the size in bytes of one vertex.
 
void setIndexDataPattern (DataPattern p)
 Sets the usage pattern for indices to p.
 
DataPattern indexDataPattern () const
 Returns the usage pattern for indices in this geometry.
 
void setVertexDataPattern (DataPattern p)
 Sets the usage pattern for vertices to p.
 
DataPattern vertexDataPattern () const
 Returns the usage pattern for vertices in this geometry.
 
void markIndexDataDirty ()
 Mark that the vertices in this geometry has changed and must be uploaded again.
 
void markVertexDataDirty ()
 Mark that the vertices in this geometry has changed and must be uploaded again.
 
float lineWidth () const
 Gets the current line or point width or to be used for this geometry.
 
void setLineWidth (float w)
 Sets the line or point width to be used for this geometry to width.
 

Static Public Member Functions

static const AttributeSetdefaultAttributes_Point2D ()
 Convenience function which returns attributes to be used for 2D solid color drawing.
 
static const AttributeSetdefaultAttributes_TexturedPoint2D ()
 Convenience function which returns attributes to be used for textured 2D drawing.
 
static const AttributeSetdefaultAttributes_ColoredPoint2D ()
 Convenience function which returns attributes to be used for per vertex colored 2D drawing.
 
static void updateRectGeometry (QSGGeometry *g, const QRectF &rect)
 Updates the geometry g with the coordinates in rect.
 
static void updateTexturedRectGeometry (QSGGeometry *g, const QRectF &rect, const QRectF &sourceRect)
 Updates the geometry g with the coordinates in rect and texture coordinates from textureRect.
 
static void updateColoredRectGeometry (QSGGeometry *g, const QRectF &rect)
 Updates the geometry g with the coordinates in rect.
 

Friends

class QSGGeometryData
 

Detailed Description

The QSGGeometry class provides low-level storage for graphics primitives in the \l{Qt Quick Scene Graph}.

\inmodule QtQuick

The QSGGeometry class stores the geometry of the primitives rendered with the scene graph. It contains vertex data and optionally index data. The mode used to draw the geometry, also called primitive topology, is specified with setDrawingMode().

Vertices can be as simple as points defined by x and y values or can be more complex where each vertex contains a normal, texture coordinates and a 3D position. The QSGGeometry::AttributeSet is used to describe how the vertex data is built up. The attribute set can only be specified on construction. The QSGGeometry class provides a few convenience attributes and attribute sets by default. The defaultAttributes_Point2D() function returns an attribute set to be used in normal solid color rectangles, while the defaultAttributes_TexturedPoint2D function returns attributes to be used for textured 2D geometry. The vertex data is internally stored as a {void *} and is accessible with the vertexData() function. Convenience accessors for the common attribute sets are available with vertexDataAsPoint2D() and vertexDataAsTexturedPoint2D(). Vertex data is allocated by passing a vertex count to the constructor or by calling allocate() later.

The QSGGeometry can optionally contain indices of either unsigned 32-bit, unsigned 16-bit, or unsigned 8-bit integers. The index type must be specified during construction and cannot be changed.

Below is a snippet illustrating how a geometry composed of position and color vertices can be built.

struct MyPoint2D {
float x;
float y;
float r;
float g;
float b;
float a;
void set(float x_, float y_, float r_, float g_, float b_, float a_) {
x = x_;
y = y_;
r = r_;
g = g_;
b = b_;
a = a_;
}
};
QSGGeometry::Attribute MyPoint2D_Attributes[] = {
};
QSGGeometry::AttributeSet MyPoint2D_AttributeSet = {
2,
sizeof(MyPoint2D),
MyPoint2D_Attributes
};
...
geometry = new QSGGeometry(MyPoint2D_AttributeSet, 2);
geometry->setDrawingMode(DrawLines);
MyPoint2D *vertices = static_cast<MyPoint2D *>(geometry->vertexData());
vertices[0].set(0, 0, 1, 0, 0, 1);
vertices[1].set(width(), height(), 0, 0, 1, 1);
QSGGeometry(const QSGGeometry::AttributeSet &attribs, int vertexCount, int indexCount=0, int indexType=UnsignedShortType)
Constructs a geometry object based on attributes.
GLboolean GLboolean GLboolean b
GLint GLint GLint GLint GLint x
[0]
GLint GLsizei GLsizei height
GLboolean GLboolean GLboolean GLboolean a
[7]
GLboolean r
[2]
GLint GLsizei width
GLboolean GLboolean g
GLint y
QFuture< QSet< QChar > > set
[10]
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 create(int pos, int tupleSize, int primitiveType, bool isPosition=false)
Creates a new QSGGeometry::Attribute for attribute register pos with tupleSize.

The QSGGeometry is a software buffer and client-side in terms of accelerated rendering, as the buffers used in 2D graphics typically consist of many small buffers that change every frame and do not benefit from being uploaded to graphics memory. However, the QSGGeometry supports hinting to the renderer that a buffer should be uploaded using the setVertexDataPattern() and setIndexDataPattern() functions. Whether this hint is respected or not is implementation specific.

See also
QSGGeometryNode, {Scene Graph - Custom Geometry}
Note
All classes with QSG prefix should be used solely on the scene graph's rendering thread. See \l {Scene Graph and Rendering} for more information.

Definition at line 14 of file qsggeometry.h.

Member Enumeration Documentation

◆ AttributeType

This enum identifies several attribute types.

\value UnknownAttribute Don't care \value PositionAttribute Position \value ColorAttribute Color \value TexCoordAttribute Texture coordinate \value TexCoord1Attribute Texture coordinate 1 \value TexCoord2Attribute Texture coordinate 2

Enumerator
UnknownAttribute 
PositionAttribute 
ColorAttribute 
TexCoordAttribute 
TexCoord1Attribute 
TexCoord2Attribute 

Definition at line 17 of file qsggeometry.h.

◆ DataPattern

The DataPattern enum is used to specify the use pattern for the vertex and index data in a geometry object.

\value AlwaysUploadPattern The data is always uploaded. This means that the user does not need to explicitly mark index and vertex data as dirty after changing it. This is the default.

\value DynamicPattern The data is modified repeatedly and drawn many times. This is a hint that may provide better performance. When set the user must make sure to mark the data as dirty after changing it.

\value StaticPattern The data is modified once and drawn many times. This is a hint that may provide better performance. When set the user must make sure to mark the data as dirty after changing it.

\value StreamPattern The data is modified for almost every time it is drawn. This is a hint that may provide better performance. When set, the user must make sure to mark the data as dirty after changing it.

Enumerator
AlwaysUploadPattern 
StreamPattern 
DynamicPattern 
StaticPattern 

Definition at line 26 of file qsggeometry.h.

◆ DrawingMode

Specifies the drawing mode, also called primitive topology.

Note
Starting with Qt 6 the scene graph only exposes topologies that are supported across all the supported 3D graphics APIs. As a result, the values DrawLineLoop and DrawTriangleFan are no longer supported at run time in Qt 6, even though the enum values themselves are still present.

\value DrawPoints \value DrawLines \omitvalue DrawLineLoop \value DrawLineStrip \value DrawTriangles \value DrawTriangleStrip \omitvalue DrawTriangleFan

Enumerator
DrawPoints 
DrawLines 
DrawLineLoop 
DrawLineStrip 
DrawTriangles 
DrawTriangleStrip 
DrawTriangleFan 

Definition at line 33 of file qsggeometry.h.

◆ Type

Specifies the component type in the vertex data.

\value ByteType \value UnsignedByteType \value ShortType \value UnsignedShortType \value IntType \value UnsignedIntType \value FloatType \value Bytes2Type Added in Qt 5.14. \value Bytes3Type Added in Qt 5.14. \value Bytes4Type Added in Qt 5.14. \value DoubleType Added in Qt 5.14.

Enumerator
ByteType 
UnsignedByteType 
ShortType 
UnsignedShortType 
IntType 
UnsignedIntType 
FloatType 
Bytes2Type 
Bytes3Type 
Bytes4Type 
DoubleType 

Definition at line 43 of file qsggeometry.h.

Constructor & Destructor Documentation

◆ QSGGeometry()

QSGGeometry::QSGGeometry ( const QSGGeometry::AttributeSet & attributes,
int vertexCount,
int indexCount = 0,
int indexType = UnsignedShortType )

Constructs a geometry object based on attributes.

The object allocate space for vertexCount vertices based on the accumulated size in attributes and for indexCount.

The indexType can be UnsignedShortType or UnsignedIntType. Support for the latter depends on the graphics API implementation used at run time, and may not always be available.

Geometry objects are constructed by default with DrawTriangleStrip as the drawing mode.

Note
attributes and the \l Attribute objects referenced by it must stay valid for the entire lifetime of the QSGGeometry. QSGGeometry stores a reference to attributes and does not delete the \l Attribute objects.

Definition at line 379 of file qsggeometry.cpp.

References allocate(), QSGGeometry::AttributeSet::count, indexCount(), indexType(), Q_ASSERT, Q_UNUSED, qFatal, QSGGeometry::AttributeSet::stride, UnsignedByteType, UnsignedIntType, UnsignedShortType, and vertexCount().

+ Here is the call graph for this function:

◆ ~QSGGeometry()

QSGGeometry::~QSGGeometry ( )
virtual

Destroys the geometry object and the vertex and index data it has allocated.

Definition at line 431 of file qsggeometry.cpp.

Member Function Documentation

◆ allocate()

void QSGGeometry::allocate ( int vertexCount,
int indexCount = 0 )

Resizes the vertex and index data of this geometry object to fit vertexCount vertices and indexCount indices.

Vertex and index data will be invalidated after this call and the caller must mark the associated geometry node as dirty, by calling node->markDirty(QSGNode::DirtyGeometry) to ensure that the renderer has a chance to update internal buffers.

Definition at line 610 of file qsggeometry.cpp.

References indexCount(), markIndexDataDirty(), markVertexDataDirty(), Q_ASSERT, Q_CHECK_PTR(), QSGGeometry::AttributeSet::stride, UnsignedIntType, UnsignedShortType, and vertexCount().

Referenced by QSGGeometry(), QQuickNinePatchNode::initialize(), QSGTextMaskMaterial::populate(), QSGNinePatchNode::rebuildGeometry(), QSGBasicInternalImageNode::updateGeometry(), QSGBasicInternalImageNode::updateGeometry(), QWavefrontMesh::updateGeometry(), and QQuickGridMesh::updateGeometry().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ attributeCount()

int QSGGeometry::attributeCount ( ) const
inline

Returns the number of attributes in the attrbute set used by this geometry.

Definition at line 146 of file qsggeometry.h.

Referenced by QSGBatchRenderer::calculateVertexInputLayout().

+ Here is the caller graph for this function:

◆ attributes()

QSGGeometry::Attribute * QSGGeometry::attributes ( ) const
inline

Returns an array with the attributes of this geometry.

The size of the array is given with attributeCount().

Definition at line 147 of file qsggeometry.h.

Referenced by QSGBatchRenderer::calculateVertexInputLayout(), and QSGBatchRenderer::Batch::geometryWasChanged().

+ Here is the caller graph for this function:

◆ defaultAttributes_ColoredPoint2D()

const QSGGeometry::AttributeSet & QSGGeometry::defaultAttributes_ColoredPoint2D ( )
static

Convenience function which returns attributes to be used for per vertex colored 2D drawing.

Definition at line 64 of file qsggeometry.cpp.

References attrs, ColorAttribute, QSGGeometry::Attribute::createWithAttributeType(), FloatType, PositionAttribute, and UnsignedByteType.

Referenced by QQuickShapeGenericStrokeFillNode::QQuickShapeGenericStrokeFillNode().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ defaultAttributes_Point2D()

const QSGGeometry::AttributeSet & QSGGeometry::defaultAttributes_Point2D ( )
static

Convenience function which returns attributes to be used for 2D solid color drawing.

Definition at line 37 of file qsggeometry.cpp.

References attrs, QSGGeometry::Attribute::createWithAttributeType(), FloatType, and PositionAttribute.

Referenced by QWavefrontMesh::updateGeometry(), and QQuickGridMesh::updateGeometry().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ defaultAttributes_TexturedPoint2D()

const QSGGeometry::AttributeSet & QSGGeometry::defaultAttributes_TexturedPoint2D ( )
static

Convenience function which returns attributes to be used for textured 2D drawing.

Definition at line 50 of file qsggeometry.cpp.

References attrs, QSGGeometry::Attribute::createWithAttributeType(), FloatType, PositionAttribute, and TexCoordAttribute.

Referenced by QSGVideoNode::setTexturedRectGeometry(), QSGBasicInternalImageNode::updateGeometry(), QWavefrontMesh::updateGeometry(), QQuickGridMesh::updateGeometry(), and QWaylandQuickItem::updatePaintNode().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ drawingMode()

int QSGGeometry::drawingMode ( ) const
inline

Returns the drawing mode of this geometry.

The default value is DrawTriangleStrip.

Definition at line 116 of file qsggeometry.h.

◆ indexCount()

int QSGGeometry::indexCount ( ) const
inline

Returns the number of indices in this geometry object.

Definition at line 134 of file qsggeometry.h.

Referenced by QSGGeometry(), and allocate().

+ Here is the caller graph for this function:

◆ indexData() [1/2]

void * QSGGeometry::indexData ( )

Returns a pointer to the raw index data of this geometry object.

See also
indexDataAsUShort(), indexDataAsUInt()

Definition at line 475 of file qsggeometry.cpp.

References nullptr.

Referenced by QSGBasicInternalImageNode::updateGeometry(), and QWavefrontMesh::updateGeometry().

+ Here is the caller graph for this function:

◆ indexData() [2/2]

const void * QSGGeometry::indexData ( ) const

Returns a pointer to the raw index data of this geometry object.

See also
indexDataAsUShort(), indexDataAsUInt()

Definition at line 487 of file qsggeometry.cpp.

References nullptr.

◆ indexDataAsUInt() [1/2]

uint * QSGGeometry::indexDataAsUInt ( )
inline

Convenience function to access the index data as a mutable array of 32-bit unsigned integers.

Definition at line 192 of file qsggeometry.h.

References Q_ASSERT.

◆ indexDataAsUInt() [2/2]

const uint * QSGGeometry::indexDataAsUInt ( ) const
inline

Convenience function to access the index data as an immutable array of 32-bit unsigned integers.

Definition at line 204 of file qsggeometry.h.

References Q_ASSERT.

◆ indexDataAsUShort() [1/2]

quint16 * QSGGeometry::indexDataAsUShort ( )
inline

Convenience function to access the index data as a mutable array of 16-bit unsigned integers.

Definition at line 198 of file qsggeometry.h.

References Q_ASSERT.

Referenced by QSGDefaultSpriteNode::QSGDefaultSpriteNode(), QQuickNinePatchNode::initialize(), QSGTextMaskMaterial::populate(), QSGNinePatchNode::rebuildGeometry(), and QQuickGridMesh::updateGeometry().

+ Here is the caller graph for this function:

◆ indexDataAsUShort() [2/2]

const quint16 * QSGGeometry::indexDataAsUShort ( ) const
inline

Convenience function to access the index data as an immutable array of 16-bit unsigned integers.

Definition at line 210 of file qsggeometry.h.

References Q_ASSERT.

◆ indexDataPattern()

QSGGeometry::DataPattern QSGGeometry::indexDataPattern ( ) const
inline

Returns the usage pattern for indices in this geometry.

The default pattern is AlwaysUploadPattern.

Definition at line 155 of file qsggeometry.h.

◆ indexType()

int QSGGeometry::indexType ( ) const
inline

Returns the primitive type used for indices in this geometry object.

Definition at line 132 of file qsggeometry.h.

Referenced by QSGGeometry(), QSGTextMaskMaterial::populate(), QSGBatchRenderer::qsg_indexFormat(), and QSGBasicInternalImageNode::updateGeometry().

+ Here is the caller graph for this function:

◆ lineWidth()

float QSGGeometry::lineWidth ( ) const

Gets the current line or point width or to be used for this geometry.

This property only applies to line width when the drawingMode is DrawLines or DrawLineStrip. When supported, it also applies to point size when the drawingMode is DrawPoints.

The default value is 1.0

Note
Support for point and line drawing may be limited at run time, depending on the platform and graphics API. For example, some APIs do not support point sprites and so setting a size other than 1 is not possible.
The width of 1.0 is always supported.
See also
setLineWidth(), drawingMode()

Definition at line 560 of file qsggeometry.cpp.

◆ markIndexDataDirty()

void QSGGeometry::markIndexDataDirty ( )

Mark that the vertices in this geometry has changed and must be uploaded again.

This function only has an effect when the usage pattern for vertices is StaticData and the renderer that renders this geometry uploads the geometry into Vertex Buffer Objects (VBOs).

Definition at line 822 of file qsggeometry.cpp.

Referenced by allocate().

+ Here is the caller graph for this function:

◆ markVertexDataDirty()

void QSGGeometry::markVertexDataDirty ( )

Mark that the vertices in this geometry has changed and must be uploaded again.

This function only has an effect when the usage pattern for vertices is StaticData and the renderer that renders this geometry uploads the geometry into Vertex Buffer Objects (VBOs).

Definition at line 837 of file qsggeometry.cpp.

Referenced by allocate().

+ Here is the caller graph for this function:

◆ setDrawingMode()

void QSGGeometry::setDrawingMode ( unsigned int mode)

Sets the mode to be used for drawing this geometry.

The default value is QSGGeometry::DrawTriangleStrip.

See also
DrawingMode

Definition at line 538 of file qsggeometry.cpp.

Referenced by QQuickNinePatchNode::QQuickNinePatchNode(), QSGBasicGlyphNode::QSGBasicGlyphNode(), QSGDefaultNinePatchNode::QSGDefaultNinePatchNode(), QSGDefaultSpriteNode::QSGDefaultSpriteNode(), QSGBasicInternalImageNode::updateGeometry(), QSGBasicInternalImageNode::updateGeometry(), and QWavefrontMesh::updateGeometry().

+ Here is the caller graph for this function:

◆ setIndexDataPattern()

void QSGGeometry::setIndexDataPattern ( DataPattern p)

Sets the usage pattern for indices to p.

The default is AlwaysUploadPattern. When set to anything other than the default, the user must call markIndexDataDirty() after changing the index data, in addition to calling QSGNode::markDirty() with QSGNode::DirtyGeometry.

Definition at line 782 of file qsggeometry.cpp.

Referenced by QSGInternalTextNode::addGlyphs().

+ Here is the caller graph for this function:

◆ setLineWidth()

void QSGGeometry::setLineWidth ( float width)

Sets the line or point width to be used for this geometry to width.

This property only applies to line width when the drawingMode is DrawLines or DrawLineStrip. When supported, it also applies to point size when the drawingMode is DrawPoints.

Note
Support for point and line drawing may be limited at run time, depending on the platform and graphics API. For example, some APIs do not support point sprites and so setting a size other than 1 is not possible.
The width of 1.0 is always supported.
See also
lineWidth(), drawingMode()

Definition at line 580 of file qsggeometry.cpp.

◆ setVertexDataPattern()

void QSGGeometry::setVertexDataPattern ( DataPattern p)

Sets the usage pattern for vertices to p.

The default is AlwaysUploadPattern. When set to anything other than the default, the user must call markVertexDataDirty() after changing the vertex data, in addition to calling QSGNode::markDirty() with QSGNode::DirtyGeometry.

Definition at line 806 of file qsggeometry.cpp.

Referenced by QSGInternalTextNode::addGlyphs().

+ Here is the caller graph for this function:

◆ sizeOfIndex()

int QSGGeometry::sizeOfIndex ( ) const
inline

Returns the byte size of the index type.

This value is either 2 when the index type is UnsignedShortType, or 4 when the index type is UnsignedIntType.

Definition at line 288 of file qsggeometry.h.

◆ sizeOfVertex()

int QSGGeometry::sizeOfVertex ( ) const
inline

Returns the size in bytes of one vertex.

This value comes from the attributes.

Definition at line 148 of file qsggeometry.h.

Referenced by QSGBatchRenderer::calculateVertexInputLayout(), and QSGTextMaskMaterial::populate().

+ Here is the caller graph for this function:

◆ updateColoredRectGeometry()

void QSGGeometry::updateColoredRectGeometry ( QSGGeometry * g,
const QRectF & rect )
static

Updates the geometry g with the coordinates in rect.

The function assumes the geometry object contains a single triangle strip of QSGGeometry::ColoredPoint2D vertices

Definition at line 709 of file qsggeometry.cpp.

References rect, and QSGGeometry::ColoredPoint2D::x.

Referenced by QSGDefaultRectangleNode::QSGDefaultRectangleNode(), and QSGDefaultRectangleNode::setRect().

+ Here is the caller graph for this function:

◆ updateRectGeometry()

void QSGGeometry::updateRectGeometry ( QSGGeometry * g,
const QRectF & rect )
static

Updates the geometry g with the coordinates in rect.

The function assumes the geometry object contains a single triangle strip of QSGGeometry::Point2D vertices

Definition at line 654 of file qsggeometry.cpp.

References rect, and QSGGeometry::Point2D::x.

Referenced by QSGSimpleRectNode::QSGSimpleRectNode(), QSGSimpleRectNode::QSGSimpleRectNode(), QGeoTiledMapRootNode::setClipRect(), and QSGSimpleRectNode::setRect().

+ Here is the caller graph for this function:

◆ updateTexturedRectGeometry()

void QSGGeometry::updateTexturedRectGeometry ( QSGGeometry * g,
const QRectF & rect,
const QRectF & textureRect )
static

Updates the geometry g with the coordinates in rect and texture coordinates from textureRect.

textureRect should be in normalized coordinates.

g is assumed to be a triangle strip of four vertices of type QSGGeometry::TexturedPoint2D.

Definition at line 679 of file qsggeometry.cpp.

References rect, and QSGGeometry::TexturedPoint2D::x.

Referenced by qsgsimpletexturenode_update(), QSGImageNode::rebuildGeometry(), QSGNinePatchNode::rebuildGeometry(), QSGBasicInternalImageNode::updateGeometry(), and QWaylandQuickItem::updatePaintNode().

+ Here is the caller graph for this function:

◆ vertexCount()

int QSGGeometry::vertexCount ( ) const
inline

Returns the number of vertices in this geometry object.

Definition at line 120 of file qsggeometry.h.

Referenced by QSGGeometry(), allocate(), operator<<(), and QWavefrontMesh::updateGeometry().

+ Here is the caller graph for this function:

◆ vertexData() [1/2]

void * QSGGeometry::vertexData ( )
inline

Returns a pointer to the raw vertex data of this geometry object.

See also
vertexDataAsPoint2D(), vertexDataAsTexturedPoint2D()

Definition at line 122 of file qsggeometry.h.

References m_data.

Referenced by QQuickImageParticle::commit(), QWavefrontMesh::updateGeometry(), and QQuickGridMesh::updateGeometry().

+ Here is the caller graph for this function:

◆ vertexData() [2/2]

const void * QSGGeometry::vertexData ( ) const
inline

Returns a pointer to the raw vertex data of this geometry object.

See also
vertexDataAsPoint2D(), vertexDataAsTexturedPoint2D()

Definition at line 127 of file qsggeometry.h.

References m_data.

◆ vertexDataAsColoredPoint2D() [1/2]

QSGGeometry::ColoredPoint2D * QSGGeometry::vertexDataAsColoredPoint2D ( )
inline

Convenience function to access the vertex data as a mutable array of QSGGeometry::ColoredPoint2D.

Definition at line 239 of file qsggeometry.h.

References m_data, and Q_ASSERT.

Referenced by QSGDefaultRectangleNode::rect(), and QSGDefaultRectangleNode::setColor().

+ Here is the caller graph for this function:

◆ vertexDataAsColoredPoint2D() [2/2]

const QSGGeometry::ColoredPoint2D * QSGGeometry::vertexDataAsColoredPoint2D ( ) const
inline

Convenience function to access the vertex data as an immutable array of QSGGeometry::ColoredPoint2D.

Definition at line 275 of file qsggeometry.h.

References m_data, and Q_ASSERT.

◆ vertexDataAsPoint2D() [1/2]

QSGGeometry::Point2D * QSGGeometry::vertexDataAsPoint2D ( )
inline

Convenience function to access the vertex data as a mutable array of QSGGeometry::Point2D.

Definition at line 216 of file qsggeometry.h.

References m_data, and Q_ASSERT.

Referenced by QSGSimpleRectNode::rect().

+ Here is the caller graph for this function:

◆ vertexDataAsPoint2D() [2/2]

const QSGGeometry::Point2D * QSGGeometry::vertexDataAsPoint2D ( ) const
inline

Convenience function to access the vertex data as an immutable array of QSGGeometry::Point2D.

Definition at line 252 of file qsggeometry.h.

References m_data, and Q_ASSERT.

◆ vertexDataAsTexturedPoint2D() [1/2]

QSGGeometry::TexturedPoint2D * QSGGeometry::vertexDataAsTexturedPoint2D ( )
inline

Convenience function to access the vertex data as a mutable array of QSGGeometry::TexturedPoint2D.

Definition at line 226 of file qsggeometry.h.

References m_data, and Q_ASSERT.

Referenced by QQuickNinePatchNode::initialize(), QSGTextMaskMaterial::populate(), QSGNinePatchNode::rebuildGeometry(), and QSGBasicInternalImageNode::updateGeometry().

+ Here is the caller graph for this function:

◆ vertexDataAsTexturedPoint2D() [2/2]

const QSGGeometry::TexturedPoint2D * QSGGeometry::vertexDataAsTexturedPoint2D ( ) const
inline

Convenience function to access the vertex data as an immutable array of QSGGeometry::TexturedPoint2D.

Definition at line 262 of file qsggeometry.h.

References m_data, and Q_ASSERT.

◆ vertexDataPattern()

QSGGeometry::DataPattern QSGGeometry::vertexDataPattern ( ) const
inline

Returns the usage pattern for vertices in this geometry.

The default pattern is AlwaysUploadPattern.

Definition at line 158 of file qsggeometry.h.

Friends And Related Symbol Documentation

◆ QSGGeometryData

friend class QSGGeometryData
friend

Definition at line 168 of file qsggeometry.h.


The documentation for this class was generated from the following files: