Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
QQuick3DTexture Class Reference

#include <qquick3dtexture_p.h>

+ Inheritance diagram for QQuick3DTexture:
+ Collaboration diagram for QQuick3DTexture:

Public Types

enum  MappingMode { UV = 0 , Environment = 1 , LightProbe = 2 }
 
enum  TilingMode { ClampToEdge = 1 , MirroredRepeat , Repeat }
 
enum  Filter { None = 0 , Nearest , Linear }
 

Public Slots

void setSource (const QUrl &source)
 
void setSourceItem (QQuickItem *sourceItem)
 
void setScaleU (float scaleU)
 
void setScaleV (float scaleV)
 
void setMappingMode (QQuick3DTexture::MappingMode mappingMode)
 
void setHorizontalTiling (QQuick3DTexture::TilingMode tilingModeHorizontal)
 
void setVerticalTiling (QQuick3DTexture::TilingMode tilingModeVertical)
 
Q_REVISION(6, 7) void setDepthTiling(QQuick3DTexture void setRotationUV (float rotationUV)
 
void setPositionU (float positionU)
 
void setPositionV (float positionV)
 
void setPivotU (float pivotU)
 
void setPivotV (float pivotV)
 
void setFlipU (bool flipU)
 
void setFlipV (bool flipV)
 
void setIndexUV (int indexUV)
 
void setMagFilter (QQuick3DTexture::Filter magFilter)
 
void setMinFilter (QQuick3DTexture::Filter minFilter)
 
void setMipFilter (QQuick3DTexture::Filter mipFilter)
 
void setTextureData (QQuick3DTextureData *textureData)
 
void setGenerateMipmaps (bool generateMipmaps)
 
void setAutoOrientation (bool autoOrientation)
 
- Public Slots inherited from QQuick3DObject
void update ()
 
void setParentItem (QQuick3DObject *parentItem)
 
- Public Slots inherited from QObject
void deleteLater ()
 \threadsafe
 

Signals

void sourceChanged ()
 
void sourceItemChanged ()
 
void scaleUChanged ()
 
void scaleVChanged ()
 
void mappingModeChanged ()
 
void horizontalTilingChanged ()
 
void verticalTilingChanged ()
 
 Q_REVISION (6, 7) void depthTilingChanged()
 
void rotationUVChanged ()
 
void positionUChanged ()
 
void positionVChanged ()
 
void pivotUChanged ()
 
void pivotVChanged ()
 
void flipUChanged ()
 
void flipVChanged ()
 
void indexUVChanged ()
 
void magFilterChanged ()
 
void minFilterChanged ()
 
void mipFilterChanged ()
 
void textureDataChanged ()
 
void generateMipmapsChanged ()
 
void autoOrientationChanged ()
 
 Q_REVISION (6, 7) void textureProviderChanged()
 
- Signals inherited from QQuick3DObject
void parentChanged ()
 
void childrenChanged ()
 
void stateChanged ()
 
- Signals inherited from QObject
void destroyed (QObject *=nullptr)
 This signal is emitted immediately before the object obj is destroyed, after any instances of QPointer have been notified, and cannot be blocked.
 
void objectNameChanged (const QString &objectName, QPrivateSignal)
 This signal is emitted after the object's name has been changed.
 

Public Member Functions

 QQuick3DTexture (QQuick3DObject *parent=nullptr)
 \qmltype Texture \inherits Object3D \inqmlmodule QtQuick3D
 
 ~QQuick3DTexture () override
 
QUrl source () const
 \qmlproperty url QtQuick3D::Texture::source
 
QQuickItemsourceItem () const
 \qmlproperty Item QtQuick3D::Texture::sourceItem
 
float scaleU () const
 \qmlproperty float QtQuick3D::Texture::scaleU
 
float scaleV () const
 \qmlproperty float QtQuick3D::Texture::scaleV
 
MappingMode mappingMode () const
 \qmlproperty enumeration QtQuick3D::Texture::mappingMode
 
TilingMode horizontalTiling () const
 \qmlproperty enumeration QtQuick3D::Texture::tilingModeHorizontal
 
TilingMode verticalTiling () const
 \qmlproperty enumeration QtQuick3D::Texture::tilingModeVertical
 
 Q_REVISION (6, 7) TilingMode depthTiling() const
 
float rotationUV () const
 \qmlproperty float QtQuick3D::Texture::rotationUV
 
float positionU () const
 \qmlproperty float QtQuick3D::Texture::positionU
 
float positionV () const
 \qmlproperty float QtQuick3D::Texture::positionV
 
float pivotU () const
 \qmlproperty float QtQuick3D::Texture::pivotU
 
float pivotV () const
 \qmlproperty float QtQuick3D::Texture::pivotV
 
bool flipU () const
 \qmlproperty bool QtQuick3D::Texture::flipU
 
bool flipV () const
 \qmlproperty bool QtQuick3D::Texture::flipV
 
int indexUV () const
 \qmlproperty int QtQuick3D::Texture::indexUV
 
Filter magFilter () const
 \qmlproperty enumeration QtQuick3D::Texture::magFilter
 
Filter minFilter () const
 \qmlproperty enumeration QtQuick3D::Texture::minFilter
 
Filter mipFilter () const
 \qmlproperty enumeration QtQuick3D::Texture::mipFilter
 
QQuick3DTextureDatatextureData () const
 \qmlproperty TextureData QtQuick3D::Texture::textureData
 
bool generateMipmaps () const
 \qmlproperty bool QtQuick3D::Texture::generateMipmaps
 
bool autoOrientation () const
 \qmlproperty bool QtQuick3D::Texture::autoOrientation
 
QSSGRenderImagegetRenderImage ()
 
 Q_REVISION (6, 7) QQuick3DRenderExtension *textureProvider() const
 
 Q_REVISION (6, 7) void setTextureProvider(QQuick3DRenderExtension *newRenderTexture)
 
bool extensionDirty () const
 
bool hasSourceData () const
 
- Public Member Functions inherited from QObject
Q_INVOKABLE QObject (QObject *parent=nullptr)
 Constructs an object with parent object parent.
 
virtual ~QObject ()
 Destroys the object, deleting all its child objects.
 
virtual bool event (QEvent *event)
 This virtual function receives events to an object and should return true if the event e was recognized and processed.
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 Filters events if this object has been installed as an event filter for the watched object.
 
QString objectName () const
 
Q_WEAK_OVERLOAD void setObjectName (const QString &name)
 Sets the object's name to name.
 
void setObjectName (QAnyStringView name)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
QBindable< QStringbindableObjectName ()
 
bool isWidgetType () const
 Returns true if the object is a widget; otherwise returns false.
 
bool isWindowType () const
 Returns true if the object is a window; otherwise returns false.
 
bool isQuickItemType () const
 Returns true if the object is a QQuickItem; otherwise returns false.
 
bool signalsBlocked () const noexcept
 Returns true if signals are blocked; otherwise returns false.
 
bool blockSignals (bool b) noexcept
 If block is true, signals emitted by this object are blocked (i.e., emitting a signal will not invoke anything connected to it).
 
QThreadthread () const
 Returns the thread in which the object lives.
 
bool moveToThread (QThread *thread QT6_DECL_NEW_OVERLOAD_TAIL)
 Changes the thread affinity for this object and its children and returns true on success.
 
int startTimer (int interval, Qt::TimerType timerType=Qt::CoarseTimer)
 This is an overloaded function that will start a timer of type timerType and a timeout of interval milliseconds.
 
int startTimer (std::chrono::nanoseconds time, Qt::TimerType timerType=Qt::CoarseTimer)
 
void killTimer (int id)
 Kills the timer with timer identifier, id.
 
void killTimer (Qt::TimerId id)
 
template<typename T >
findChild (QAnyStringView aName, Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
 Returns the child of this object that can be cast into type T and that is called name, or \nullptr if there is no such object.
 
template<typename T >
QList< T > findChildren (QAnyStringView aName, Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
 Returns all children of this object with the given name that can be cast to type T, or an empty list if there are no such objects.
 
template<typename T >
findChild (Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
template<typename T >
QList< T > findChildren (Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
const QObjectListchildren () const
 Returns a list of child objects.
 
void setParent (QObject *parent)
 Makes the object a child of parent.
 
void installEventFilter (QObject *filterObj)
 Installs an event filter filterObj on this object.
 
void removeEventFilter (QObject *obj)
 Removes an event filter object obj from this object.
 
QMetaObject::Connection connect (const QObject *sender, const char *signal, const char *member, Qt::ConnectionType type=Qt::AutoConnection) const
 
bool disconnect (const char *signal=nullptr, const QObject *receiver=nullptr, const char *member=nullptr) const
 
bool disconnect (const QObject *receiver, const char *member=nullptr) const
 
void dumpObjectTree () const
 Dumps a tree of children to the debug output.
 
void dumpObjectInfo () const
 Dumps information about signal connections, etc.
 
bool setProperty (const char *name, const QVariant &value)
 Sets the value of the object's name property to value.
 
bool setProperty (const char *name, QVariant &&value)
 
QVariant property (const char *name) const
 Returns the value of the object's name property.
 
QList< QByteArraydynamicPropertyNames () const
 
QBindingStoragebindingStorage ()
 
const QBindingStoragebindingStorage () const
 
QObjectparent () const
 Returns a pointer to the parent object.
 
bool inherits (const char *classname) const
 Returns true if this object is an instance of a class that inherits className or a QObject subclass that inherits className; otherwise returns false.
 
- Public Member Functions inherited from QQmlParserStatus
 QQmlParserStatus ()
 
virtual ~QQmlParserStatus ()
 
- Public Member Functions inherited from QQuickItemChangeListener
virtual ~QQuickItemChangeListener ()
 
virtual void itemSiblingOrderChanged (QQuickItem *)
 
virtual void itemVisibilityChanged (QQuickItem *)
 
virtual void itemEnabledChanged (QQuickItem *)
 
virtual void itemOpacityChanged (QQuickItem *)
 
virtual void itemDestroyed (QQuickItem *)
 
virtual void itemChildAdded (QQuickItem *, QQuickItem *)
 
virtual void itemChildRemoved (QQuickItem *, QQuickItem *)
 
virtual void itemParentChanged (QQuickItem *, QQuickItem *)
 
virtual void itemRotationChanged (QQuickItem *)
 
virtual void itemImplicitWidthChanged (QQuickItem *)
 
virtual void itemImplicitHeightChanged (QQuickItem *)
 
virtual void itemFocusChanged (QQuickItem *, Qt::FocusReason)
 
virtual void itemScaleChanged (QQuickItem *)
 
virtual void itemTransformChanged (QQuickItem *)
 
virtual QQuickAnchorsPrivateanchorPrivate ()
 

Protected Member Functions

QSSGRenderGraphObjectupdateSpatialNode (QSSGRenderGraphObject *node) override
 
void markAllDirty () override
 
void itemChange (ItemChange change, const ItemChangeData &value) override
 
void itemGeometryChanged (QQuickItem *item, QQuickGeometryChange change, const QRectF &geometry) override
 
 QQuick3DTexture (QQuick3DObjectPrivate &dd, QQuick3DObject *parent=nullptr)
 
- Protected Member Functions inherited from QQuick3DObject
 QQuick3DObject (QQuick3DObjectPrivate &dd, QQuick3DObject *parent=nullptr)
 
void classBegin () override
 Invoked after class creation, but before any properties have been set.
 
void componentComplete () override
 Invoked after the root component that caused this instantiation has completed construction.
 
bool isComponentComplete () const
 
virtual void preSync ()
 
- Protected Member Functions inherited from QObject
QObjectsender () const
 Returns a pointer to the object that sent the signal, if called in a slot activated by a signal; otherwise it returns \nullptr.
 
int senderSignalIndex () const
 
int receivers (const char *signal) const
 Returns the number of receivers connected to the signal.
 
bool isSignalConnected (const QMetaMethod &signal) const
 
virtual void timerEvent (QTimerEvent *event)
 This event handler can be reimplemented in a subclass to receive timer events for the object.
 
virtual void childEvent (QChildEvent *event)
 This event handler can be reimplemented in a subclass to receive child events.
 
virtual void customEvent (QEvent *event)
 This event handler can be reimplemented in a subclass to receive custom events.
 
virtual void connectNotify (const QMetaMethod &signal)
 
virtual void disconnectNotify (const QMetaMethod &signal)
 
 QObject (QObjectPrivate &dd, QObject *parent=nullptr)
 

Properties

QUrl source
 
QQuickItemsourceItem
 
QQuick3DTextureDatatextureData
 
QQuick3DRenderExtensiontextureProvider
 \qmlproperty RenderExtension QtQuick3D::Texture::textureProvider
 
float scaleU
 
float scaleV
 
MappingMode mappingMode
 
TilingMode tilingModeHorizontal
 
TilingMode tilingModeVertical
 
TilingMode tilingModeDepth
 
float rotationUV
 
float positionU
 
float positionV
 
float pivotU
 
float pivotV
 
bool flipU
 
bool flipV
 
int indexUV
 
Filter magFilter
 
Filter minFilter
 
Filter mipFilter
 
bool generateMipmaps
 
bool autoOrientation
 
- Properties inherited from QQuick3DObject
QQuick3DObjectparent
 \qmlproperty Object3D QtQuick3D::Object3D::parent This property holds the parent of the Object3D in a 3D scene.
 
- Properties inherited from QObject
QString objectName
 the name of this object
 

Additional Inherited Members

- Static Public Member Functions inherited from QObject
static QMetaObject::Connection connect (const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
 \threadsafe
 
static QMetaObject::Connection connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type=Qt::AutoConnection)
 
template<typename Func1 , typename Func2 >
static QMetaObject::Connection connect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const typename QtPrivate::ContextTypeForFunctor< Func2 >::ContextType *context, Func2 &&slot, Qt::ConnectionType type=Qt::AutoConnection)
 
template<typename Func1 , typename Func2 >
static QMetaObject::Connection connect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, Func2 &&slot)
 
static bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *member)
 \threadsafe
 
static bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &member)
 
static bool disconnect (const QMetaObject::Connection &)
 Disconnect a connection.
 
template<typename Func1 , typename Func2 >
static bool disconnect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const typename QtPrivate::FunctionPointer< Func2 >::Object *receiver, Func2 slot)
 
template<typename Func1 >
static bool disconnect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const QObject *receiver, void **zero)
 
- Protected Attributes inherited from QObject
QScopedPointer< QObjectDatad_ptr
 

Detailed Description

Definition at line 33 of file qquick3dtexture_p.h.

Member Enumeration Documentation

◆ Filter

Enumerator
None 
Nearest 
Linear 

Definition at line 79 of file qquick3dtexture_p.h.

◆ MappingMode

Enumerator
UV 
Environment 
LightProbe 

Definition at line 63 of file qquick3dtexture_p.h.

◆ TilingMode

Enumerator
ClampToEdge 
MirroredRepeat 
Repeat 

Definition at line 71 of file qquick3dtexture_p.h.

Constructor & Destructor Documentation

◆ QQuick3DTexture() [1/2]

QT_BEGIN_NAMESPACE QQuick3DTexture::QQuick3DTexture ( QQuick3DObject * parent = nullptr)
explicit

\qmltype Texture \inherits Object3D \inqmlmodule QtQuick3D

Defines a texture for use in 3D scenes.

A texture is technically any array of pixels (1D, 2D or 3D) and its related settings, such as minification and magnification filters, scaling and UV transformations.

The Texture type in Qt Quick 3D represents a two-dimensional image. Its use is typically to map onto / wrap around three-dimensional geometry to emulate additional detail which cannot be efficiently modelled in 3D. It can also be used to emulate other lighting effects, such as reflections.

While Texture itself always represents a 2D texture, other kinds of textures are available as well via subclasses of Texture. For example, to create a cube map texture with 6 faces, use the \l CubeMapTexture type.

When the geometry is being rendered, each location on its surface will be transformed to a corresponding location in the texture by transforming and interpolating the UV coordinates (texture coordinate) that have been set for the mesh's vertexes. The fragment shader program that is being used to render the active material will then typically sample the material's texture(s) at the given coordinates and use the sampled data in its light calculations.

Note
A Material may use multiple textures to give the desired interaction with light in the 3D scene. It can represent the color of each texel on the geometry surface, but also other attributes of the surface. For instance, a "normal map" can represent the deviation from the geometry normals for each texel on the surface, emulating light interaction with finer details on the surface, such as cracks or bumps. See \l{Qt Quick 3D - Principled Material Example}{the principled material example} for a demonstration of a material with multiple texture maps.

Texture objects can source image data from: \list

  • an image or texture file by using the \l source property,
  • a Qt Quick \l Item by using the sourceItem property,
  • or by setting the \l textureData property to a \l TextureData item subclass for defining the custom texture contents. \endlist

The following example maps the image "madewithqt.png" onto the default sphere mesh, and scales the UV coordinates to tile the image on the sphere surface. \qml Model { source: "#Sphere" materials: [ PrincipledMaterial { baseColorMap: Texture { source: "madewithqt.png" scaleU: 4.0 scaleV: 4.0 } } ] } \endqml

The result looks as follows: \table \header

  • Original image
  • Mapped onto a sphere \row
  • \endtable
See also
{Qt Quick 3D - Procedural Texture Example}

Definition at line 95 of file qquick3dtexture.cpp.

◆ ~QQuick3DTexture()

QQuick3DTexture::~QQuick3DTexture ( )
override

Definition at line 111 of file qquick3dtexture.cpp.

◆ QQuick3DTexture() [2/2]

QQuick3DTexture::QQuick3DTexture ( QQuick3DObjectPrivate & dd,
QQuick3DObject * parent = nullptr )
explicitprotected

Definition at line 100 of file qquick3dtexture.cpp.

Member Function Documentation

◆ autoOrientation()

bool QQuick3DTexture::autoOrientation ( ) const

\qmlproperty bool QtQuick3D::Texture::autoOrientation

This property determines if a texture transformation, such as flipping the V texture coordinate, is applied automatically for textures where this is typically relevant.

By default, this property is set to true.

Certain type of texture data, such as compressed textures loaded via the \l source property from a .ktx or .pkm file, or textures generated by rendering a Qt Quick scene via the \l sourceItem property, often have a different Y axis orientation when compared to textures loaded from image files, such as, .png or .jpg. Therefore, such a Texture would appear "upside down" compared to a Texture with its source set to a regular image file. To remedy this, any qualifying Texture gets an implicit UV transformation as if the flipV property was set to true. If this is not desired, set this property to false.

Note
This property is effective when the Texture is used in combination with a DefaultMaterial or PrincipledMaterial. \l{QtQuick3D::CustomMaterial}{Custom materials} provide their own shader code, and so transformations such as the one configured by this property are ignored and are up to the application-provided shader code to implement.
Since
6.2
See also
flipV

Definition at line 650 of file qquick3dtexture.cpp.

◆ autoOrientationChanged

void QQuick3DTexture::autoOrientationChanged ( )
signal

◆ extensionDirty()

bool QQuick3DTexture::extensionDirty ( ) const
inline

Definition at line 117 of file qquick3dtexture_p.h.

◆ flipU()

bool QQuick3DTexture::flipU ( ) const

\qmlproperty bool QtQuick3D::Texture::flipU

This property sets the use of the horizontally flipped texture coordinates.

The default is false.

Note
This property is effective when the Texture is used in combination with a DefaultMaterial or PrincipledMaterial. \l{QtQuick3D::CustomMaterial}{Custom materials} provide their own shader code, and so transformations such as the one configured by this property are ignored and are up to the application-provided shader code to implement.
See also
flipV

Definition at line 474 of file qquick3dtexture.cpp.

◆ flipUChanged

void QQuick3DTexture::flipUChanged ( )
signal

◆ flipV()

bool QQuick3DTexture::flipV ( ) const

\qmlproperty bool QtQuick3D::Texture::flipV

This property sets the use of the vertically flipped texture coordinates.

The default is false.

Note
This property is effective when the Texture is used in combination with a DefaultMaterial or PrincipledMaterial. \l{QtQuick3D::CustomMaterial}{Custom materials} provide their own shader code, and so transformations such as the one configured by this property are ignored and are up to the application-provided shader code to implement.
See also
flipU

Definition at line 495 of file qquick3dtexture.cpp.

◆ flipVChanged

void QQuick3DTexture::flipVChanged ( )
signal

◆ generateMipmaps()

bool QQuick3DTexture::generateMipmaps ( ) const

\qmlproperty bool QtQuick3D::Texture::generateMipmaps

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 \l{QtQuick3D::Texture::mipFilter}{mipFilter} mode for the generated mipmaps to be be used.
This property is not applicable when the texture content is based on a Qt Quick item referenced by the \l sourceItem property. Mipmap generation for dynamic textures is not feasible due to the performance implications. Therefore, the value of this property is ignored for such textures.
See also
mipFilter

Definition at line 614 of file qquick3dtexture.cpp.

◆ generateMipmapsChanged

void QQuick3DTexture::generateMipmapsChanged ( )
signal

◆ getRenderImage()

QSSGRenderImage * QQuick3DTexture::getRenderImage ( )

Definition at line 1465 of file qquick3dtexture.cpp.

◆ hasSourceData()

bool QQuick3DTexture::hasSourceData ( ) const
inline

Definition at line 119 of file qquick3dtexture_p.h.

◆ horizontalTiling()

QQuick3DTexture::TilingMode QQuick3DTexture::horizontalTiling ( ) const

\qmlproperty enumeration QtQuick3D::Texture::tilingModeHorizontal

Controls how the texture is mapped when the U scaling value is greater than 1.

By default, this property is set to {Texture.Repeat}.

\value Texture.ClampToEdge Texture is not tiled, but the value on the edge is used instead. \value Texture.MirroredRepeat Texture is repeated and mirrored over the X axis. \value Texture.Repeat Texture is repeated over the X axis.

See also
scaleU

Definition at line 305 of file qquick3dtexture.cpp.

◆ horizontalTilingChanged

void QQuick3DTexture::horizontalTilingChanged ( )
signal

◆ indexUV()

int QQuick3DTexture::indexUV ( ) const

\qmlproperty int QtQuick3D::Texture::indexUV

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.

The default is 0.

Definition at line 509 of file qquick3dtexture.cpp.

◆ indexUVChanged

void QQuick3DTexture::indexUVChanged ( )
signal

◆ itemChange()

void QQuick3DTexture::itemChange ( ItemChange change,
const ItemChangeData & value )
overrideprotectedvirtual

Reimplemented from QQuick3DObject.

Definition at line 1376 of file qquick3dtexture.cpp.

◆ itemGeometryChanged()

void QQuick3DTexture::itemGeometryChanged ( QQuickItem * item,
QQuickGeometryChange change,
const QRectF & geometry )
overrideprotectedvirtual

Reimplemented from QQuickItemChangeListener.

Definition at line 1432 of file qquick3dtexture.cpp.

◆ magFilter()

QQuick3DTexture::Filter QQuick3DTexture::magFilter ( ) const

\qmlproperty enumeration QtQuick3D::Texture::magFilter

This property determines how the texture is sampled when it is "magnified", i.e. a texel covers more than one pixel in screen space.

The default value is {Texture.Linear}.

\value Texture.Nearest uses the value of the closest texel. \value Texture.Linear takes the four closest texels and bilinearly interpolates them.

Note
Using Texture.None here will default to Texture.Linear instead.
See also
minFilter, mipFilter

Definition at line 529 of file qquick3dtexture.cpp.

◆ magFilterChanged

void QQuick3DTexture::magFilterChanged ( )
signal

◆ mappingMode()

QQuick3DTexture::MappingMode QQuick3DTexture::mappingMode ( ) const

\qmlproperty enumeration QtQuick3D::Texture::mappingMode

This property defines which method of mapping to use when sampling this texture.

\value Texture.UV The default value. Suitable for base color, diffuse, opacity, and most other texture maps. Performs standard UV mapping. The same portion of the image will always appear on the same vertex, unless the UV coordinates are transformed and animated.

\value Texture.Environment Used for \l{PrincipledMaterial::specularReflectionMap}{specular reflection}, this causes the image to be projected onto the material as though it was being reflected. Using this mode for other type of texture maps provides a mirror effect.

\value Texture.LightProbe The default for HDRI sphere maps used by light probes. This mode does not need to be manually set for Texture objects associated with the \l{SceneEnvironment::lightProbe}{lightProbe} property, because it is implied automatically.

Definition at line 287 of file qquick3dtexture.cpp.

◆ mappingModeChanged

void QQuick3DTexture::mappingModeChanged ( )
signal

◆ markAllDirty()

void QQuick3DTexture::markAllDirty ( )
overrideprotectedvirtual

Reimplemented from QQuick3DObject.

Definition at line 1471 of file qquick3dtexture.cpp.

◆ minFilter()

QQuick3DTexture::Filter QQuick3DTexture::minFilter ( ) const

\qmlproperty enumeration QtQuick3D::Texture::minFilter

This property determines how the texture is sampled when it is "minimized", i.e. a texel covers less than one pixel in screen space.

The default value is {Texture.Linear}.

\value Texture.Nearest uses the value of the closest texel. \value Texture.Linear takes the four closest texels and bilinearly interpolates them.

Note
Using Texture.None here will default to Texture.Linear instead.
See also
magFilter, mipFilter

Definition at line 549 of file qquick3dtexture.cpp.

◆ minFilterChanged

void QQuick3DTexture::minFilterChanged ( )
signal

◆ mipFilter()

QQuick3DTexture::Filter QQuick3DTexture::mipFilter ( ) const

\qmlproperty enumeration QtQuick3D::Texture::mipFilter

This property determines how the texture mipmaps are sampled when a texel covers less than one pixel.

The default value is {Texture.None}.

\value Texture.None disables the usage of mipmap sampling. \value Texture.Nearest uses mipmapping and samples the value of the closest texel. \value Texture.Linear uses mipmapping and interpolates between multiple texel values.

Note
This property will have no effect on Textures that do not have mipmaps.
See also
minFilter, magFilter

Definition at line 570 of file qquick3dtexture.cpp.

◆ mipFilterChanged

void QQuick3DTexture::mipFilterChanged ( )
signal

◆ pivotU()

float QQuick3DTexture::pivotU ( ) const

\qmlproperty float QtQuick3D::Texture::pivotU

This property sets the pivot U position which is used when applying a \l{QtQuick3D::Texture::rotationUV}{rotationUV}.

The default is 0.0.

Note
This property is effective when the Texture is used in combination with a DefaultMaterial or PrincipledMaterial. \l{QtQuick3D::CustomMaterial}{Custom materials} provide their own shader code, and so transformations such as the one configured by this property are ignored and are up to the application-provided shader code to implement.
See also
rotationUV

Definition at line 431 of file qquick3dtexture.cpp.

◆ pivotUChanged

void QQuick3DTexture::pivotUChanged ( )
signal

◆ pivotV()

float QQuick3DTexture::pivotV ( ) const

\qmlproperty float QtQuick3D::Texture::pivotV

This property sets the pivot V position which is used when applying a \l{QtQuick3D::Texture::rotationUV}{rotationUV}.

The default is 0.0.

Note
This property is effective when the Texture is used in combination with a DefaultMaterial or PrincipledMaterial. \l{QtQuick3D::CustomMaterial}{Custom materials} provide their own shader code, and so transformations such as the one configured by this property are ignored and are up to the application-provided shader code to implement.
See also
pivotU, rotationUV

Definition at line 453 of file qquick3dtexture.cpp.

◆ pivotVChanged

void QQuick3DTexture::pivotVChanged ( )
signal

◆ positionU()

float QQuick3DTexture::positionU ( ) const

\qmlproperty float QtQuick3D::Texture::positionU

This property offsets the U coordinate mapping from left to right.

The default is 0.0.

Note
This property is effective when the Texture is used in combination with a DefaultMaterial or PrincipledMaterial. \l{QtQuick3D::CustomMaterial}{Custom materials} provide their own shader code, and so transformations such as the one configured by this property are ignored and are up to the application-provided shader code to implement.
See also
positionV

Definition at line 384 of file qquick3dtexture.cpp.

◆ positionUChanged

void QQuick3DTexture::positionUChanged ( )
signal

◆ positionV()

float QQuick3DTexture::positionV ( ) const

\qmlproperty float QtQuick3D::Texture::positionV

This property offsets the V coordinate mapping from bottom to top.

The default is 0.0.

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 is effective when the Texture is used in combination with a DefaultMaterial or PrincipledMaterial. \l{QtQuick3D::CustomMaterial}{Custom materials} provide their own shader code, and so transformations such as the one configured by this property are ignored and are up to the application-provided shader code to implement.
See also
positionU

Definition at line 409 of file qquick3dtexture.cpp.

◆ positionVChanged

void QQuick3DTexture::positionVChanged ( )
signal

◆ Q_REVISION() [1/5]

QQuick3DTexture::Q_REVISION ( 6 ,
7  ) const

◆ Q_REVISION() [2/5]

QQuick3DTexture::Q_REVISION ( 6 ,
7  ) const

◆ Q_REVISION [3/5]

QQuick3DTexture::Q_REVISION ( 6 ,
7  )
signal

◆ Q_REVISION() [4/5]

QQuick3DTexture::Q_REVISION ( 6 ,
7  )

◆ Q_REVISION [5/5]

QQuick3DTexture::Q_REVISION ( 6 ,
7  )
signal

◆ rotationUV()

float QQuick3DTexture::rotationUV ( ) const

\qmlproperty float QtQuick3D::Texture::rotationUV

This property rotates the texture around the pivot point. This is defined using euler angles and for a positive value rotation is clockwise.

The default is 0.0.

Note
This property is effective when the Texture is used in combination with a DefaultMaterial or PrincipledMaterial. \l{QtQuick3D::CustomMaterial}{Custom materials} provide their own shader code, and so transformations such as the one configured by this property are ignored and are up to the application-provided shader code to implement.
See also
pivotU, pivotV

Definition at line 363 of file qquick3dtexture.cpp.

◆ rotationUVChanged

void QQuick3DTexture::rotationUVChanged ( )
signal

◆ scaleU()

float QQuick3DTexture::scaleU ( ) const

\qmlproperty float QtQuick3D::Texture::scaleU

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.

The default is 1.0.

Note
This property is effective when the Texture is used in combination with a DefaultMaterial or PrincipledMaterial. \l{QtQuick3D::CustomMaterial}{Custom materials} provide their own shader code, and so transformations such as the one configured by this property are ignored and are up to the application-provided shader code to implement.
See also
tilingModeHorizontal

Definition at line 235 of file qquick3dtexture.cpp.

◆ scaleUChanged

void QQuick3DTexture::scaleUChanged ( )
signal

◆ scaleV()

float QQuick3DTexture::scaleV ( ) const

\qmlproperty float QtQuick3D::Texture::scaleV

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.

The default is 1.0.

Note
This property is effective when the Texture is used in combination with a DefaultMaterial or PrincipledMaterial. \l{QtQuick3D::CustomMaterial}{Custom materials} provide their own shader code, and so transformations such as the one configured by this property are ignored and are up to the application-provided shader code to implement.
See also
tilingModeVertical

Definition at line 260 of file qquick3dtexture.cpp.

◆ scaleVChanged

void QQuick3DTexture::scaleVChanged ( )
signal

◆ setAutoOrientation

void QQuick3DTexture::setAutoOrientation ( bool autoOrientation)
slot

Definition at line 959 of file qquick3dtexture.cpp.

◆ setFlipU

void QQuick3DTexture::setFlipU ( bool flipU)
slot

Definition at line 883 of file qquick3dtexture.cpp.

◆ setFlipV

void QQuick3DTexture::setFlipV ( bool flipV)
slot

Definition at line 894 of file qquick3dtexture.cpp.

◆ setGenerateMipmaps

void QQuick3DTexture::setGenerateMipmaps ( bool generateMipmaps)
slot

Definition at line 948 of file qquick3dtexture.cpp.

◆ setHorizontalTiling

void QQuick3DTexture::setHorizontalTiling ( QQuick3DTexture::TilingMode tilingModeHorizontal)
slot

Definition at line 799 of file qquick3dtexture.cpp.

◆ setIndexUV

void QQuick3DTexture::setIndexUV ( int indexUV)
slot

Definition at line 905 of file qquick3dtexture.cpp.

◆ setMagFilter

void QQuick3DTexture::setMagFilter ( QQuick3DTexture::Filter magFilter)
slot

Definition at line 970 of file qquick3dtexture.cpp.

◆ setMappingMode

void QQuick3DTexture::setMappingMode ( QQuick3DTexture::MappingMode mappingMode)
slot

Definition at line 789 of file qquick3dtexture.cpp.

◆ setMinFilter

void QQuick3DTexture::setMinFilter ( QQuick3DTexture::Filter minFilter)
slot

Definition at line 981 of file qquick3dtexture.cpp.

◆ setMipFilter

void QQuick3DTexture::setMipFilter ( QQuick3DTexture::Filter mipFilter)
slot

Definition at line 992 of file qquick3dtexture.cpp.

◆ setPivotU

void QQuick3DTexture::setPivotU ( float pivotU)
slot

Definition at line 861 of file qquick3dtexture.cpp.

◆ setPivotV

void QQuick3DTexture::setPivotV ( float pivotV)
slot

Definition at line 872 of file qquick3dtexture.cpp.

◆ setPositionU

void QQuick3DTexture::setPositionU ( float positionU)
slot

Definition at line 839 of file qquick3dtexture.cpp.

◆ setPositionV

void QQuick3DTexture::setPositionV ( float positionV)
slot

Definition at line 850 of file qquick3dtexture.cpp.

◆ setRotationUV

void QQuick3DTexture::setRotationUV ( float rotationUV)
slot

Definition at line 828 of file qquick3dtexture.cpp.

◆ setScaleU

void QQuick3DTexture::setScaleU ( float scaleU)
slot

Definition at line 767 of file qquick3dtexture.cpp.

◆ setScaleV

void QQuick3DTexture::setScaleV ( float scaleV)
slot

Definition at line 778 of file qquick3dtexture.cpp.

◆ setSource

void QQuick3DTexture::setSource ( const QUrl & source)
slot

Definition at line 674 of file qquick3dtexture.cpp.

◆ setSourceItem

void QQuick3DTexture::setSourceItem ( QQuickItem * sourceItem)
slot

Definition at line 718 of file qquick3dtexture.cpp.

◆ setTextureData

void QQuick3DTexture::setTextureData ( QQuick3DTextureData * textureData)
slot

Definition at line 922 of file qquick3dtexture.cpp.

◆ setVerticalTiling

void QQuick3DTexture::setVerticalTiling ( QQuick3DTexture::TilingMode tilingModeVertical)
slot

Definition at line 809 of file qquick3dtexture.cpp.

◆ source()

QUrl QQuick3DTexture::source ( ) const

\qmlproperty url QtQuick3D::Texture::source

This property holds the location of an image or texture file containing the data used by the texture.

The property is a URL, with the same rules as other source properties, such as \l{Image::source}{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.

The source file can have any conventional image file format \l{QImageReader::supportedImageFormats()}{supported by Qt}. In addition, Texture supports the same \l [QtQuick]{Compressed Texture Files}{compressed texture file types} as QtQuick::Image.

Note
Texture data read from image files such as .png or .jpg involves storing the rows of pixels within the texture in an order defined the Qt Quick 3D rendering engine. When the source file is a container for - possibly compressed - texture data, such transformations cannot happen on the pixel data level. Examples of this are .ktx or .pkm files. Instead, the Texture implicitly enables vertical flipping in the fragment shader code in order to get identical on-screen results. This is controlled by the \l autoOrientation property and can be disabled, if desired.
Some texture compression tools may apply automatic vertical mirroring (flipping) on the image data. In modern tools this is often an opt-in setting. It is important to be aware of the settings used in the asset conditioning pipeline, because an unexpectedly flipped texture, and thus incorrect texturing of objects, can have its root cause in the asset itself, outside the application's and rendering engine's control. When the asset requires it, applications can always set the \l flipV property themselves.
See also
sourceItem, textureData, autoOrientation, flipV

Definition at line 161 of file qquick3dtexture.cpp.

◆ sourceChanged

void QQuick3DTexture::sourceChanged ( )
signal

◆ sourceItem()

QQuickItem * QQuick3DTexture::sourceItem ( ) const

\qmlproperty Item QtQuick3D::Texture::sourceItem

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 \l{QQuickItem::textureProvider()}{texture provider}, no additional texture is used.

If this property is set, then the value of \l source will be ignored. A Texture should use one method to provide image data, and set only one of source, \l sourceItem, or \l textureData.

Note
Currently input events are forwarded to the Item used as a texture source only if the user is limited to interacting with one sourceItem instance at a time. In other words: you can share the same Item between multiple Textures, but then you cannot have multi-touch interaction with the same item on multiple textures at the same time. So it's best to use a separate 2D subscene instance for each Texture instance, if you expect to manipulate interactive items inside.
Using this property in a Texture that is referenced from multiple windows is strongly discouraged. This includes usage via \l{View3D::importScene}. As the source texture created by this property is only accessible by one render thread, attempting to share it between multiple QQuickWindow instances is going to fail, unless the basic render loop of Qt Quick is used instead of the default threaded one. See \l{Qt Quick Scene Graph} on more information about the Qt Quick render loops.
A Texture that contains the results of a Qt Quick offscreen render pass will in effect have an Y axis orientation that is different from what a Texture that receives its content via the source property uses. When used in combination with DefaultMaterial or PrincipledMaterial, this is all transparent to the application as the necessary UV transformations are applied automatically as long as the autoOrientation property is set to true, and so no further action is needed, regardless of how the texture was sourced. However, when developing \l{QtQuick3D::CustomMaterial}{custom materials} this needs to be kept in mind by the shader code author when sampling the texture and working with UV coordinates.
See also
source, textureData, autoOrientation

Definition at line 210 of file qquick3dtexture.cpp.

◆ sourceItemChanged

void QQuick3DTexture::sourceItemChanged ( )
signal

◆ textureData()

QQuick3DTextureData * QQuick3DTexture::textureData ( ) const

\qmlproperty TextureData QtQuick3D::Texture::textureData

This property holds a reference to a \l TextureData component which defines the contents and properties of raw texture data.

If this property is used, then the value of \l source will be ignored. A Texture should use one method to provide image data, and set only one of source, \l sourceItem, or \l textureData.

See also
source, sourceItem, {Qt Quick 3D - Procedural Texture Example}

Definition at line 588 of file qquick3dtexture.cpp.

◆ textureDataChanged

void QQuick3DTexture::textureDataChanged ( )
signal

◆ updateSpatialNode()

QSSGRenderGraphObject * QQuick3DTexture::updateSpatialNode ( QSSGRenderGraphObject * node)
overrideprotectedvirtual

Reimplemented from QQuick3DObject.

Definition at line 1070 of file qquick3dtexture.cpp.

◆ verticalTiling()

QQuick3DTexture::TilingMode QQuick3DTexture::verticalTiling ( ) const

\qmlproperty enumeration QtQuick3D::Texture::tilingModeVertical

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}.

\value Texture.ClampToEdge Texture is not tiled, but the value on the edge is used instead. \value Texture.MirroredRepeat Texture is repeated and mirrored over the Y axis. \value Texture.Repeat Texture is repeated over the Y axis.

See also
scaleV

Definition at line 324 of file qquick3dtexture.cpp.

◆ verticalTilingChanged

void QQuick3DTexture::verticalTilingChanged ( )
signal

Property Documentation

◆ autoOrientation

bool QQuick3DTexture::autoOrientation
readwrite

Definition at line 58 of file qquick3dtexture_p.h.

◆ flipU

bool QQuick3DTexture::flipU
readwrite

Definition at line 51 of file qquick3dtexture_p.h.

◆ flipV

bool QQuick3DTexture::flipV
readwrite

Definition at line 52 of file qquick3dtexture_p.h.

◆ generateMipmaps

bool QQuick3DTexture::generateMipmaps
readwrite

Definition at line 57 of file qquick3dtexture_p.h.

◆ indexUV

int QQuick3DTexture::indexUV
readwrite

Definition at line 53 of file qquick3dtexture_p.h.

◆ magFilter

Filter QQuick3DTexture::magFilter
readwrite

Definition at line 54 of file qquick3dtexture_p.h.

◆ mappingMode

MappingMode QQuick3DTexture::mappingMode
readwrite

Definition at line 42 of file qquick3dtexture_p.h.

◆ minFilter

Filter QQuick3DTexture::minFilter
readwrite

Definition at line 55 of file qquick3dtexture_p.h.

◆ mipFilter

Filter QQuick3DTexture::mipFilter
readwrite

Definition at line 56 of file qquick3dtexture_p.h.

◆ pivotU

float QQuick3DTexture::pivotU
readwrite

Definition at line 49 of file qquick3dtexture_p.h.

◆ pivotV

float QQuick3DTexture::pivotV
readwrite

Definition at line 50 of file qquick3dtexture_p.h.

◆ positionU

float QQuick3DTexture::positionU
readwrite

Definition at line 47 of file qquick3dtexture_p.h.

◆ positionV

float QQuick3DTexture::positionV
readwrite

Definition at line 48 of file qquick3dtexture_p.h.

◆ rotationUV

float QQuick3DTexture::rotationUV
readwrite

Definition at line 46 of file qquick3dtexture_p.h.

◆ scaleU

float QQuick3DTexture::scaleU
readwrite

Definition at line 40 of file qquick3dtexture_p.h.

◆ scaleV

float QQuick3DTexture::scaleV
readwrite

Definition at line 41 of file qquick3dtexture_p.h.

◆ source

QUrl QQuick3DTexture::source
readwrite

Definition at line 36 of file qquick3dtexture_p.h.

◆ sourceItem

QQuickItem * QQuick3DTexture::sourceItem
readwrite

Definition at line 37 of file qquick3dtexture_p.h.

◆ textureData

QQuick3DTextureData * QQuick3DTexture::textureData
readwrite

Definition at line 38 of file qquick3dtexture_p.h.

◆ textureProvider

QQuick3DRenderExtension * QQuick3DTexture::textureProvider
readwrite

\qmlproperty RenderExtension QtQuick3D::Texture::textureProvider

This property holds the RenderExtension that will provide the \l QRhiTexture that will be used by this item.

Note
The texture created by RenderExtension needs to be made available by \l{QSSGRenderExtensionHelpers::registerRenderResult}{registering} it with the engine.
Since
6.7
See also
RenderExtension, QSSGRenderExtensionHelpers

Definition at line 39 of file qquick3dtexture_p.h.

◆ tilingModeDepth

TilingMode QQuick3DTexture::tilingModeDepth
readwrite

Definition at line 45 of file qquick3dtexture_p.h.

◆ tilingModeHorizontal

TilingMode QQuick3DTexture::tilingModeHorizontal
readwrite

Definition at line 43 of file qquick3dtexture_p.h.

◆ tilingModeVertical

TilingMode QQuick3DTexture::tilingModeVertical
readwrite

Definition at line 44 of file qquick3dtexture_p.h.


The documentation for this class was generated from the following files: