QQuick3DTextureProviderExtension Class
用于实现用户端纹理提供程序扩展的抽象类。更多
| Header: | #include <QQuick3DTextureProviderExtension> |
| Since: | Qt 6.11 |
| In QML: | TextureProviderExtension |
| Inherits: | QQuick3DRenderExtension |
属性
(since 6.11)samplerHint : SamplerHint
公共功能
| QQuick3DTextureProviderExtension::SamplerHint | samplerHint() const |
| void | setSamplerHint(QQuick3DTextureProviderExtension::SamplerHint newSamplerHint) |
信号
| void | samplerHintChanged() |
重新实现的受保护函数
| virtual QSSGRenderGraphObject * | updateSpatialNode(QSSGRenderGraphObject *node) override |
详细说明
这是纹理提供程序扩展的前端部分。后端在QSSGRenderExtension 中实现。QQuick3DTextureProviderExtension 是QQuick3DRenderExtension 类的一个特化类,用于创建自定义纹理提供程序扩展,该扩展既能提供关于纹理类型的附加元数据,又能自动在QtQuick3D 场景图中注册该扩展。这意味着无需手动将扩展添加到与View3D 一起使用的扩展列表中,只需使用纹理组件的 textureProvider 属性就足以在必要时触发扩展代码运行。
QQuick3DTextureProviderExtension 类是一个抽象类,应该被子类化并暴露给 QML。子类应实现QQuick3DRenderExtension::updateSpatialNode() 函数,并返回一个包含应运行代码的QSSGRenderExtension 实例。
另请参阅 QSSGRenderExtension 。
属性文档
[since 6.11] samplerHint : SamplerHint
此属性包含扩展将提供的纹理类型的提示。这是必要的,因为纹理数据在必要时才会提供,但使用纹理组件的材料需要知道提供哪种类型的采样器。
默认值为QQuick3DTextureProviderExtension::Sampler2D 。
注意: 该属性仅在使用自定义材质(CustomMaterials)时使用。
此属性在 Qt 6.11 中引入。
访问功能:
| QQuick3DTextureProviderExtension::SamplerHint | samplerHint() const |
| void | setSamplerHint(QQuick3DTextureProviderExtension::SamplerHint newSamplerHint) |
Notifier 信号:
| void | samplerHintChanged() |
另请参阅 SamplerHint。
成员函数文档
[override virtual protected] QSSGRenderGraphObject *QQuick3DTextureProviderExtension::updateSpatialNode(QSSGRenderGraphObject *node)
重实现:QQuick3DRenderExtension::updateSpatialNode(QSSGRenderGraphObject *node).
在QtQuick3D 场景图的同步过程中,当创建一个项目或请求更新(通常是由于项目属性发生变化)时,会调用该函数。该函数应返回一个QSSGRenderTextureProviderExtension 实例,其中包含在QtQuick3D 的渲染流水线执行期间应运行的代码。
node 参数是该函数返回的上一个QSSGRenderTextureProviderExtension 实例,如果是首次调用该函数,则为空。函数可以返回相同实例、不同实例或空值。如果函数返回 null,扩展将从呈现管道中移除。
注: QSSGRenderTextureProviderExtension 实例是一个资源对象,将由QtQuick3D 场景图拥有。如果返回的是另一个实例或空值,渲染器将排队删除之前的实例。
© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.