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  · 

QGLBezierPatches Class

The QGLBezierPatches class represents 3D geometry as a set of Bezier bicubic patches. More...

 #include <QGLBezierPatches>

Inherited by: QGLTeapot.

This class was introduced in Qt 4.8.

Public Functions

QGLBezierPatches()
QGLBezierPatches(const QGLBezierPatches & other)
virtual ~QGLBezierPatches()
qreal intersection(const QRay3D & ray, QVector2D * texCoord = 0, int * patch = 0) const
bool intersects(const QRay3D & ray) const
QVector3DArray positions() const
void setPositions(const QVector3DArray & positions)
void setSubdivisionDepth(int value)
void setTextureCoords(const QVector2DArray & textureCoords)
int subdivisionDepth() const
QVector2DArray textureCoords() const
void transform(const QMatrix4x4 & matrix)
QGLBezierPatches transformed(const QMatrix4x4 & matrix) const
QGLBezierPatches & operator=(const QGLBezierPatches & other)

Detailed Description

The QGLBezierPatches class represents 3D geometry as a set of Bezier bicubic patches.

Bezier bicubic patches represent a curved 3D surface by four fixed control points at indices 0, 3, 12, and 15, together with twelve additional floating control points that define the surface curvature. Bezier geometry objects are made up of one or more such patches to define the surface of an object.

The application specifies the vertex position data to the constructor, and can optionally provide an index array. The class interprets groups of 16 vertices as the control points for successive patches.

A mesh defined by QGLBezierPatches is subdivided into flat triangles for rendering when the << operator is used to add the patches to a QGLBuilder.

Many curved 3D objects can be defined as being made up of Bezier bicubic patches, stitched together into a mesh. The most famous Bezier bicubic object is probably the classic 3D "Utah Teapot", first rendered in 1975. The QGLTeapot class provides a built-in implementation of this object for testing purposes.

If texture co-ordinates are supplied via setTextureCoords(), then patch texture co-ordinates will be derived from the specified values as the patches are subdivided. Otherwise, QGLBezierPatches will generate texture co-ordinates for each patch based on the default square from (0, 0) to (1, 1). The first vertex in the patch corresponds to (0, 0), and the opposite vertex in the patch corresponds to (1, 1).

See also QGLBuilder and QGLTeapot.

Member Function Documentation

QGLBezierPatches::QGLBezierPatches()

Constructs an empty Bezier patch list.

See also setPositions().

QGLBezierPatches::QGLBezierPatches(const QGLBezierPatches & other)

Constructs a copy of other.

See also operator=().

QGLBezierPatches::~QGLBezierPatches() [virtual]

Destroys this Bezier patch list.

qreal QGLBezierPatches::intersection(const QRay3D & ray, QVector2D * texCoord = 0, int * patch = 0) const

Returns the t value at which ray intersects this Bezier geometry object, or not-a-number if there is no intersection.

When the ray intersects this object, the return value is a parametric value that can be passed to QRay3D::point() to determine the actual intersection point, as shown in the following example:

 qreal t = patches.intersection(ray);
 QVector3D pt;
 if (qIsNaN(t)) {
     qWarning("no intersection occurred");
 else
     pt = ray.point(t);

If ray intersects the object multiple times, the returned t will be the smallest t value, corresponding to the first intersection of the ray with the object. The t value may be negative if the first intersection occurs in the reverse direction of ray.

The intersection is determined by subdividing the patches into triangles and intersecting with those triangles. A pruning algorithm is used to discard patches whose convex hull do not intersect with ray.

If texCoord is not null, then it will return the texture co-ordinate of the intersection point.

If patch is not null, then it will return the index of the patch that contains the intersection, or -1 if there is no intersection.

See also intersects().

bool QGLBezierPatches::intersects(const QRay3D & ray) const

Returns true if ray intersects this Bezier geometry object; false otherwise.

See also intersection().

QVector3DArray QGLBezierPatches::positions() const

Returns the positions of the vertices in the Bezier patches.

See also setPositions() and textureCoords().

void QGLBezierPatches::setPositions(const QVector3DArray & positions)

Sets the positions of the vertices in the Bezier patches.

See also positions() and setTextureCoords().

void QGLBezierPatches::setSubdivisionDepth(int value)

Sets the depth of subdivision to use when converting the Bezier geometry into triangles to value.

See also subdivisionDepth().

void QGLBezierPatches::setTextureCoords(const QVector2DArray & textureCoords)

Sets the texture co-ordinates for the Bezier patches to the elements of textureCoords. Each patch consumes two elements from textureCoords, defining the opposite corners.

If textureCoords is empty, then each patch will generate texture co-ordinates in the range (0, 0) to (1, 1).

See also textureCoords() and setPositions().

int QGLBezierPatches::subdivisionDepth() const

Returns the depth of subdivision to use when converting the Bezier geometry into triangles. The default value is 4.

See also setSubdivisionDepth().

QVector2DArray QGLBezierPatches::textureCoords() const

Returns the texture co-ordinates for the Bezier patches. Each patch consumes two elements from the texture co-ordinate array, defining the opposite corners.

The default is an empty array, which indicates that each patch will generate texture co-ordinates in the range (0, 0) to (1, 1).

See also setTextureCoords() and positions().

void QGLBezierPatches::transform(const QMatrix4x4 & matrix)

Transforms the positions() in this Bezier geometry object according to matrix.

See also transformed().

QGLBezierPatches QGLBezierPatches::transformed(const QMatrix4x4 & matrix) const

Returns a new Bezier geometry object that results from transforming this object's positions() according to matrix.

See also transform().

QGLBezierPatches & QGLBezierPatches::operator=(const QGLBezierPatches & other)

Assigns other to this Bezier patch list.

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