refactor: reorganize docs into plan/ and add skills/

This commit is contained in:
2026-03-18 17:49:22 +08:00
parent fc7c8f6797
commit 9bad996ecf
143 changed files with 13263 additions and 0 deletions

View File

@@ -0,0 +1,61 @@
# Frustum
视锥体,用于视锥剔除。
## 头文件
```cpp
#include <XCEngine/Math/Frustum.h>
```
## 命名空间
`XCEngine::Math`
## 结构体定义
```cpp
class Frustum {
public:
Plane planes[6]; // 6 个裁剪平面
enum class PlaneIndex {
Left = 0,
Right = 1,
Bottom = 2,
Top = 3,
Near = 4,
Far = 5
};
};
```
## 实例方法
| 方法 | 返回值 | 描述 |
|------|--------|------|
| `Contains(point)` | `bool` | 点是否在视锥内 |
| `Contains(Sphere)` | `bool` | 球体是否在视锥内 |
| `Contains(Bounds)` | `bool` | Bounds 是否在视锥内 |
| `Intersects(Bounds)` | `bool` | Bounds 是否与视锥相交 |
| `Intersects(Sphere)` | `bool` | 球体是否与视锥相交 |
## 使用示例
```cpp
Frustum frustum;
// 需要从相机矩阵构建视锥平面
// 视锥剔除
for (const auto& object : objects) {
if (frustum.Contains(object.bounds)) {
// 物体在视锥内,渲染
Render(object);
}
}
// 或使用相交检测
if (frustum.Intersects(bounds)) {
Render(object);
}
```