Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
QSGFlatColorMaterial Class Reference

The QSGFlatColorMaterial class provides a convenient way of rendering solid colored geometry in the scene graph. More...

#include <qsgflatcolormaterial.h>

+ Inheritance diagram for QSGFlatColorMaterial:
+ Collaboration diagram for QSGFlatColorMaterial:

Public Member Functions

 QSGFlatColorMaterial ()
 Constructs a new flat color material.
 
QSGMaterialTypetype () const override
 
QSGMaterialShadercreateShader (QSGRendererInterface::RenderMode renderMode) const override
 
void setColor (const QColor &color)
 Sets this flat color material's color to color.
 
const QColorcolor () const
 Returns this flat color material's color.
 
int compare (const QSGMaterial *other) const override
 
- Public Member Functions inherited from QSGMaterial
 QSGMaterial ()
 
virtual ~QSGMaterial ()
 
virtual QSGMaterialTypetype () const =0
 This function is called by the scene graph to query an identifier that is unique to the QSGMaterialShader instantiated by createShader().
 
virtual QSGMaterialShadercreateShader (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.
 

Additional Inherited Members

- Public Types inherited from QSGMaterial
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...
 

Detailed Description

The QSGFlatColorMaterial class provides a convenient way of rendering solid 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 flat color material will fill every pixel in a geometry using a solid color. The color can contain transparency.

The geometry to be rendered with a flat color material requires vertices in attribute location 0 in the QSGGeometry object to render correctly. The QSGGeometry::defaultAttributes_Point2D() returns an attribute set compatible with this material.

The flat color material respects both current opacity and current matrix when updating its rendering state.

Definition at line 12 of file qsgflatcolormaterial.h.

Constructor & Destructor Documentation

◆ QSGFlatColorMaterial()

QSGFlatColorMaterial::QSGFlatColorMaterial ( )

Constructs a new flat color material.

The default color is white.

Definition at line 89 of file qsgflatcolormaterial.cpp.

Member Function Documentation

◆ color()

const QColor & QSGFlatColorMaterial::color ( ) const
inline

Returns this flat color material's color.

The default color is white.

Definition at line 20 of file qsgflatcolormaterial.h.

Referenced by QSGSimpleRectNode::color(), compare(), setColor(), QSGSimpleRectNode::setColor(), and FlatColorMaterialRhiShader::updateUniformData().

+ Here is the caller graph for this function:

◆ compare()

int QSGFlatColorMaterial::compare ( const QSGMaterial other) const
overridevirtual

Reimplemented from QSGMaterial.

Definition at line 141 of file qsgflatcolormaterial.cpp.

References color(), other(), and QColor::rgba().

+ Here is the call graph for this function:

◆ createShader()

QSGMaterialShader * QSGFlatColorMaterial::createShader ( QSGRendererInterface::RenderMode  renderMode) const
overridevirtual

Implements QSGMaterial.

Definition at line 130 of file qsgflatcolormaterial.cpp.

References Q_UNUSED.

◆ setColor()

void QSGFlatColorMaterial::setColor ( const QColor color)

Sets this flat color material's color to color.

Definition at line 107 of file qsgflatcolormaterial.cpp.

References QColor::alpha(), QSGMaterial::Blending, color(), and QSGMaterial::setFlag().

Referenced by QSGSimpleRectNode::QSGSimpleRectNode(), and QSGSimpleRectNode::setColor().

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

◆ type()

QSGMaterialType * QSGFlatColorMaterial::type ( ) const
overridevirtual

Implements QSGMaterial.

Definition at line 119 of file qsgflatcolormaterial.cpp.

References FlatColorMaterialRhiShader::type.


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