![]() |
Qt 6.x
The Qt SDK
|
The QSGVertexColorMaterial class provides a convenient way of rendering per-vertex colored geometry in the scene graph. More...
#include <qsgvertexcolormaterial.h>
Public Member Functions | |
QSGVertexColorMaterial () | |
Creates a new vertex color material. | |
int | compare (const QSGMaterial *other) const override |
int QSGVertexColorMaterial::compare() const | |
![]() | |
QSGMaterial () | |
virtual | ~QSGMaterial () |
virtual QSGMaterialType * | type () const =0 |
This function is called by the scene graph to query an identifier that is unique to the QSGMaterialShader instantiated by createShader(). | |
virtual QSGMaterialShader * | createShader (QSGRendererInterface::RenderMode renderMode) const =0 |
This function returns a new instance of a the QSGMaterialShader implementation used to render geometry for a specific implementation of QSGMaterial. | |
virtual int | compare (const QSGMaterial *other) const |
Compares this material to other and returns 0 if they are equal; -1 if this material should sort before other and 1 if other should sort before. | |
QSGMaterial::Flags | flags () const |
Returns the material's flags. | |
void | setFlag (Flags flags, bool on=true) |
Sets the flags flags on this material if on is true; otherwise clears the attribute. | |
Protected Member Functions | |
QSGMaterialType * | type () const override |
QSGMaterialShader * | createShader (QSGRendererInterface::RenderMode renderMode) const override |
Additional Inherited Members | |
![]() | |
enum | Flag { Blending = 0x0001 , RequiresDeterminant = 0x0002 , RequiresFullMatrixExceptTranslate = 0x0004 | RequiresDeterminant , RequiresFullMatrix = 0x0008 | RequiresFullMatrixExceptTranslate , NoBatching = 0x0010 } |
\value Blending Set this flag to true if the material requires blending to be enabled during rendering. More... | |
The QSGVertexColorMaterial class provides a convenient way of rendering per-vertex colored geometry in the scene graph.
\inmodule QtQuick
The vertex color material will give each vertex in a geometry a color. Pixels between vertices will be linearly interpolated. The colors can contain transparency.
The geometry to be rendered with vertex color must have the following layout. Attribute position 0 must contain vertices. Attribute position 1 must contain colors, a tuple of 4 values with RGBA layout. Both floats in the range of 0 to 1 and unsigned bytes in the range 0 to 255 are valid for the color values.
QSGGeometry::defaultAttributes_ColoredPoint2D() can be used to construct an attribute set that is compatible with this material.
The vertex color material respects both current opacity and current matrix when updating it's rendering state.
Definition at line 11 of file qsgvertexcolormaterial.h.
QSGVertexColorMaterial::QSGVertexColorMaterial | ( | ) |
Creates a new vertex color material.
Definition at line 78 of file qsgvertexcolormaterial.cpp.
References QSGMaterial::Blending, and QSGMaterial::setFlag().
|
overridevirtual |
int QSGVertexColorMaterial::compare() const
As the vertex color material has all its state in the vertex attributes, all materials will be equal.
Reimplemented from QSGMaterial.
Definition at line 93 of file qsgvertexcolormaterial.cpp.
|
overrideprotectedvirtual |
Implements QSGMaterial.
Definition at line 114 of file qsgvertexcolormaterial.cpp.
References Q_UNUSED.
|
overrideprotectedvirtual |
Implements QSGMaterial.
Definition at line 102 of file qsgvertexcolormaterial.cpp.
References type().
Referenced by type().