Qt3DExtras::QDiffuseMapMaterial Class
class Qt3DExtras::QDiffuseMapMaterialQDiffuseMapMaterial 提供了 Phong 照明效果的默认实现,其中漫反射光分量是从纹理贴图中读取的。更多内容...
| 标题: | #include <qdiffusemapmaterial.h> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS 3dextras) target_link_libraries(mytarget PRIVATE Qt6::3dextras) |
| qmake: | QT += 3dextras |
| 继承自: | Qt3DRender::QMaterial |
| 状态: | 已弃用 |
该类已弃用。我们强烈建议不要在新代码中使用它。
属性
|
公共函数
| QDiffuseMapMaterial(Qt3DCore::QNode *parent = nullptr) | |
| virtual | ~QDiffuseMapMaterial() |
| QColor | ambient() const |
| Qt3DRender::QAbstractTexture * | diffuse() const |
| float | shininess() const |
| QColor | specular() const |
| float | textureScale() const |
公共槽位
| void | setAmbient(const QColor &color) |
| void | setDiffuse(Qt3DRender::QAbstractTexture *diffuse) |
| void | setShininess(float shininess) |
| void | setSpecular(const QColor &specular) |
| void | setTextureScale(float textureScale) |
信号
| void | ambientChanged(const QColor &ambient) |
| void | diffuseChanged(Qt3DRender::QAbstractTexture *diffuse) |
| void | shininessChanged(float shininess) |
| void | specularChanged(const QColor &specular) |
| void | textureScaleChanged(float textureScale) |
详细说明
该类已弃用;请改用Qt3DExtras::QDiffuseSpecularMaterial 。
镜面反射照明效果基于环境光、漫反射和镜面反射这三个照明组件的组合。这些组件的相对强度通过其反射系数来控制,这些系数以 RGB 三元组的形式进行建模:
- 环境光是指在没有其他光源的情况下,物体所发出的颜色。
- 漫反射是指粗糙表面在光照下反射出的颜色。
- 镜面反射是指光线在光滑表面反射时所呈现的颜色。
- 表面的光泽度由一个浮点属性控制。
该材质采用单渲染通道的方法,并执行基于片段的照明计算。提供了适用于 OpenGL 2、OpenGL 3 或更高版本以及 OpenGL ES 2 的技术实现。
属性文档
ambient : QColor
保存当前环境颜色。
访问函数:
| QColor | ambient() const |
| void | setAmbient(const QColor &color) |
通知信号:
| void | ambientChanged(const QColor &ambient) |
diffuse : Qt3DRender::QAbstractTexture*
存储当前用作漫反射贴图的纹理。
默认情况下,漫反射纹理具有以下属性:
- 线性缩放和放大滤波器
- 启用Mipmap功能的线性Mipmap
- 重复环绕模式
- 最大各向异性为 16.0
访问函数:
| Qt3DRender::QAbstractTexture * | diffuse() const |
| void | setDiffuse(Qt3DRender::QAbstractTexture *diffuse) |
通知信号:
| void | diffuseChanged(Qt3DRender::QAbstractTexture *diffuse) |
shininess : float
将当前的光泽度作为浮点数值保存。
访问函数:
| float | shininess() const |
| void | setShininess(float shininess) |
通知器信号:
| void | shininessChanged(float shininess) |
specular : QColor
存储当前的镜面反射颜色。
访问函数:
| QColor | specular() const |
| void | setSpecular(const QColor &specular) |
通知器信号:
| void | specularChanged(const QColor &specular) |
textureScale : float
保存当前的纹理缩放比例。在渲染时,该比例将作为乘数应用于纹理坐标。默认值为 1.0。
当与 QTextureWrapMode::Repeat 结合使用时,textureScale 提供了一种在表面上平铺纹理的简便方法。例如,textureScale 设置为4.0 时,将生成 16 个(4x4)平铺块。
访问函数:
| float | textureScale() const |
| void | setTextureScale(float textureScale) |
通知器信号:
| void | textureScaleChanged(float textureScale) |
成员函数文档
[explicit] QDiffuseMapMaterial::QDiffuseMapMaterial(Qt3DCore::QNode *parent = nullptr)
创建一个新的 QDiffuseMapMaterial 实例,其父对象为parent 。
[virtual noexcept] QDiffuseMapMaterial::~QDiffuseMapMaterial()
销毁该QDiffuseMapMaterial 实例。
© 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.