Qt3DExtras::QGoochMaterial Class
class Qt3DExtras::QGoochMaterialQGoochMaterial 提供了一种实现 Gooch 着色模型的材质,该模型在 CAD 和 CAM 应用中广受欢迎。更多内容...
| 标题: | #include <qgoochmaterial.h> |
| 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 着色模型结合某种轮廓边缘描边技术,是一种广受欢迎的解决方案。
Gooch 照明模型在Gooch 的原始论文中进行了详细阐述。 Gooch 模型将物体的漫反射颜色与用户提供的冷色和暖色混合,生成颜色渐变的端点,该渐变用于根据片段到光源的向量与片段法向量之间的夹角余弦值对物体进行着色。 此外,还可以选择在顶部添加镜面高光。漫反射颜色对冷色和暖色的相对贡献分别由 alpha 和 beta 属性控制。
该材质采用单渲染通道的方法,并执行逐片元光照计算。提供了适用于 OpenGL 2、OpenGL 3 或更高版本以及 OpenGL ES 2 的技术实现。
属性文档
alpha : float
存储当前的透明度值。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) |
通知信号:
| void | warmChanged(const QColor &warm) |
成员函数文档
[explicit] QGoochMaterial::QGoochMaterial(Qt3DCore::QNode *parent = nullptr)
创建一个新的 QGoochMaterial 实例,其父对象为parent 。
© 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.