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

The QSGVertexColorMaterial class provides a convenient way of rendering per-vertex colored geometry in the scene graph. More...

#include <qsgvertexcolormaterial.h>

+ Inheritance diagram for QSGVertexColorMaterial:
+ Collaboration diagram for QSGVertexColorMaterial:

Public Member Functions

 QSGVertexColorMaterial ()
 Creates a new vertex color material.
 
int compare (const QSGMaterial *other) const override
 int QSGVertexColorMaterial::compare() const
 
- Public Member Functions inherited from QSGMaterial
 QSGMaterial ()
 
virtual ~QSGMaterial ()
 
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.
 
int viewCount () const
 

Protected Member Functions

QSGMaterialTypetype () const override
 
QSGMaterialShadercreateShader (QSGRendererInterface::RenderMode renderMode) const override
 

Additional Inherited Members

- Public Types inherited from QSGMaterial
enum  Flag {
  Blending = 0x0001 , RequiresDeterminant = 0x0002 , RequiresFullMatrixExceptTranslate = 0x0004 | RequiresDeterminant , RequiresFullMatrix = 0x0008 | RequiresFullMatrixExceptTranslate ,
  NoBatching = 0x0010 , MultiView2 = 0x10000 , MultiView3 = 0x20000 , MultiView4 = 0x40000
}
 \value Blending Set this flag to true if the material requires blending to be enabled during rendering. More...
 

Detailed Description

The QSGVertexColorMaterial class provides a convenient way of rendering per-vertex colored geometry in the scene graph.

\inmodule QtQuick

Warning
This utility class is only functional when running with the default backend of the Qt Quick scenegraph.

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.

Note
The rendering pipeline expects pixels with premultiplied alpha.

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.

Constructor & Destructor Documentation

◆ QSGVertexColorMaterial()

QSGVertexColorMaterial::QSGVertexColorMaterial ( )

Creates a new vertex color material.

Definition at line 80 of file qsgvertexcolormaterial.cpp.

References QSGMaterial::Blending, and QSGMaterial::setFlag().

+ Here is the call graph for this function:

Member Function Documentation

◆ compare()

int QSGVertexColorMaterial::compare ( const QSGMaterial * other) const
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 95 of file qsgvertexcolormaterial.cpp.

◆ createShader()

QSGMaterialShader * QSGVertexColorMaterial::createShader ( QSGRendererInterface::RenderMode renderMode) const
overrideprotectedvirtual

Implements QSGMaterial.

Definition at line 116 of file qsgvertexcolormaterial.cpp.

References Q_UNUSED, and QSGMaterial::viewCount().

+ Here is the call graph for this function:

◆ type()

QSGMaterialType * QSGVertexColorMaterial::type ( ) const
overrideprotectedvirtual

Implements QSGMaterial.

Definition at line 104 of file qsgvertexcolormaterial.cpp.

References type().

Referenced by type().

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

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