- components: 新增 light-component 全部12个方法文档 - resources: 更新 audio-loader, resource-file-system 文档 - rhi: 更新 opengl/fence 文档
38 lines
767 B
Markdown
38 lines
767 B
Markdown
# SetSpotAngle
|
|
|
|
**所属类**: `LightComponent`
|
|
|
|
**头文件**: `XCEngine/Components/LightComponent.h`
|
|
|
|
**描述**: 设置聚光灯的角度(仅对聚光灯有效)。
|
|
|
|
## 函数签名
|
|
|
|
```cpp
|
|
void SetSpotAngle(float value);
|
|
```
|
|
|
|
## 参数
|
|
|
|
| 参数 | 类型 | 描述 |
|
|
|------|------|------|
|
|
| `value` | `float` | 聚光灯角度(度),通常在 1.0 到 90.0 之间 |
|
|
|
|
## 使用示例
|
|
|
|
```cpp
|
|
#include <XCEngine/Components/LightComponent.h>
|
|
|
|
using namespace XCEngine::Components;
|
|
|
|
void SetupSpotLight(LightComponent* light) {
|
|
light->SetLightType(LightType::Spot);
|
|
light->SetSpotAngle(45.0f); // 45度锥角
|
|
}
|
|
```
|
|
|
|
## 相关文档
|
|
|
|
- [LightComponent](./light-component.md) - 光源组件
|
|
- [GetSpotAngle](./get-spot-angle.md) - 获取聚光灯角度
|