Viadeo Twitter Google Bookmarks ! Facebook Digg del.icio.us MySpace Yahoo MyWeb Blinklist Netvouz Reddit Simpy StumbleUpon Bookmarks Windows Live Favorites 
Logo Documentation Qt ·  Page d'accueil  ·  Toutes les classes  ·  Classes principales  ·  Annotées  ·  Classes groupées  ·  Modules  ·  Fonctions  · 

QSGGeometryNode Class

The QSGGeometryNode class is used for all rendered content in the scene graph. More...

 #include <QSGGeometryNode>

Inherits: QSGBasicGeometryNode.

Inherited by: QSGSimpleRectNode and QSGSimpleTextureNode.

Public Functions

QSGGeometryNode()
~QSGGeometryNode()
qreal inheritedOpacity() const
QSGMaterial * material() const
QSGMaterial * opaqueMaterial() const
void setMaterial(QSGMaterial * material)
void setOpaqueMaterial(QSGMaterial * material)

Detailed Description

The QSGGeometryNode class is used for all rendered content in the scene graph.

The QSGGeometryNode consists of geometry and material. The geometry defines the mesh, the vertices and their structure, to be drawn. The Material defines how the shape is filled.

The following is a code snipped illustrating how to create a red line using a QSGGeometryNode:

 QSGGeometry *geometry = new QSGGeometry(QSGGeometry::defaultAttributes_Point2D(), 2);
 geometry->setDrawingMode(GL_LINES);
 geometry->setLineWidth(3);
 geometry->vertexDataAsPoint2D()[0].set(0, 0);
 geometry->vertexDataAsPoint2D()[1].set(width(), height());

 QSGFlatColorMaterial *material = new QSGFlatColorMaterial;
 material->setColor(QColor(255, 0, 0));

 QSGGeometryNode *node = new QSGGeometryNode;
 node->setGeometry(geometry);
 node->setFlag(QSGNode::OwnsGeometry);
 node->setMaterial(material);
 node->setFlag(QSGNode::OwnsMaterial);

A geometry node must have both geometry and a normal material before it is added to the scene graph. When the geometry and materials are changed after the node has been added to the scene graph, the user should also mark them as dirty using QSGNode::markDirty().

The geometry node supports two types of materials, the opaqueMaterial and the normal material. The opaqueMaterial is used when the accumulated scene graph opacity at the time of rendering is 1. The primary usecase is to special case opaque rendering to avoid an extra operation in the fragment shader can have significant performance impact on embedded graphics chips. The opaque material is optional.

See also QSGGeometry, QSGMaterial, and QSGSimpleMaterial.

Member Function Documentation

QSGGeometryNode::QSGGeometryNode()

Creates a new geometry node without geometry and material.

QSGGeometryNode::~QSGGeometryNode()

Deletes this geometry node.

The flags QSGNode::OwnsMaterial, QSGNode::OwnsOpaqueMaterial and QSGNode::OwnsGeometry decides weither the geometry node should also delete the materials and geometry. By default, these flags are disabled.

qreal QSGGeometryNode::inheritedOpacity() const

QSGMaterial * QSGGeometryNode::material() const

See also setMaterial().

QSGMaterial * QSGGeometryNode::opaqueMaterial() const

See also setOpaqueMaterial().

void QSGGeometryNode::setMaterial(QSGMaterial * material)

Sets the material of this geometry node to material.

Geometry nodes must have a material before they can be added to the scene graph.

If the material is changed whitout calling setMaterial() again, the user must also mark the material as dirty using QSGNode::markDirty().

See also material().

void QSGGeometryNode::setOpaqueMaterial(QSGMaterial * material)

Sets the opaque material of this geometry to material.

The opaque material will be preferred by the renderer over the default material, as returned by the material() function, if it is not null and the geometry item has an inherited opacity of 1.

The opaqueness refers to scene graph opacity, the material is still allowed to set QSGMaterial::Blending to true and draw transparent pixels.

If the material is changed whitout calling setOpaqueMaterial() again, the user must also mark the opaque material as dirty using QSGNode::markDirty().

See also opaqueMaterial().

Cette page est une traduction d'une page de la documentation de Qt, écrite par Nokia Corporation and/or its subsidiary(-ies). Les éventuels problèmes résultant d'une mauvaise traduction ne sont pas imputables à Nokia. Qt 5.0-snapshot
Copyright © 2012 Developpez LLC. Tous droits réservés Developpez LLC. Aucune reproduction, même partielle, ne peut être faite de ce site et de l'ensemble de son contenu : textes, documents et images sans l'autorisation expresse de Developpez LLC. Sinon, vous encourez selon la loi jusqu'à 3 ans de prison et jusqu'à 300 000 E de dommages et intérêts. Cette page est déposée à la SACD.
Vous avez déniché une erreur ? Un bug ? Une redirection cassée ? Ou tout autre problème, quel qu'il soit ? Ou bien vous désirez participer à ce projet de traduction ? N'hésitez pas à nous contacter ou par MP !
 
 
 
 
Partenaires

Hébergement Web