QGLMaterial ClassThe 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
Properties
Public Functions
Reimplemented Public Functions
Signals
Additional Inherited Members
Detailed DescriptionThe QGLMaterial class describes one-sided material properties for rendering fragments. See also QGLTwoSidedMaterial. Member Type Documentation
|
Constant | Value | Description |
---|---|---|
QGLMaterial::Modulate | 0 | Modulate the texture with the lighting conditions to produce a lit texture. |
QGLMaterial::Decal | 1 | Combine the texture with the lighting conditions to produce a decal effect. |
QGLMaterial::Replace | 2 | Replace with the contents of the texture, ignoring colors and lighting conditions. |
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().
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().
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().
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().
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().
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().
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().
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().
Constructs a QGLMaterial object with its default values, and attaches it to parent.
Destroys this QGLMaterial object.
Reimplemented from QGLAbstractMaterial::bind().
Reimplemented from QGLAbstractMaterial::front().
Returns this material.
Reimplemented from QGLAbstractMaterial::isTransparent().
Reimplemented from QGLAbstractMaterial::prepareToDraw().
Reimplemented from QGLAbstractMaterial::release().
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().
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().