本页内容

Qt3DRender::QDirectionalLight Class

class Qt3DRender::QDirectionalLight

在Qt 3D 场景中封装一个“定向光”对象。更多内容...

标题: #include <qdirectionallight.h>
CMake: find_package(Qt6 REQUIRED COMPONENTS 3drender)
target_link_libraries(mytarget PRIVATE Qt6::3drender)
qmake: QT += 3drender
在 QML 中: DirectionalLight
继承自: Qt3DRender::QAbstractLight
状态: 已弃用

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

属性

公共函数

QDirectionalLight(Qt3DCore::QNode *parent = nullptr)
QVector3D worldDirection() const

公共槽位

void setWorldDirection(const QVector3D &worldDirection)

信号

void worldDirectionChanged(const QVector3D &worldDirection)

详细说明

定向光是一种行为类似于阳光的光源。无论场景中物体位于何处,定向光发出的光都会从同一方向以相同的强度照射到所有物体上。

属性文档

worldDirection : QVector3D

指定定向光的世界方向。

注意: 该属性的确切含义 和用法取决于材质实现。

访问函数:

QVector3D worldDirection() const
void setWorldDirection(const QVector3D &worldDirection)

通知信号:

void worldDirectionChanged(const QVector3D &worldDirection)

成员函数文档

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

使用指定的parent 创建一个新的QDirectionalLight。

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