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  · 

QGLMaterial Class

The QGLMaterial class describes one-sided material properties for rendering fragments. More...

 #include <QGLMaterial>

Inherits: QGLAbstractMaterial.

QGLMaterial is instantiated by QML element Material

This class was introduced in Qt 4.8.

Public Types

enum TextureCombineMode { Modulate, Decal, Replace }

Properties

  • 1 property inherited from QObject

Public Functions

QGLAbstractMaterial(QObject * parent = 0)
QGLMaterial(QObject * parent = 0)
~QGLAbstractMaterial()
~QGLMaterial()
QColor ambientColor() const
virtual QGLMaterial * back() const
virtual void bind(QGLPainter * painter) = 0
QColor diffuseColor() const
QColor emittedLight() const
virtual QGLMaterial * front() const
virtual bool isTransparent() const = 0
virtual void prepareToDraw(QGLPainter * painter, const QGLAttributeSet & attributes)
virtual void release(QGLPainter * painter, QGLAbstractMaterial * next) = 0
void setAmbientColor(const QColor & value)
void setColor(const QColor & value)
void setDiffuseColor(const QColor & value)
void setEmittedLight(const QColor & value)
void setShininess(qreal value)
void setSpecularColor(const QColor & value)
void setTexture(QGLTexture2D * value, int layer = 0)
void setTextureCombineMode(QGLMaterial::TextureCombineMode mode, int layer = 0)
void setTextureUrl(const QUrl & url, int layer = 0)
qreal shininess() const
QColor specularColor() const
QGLTexture2D * texture(int layer = 0) const
QGLMaterial::TextureCombineMode textureCombineMode(int layer = 0) const
int textureLayerCount() const
QUrl textureUrl(int layer = 0) const

Reimplemented Public Functions

virtual void bind(QGLPainter * painter)
virtual QGLMaterial * front() const
virtual bool isTransparent() const
virtual void prepareToDraw(QGLPainter * painter, const QGLAttributeSet & attributes)
virtual void release(QGLPainter * painter, QGLAbstractMaterial * next)
  • 31 public functions inherited from QObject

Signals

void ambientColorChanged()
void diffuseColorChanged()
void emittedLightChanged()
void materialChanged()
void shininessChanged()
void specularColorChanged()
void texturesChanged()

Additional Inherited Members

  • 1 public slot inherited from QObject
  • 11 static public members inherited from QObject
  • 9 protected functions inherited from QObject

Detailed Description

The QGLMaterial class describes one-sided material properties for rendering fragments.

See also QGLTwoSidedMaterial.

Member Type Documentation

enum QGLMaterial::TextureCombineMode

This enum defines the mode to use when combining a texture with the material colors on a QGLMaterial object.

ConstantValueDescription
QGLMaterial::Modulate0Modulate the texture with the lighting conditions to produce a lit texture.
QGLMaterial::Decal1Combine the texture with the lighting conditions to produce a decal effect.
QGLMaterial::Replace2Replace with the contents of the texture, ignoring colors and lighting conditions.

Property Documentation

ambientColor : QColor

This property holds the ambient color of the material. The default value is (0.2, 0.2, 0.2, 1.0).

Access functions:

QColor ambientColor() const
void setAmbientColor(const QColor & value)

Notifier signal:

void ambientColorChanged()

See also diffuseColor(), specularColor(), and ambientColorChanged().

diffuseColor : QColor

This property holds the diffuse color of the material. The default value is (0.8, 0.8, 0.8, 1.0).

Access functions:

QColor diffuseColor() const
void setDiffuseColor(const QColor & value)

Notifier signal:

void diffuseColorChanged()

See also ambientColor(), specularColor(), and diffuseColorChanged().

emittedLight : QColor

This property holds the emitted light intensity of the material. The default value is (0.0, 0.0, 0.0, 1.0), which indicates that the material does not emit any light.

Access functions:

QColor emittedLight() const
void setEmittedLight(const QColor & value)

Notifier signal:

void emittedLightChanged()

See also emittedLightChanged().

shininess : qreal

This property holds the specular exponent of the material, or how shiny it is. Must be between 0 and 128. The default value is 0. A value outside this range will be clamped to the range when the property is set.

Access functions:

qreal shininess() const
void setShininess(qreal value)

Notifier signal:

void shininessChanged()

See also shininessChanged().

specularColor : QColor

This property holds the specular color of the material. The default value is (0, 0, 0, 1).

Access functions:

QColor specularColor() const
void setSpecularColor(const QColor & value)

Notifier signal:

void specularColorChanged()

See also ambientColor(), diffuseColor(), and specularColorChanged().

texture : QGLTexture2D *

This property holds the 2D texture associated with layer on this material; null if no texture.

Layer 0 is normally the primary texture associated with the material. Multiple texture layers may be specified for materials with special blending effects or to specify ambient, diffuse, or specular colors pixel-by-pixel.

Access functions:

QGLTexture2D * texture(int layer = 0) const
void setTexture(QGLTexture2D * value, int layer = 0)

Notifier signal:

void texturesChanged()

See also texturesChanged().

textureCombineMode : QGLMaterial::TextureCombineMode

This property holds the texture combine mode associated with layer on this material. The default value is Modulate.

Access functions:

QGLMaterial::TextureCombineMode textureCombineMode(int layer = 0) const
void setTextureCombineMode(QGLMaterial::TextureCombineMode mode, int layer = 0)

Notifier signal:

void texturesChanged()

See also texturesChanged().

textureUrl : QUrl

This property holds uRL of the 2D texture associated with layer on this material.

By default layer is 0, the primary texture.

If the URL has not been specified, then this property is a null QUrl.

Setting this property to a non-empty URL will replace any existing texture with a new texture based on the image at the given url. If that image is not a valid texture then the new texture will be a null texture.

If an empty url is set, this has the same effect as setTexture(0).

Access functions:

QUrl textureUrl(int layer = 0) const
void setTextureUrl(const QUrl & url, int layer = 0)

Notifier signal:

void texturesChanged()

See also texture() and setTexture().

Member Function Documentation

QGLMaterial::QGLMaterial(QObject * parent = 0)

Constructs a QGLMaterial object with its default values, and attaches it to parent.

QGLMaterial::~QGLMaterial()

Destroys this QGLMaterial object.

void QGLMaterial::bind(QGLPainter * painter) [virtual]

Reimplemented from QGLAbstractMaterial::bind().

QGLMaterial * QGLMaterial::front() const [virtual]

Reimplemented from QGLAbstractMaterial::front().

Returns this material.

bool QGLMaterial::isTransparent() const [virtual]

Reimplemented from QGLAbstractMaterial::isTransparent().

void QGLMaterial::prepareToDraw(QGLPainter * painter, const QGLAttributeSet & attributes) [virtual]

Reimplemented from QGLAbstractMaterial::prepareToDraw().

void QGLMaterial::release(QGLPainter * painter, QGLAbstractMaterial * next) [virtual]

Reimplemented from QGLAbstractMaterial::release().

void QGLMaterial::setColor(const QColor & value)

Sets ambientColor() to 20% of value, and diffuseColor() to 80% of value. This is a convenience function for quickly setting ambient and diffuse lighting colors based on a flat color.

See also ambientColor() and diffuseColor().

int QGLMaterial::textureLayerCount() const

Returns the number of texture layers associated with this material.

The return value may be larger than the number of actual texture layers if some of the intermediate layers are null. For example, setting layers 0 and 2 will report textureLayerCount() as 3. The main use of this value is to iterate over all layers.

See also texture().

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