2026-03-26 02:02:21 +08:00
|
|
|
# GetIntensity
|
|
|
|
|
|
|
|
|
|
**所属类**: `LightComponent`
|
|
|
|
|
|
|
|
|
|
**头文件**: `XCEngine/Components/LightComponent.h`
|
|
|
|
|
|
|
|
|
|
**描述**: 获取光源的强度。
|
|
|
|
|
|
|
|
|
|
## 函数签名
|
|
|
|
|
|
|
|
|
|
```cpp
|
|
|
|
|
float GetIntensity() const;
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## 返回值
|
|
|
|
|
|
|
|
|
|
| 类型 | 描述 |
|
|
|
|
|
|------|------|
|
|
|
|
|
| `float` | 光源强度,默认值为 1.0 |
|
|
|
|
|
|
|
|
|
|
## 使用示例
|
|
|
|
|
|
|
|
|
|
```cpp
|
|
|
|
|
#include <XCEngine/Components/LightComponent.h>
|
|
|
|
|
|
|
|
|
|
using namespace XCEngine::Components;
|
|
|
|
|
|
|
|
|
|
void PrintLightIntensity(LightComponent* light) {
|
|
|
|
|
float intensity = light->GetIntensity();
|
|
|
|
|
printf("Light intensity: %.2f\n", intensity);
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## 相关文档
|
|
|
|
|
|
2026-03-26 02:04:27 +08:00
|
|
|
- [LightComponent](light-component.md) - 光源组件
|
|
|
|
|
- [SetIntensity](set-intensity.md) - 设置光源强度
|