Texture QML Type
Defines a texture for use in 3D scenes. More...
Import Statement: | import QtQuick3D 1.0 |
Inherits: |
Properties
- flipV : bool
- generateMipmaps : bool
- indexUV : int
- magFilter : enumeration
- mappingMode : enumeration
- minFilter : enumeration
- mipFilter : enumeration
- pivotU : float
- pivotV : float
- positionU : float
- positionV : float
- rotationUV : float
- scaleU : float
- scaleV : float
- source : url
- sourceItem : Item
- textureData : TextureData
- tilingModeHorizontal : enumeration
- tilingModeVertical : enumeration
Detailed Description
Texture defines an image and related settings, such as the minification and magnification filters, scaling, and UV transformations.
Texture objects can source image data from:
- an image file using the source property,
- a Qt Quick Item using the sourceItem property,
- or by setting the textureData property to a TextureData item subclass for defining the custom texture contents.
Property Documentation
flipV : bool |
This property sets the use of the vertically flipped coordinates.
generateMipmaps : bool |
This property determines if mipmaps are generated for textures that do not provide mipmap levels themselves. Using mipmaps along with mip filtering gives better visual quality when viewing textures at a distance compared rendering without them, but it may come at a performance cost (both when initializing the image and during rendering).
By default, this property is set to false.
Note: It is necessary to set a QQuick3D::Texture::mipFilter
mode for the generated mipmaps to be be used.
See also mipFilter.
indexUV : int |
This property sets the UV coordinate index used by this texture. Since QtQuick3D supports 2 UV sets(0 or 1) for now, the value will be saturated to the range.
magFilter : enumeration |
This property determines how the texture is sampled when a texel covers more than one pixel.
The default value is Texture.Linear
Constant | Description |
---|---|
Texture.None | defaults to Texture.Linear since it is not possible to disable |
Texture.Nearest | uses the value of the closest texel |
Texture.Linear | takes the four closest texels and bilinearly interpolates them. |
Note: Using Texture.None
is not possible and will default to Texture.Linear
mappingMode : enumeration |
This property defines which method of mapping to use when sampling this texture.
Constant | Description |
---|---|
Texture.UV | The default for diffuse and opacity maps, this causes the image to be stuck to the mesh. The same portion of the image will always appear on the same vertex (unless the UV properties are animated). |
Texture.Environment | The default for specular reflection, this causes the image to be ‘projected’ onto the material as though it is being reflected. Using Environmental Mapping for diffuse maps provides a mirror effect. |
Texture.LightProbe | The default for HDRI sphere maps used by light probes. Normally this does not need to be set when using a light probe, but may need to be set explicitly when using environment maps. |
minFilter : enumeration |
This property determines how the texture is sampled when a texel covers more than one pixel.
The default value is Texture.Linear
Constant | Description |
---|---|
Texture.Nearest | uses the value of the closest texel |
Texture.Linear | takes the four closest texels and bilinearly interpolates them. |
Note: Using Texture.None
is not possible and will default to Texture.Linear
mipFilter : enumeration |
This property determines how the texture mipmaps are sampled when a texel covers less than one pixel.
The default value is Texture.None
Constant | Description |
---|---|
Texture.None | disables the usage of mipmap sampling |
Texture.Nearest | uses mipmapping and samples the value of the closest texel |
Texture.Linear | uses mipmapping and interpolates between multiple texel values. |
Note: This property will have no effect on Textures that do not have mipmaps.
This property sets the pivot U position.
See also rotationUV.
This property sets the pivot V position.
See also rotationUV.
This property offsets the V coordinate mapping from bottom to top.
Note: Qt Quick 3D uses OpenGL-style vertex data, regardless of the graphics API used at run time. The UV position (0, 0)
is therefore referring to the bottom-left corner of the image data.
This property defines how to scale the U texture coordinate when mapping to a mesh's UV coordinates.
Scaling the U value when using horizontal tiling will define how many times the texture is repeated from left to right.
See also tilingModeHorizontal.
This property defines how to scale the V texture coordinate when mapping to a mesh's UV coordinates.
Scaling the V value when using vertical tiling will define how many times a texture is repeated from bottom to top.
See also tilingModeVertical.
source : url |
This property holds the location of an image file containing the data used by the texture.
The property is a URL, with the same rules as other source properties, such as Image.source. With Texture, only the qrc
and file
schemes are supported. When no scheme is present and the value is a relative path, it is assumed to be relative to the component's (i.e. the .qml
file's) location.
A Texture should use one method to provide image data, and set only one of source, sourceItem, or textureData.
See also sourceItem and textureData.
sourceItem : Item |
This property defines a Item to be used as the source of the texture. Using this property allows any 2D Qt Quick content to be used as a texture source by rendering that item as an offscreen layer.
If the item is a texture provider, no additional texture is used.
If this property is set, then the value of source will be ignored. A Texture should use one method to provide image data, and set only one of source, sourceItem, or textureData.
Note: Currently there is no way to forward input events to the Item used as a texture source.
See also source and textureData.
textureData : TextureData |
This property holds a reference to a TextureData component which defines the contents and properties of raw texture data.
If this property is used, then the value of source will be ignored. A Texture should use one method to provide image data, and set only one of source, sourceItem, or textureData.
See also source and sourceItem.
tilingModeHorizontal : enumeration |
Controls how the texture is mapped when the U scaling value is greater than 1.
By default, this property is set to Texture.Repeat
Constant | Description |
---|---|
Texture.ClampToEdge | Texture is not tiled, but the value on the edge is used instead. |
Texture.MirroredRepeat | Texture is repeated and mirrored over the X axis. |
Texture.Repeat | Texture is repeated over the X axis. |
See also scaleU.
tilingModeVertical : enumeration |
This property controls how the texture is mapped when the V scaling value is greater than 1.
By default, this property is set to Texture.Repeat
Constant | Description |
---|---|
Texture.ClampToEdge | Texture is not tiled, but the value on the edge is used instead. |
Texture.MirroredRepeat | Texture is repeated and mirrored over the Y axis. |
Texture.Repeat | Texture is repeated over the Y axis. |
See also scaleV.