Qt3DRender::QTextureImage Class
class Qt3DRender::QTextureImage封装了从图像源创建 OpenGL 纹理图像所需的信息。更多内容...
| 头文件: | #include <qtextureimage.h> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS 3drender) target_link_libraries(mytarget PRIVATE Qt6::3drender) |
| qmake: | QT += 3drender |
| 在 QML 中: | TextureImage |
| 继承自: | Qt3DRender::QAbstractTextureImage |
| 状态: | 已弃用 |
该类已弃用。我们强烈建议不要在新代码中使用它。
公共类型
| enum | Status { None, Loading, Ready, Error } |
属性
公共函数
| QTextureImage(Qt3DCore::QNode *parent = nullptr) | |
| bool | isMirrored() const |
| QUrl | source() const |
| Qt3DRender::QTextureImage::Status | status() const |
公共插槽
| void | setMirrored(bool mirrored) |
| void | setSource(const QUrl &source) |
信号
| void | mirroredChanged(bool mirrored) |
| void | sourceChanged(const QUrl &source) |
| void | statusChanged(Qt3DRender::QTextureImage::Status status) |
受保护函数
| void | setStatus(Qt3DRender::QTextureImage::Status status) |
成员类型文档
enum QTextureImage::Status
此枚举指定了纹理图像加载的状态值。
| 常量 | 值 | 描述 |
|---|---|---|
Qt3DRender::QTextureImage::None | 0 | 纹理图像的加载尚未开始。 |
Qt3DRender::QTextureImage::Loading | 1 | 纹理图像加载已开始,但尚未完成。 |
Qt3DRender::QTextureImage::Ready | 2 | 纹理图像加载已完成。 |
Qt3DRender::QTextureImage::Error | 3 | 纹理图像加载过程中发生错误。 |
属性文档
mirrored : bool
该属性指定在加载图像时是否应将其镜像。此功能旨在避免用户为使图像与渲染 API 使用的纹理坐标原点对齐而进行手动调整。默认情况下,该属性设置为 true。使用 GPU 压缩纹理格式时,此属性无效。
警告: 在加载未压缩或 CPU 压缩的图像格式(如 PNG)时,此 属性会导致运行时性能开销。为避免此性能开销,建议将此属性设置为 false,并加载已预先镜像的纹理资源。
注意:OpenGL 规定纹理坐标的原点位于左下角,而 DirectX 则使用左上角作为原点。
注意: 使用立方体贴图时, 通常应禁用镜像功能,因为立方体贴图采样器采用的是方向而非常规的纹理坐标。
访问函数:
| bool | isMirrored() const |
| void | setMirrored(bool mirrored) |
通知器信号:
| void | mirroredChanged(bool mirrored) |
source : QUrl
该属性存储了用于加载纹理图像数据的源网址。
访问函数:
通知信号:
| void | sourceChanged(const QUrl &source) |
[read-only] status : Status
该属性用于存储纹理图像的加载状态。
- TextureImage.None
- TextureImage.Loading
- TextureImage.Ready
- TextureImage.Error
访问函数:
| Qt3DRender::QTextureImage::Status | status() const |
通知器信号:
| void | statusChanged(Qt3DRender::QTextureImage::Status status) |
成员函数文档
[explicit] QTextureImage::QTextureImage(Qt3DCore::QNode *parent = nullptr)
创建一个新的Qt3DRender::QTextureImage 实例,其父对象为parent 。
bool QTextureImage::isMirrored() const
返回镜像功能是否已启用。
注意: 这是属性mirrored 的获取器 函数。
[slot] void QTextureImage::setMirrored(bool mirrored)
将镜像设置为mirrored 。
注意:这会在 内部触发对数据生成器的更新调用。
注意: 属性mirrored 的设置 函数。
另请参阅 isMirrored()。
[slot] void QTextureImage::setSource(const QUrl &source)
将纹理图像的源网址设置为source 。
注意:这会在 内部触发对数据生成器的调用。
注意: 这是属性source 的设置 函数。
另请参阅 source()。
[protected] void QTextureImage::setStatus(Qt3DRender::QTextureImage::Status status)
将状态设置为status 。status
另请参阅 status()。
QUrl QTextureImage::source() const
返回将用于加载纹理图像数据的源网址。
注意: 这是 source 属性的获取 函数。
另请参阅 setSource()。
Qt3DRender::QTextureImage::Status QTextureImage::status() const
返回当前状态。
注意: 这是 status 属性的获取 函数。
另请参阅 ` setStatus()`。
© 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.