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:
23
docs/api/math/vector4/dot.md
Normal file
23
docs/api/math/vector4/dot.md
Normal file
@@ -0,0 +1,23 @@
|
||||
# Vector4::Dot
|
||||
|
||||
```cpp
|
||||
static float Dot(const Vector4& a, const Vector4& b)
|
||||
```
|
||||
|
||||
计算两个 4D 向量的点积。
|
||||
|
||||
**参数:**
|
||||
- `a` - 第一个向量
|
||||
- `b` - 第二个向量
|
||||
|
||||
**返回:** `float` - 点积结果
|
||||
|
||||
**复杂度:** O(1)
|
||||
|
||||
**示例:**
|
||||
|
||||
```cpp
|
||||
Vector4 a(1.0f, 2.0f, 3.0f, 4.0f);
|
||||
Vector4 b(4.0f, 3.0f, 2.0f, 1.0f);
|
||||
float dot = Vector4::Dot(a, b); // 20.0f
|
||||
```
|
||||
17
docs/api/math/vector4/one.md
Normal file
17
docs/api/math/vector4/one.md
Normal file
@@ -0,0 +1,17 @@
|
||||
# Vector4::One
|
||||
|
||||
```cpp
|
||||
static Vector4 One()
|
||||
```
|
||||
|
||||
返回单位向量 (1, 1, 1, 1)。
|
||||
|
||||
**返回:** `Vector4` - 值为 (1, 1, 1, 1) 的向量
|
||||
|
||||
**复杂度:** O(1)
|
||||
|
||||
**示例:**
|
||||
|
||||
```cpp
|
||||
Vector4 unit = Vector4::One();
|
||||
```
|
||||
23
docs/api/math/vector4/project.md
Normal file
23
docs/api/math/vector4/project.md
Normal file
@@ -0,0 +1,23 @@
|
||||
# Vector4::Project
|
||||
|
||||
```cpp
|
||||
static Vector4 Project(const Vector4& vector, const Vector4& onNormal)
|
||||
```
|
||||
|
||||
将向量投影到法线向量上。
|
||||
|
||||
**参数:**
|
||||
- `vector` - 要投影的向量
|
||||
- `onNormal` - 投影到的法线向量
|
||||
|
||||
**返回:** `Vector4` - 投影结果
|
||||
|
||||
**复杂度:** O(1)
|
||||
|
||||
**示例:**
|
||||
|
||||
```cpp
|
||||
Vector4 v(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
Vector4 normal(1.0f, 0.0f, 0.0f, 0.0f);
|
||||
Vector4 projected = Vector4::Project(v, normal); // (1, 0, 0, 0)
|
||||
```
|
||||
18
docs/api/math/vector4/tovector3.md
Normal file
18
docs/api/math/vector4/tovector3.md
Normal file
@@ -0,0 +1,18 @@
|
||||
# Vector4::ToVector3
|
||||
|
||||
```cpp
|
||||
Vector3 ToVector3() const
|
||||
```
|
||||
|
||||
将 Vector4 转换为 Vector3,丢弃 w 分量。
|
||||
|
||||
**返回:** `Vector3` - 转换后的 Vector3 (x, y, z)
|
||||
|
||||
**复杂度:** O(1)
|
||||
|
||||
**示例:**
|
||||
|
||||
```cpp
|
||||
Vector4 pos4(1.0f, 2.0f, 3.0f, 1.0f);
|
||||
Vector3 pos3 = pos4.ToVector3(); // (1, 2, 3)
|
||||
```
|
||||
53
docs/api/math/vector4/vector4.md
Normal file
53
docs/api/math/vector4/vector4.md
Normal file
@@ -0,0 +1,53 @@
|
||||
# Vector4
|
||||
|
||||
4D 向量结构体,用于表示齐次坐标、颜色 (RGBA) 或 SIMD 操作。
|
||||
|
||||
**头文件:** `#include <XCEngine/Math/Vector4.h>`
|
||||
|
||||
**命名空间:** `XCEngine::Math`
|
||||
|
||||
## 结构体定义
|
||||
|
||||
```cpp
|
||||
struct Vector4 {
|
||||
float x = 0.0f;
|
||||
float y = 0.0f;
|
||||
float z = 0.0f;
|
||||
float w = 0.0f;
|
||||
};
|
||||
```
|
||||
|
||||
## 构造函数
|
||||
|
||||
- `Vector4(float x, float y, float z, float w)` - 从四个分量构造
|
||||
- `explicit Vector4(const Vector3& v, float w = 0.0f)` - 从 Vector3 构造
|
||||
|
||||
## 静态工厂方法
|
||||
|
||||
| 方法 | 返回值 | 描述 |
|
||||
|------|--------|------|
|
||||
| [Zero()](zero.md) | `Vector4` | 返回 (0, 0, 0, 0) |
|
||||
| [One()](one.md) | `Vector4` | 返回 (1, 1, 1, 1) |
|
||||
|
||||
## 静态数学方法
|
||||
|
||||
| 方法 | 返回值 | 描述 |
|
||||
|------|--------|------|
|
||||
| [Dot(a, b)](dot.md) | `float` | 4D 点积 |
|
||||
| [Project(vector, onNormal)](project.md) | `Vector4` | 投影 |
|
||||
|
||||
## 实例方法
|
||||
|
||||
| 方法 | 返回值 | 描述 |
|
||||
|------|--------|------|
|
||||
| [ToVector3()](tovector3.md) | `Vector3` | 转换到 Vector3(丢弃 w) |
|
||||
|
||||
## 运算符
|
||||
|
||||
- 算术: `+`, `-`, `*` (scalar)
|
||||
- 下标: `operator[]`
|
||||
- 比较: `==`, `!=`
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [Math 模块总览](../math.md) - 返回 Math 模块总览
|
||||
17
docs/api/math/vector4/zero.md
Normal file
17
docs/api/math/vector4/zero.md
Normal file
@@ -0,0 +1,17 @@
|
||||
# Vector4::Zero
|
||||
|
||||
```cpp
|
||||
static Vector4 Zero()
|
||||
```
|
||||
|
||||
返回零向量 (0, 0, 0, 0)。
|
||||
|
||||
**返回:** `Vector4` - 值为 (0, 0, 0, 0) 的向量
|
||||
|
||||
**复杂度:** O(1)
|
||||
|
||||
**示例:**
|
||||
|
||||
```cpp
|
||||
Vector4 origin = Vector4::Zero();
|
||||
```
|
||||
Reference in New Issue
Block a user