- Qt 6.12
- Qt Quick 3D
- C++ Classes
- QQuick3DTextureProviderExtension
- Qt Quick 3D | Commercial or GPLv3

# QQuick3DTextureProviderExtension Class

Abstract class for implementing user side texture provider extensions. More...

Header: | `#include <QQuick3DTextureProviderExtension>`
Since: | Qt 6.11
In QML: | TextureProviderExtension
Inherits: | QQuick3DRenderExtension

- List of all members, including inherited members

## Public Types

enum class | SamplerHint { Sampler2D, Sampler2DArray, Sampler3D, SamplerCube, SamplerCubeArray, SamplerBuffer }

## Properties

- `(since 6.11)` samplerHint : SamplerHint

## Public Functions

QQuick3DTextureProviderExtension::SamplerHint | samplerHint() const
void | setSamplerHint(QQuick3DTextureProviderExtension::SamplerHint newSamplerHint)

## Signals

void | samplerHintChanged()
`(since 6.12)` void | surfaceChanged()

## Reimplemented Protected Functions

virtual QSSGRenderGraphObject * | updateSpatialNode(QSSGRenderGraphObject *node) override

## Detailed Description

This is the front-end side of a texture provider extension. The back-end side is implemented in QSSGRenderExtension. The QQuick3DTextureProviderExtension is a specialization of the QQuick3DRenderExtension class that is used to create a custom texture provider extension that can both provide additional metadata about what type of texture will be provided and also automatically register the extension with the QtQuick3D scene graph. This means it is unecessary to manually add the extension to the list of extensions to be used with a View3D, and just using the textureProvider property of the Texture component is enough to trigger the extension code to be run when necessary.

The QQuick3DTextureProviderExtension class is an abstract class that should be subclassed and exposed to QML. The subclass should implement the QQuick3DRenderExtension::updateSpatialNode() function and return a QSSGRenderExtension instance that contains the code that should be run.

See also QSSGRenderExtension.

## Member Type Documentation

### enum class QQuick3DTextureProviderExtension::SamplerHint

Specifies a hint about the type of texture that will be provided by the extension.

Constant | Value | Description
--- | --- | ---
`QQuick3DTextureProviderExtension::SamplerHint::Sampler2D` | `0` | A 2D texture
`QQuick3DTextureProviderExtension::SamplerHint::Sampler2DArray` | `1` | An array texture
`QQuick3DTextureProviderExtension::SamplerHint::Sampler3D` | `2` | A 3D texture
`QQuick3DTextureProviderExtension::SamplerHint::SamplerCube` | `3` | A cube map texture
`QQuick3DTextureProviderExtension::SamplerHint::SamplerCubeArray` | `4` | An array of cube map textures
`QQuick3DTextureProviderExtension::SamplerHint::SamplerBuffer` | `5` | A buffer texture

## Property Documentation

### `[since 6.11]` samplerHint : SamplerHint

This property contains a hint about the type of texture that will be provided by the extension. This is necessary because the texture data will not be provided until it is necessary, but materials that use the Texture component need to know what type of sampler to provide.

The default value is `QQuick3DTextureProviderExtension::Sampler2D`.

Note: This property is only used when using CustomMaterials.

This enumeration was introduced in Qt 6.11.

Access functions:

QQuick3DTextureProviderExtension::SamplerHint | samplerHint() const
void | setSamplerHint(QQuick3DTextureProviderExtension::SamplerHint newSamplerHint)

Notifier signal:

void | samplerHintChanged()

See also SamplerHint.

## Member Function Documentation

### `[signal, since 6.12]` void QQuick3DTextureProviderExtension::surfaceChanged()

This signal is emitted when the underlying rendering surface has changed and textures need to be recreated.

This function was introduced in Qt 6.12.

### `[override virtual protected]` QSSGRenderGraphObject *QQuick3DTextureProviderExtension::updateSpatialNode(QSSGRenderGraphObject *node)

Reimplements: QQuick3DRenderExtension::updateSpatialNode(QSSGRenderGraphObject *node).

This function is called during the synchronization of the QtQuick3D scene graph when an item is created or when an update is requested, usually as a result of a change in the item's properties. The function should return a QSSGRenderTextureProviderExtension instance that contains the code that should be run during QtQuick3D's rendering pipeline execution.

The node parameter is the previous QSSGRenderTextureProviderExtension instance that was returned from this function, or null if this is the first time the function is called. The function can return the same instance, a different instance, or null. If the function returns null, the extension will be removed from the rendering pipeline.

Note: The QSSGRenderTextureProviderExtension instance is a resource object and will be owned by the QtQuick3D scene graph. If a different instance, or null, is returned, the previous instance will be queued for deletion by the renderer.

See also QSSGRenderTextureProviderExtension.