docs: 新增 light-component 全部方法文档及更新其他模块

- components: 新增 light-component 全部12个方法文档
- resources: 更新 audio-loader, resource-file-system 文档
- rhi: 更新 opengl/fence 文档
This commit is contained in:
2026-03-26 02:02:21 +08:00
parent ab5ba1d57a
commit c2354530b9
16 changed files with 480 additions and 39 deletions

View File

@@ -0,0 +1,38 @@
# GetCastsShadows
**所属类**: `LightComponent`
**头文件**: `XCEngine/Components/LightComponent.h`
**描述**: 检查光源是否投射阴影。
## 函数签名
```cpp
bool GetCastsShadows() const;
```
## 返回值
| 类型 | 描述 |
|------|------|
| `bool` | true 表示投射阴影false 表示不投射阴影 |
## 使用示例
```cpp
#include <XCEngine/Components/LightComponent.h>
using namespace XCEngine::Components;
void CheckShadowCasting(LightComponent* light) {
if (light->GetCastsShadows()) {
printf("This light casts shadows\n");
}
}
```
## 相关文档
- [LightComponent](./light-component.md) - 光源组件
- [SetCastsShadows](./set-casts-shadows.md) - 设置阴影投射

View File

@@ -0,0 +1,37 @@
# GetColor
**所属类**: `LightComponent`
**头文件**: `XCEngine/Components/LightComponent.h`
**描述**: 获取光源的颜色。
## 函数签名
```cpp
const Math::Color& GetColor() const;
```
## 返回值
| 类型 | 描述 |
|------|------|
| `const Math::Color&` | 光源颜色引用 |
## 使用示例
```cpp
#include <XCEngine/Components/LightComponent.h>
using namespace XCEngine::Components;
void PrintLightColor(LightComponent* light) {
const auto& color = light->GetColor();
printf("Light color: (%.2f, %.2f, %.2f)\n", color.r, color.g, color.b);
}
```
## 相关文档
- [LightComponent](light-component.md) - 光源组件
- [SetColor](set-color.md) - 设置光源颜色

View File

@@ -0,0 +1,37 @@
# 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);
}
```
## 相关文档
- [LightComponent](./light-component.md) - 光源组件
- [SetIntensity](./set-intensity.md) - 设置光源强度

View File

@@ -0,0 +1,42 @@
# GetLightType
**所属类**: `LightComponent`
**头文件**: `XCEngine/Components/LightComponent.h`
**描述**: 获取光源的类型。
## 函数签名
```cpp
LightType GetLightType() const;
```
## 返回值
| 类型 | 描述 |
|------|------|
| `LightType` | 光源类型:`Directional`(定向光)、`Point`(点光源)或 `Spot`(聚光灯) |
## 使用示例
```cpp
#include <XCEngine/Components/LightComponent.h>
using namespace XCEngine::Components;
void CheckLightType(LightComponent* light) {
if (light->GetLightType() == LightType::Directional) {
printf("Directional light\n");
} else if (light->GetLightType() == LightType::Point) {
printf("Point light\n");
} else {
printf("Spot light\n");
}
}
```
## 相关文档
- [LightComponent](light-component.md) - 光源组件
- [SetLightType](set-light-type.md) - 设置光源类型

View File

@@ -0,0 +1,37 @@
# 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) - 设置作用范围

View File

@@ -0,0 +1,37 @@
# GetSpotAngle
**所属类**: `LightComponent`
**头文件**: `XCEngine/Components/LightComponent.h`
**描述**: 获取聚光灯的角度(仅对聚光灯有效)。
## 函数签名
```cpp
float GetSpotAngle() const;
```
## 返回值
| 类型 | 描述 |
|------|------|
| `float` | 聚光灯角度(度),默认值为 30.0 |
## 使用示例
```cpp
#include <XCEngine/Components/LightComponent.h>
using namespace XCEngine::Components;
void PrintSpotAngle(LightComponent* light) {
float angle = light->GetSpotAngle();
printf("Spot angle: %.1f degrees\n", angle);
}
```
## 相关文档
- [LightComponent](./light-component.md) - 光源组件
- [SetSpotAngle](./set-spot-angle.md) - 设置聚光灯角度

View File

@@ -0,0 +1,40 @@
# SetCastsShadows
**所属类**: `LightComponent`
**头文件**: `XCEngine/Components/LightComponent.h`
**描述**: 设置光源是否投射阴影。
## 函数签名
```cpp
void SetCastsShadows(bool value);
```
## 参数
| 参数 | 类型 | 描述 |
|------|------|------|
| `value` | `bool` | true 启用阴影投射false 禁用阴影投射 |
## 使用示例
```cpp
#include <XCEngine/Components/LightComponent.h>
using namespace XCEngine::Components;
void SetupShadowCasting(LightComponent* light) {
// 启用阴影
light->SetCastsShadows(true);
// 禁用阴影(性能优化)
light->SetCastsShadows(false);
}
```
## 相关文档
- [LightComponent](./light-component.md) - 光源组件
- [GetCastsShadows](./get-casts-shadows.md) - 检查阴影投射

View File

@@ -0,0 +1,43 @@
# SetColor
**所属类**: `LightComponent`
**头文件**: `XCEngine/Components/LightComponent.h`
**描述**: 设置光源的颜色。
## 函数签名
```cpp
void SetColor(const Math::Color& value);
```
## 参数
| 参数 | 类型 | 描述 |
|------|------|------|
| `value` | `const Math::Color&` | 光源颜色 |
## 使用示例
```cpp
#include <XCEngine/Components/LightComponent.h>
using namespace XCEngine::Components;
void SetupLightColor(LightComponent* light) {
// 白色光源
light->SetColor(Math::Color::White());
// 暖色光源
light->SetColor(Math::Color(1.0f, 0.9f, 0.7f, 1.0f));
// 蓝色光源
light->SetColor(Math::Color(0.5f, 0.7f, 1.0f, 1.0f));
}
```
## 相关文档
- [LightComponent](light-component.md) - 光源组件
- [GetColor](get-color.md) - 获取光源颜色

View File

@@ -0,0 +1,43 @@
# 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);
}
```
## 相关文档
- [LightComponent](./light-component.md) - 光源组件
- [GetIntensity](./get-intensity.md) - 获取光源强度

View File

@@ -0,0 +1,43 @@
# SetLightType
**所属类**: `LightComponent`
**头文件**: `XCEngine/Components/LightComponent.h`
**描述**: 设置光源的类型。
## 函数签名
```cpp
void SetLightType(LightType value);
```
## 参数
| 参数 | 类型 | 描述 |
|------|------|------|
| `value` | `LightType` | 光源类型:`Directional`(定向光)、`Point`(点光源)或 `Spot`(聚光灯) |
## 使用示例
```cpp
#include <XCEngine/Components/LightComponent.h>
using namespace XCEngine::Components;
void SetupLightType(LightComponent* light) {
// 定向光(太阳光)
light->SetLightType(LightType::Directional);
// 点光源(灯泡)
light->SetLightType(LightType::Point);
// 聚光灯(手电筒)
light->SetLightType(LightType::Spot);
}
```
## 相关文档
- [LightComponent](light-component.md) - 光源组件
- [GetLightType](get-light-type.md) - 获取光源类型

View File

@@ -0,0 +1,37 @@
# SetRange
**所属类**: `LightComponent`
**头文件**: `XCEngine/Components/LightComponent.h`
**描述**: 设置光源的作用范围(仅对点光源和聚光灯有效)。
## 函数签名
```cpp
void SetRange(float value);
```
## 参数
| 参数 | 类型 | 描述 |
|------|------|------|
| `value` | `float` | 作用范围(米) |
## 使用示例
```cpp
#include <XCEngine/Components/LightComponent.h>
using namespace XCEngine::Components;
void SetupLightRange(LightComponent* light) {
light->SetLightType(LightType::Point);
light->SetRange(15.0f); // 15米范围
}
```
## 相关文档
- [LightComponent](./light-component.md) - 光源组件
- [GetRange](./get-range.md) - 获取作用范围

View File

@@ -0,0 +1,37 @@
# 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) - 获取聚光灯角度