Docs for vertex and flat color materials
authorGunnar Sletta <gunnar.sletta@nokia.com>
Mon, 9 May 2011 09:54:10 +0000 (11:54 +0200)
committerGunnar Sletta <gunnar.sletta@nokia.com>
Mon, 9 May 2011 11:51:40 +0000 (13:51 +0200)
src/declarative/scenegraph/util/qsgflatcolormaterial.cpp
src/declarative/scenegraph/util/qsgvertexcolormaterial.cpp

index e348655..ed3d96f 100644 (file)
@@ -116,10 +116,51 @@ const char *FlatColorMaterialShader::fragmentShader() const {
 }
 
 
+
+/*!
+    \class QSGFlatColorMaterial
+    \brief The QSGFlatColorMaterial provides a convenient way of rendering
+    solid colored geometry in the scene graph.
+
+    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 it's rendering state.
+ */
+
+
+/*!
+    Constructs a new flat color material.
+
+    The default color is white.
+ */
+
 QSGFlatColorMaterial::QSGFlatColorMaterial() : m_color(QColor(255, 255, 255))
 {
 }
 
+
+
+/*!
+    \fn QColor QSGFlatColorMaterial::color() const
+
+    Returns this flat color material's color.
+
+    The default color is white.
+ */
+
+
+
+/*!
+    Sets this flat color material's color to \a color.
+ */
+
 void QSGFlatColorMaterial::setColor(const QColor &color)
 {
     m_color = color;
@@ -127,11 +168,22 @@ void QSGFlatColorMaterial::setColor(const QColor &color)
 }
 
 
+
+/*!
+    \internal
+ */
+
 QSGMaterialType *QSGFlatColorMaterial::type() const
 {
     return &FlatColorMaterialShader::type;
 }
 
+
+
+/*!
+    \internal
+ */
+
 QSGMaterialShader *QSGFlatColorMaterial::createShader() const
 {
     return new FlatColorMaterialShader;
index bbd57ea..429251a 100644 (file)
@@ -107,22 +107,75 @@ const char *QSGVertexColorMaterialShader::fragmentShader() const {
 }
 
 
+
+/*!
+    \class QSGVertexColorMaterial
+    \brief The QSGVertexColorMaterial provides a convenient way of rendering per-vertex
+    colored geometry in the scene graph.
+
+    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. The
+    QSGGeometry::defaultAttributes_ColoredPoint2D() constructs an attribute set
+    compatible with this material.
+
+    The vertex color material respets both current opacity and current matrix when
+    updating it's rendering state.
+ */
+
+
 QSGVertexColorMaterial::QSGVertexColorMaterial(bool opaque) : m_opaque(opaque)
 {
     setFlag(Blending, !opaque);
 }
 
+
+
+/*!
+    \fn bool QSGVertexColorMaterial::opaque() const
+
+    Returns if the vertex color material should interpret all colors
+    as opaque.
+ */
+
+
+
+/*!
+    Sets wether the material should interpret all colors in the
+    geometry as \a opaque.
+
+    This is an optimization hint. Setting opaque to true for geometry that only
+    contains opaque colors, can lead to better performance.
+
+ */
+
 void QSGVertexColorMaterial::setOpaque(bool opaque)
 {
     setFlag(Blending, !opaque);
     m_opaque = opaque;
 }
 
+
+
+/*!
+    \internal
+ */
+
 QSGMaterialType *QSGVertexColorMaterial::type() const
 {
     return &QSGVertexColorMaterialShader::type;
 }
 
+
+
+/*!
+    \internal
+ */
+
 QSGMaterialShader *QSGVertexColorMaterial::createShader() const
 {
     return new QSGVertexColorMaterialShader;