docs: 重构 API 文档结构并修正源码准确性
- 重组文档目录结构: 每个模块的概述页移动到模块子目录 - 重命名 index.md 为 main.md - 修正所有模块文档中的错误: - math: FromEuler→FromEulerAngles, TransformDirection 包含缩放, Box 是 OBB, Color::ToRGBA 格式 - containers: 新增 operator==/!= 文档, 补充 std::hash DJB 算法细节 - core: 修复 types 链接错误 - debug: LogLevelToString 返回大写, timestamp 是秒, Profiler 空实现标注, Windows API vs ANSI - memory: 修复头文件路径, malloc vs operator new, 新增方法文档 - resources: 修复 Shader/Texture 链接错误 - threading: TaskSystem::Wait 空实现标注, ReadWriteLock 重入描述, LambdaTask 链接 - 验证: fix_links.py 确认 0 个断裂引用
This commit is contained in:
37
docs/api/math/box/box.md
Normal file
37
docs/api/math/box/box.md
Normal file
@@ -0,0 +1,37 @@
|
||||
# Box
|
||||
|
||||
带变换的有向包围盒 (OBB) 结构体。
|
||||
|
||||
**头文件:** `#include <XCEngine/Math/Box.h>`
|
||||
|
||||
**命名空间:** `XCEngine::Math`
|
||||
|
||||
## 结构体定义
|
||||
|
||||
```cpp
|
||||
struct Box {
|
||||
Vector3 center = Vector3::Zero();
|
||||
Vector3 extents = Vector3::Zero();
|
||||
Matrix4x4 transform = Matrix4x4::Identity();
|
||||
};
|
||||
```
|
||||
|
||||
## 构造函数
|
||||
|
||||
- `Box()` - 默认构造
|
||||
- `Box(const Vector3& center, const Vector3& extents)` - 从中心和半长构造
|
||||
|
||||
## 实例方法
|
||||
|
||||
| 方法 | 返回值 | 描述 |
|
||||
|------|--------|------|
|
||||
| [GetMin()](getmin.md) | `Vector3` | 局部空间最小点 |
|
||||
| [GetMax()](getmax.md) | `Vector3` | 局部空间最大点 |
|
||||
| [Contains(point)](contains.md) | `bool` | 点是否在盒内 |
|
||||
| [Intersects(Sphere)](intersects.md) | `bool` | 与球体相交 |
|
||||
| [Intersects(Box)](intersects-box.md) | `bool` | 与另一个 OBB 相交 |
|
||||
| [Intersects(Ray, t)](intersects-ray.md) | `bool` | 与射线相交 |
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [Math 模块总览](../math.md) - 返回 Math 模块总览
|
||||
20
docs/api/math/box/contains.md
Normal file
20
docs/api/math/box/contains.md
Normal file
@@ -0,0 +1,20 @@
|
||||
# Box::Contains
|
||||
|
||||
```cpp
|
||||
bool Contains(const Vector3& point) const
|
||||
```
|
||||
|
||||
检测点是否在盒内。
|
||||
|
||||
**参数:**
|
||||
- `point` - 要检测的点
|
||||
|
||||
**返回:** `bool` - true 表示点在盒内
|
||||
|
||||
**复杂度:** O(1)
|
||||
|
||||
**示例:**
|
||||
|
||||
```cpp
|
||||
if (box.Contains(point)) { /* inside */ }
|
||||
```
|
||||
17
docs/api/math/box/getmax.md
Normal file
17
docs/api/math/box/getmax.md
Normal file
@@ -0,0 +1,17 @@
|
||||
# Box::GetMax
|
||||
|
||||
```cpp
|
||||
Vector3 GetMax() const
|
||||
```
|
||||
|
||||
获取局部空间最大点。
|
||||
|
||||
**返回:** `Vector3` - (+extents)
|
||||
|
||||
**复杂度:** O(1)
|
||||
|
||||
**示例:**
|
||||
|
||||
```cpp
|
||||
Vector3 max = box.GetMax();
|
||||
```
|
||||
17
docs/api/math/box/getmin.md
Normal file
17
docs/api/math/box/getmin.md
Normal file
@@ -0,0 +1,17 @@
|
||||
# Box::GetMin
|
||||
|
||||
```cpp
|
||||
Vector3 GetMin() const
|
||||
```
|
||||
|
||||
获取局部空间最小点。
|
||||
|
||||
**返回:** `Vector3` - (-extents)
|
||||
|
||||
**复杂度:** O(1)
|
||||
|
||||
**示例:**
|
||||
|
||||
```cpp
|
||||
Vector3 min = box.GetMin();
|
||||
```
|
||||
20
docs/api/math/box/intersects-box.md
Normal file
20
docs/api/math/box/intersects-box.md
Normal file
@@ -0,0 +1,20 @@
|
||||
# Box::Intersects (Box)
|
||||
|
||||
```cpp
|
||||
bool Intersects(const Box& other) const
|
||||
```
|
||||
|
||||
检测两个 OBB 是否相交(使用 SAT 算法)。
|
||||
|
||||
**参数:**
|
||||
- `other` - 另一个 OBB
|
||||
|
||||
**返回:** `bool` - true 表示相交
|
||||
|
||||
**复杂度:** O(1)
|
||||
|
||||
**示例:**
|
||||
|
||||
```cpp
|
||||
if (box.Intersects(otherBox)) { /* collision */ }
|
||||
```
|
||||
24
docs/api/math/box/intersects-ray.md
Normal file
24
docs/api/math/box/intersects-ray.md
Normal file
@@ -0,0 +1,24 @@
|
||||
# Box::Intersects (Ray)
|
||||
|
||||
```cpp
|
||||
bool Intersects(const Ray& ray, float& t) const
|
||||
```
|
||||
|
||||
检测盒是否与射线相交。
|
||||
|
||||
**参数:**
|
||||
- `ray` - 射线
|
||||
- `t` - 输出交点距离
|
||||
|
||||
**返回:** `bool` - true 表示相交
|
||||
|
||||
**复杂度:** O(1)
|
||||
|
||||
**示例:**
|
||||
|
||||
```cpp
|
||||
float t;
|
||||
if (box.Intersects(ray, t)) {
|
||||
Vector3 hit = ray.GetPoint(t);
|
||||
}
|
||||
```
|
||||
20
docs/api/math/box/intersects.md
Normal file
20
docs/api/math/box/intersects.md
Normal file
@@ -0,0 +1,20 @@
|
||||
# Box::Intersects
|
||||
|
||||
```cpp
|
||||
bool Intersects(const Sphere& sphere) const
|
||||
```
|
||||
|
||||
检测盒是否与球体相交。
|
||||
|
||||
**参数:**
|
||||
- `sphere` - 球体
|
||||
|
||||
**返回:** `bool` - true 表示相交
|
||||
|
||||
**复杂度:** O(1)
|
||||
|
||||
**示例:**
|
||||
|
||||
```cpp
|
||||
if (box.Intersects(sphere)) { /* collision */ }
|
||||
```
|
||||
Reference in New Issue
Block a user