Qt3DRender::QTextureLoader Class
class Qt3DRender::QTextureLoader负责纹理的加载以及纹理属性的设置。更多...
| 头文件: | #include <Qt3DRender/QTexture> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS 3drender) target_link_libraries(mytarget PRIVATE Qt6::3drender) |
| qmake: | QT += 3drender |
| 在 QML 中: | TextureLoader |
| 继承自: | Qt3DRender::QAbstractTexture |
| 状态: | 已弃用 |
该类已弃用。我们强烈建议不要在新代码中使用它。
属性
公共函数
| QTextureLoader(Qt3DCore::QNode *parent = nullptr) | |
| bool | isMirrored() const |
| QUrl | source() const |
公共插槽
| void | setMirrored(bool mirrored) |
| void | setSource(const QUrl &source) |
信号
| void | mirroredChanged(bool mirrored) |
| void | sourceChanged(const QUrl &source) |
属性文档
mirrored : bool
此属性指定在加载纹理时是否应将其镜像。此功能旨在避免用户需要手动调整图像以匹配渲染 API 所使用的纹理坐标原点。默认情况下,此属性设置为 true。使用 GPU 压缩纹理格式时,此属性无效。
警告: 当加载未压缩或 CPU 压缩的图像格式(如 PNG)时,此 属性会在运行时导致性能开销。为避免此性能开销,建议将此属性设置为 false,并加载已预先镜像的纹理资源。
注意:OpenGL 规定纹理坐标的原点位于左下角,而 DirectX 则使用左上角作为原点。
注意: 使用立方体贴图时, 通常应禁用镜像功能,因为立方体贴图采样器采用的是方向而非常规的纹理坐标。
访问函数:
| bool | isMirrored() const |
| void | setMirrored(bool mirrored) |
通知器信号:
| void | mirroredChanged(bool mirrored) |
source : QUrl
该属性保存当前的纹理来源。
访问函数:
| QUrl | source() const |
| void | setSource(const QUrl &source) |
通知器信号:
| void | sourceChanged(const QUrl &source) |
成员函数文档
[explicit] QTextureLoader::QTextureLoader(Qt3DCore::QNode *parent = nullptr)
创建一个新的Qt3DRender::QTextureLoader 实例,并将parent 作为其父对象。
请注意,默认情况下,如果文件元数据没有冲突,加载的纹理将设置以下属性: - wrapMode 设置为 Repeat - minificationFilter 设置为 LinearMipMapLinear - magnificationFilter 设置为 Linear - generateMipMaps 设置为 true - maximumAnisotropy 设置为 16.0f - target 设置为 TargetAutomatic
[slot] void QTextureLoader::setMirrored(bool mirrored)
将镜像设置为mirrored 。
注意:这会在 内部触发对数据生成器的更新调用。
注意: 属性mirrored 的设置 函数。
另请参阅 isMirrored()。
[slot] void QTextureLoader::setSource(const QUrl &source)
将纹理加载器的来源设置为source 。来源
注意: 这是属性source 的设置 函数。
另请参阅 source()。
© 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.