Qt3DExtras::QGoochMaterial Class
class Qt3DExtras::QGoochMaterialQGoochMaterial 提供了一种实现 Gooch 阴影模型的材料,在 CAD 和 CAM 应用程序中非常流行。更多
头文件: | #include <QGoochMaterial> |
CMake: | find_package(Qt6 REQUIRED COMPONENTS 3dextras) target_link_libraries(mytarget PRIVATE Qt6::3dextras) |
qmake: | QT += 3dextras |
继承: | Qt3DRender::QMaterial |
状态: | 已废弃 |
属性
公共功能
QGoochMaterial(Qt3DCore::QNode *parent = nullptr) | |
float | alpha() const |
float | beta() const |
QColor | cool() const |
QColor | diffuse() const |
float | shininess() const |
QColor | specular() const |
QColor | warm() const |
公共插槽
void | setAlpha(float alpha) |
void | setBeta(float beta) |
void | setCool(const QColor &cool) |
void | setDiffuse(const QColor &diffuse) |
void | setShininess(float shininess) |
void | setSpecular(const QColor &specular) |
void | setWarm(const QColor &warm) |
信号
void | alphaChanged(float alpha) |
void | betaChanged(float beta) |
void | coolChanged(const QColor &cool) |
void | diffuseChanged(const QColor &diffuse) |
void | shininessChanged(float shininess) |
void | specularChanged(const QColor &specular) |
void | warmChanged(const QColor &warm) |
详细说明
Gooch 灯光模型同时使用颜色和亮度来帮助显示 3D 表面的曲率。这通常比 Phong 等纯粹依赖亮度变化的模型效果更好。在 CAD 和 CAM 等应用中,逼真度并不是目标,在这种情况下,Gooch 阴影模型与某种轮廓边缘着墨相结合是一种常用的解决方案。
古氏照明模型在古氏论文原文中有详细解释。古奇模型将物体的漫反射颜色与用户提供的冷色和暖色混合,产生一个颜色斜坡的端点,该斜坡根据从片段到光源的矢量与片段法线矢量之间夹角的余弦值对物体进行着色。此外,还可以在上面添加镜面高光。漫反射颜色对冷色和暖色的相对贡献分别由 alpha 和 beta 属性控制。
该材质采用了单次渲染通过的效果方法,并对每个片段进行照明。该技术适用于 OpenGL 2、OpenGL 3 或更高版本以及 OpenGL ES 2。
属性文档
alpha : float
保存当前的 alpha 值。Gooch 着色器使用的颜色斜坡起点计算公式为 {c = cool + alpha * diffuse}。
访问功能:
float | alpha() const |
void | setAlpha(float alpha) |
通知信号:
void | alphaChanged(float alpha) |
beta : float
保存当前的 beta 值。Gooch 着色器使用的颜色斜坡起点计算公式为 {c = warm + beta * diffuse}。
访问功能:
float | beta() const |
void | setBeta(float beta) |
通知信号:
void | betaChanged(float beta) |
cool : QColor
保持当前冷色。
访问功能:
QColor | cool() const |
void | setCool(const QColor &cool) |
提示信号:
void | coolChanged(const QColor &cool) |
diffuse : QColor
保存当前的漫反射颜色。
访问功能:
QColor | diffuse() const |
void | setDiffuse(const QColor &diffuse) |
通知信号:
void | diffuseChanged(const QColor &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) |
warm : QColor
保持当前暖色。
访问功能:
QColor | warm() const |
void | setWarm(const QColor &warm) |
Notifier 信号:
void | warmChanged(const QColor &warm) |
成员函数 文档
[explicit]
QGoochMaterial::QGoochMaterial(Qt3DCore::QNode *parent = nullptr)
使用父对象parent 构建一个新的 QGoochMaterial 实例。
© 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.