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  · 

QSGGeometry Class

The QSGGeometry class provides low-level storage for graphics primitives in the QML Scene Graph. More...

 #include <QSGGeometry>

Public Types

class Attribute
class AttributeSet
class ColoredPoint2D
class Point2D
class TexturedPoint2D
enum DataPattern { AlwaysUploadPattern, DynamicPattern, StaticPattern }

Public Functions

QSGGeometry(const QSGGeometry::AttributeSet & attributes, int vertexCount, int indexCount = 0, int indexType = GL_UNSIGNED_SHORT)
virtual ~QSGGeometry()
void allocate(int vertexCount, int indexCount = 0)
int attributeCount() const
const Attribute * attributes() const
GLenum drawingMode() const
int indexCount() const
void * indexData()
const void * indexData() const
uint * indexDataAsUInt()
const uint * indexDataAsUInt() const
quint16 * indexDataAsUShort()
const quint16 * indexDataAsUShort() const
DataPattern indexDataPattern() const
int indexType() const
float lineWidth() const
void markIndexDataDirty()
void markVertexDataDirty()
void setDrawingMode(GLenum mode)
void setIndexDataPattern(DataPattern p)
void setLineWidth(float w)
void setVertexDataPattern(DataPattern p)
int sizeOfIndex() const
int sizeOfVertex() const
int vertexCount() const
void * vertexData()
const void * vertexData() const
ColoredPoint2D * vertexDataAsColoredPoint2D()
const ColoredPoint2D * vertexDataAsColoredPoint2D() const
Point2D * vertexDataAsPoint2D()
const Point2D * vertexDataAsPoint2D() const
TexturedPoint2D * vertexDataAsTexturedPoint2D()
const TexturedPoint2D * vertexDataAsTexturedPoint2D() const
DataPattern vertexDataPattern() const

Static Public Members

const AttributeSet & defaultAttributes_ColoredPoint2D()
const AttributeSet & defaultAttributes_Point2D()
const AttributeSet & defaultAttributes_TexturedPoint2D()
void updateRectGeometry(QSGGeometry * g, const QRectF & rect)
void updateTexturedRectGeometry(QSGGeometry * g, const QRectF & rect, const QRectF & textureRect)

Detailed Description

The QSGGeometry class provides low-level storage for graphics primitives in the QML Scene Graph.

The QSGGeometry class provides a few convenience attributes and attribute accessors by default. The defaultAttributes_Point2D() function returns attributes to be used in normal solid color rectangles, while the defaultAttributes_TexturedPoint2D function returns attributes to be used for the common pixmap usecase.

Member Type Documentation

enum QSGGeometry::DataPattern

The DataPattern enum is used to specify the use pattern for the vertex and index data in a geometry object.

ConstantValueDescription
QSGGeometry::AlwaysUploadPattern0The data is always uploaded. This means that the user does not need to explicitly mark index and vertex data as dirty after changing it. This is the default.
QSGGeometry::DynamicPattern2The data is modified repeatedly and drawn many times. This is a hint that may provide better performance. When set the user must make sure to mark the data as dirty after changing it.
QSGGeometry::StaticPattern3The data is modified once and drawn many times. This is a hint that may provide better performance. When set the user must make sure to mark the data as dirty after changing it.

Member Function Documentation

QSGGeometry::QSGGeometry(const QSGGeometry::AttributeSet & attributes, int vertexCount, int indexCount = 0, int indexType = GL_UNSIGNED_SHORT)

Constructs a geometry object based on attributes.

The object allocate space for vertexCount vertices based on the accumulated size in attributes and for indexCount.

Geometry objects are constructed with GL_TRIANGLE_STRIP as default drawing mode.

The attribute structure is assumed to be POD and the geometry object assumes this will not go away. There is no memory management involved.

QSGGeometry::~QSGGeometry() [virtual]

void QSGGeometry::allocate(int vertexCount, int indexCount = 0)

Resizes the vertex and index data of this geometry object to fit vertexCount vertices and indexCount indices.

Vertex and index data will be invalidated after this call and the caller must mark the associated geometry node as dirty, by calling node->markDirty(QSGNode::DirtyGeometry) to ensure that the renderer has a chance to update internal buffers.

int QSGGeometry::attributeCount() const

const Attribute * QSGGeometry::attributes() const

const AttributeSet & QSGGeometry::defaultAttributes_ColoredPoint2D() [static]

Convenience function which returns attributes to be used for per vertex colored 2D drawing.

const AttributeSet & QSGGeometry::defaultAttributes_Point2D() [static]

Convenience function which returns attributes to be used for 2D solid color drawing.

const AttributeSet & QSGGeometry::defaultAttributes_TexturedPoint2D() [static]

Convenience function which returns attributes to be used for textured 2D drawing.

GLenum QSGGeometry::drawingMode() const

Returns the drawing mode of this geometry.

The default value is GL_TRIANGLE_STRIP.

See also setDrawingMode().

int QSGGeometry::indexCount() const

Returns the number of indices in this geometry object.

void * QSGGeometry::indexData()

Returns a pointer to the raw index data of this geometry object.

See also indexDataAsUShort() and indexDataAsUInt().

const void * QSGGeometry::indexData() const

Returns a pointer to the raw index data of this geometry object.

See also indexDataAsUShort() and indexDataAsUInt().

uint * QSGGeometry::indexDataAsUInt()

const uint * QSGGeometry::indexDataAsUInt() const

quint16 * QSGGeometry::indexDataAsUShort()

const quint16 * QSGGeometry::indexDataAsUShort() const

DataPattern QSGGeometry::indexDataPattern() const

Returns the usage pattern for indices in this geometry. The default pattern is AlwaysUploadPattern.

See also setIndexDataPattern().

int QSGGeometry::indexType() const

Returns the primitive type used for indices in this geometry object.

float QSGGeometry::lineWidth() const

Gets the current line width to be used for this geometry. This property only applies where the drawingMode is GL_LINES or a related value.

The default value is 1.0

See also setLineWidth() and drawingMode().

void QSGGeometry::markIndexDataDirty()

Mark that the vertices in this geometry has changed and must be uploaded again.

This function only has an effect when the usage pattern for vertices is StaticData and the renderer that renders this geometry uploads the geometry into Vertex Buffer Objects (VBOs).

void QSGGeometry::markVertexDataDirty()

Mark that the vertices in this geometry has changed and must be uploaded again.

This function only has an effect when the usage pattern for vertices is StaticData and the renderer that renders this geometry uploads the geometry into Vertex Buffer Objects (VBOs).

void QSGGeometry::setDrawingMode(GLenum mode)

Sets the drawing mode to be used for this geometry.

The default value is GL_TRIANGLE_STRIP.

See also drawingMode().

void QSGGeometry::setIndexDataPattern(DataPattern p)

Sets the usage pattern for indices to p.

The default is AlwaysUploadPattern. When set to anything other than the default, the user must call markIndexDataDirty() after changing the index data.

See also indexDataPattern().

void QSGGeometry::setLineWidth(float w)

Sets the line width to be used for this geometry. This property only applies where the drawingMode is GL_LINES or a related value.

See also lineWidth() and drawingMode().

void QSGGeometry::setVertexDataPattern(DataPattern p)

Sets the usage pattern for vertices to p.

The default is AlwaysUploadPattern. When set to anything other than the default, the user must call markVertexDataDirty() after changing the vertex data.

See also vertexDataPattern().

int QSGGeometry::sizeOfIndex() const

Returns the byte size of the index type.

This value is either 1 when index type is GL_UNSIGNED_BYTE or 2 when index type is GL_UNSIGNED_SHORT. For Desktop OpenGL, GL_UNSIGNED_INT with the value 4 is also supported.

int QSGGeometry::sizeOfVertex() const

Returns the size in bytes of one vertex.

This value comes from the attributes.

void QSGGeometry::updateRectGeometry(QSGGeometry * g, const QRectF & rect) [static]

Updates the geometry g with the coordinates in rect.

The function assumes the geometry object contains a single triangle strip of QSGGeometry::Point2D vertices

void QSGGeometry::updateTexturedRectGeometry(QSGGeometry * g, const QRectF & rect, const QRectF & textureRect) [static]

Updates the geometry g with the coordinates in rect and texture coordinates from textureRect.

textureRect should be in normalized coordinates.

g is assumed to be a triangle strip of four vertices of type QSGGeometry::TexturedPoint2D.

int QSGGeometry::vertexCount() const

Returns the number of vertices in this geometry object.

void * QSGGeometry::vertexData()

Returns a pointer to the raw vertex data of this geometry object.

See also vertexDataAsPoint2D() and vertexDataAsTexturedPoint2D.

const void * QSGGeometry::vertexData() const

Returns a pointer to the raw vertex data of this geometry object.

See also vertexDataAsPoint2D() and vertexDataAsTexturedPoint2D.

ColoredPoint2D * QSGGeometry::vertexDataAsColoredPoint2D()

const ColoredPoint2D * QSGGeometry::vertexDataAsColoredPoint2D() const

Point2D * QSGGeometry::vertexDataAsPoint2D()

const Point2D * QSGGeometry::vertexDataAsPoint2D() const

TexturedPoint2D * QSGGeometry::vertexDataAsTexturedPoint2D()

const TexturedPoint2D * QSGGeometry::vertexDataAsTexturedPoint2D() const

DataPattern QSGGeometry::vertexDataPattern() const

Returns the usage pattern for vertices in this geometry. The default pattern is AlwaysUploadPattern.

See also setVertexDataPattern().

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