Qt3DExtras::QNormalDiffuseMapMaterial Class

class Qt3DExtras::QNormalDiffuseMapMaterial

QNormalDiffuseMapMaterial(法线漫反射贴图材质)提供了一种 phong 照明和凹凸效果的默认实现,其中漫反射光分量是从纹理贴图中读取的,而网格的法线是从法线纹理贴图中渲染的。更多

Header: #include <QNormalDiffuseMapMaterial>
CMake: find_package(Qt6 REQUIRED COMPONENTS 3dextras)
target_link_libraries(mytarget PRIVATE Qt6::3dextras)
qmake: QT += 3dextras
继承: Qt3DRender::QMaterial
继承者

Qt3DExtras::QNormalDiffuseMapAlphaMaterial

状态:已废弃

该类已被弃用。我们强烈建议不要在新代码中使用该类。

属性

公共功能

QNormalDiffuseMapMaterial(Qt3DCore::QNode *parent = nullptr)
virtual ~QNormalDiffuseMapMaterial()
QColor ambient() const
Qt3DRender::QAbstractTexture *diffuse() const
Qt3DRender::QAbstractTexture *normal() const
float shininess() const
QColor specular() const
float textureScale() const

公共插槽

void setAmbient(const QColor &ambient)
void setDiffuse(Qt3DRender::QAbstractTexture *diffuse)
void setNormal(Qt3DRender::QAbstractTexture *normal)
void setShininess(float shininess)
void setSpecular(const QColor &specular)
void setTextureScale(float textureScale)

信号

void ambientChanged(const QColor &ambient)
void diffuseChanged(Qt3DRender::QAbstractTexture *diffuse)
void normalChanged(Qt3DRender::QAbstractTexture *normal)
void shininessChanged(float shininess)
void specularChanged(const QColor &specular)
void textureScaleChanged(float textureScale)

详细说明

该类已被弃用;请使用QDiffuseSpecularMaterial

镜面反射照明效果基于环境、漫反射和镜面反射三种照明成分的组合。这些组件的相对强度由它们的反射系数控制,反射系数以 RGB 三元组建模:

  • 环境光是物体在没有任何其他光源的情况下发出的颜色。
  • 漫反射(Diffuse)是灯光在物体表面反射时发出的颜色。
  • 镜面反射色是在灯光照射下闪亮表面反射时发出的颜色。
  • 表面的光泽度由浮点属性控制。

该材质采用了单次渲染通过的效果方法,并对每个片段进行照明。该技术适用于 OpenGL 2、OpenGL 3 或更高版本以及 OpenGL ES 2。

属性文档

ambient : QColor

保存当前的环境颜色。

访问功能:

QColor ambient() const
void setAmbient(const QColor &ambient)

提示信号:

void ambientChanged(const QColor &ambient)

diffuse : Qt3DRender::QAbstractTexture*

保存当前的漫反射贴图纹理。

默认情况下,漫反射纹理具有这些属性:

  • 线性缩小和放大滤镜
  • 启用混合贴图的线性混合贴图
  • 重复包裹模式M
  • 最大各向异性为 16.0

访问功能

Qt3DRender::QAbstractTexture *diffuse() const
void setDiffuse(Qt3DRender::QAbstractTexture *diffuse)

通知信号

void diffuseChanged(Qt3DRender::QAbstractTexture *diffuse)

normal : Qt3DRender::QAbstractTexture*

保存当前的法线贴图纹理。

默认情况下,法线纹理具有以下属性:

  • 线性缩小和放大过滤器
  • 重复包裹模式
  • 最大各向异性为 16.0

访问功能

Qt3DRender::QAbstractTexture *normal() const
void setNormal(Qt3DRender::QAbstractTexture *normal)

通知信号

void normalChanged(Qt3DRender::QAbstractTexture *normal)

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 提供了一种在表面上平铺纹理的简单方法。例如,如果纹理比例为4.0 ,则会产生 16 个(4x4)平铺。

访问函数

float textureScale() const
void setTextureScale(float textureScale)

Notifier 信号:

void textureScaleChanged(float textureScale)

成员函数文档

[explicit] QNormalDiffuseMapMaterial::QNormalDiffuseMapMaterial(Qt3DCore::QNode *parent = nullptr)

使用父对象parent 构建一个新的 QNormalDiffuseMapMaterial 实例。

[virtual noexcept] QNormalDiffuseMapMaterial::~QNormalDiffuseMapMaterial()

销毁QNormalDiffuseMapMaterial 实例。

© 2025 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.