本页内容

Qt3DExtras::QPhongAlphaMaterial Class

class Qt3DExtras::QPhongAlphaMaterial

QPhongAlphaMaterial 类提供了带透明度的 Phong 光照效果的默认实现。更多内容...

头文件: #include <qphongalphamaterial.h>
CMake: find_package(Qt6 REQUIRED COMPONENTS 3dextras)
target_link_libraries(mytarget PRIVATE Qt6::3dextras)
qmake: QT += 3dextras
继承自: Qt3DRender::QMaterial
状态: 已弃用

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

属性

公共函数

QPhongAlphaMaterial(Qt3DCore::QNode *parent = nullptr)
virtual ~QPhongAlphaMaterial()
float alpha() const
QColor ambient() const
Qt3DRender::QBlendEquation::BlendFunction blendFunctionArg() const
Qt3DRender::QBlendEquationArguments::Blending destinationAlphaArg() const
Qt3DRender::QBlendEquationArguments::Blending destinationRgbArg() const
QColor diffuse() const
float shininess() const
Qt3DRender::QBlendEquationArguments::Blending sourceAlphaArg() const
Qt3DRender::QBlendEquationArguments::Blending sourceRgbArg() const
QColor specular() const

公共槽位

void setAlpha(float alpha)
void setAmbient(const QColor &ambient)
void setBlendFunctionArg(Qt3DRender::QBlendEquation::BlendFunction blendFunctionArg)
void setDestinationAlphaArg(Qt3DRender::QBlendEquationArguments::Blending destinationAlphaArg)
void setDestinationRgbArg(Qt3DRender::QBlendEquationArguments::Blending destinationRgbArg)
void setDiffuse(const QColor &diffuse)
void setShininess(float shininess)
void setSourceAlphaArg(Qt3DRender::QBlendEquationArguments::Blending sourceAlphaArg)
void setSourceRgbArg(Qt3DRender::QBlendEquationArguments::Blending sourceRgbArg)
void setSpecular(const QColor &specular)

信号

void alphaChanged(float alpha)
void ambientChanged(const QColor &ambient)
void blendFunctionArgChanged(Qt3DRender::QBlendEquation::BlendFunction blendFunctionArg)
void destinationAlphaArgChanged(Qt3DRender::QBlendEquationArguments::Blending destinationAlphaArg)
void destinationRgbArgChanged(Qt3DRender::QBlendEquationArguments::Blending destinationRgbArg)
void diffuseChanged(const QColor &diffuse)
void shininessChanged(float shininess)
void sourceAlphaArgChanged(Qt3DRender::QBlendEquationArguments::Blending sourceAlphaArg)
void sourceRgbArgChanged(Qt3DRender::QBlendEquationArguments::Blending sourceRgbArg)
void specularChanged(const QColor &specular)

详细说明

该类已弃用;请改用QDiffuseSpecularMaterial 。

Phong 光照效果基于环境光、漫反射光和镜面反射光这三个光照成分的组合。这些成分的相对强度通过其反射系数来控制,这些系数以 RGB 三元组的形式建模:

  • 环境光是指在没有其他光源的情况下,物体自身发出的颜色。
  • 漫反射是指物体表面在光线照射下产生漫反射时发出的颜色。
  • 镜面反射是指光滑表面在光线照射下反射出的颜色。
  • 表面的光泽度由一个浮点属性控制。
  • Alpha 表示表面的透明度,取值范围在 0(完全透明)到 1(不透明)之间。

该材质采用单渲染通道的方法,并执行基于片段的照明计算。提供了适用于 OpenGL 2、OpenGL 3 或更高版本以及 OpenGL ES 2 的技术。

属性文档

alpha : float

存储对象的透明度(alpha)成分,其取值范围在 0 到 1 之间。

默认值为 0.5f。

访问函数:

float alpha() const
void setAlpha(float alpha)

通知器信号:

void alphaChanged(float alpha)

ambient : QColor

保存环境颜色。

访问函数:

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

通知信号:

void ambientChanged(const QColor &ambient)

blendFunctionArg : Qt3DRender::QBlendEquation::BlendFunction

存储混合方程函数的参数。

访问函数:

Qt3DRender::QBlendEquation::BlendFunction blendFunctionArg() const
void setBlendFunctionArg(Qt3DRender::QBlendEquation::BlendFunction blendFunctionArg)

通知信号:

void blendFunctionArgChanged(Qt3DRender::QBlendEquation::BlendFunction blendFunctionArg)

另请参阅 Qt3DRender::QBlendEquation::BlendFunction 。

destinationAlphaArg : Qt3DRender::QBlendEquationArguments::Blending

保存混合方程的目标阿尔法混合参数。

访问函数:

Qt3DRender::QBlendEquationArguments::Blending destinationAlphaArg() const
void setDestinationAlphaArg(Qt3DRender::QBlendEquationArguments::Blending destinationAlphaArg)

通知信号:

void destinationAlphaArgChanged(Qt3DRender::QBlendEquationArguments::Blending destinationAlphaArg)

另请参阅 Qt3DRender::QBlendEquationArguments::Blending 。

destinationRgbArg : Qt3DRender::QBlendEquationArguments::Blending

存储混合方程的目标 RGB 混合参数。

访问函数:

Qt3DRender::QBlendEquationArguments::Blending destinationRgbArg() const
void setDestinationRgbArg(Qt3DRender::QBlendEquationArguments::Blending destinationRgbArg)

通知信号:

void destinationRgbArgChanged(Qt3DRender::QBlendEquationArguments::Blending destinationRgbArg)

另请参阅 Qt3DRender::QBlendEquationArguments::Blending 。

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)

sourceAlphaArg : Qt3DRender::QBlendEquationArguments::Blending

存储混合方程源的Alpha混合参数。

访问函数:

Qt3DRender::QBlendEquationArguments::Blending sourceAlphaArg() const
void setSourceAlphaArg(Qt3DRender::QBlendEquationArguments::Blending sourceAlphaArg)

通知信号:

void sourceAlphaArgChanged(Qt3DRender::QBlendEquationArguments::Blending sourceAlphaArg)

另请参阅 Qt3DRender::QBlendEquationArguments::Blending 。

sourceRgbArg : Qt3DRender::QBlendEquationArguments::Blending

保存混合方程源RGB混合参数。

访问函数:

Qt3DRender::QBlendEquationArguments::Blending sourceRgbArg() const
void setSourceRgbArg(Qt3DRender::QBlendEquationArguments::Blending sourceRgbArg)

通知信号:

void sourceRgbArgChanged(Qt3DRender::QBlendEquationArguments::Blending sourceRgbArg)

另请参阅 Qt3DRender::QBlendEquationArguments::Blending 。

specular : QColor

存储镜面反射颜色。

访问函数:

QColor specular() const
void setSpecular(const QColor &specular)

通知信号:

void specularChanged(const QColor &specular)

成员函数文档

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

创建一个新的 QPhongAlphaMaterial 实例,其父对象为parent 。

[virtual noexcept] QPhongAlphaMaterial::~QPhongAlphaMaterial()

销毁QPhongAlphaMaterial 。

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