2026-03-26 02:02:21 +08:00
|
|
|
# SetIntensity
|
|
|
|
|
|
|
|
|
|
**所属类**: `LightComponent`
|
|
|
|
|
|
|
|
|
|
**头文件**: `XCEngine/Components/LightComponent.h`
|
|
|
|
|
|
|
|
|
|
**描述**: 设置光源的强度。
|
|
|
|
|
|
|
|
|
|
## 函数签名
|
|
|
|
|
|
|
|
|
|
```cpp
|
|
|
|
|
void SetIntensity(float value);
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## 参数
|
|
|
|
|
|
|
|
|
|
| 参数 | 类型 | 描述 |
|
|
|
|
|
|------|------|------|
|
|
|
|
|
| `value` | `float` | 光源强度,值越大光线越亮 |
|
|
|
|
|
|
|
|
|
|
## 使用示例
|
|
|
|
|
|
|
|
|
|
```cpp
|
|
|
|
|
#include <XCEngine/Components/LightComponent.h>
|
|
|
|
|
|
|
|
|
|
using namespace XCEngine::Components;
|
|
|
|
|
|
|
|
|
|
void SetupLightIntensity(LightComponent* light) {
|
|
|
|
|
// 标准强度
|
|
|
|
|
light->SetIntensity(1.0f);
|
|
|
|
|
|
|
|
|
|
// 高强度(太阳光)
|
|
|
|
|
light->SetIntensity(3.0f);
|
|
|
|
|
|
|
|
|
|
// 低强度(月光)
|
|
|
|
|
light->SetIntensity(0.2f);
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## 相关文档
|
|
|
|
|
|
2026-03-26 02:04:27 +08:00
|
|
|
- [LightComponent](light-component.md) - 光源组件
|
|
|
|
|
- [GetIntensity](get-intensity.md) - 获取光源强度
|