Qt3DRender::QSpotLight Class
class Qt3DRender::QSpotLight在Qt 3D 场景中封装一个Spot Light对象。更多内容...
| 标题: | #include <qspotlight.h> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS 3drender) target_link_libraries(mytarget PRIVATE Qt6::3drender) |
| qmake: | QT += 3drender |
| 在 QML 中: | SpotLight |
| 继承自: | Qt3DRender::QAbstractLight |
| 状态: | 已弃用 |
该类已弃用。我们强烈建议不要在新代码中使用它。
属性
|
|
公共函数
| QSpotLight(Qt3DCore::QNode *parent = nullptr) | |
| float | constantAttenuation() const |
| float | cutOffAngle() const |
| float | linearAttenuation() const |
| QVector3D | localDirection() const |
| float | quadraticAttenuation() const |
公共槽位
| void | setConstantAttenuation(float value) |
| void | setCutOffAngle(float cutOffAngle) |
| void | setLinearAttenuation(float value) |
| void | setLocalDirection(const QVector3D &localDirection) |
| void | setQuadraticAttenuation(float value) |
信号
| void | constantAttenuationChanged(float constantAttenuation) |
| void | cutOffAngleChanged(float cutOffAngle) |
| void | linearAttenuationChanged(float linearAttenuation) |
| void | localDirectionChanged(const QVector3D &localDirection) |
| void | quadraticAttenuationChanged(float quadraticAttenuation) |
详细说明
聚光灯是一种向特定方向发射锥形光束的光源。
聚光灯使用三个衰减因子来描述光强随距离的衰减情况。这些因子旨在共同用于计算总衰减。对于 Qt3D Extras 中的材质,使用以下公式,其中距离是指从光源到被渲染表面的距离:
totalAttenuation = 1.0 / (constantAttenuation + (linearAttenuation * distance) + (quadraticAttenuation * distance * distance));自定义材质可选择以不同的方式解释这些系数。
属性文档
constantAttenuation : float
指定聚光灯的恒定衰减。
注意: 该属性的确切含义和用法取决于具体实现。
访问函数:
| float | constantAttenuation() const |
| void | setConstantAttenuation(float value) |
通知信号:
| void | constantAttenuationChanged(float constantAttenuation) |
cutOffAngle : float
指定聚光灯的截止角。
注意: 此属性的确切含义 和用法取决于具体实现。
访问函数:
| float | cutOffAngle() const |
| void | setCutOffAngle(float cutOffAngle) |
通知信号:
| void | cutOffAngleChanged(float cutOffAngle) |
linearAttenuation : float
指定聚光灯的线性衰减。
注意: 该属性的确切含义和用法取决于具体实现。
访问函数:
| float | linearAttenuation() const |
| void | setLinearAttenuation(float value) |
通知信号:
| void | linearAttenuationChanged(float linearAttenuation) |
localDirection : QVector3D
指定聚光灯的本地方向。
注意: 此属性的确切含义 和用法取决于具体实现。
访问函数:
| QVector3D | localDirection() const |
| void | setLocalDirection(const QVector3D &localDirection) |
通知信号:
| void | localDirectionChanged(const QVector3D &localDirection) |
quadraticAttenuation : float
指定聚光灯的二次衰减。
注意: 该属性的确切含义 和用法取决于具体材料的实现方式。
访问函数:
| float | quadraticAttenuation() const |
| void | setQuadraticAttenuation(float value) |
通知信号:
| void | quadraticAttenuationChanged(float quadraticAttenuation) |
成员函数文档
[explicit] QSpotLight::QSpotLight(Qt3DCore::QNode *parent = nullptr)
使用指定的parent 创建一个新的QSpotLight。
© 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.