38 lines
713 B
Markdown
38 lines
713 B
Markdown
# GetRange
|
|
|
|
**所属类**: `LightComponent`
|
|
|
|
**头文件**: `XCEngine/Components/LightComponent.h`
|
|
|
|
**描述**: 获取光源的作用范围(仅对点光源和聚光灯有效)。
|
|
|
|
## 函数签名
|
|
|
|
```cpp
|
|
float GetRange() const;
|
|
```
|
|
|
|
## 返回值
|
|
|
|
| 类型 | 描述 |
|
|
|------|------|
|
|
| `float` | 作用范围(米),默认值为 10.0 |
|
|
|
|
## 使用示例
|
|
|
|
```cpp
|
|
#include <XCEngine/Components/LightComponent.h>
|
|
|
|
using namespace XCEngine::Components;
|
|
|
|
void PrintLightRange(LightComponent* light) {
|
|
float range = light->GetRange();
|
|
printf("Light range: %.2f meters\n", range);
|
|
}
|
|
```
|
|
|
|
## 相关文档
|
|
|
|
- [LightComponent](light-component.md) - 光源组件
|
|
- [SetRange](set-range.md) - 设置作用范围
|