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:
2026-03-19 00:22:30 +08:00
parent d0e16962c8
commit dc850d7739
1012 changed files with 26673 additions and 9222 deletions

View File

@@ -0,0 +1,15 @@
# RHITexture::GetDepth
```cpp
virtual uint32_t GetDepth() const = 0;
```
获取纹理深度3D 纹理)。
**返回:** 纹理深度
**复杂度:** O(1)
## 相关文档
- [RHITexture 总览](texture.md) - 返回类总览

View File

@@ -0,0 +1,15 @@
# RHITexture::GetFormat
```cpp
virtual Format GetFormat() const = 0;
```
获取纹理格式。
**返回:** 纹理格式枚举值
**复杂度:** O(1)
## 相关文档
- [RHITexture 总览](texture.md) - 返回类总览

View File

@@ -0,0 +1,15 @@
# RHITexture::GetHeight
```cpp
virtual uint32_t GetHeight() const = 0;
```
获取纹理高度(像素)。
**返回:** 纹理高度
**复杂度:** O(1)
## 相关文档
- [RHITexture 总览](texture.md) - 返回类总览

View File

@@ -0,0 +1,15 @@
# RHITexture::GetMipLevels
```cpp
virtual uint32_t GetMipLevels() const = 0;
```
获取 Mipmap 级别数。
**返回:** Mipmap 级别数
**复杂度:** O(1)
## 相关文档
- [RHITexture 总览](texture.md) - 返回类总览

View File

@@ -0,0 +1,20 @@
# RHITexture::GetName / SetName
```cpp
virtual const std::string& GetName() const = 0;
virtual void SetName(const std::string& name) = 0;
```
获取或设置纹理名称(用于调试)。
**复杂度:** O(1)
**示例:**
```cpp
texture->SetName("DiffuseMap_Main");
```
## 相关文档
- [RHITexture 总览](texture.md) - 返回类总览

View File

@@ -0,0 +1,15 @@
# RHITexture::GetNativeHandle
```cpp
virtual void* GetNativeHandle() = 0;
```
获取原生 API 句柄。
**返回:** 原生纹理句柄
**复杂度:** O(1)
## 相关文档
- [RHITexture 总览](texture.md) - 返回类总览

View File

@@ -0,0 +1,15 @@
# RHITexture::GetState
```cpp
virtual ResourceStates GetState() const = 0;
```
获取当前资源状态。
**返回:** 资源状态枚举值
**复杂度:** O(1)
## 相关文档
- [RHITexture 总览](texture.md) - 返回类总览

View File

@@ -0,0 +1,15 @@
# RHITexture::GetTextureType
```cpp
virtual TextureType GetTextureType() const = 0;
```
获取纹理类型。
**返回:** 纹理类型枚举值
**复杂度:** O(1)
## 相关文档
- [RHITexture 总览](texture.md) - 返回类总览

View File

@@ -0,0 +1,15 @@
# RHITexture::GetWidth
```cpp
virtual uint32_t GetWidth() const = 0;
```
获取纹理宽度(像素)。
**返回:** 纹理宽度
**复杂度:** O(1)
## 相关文档
- [RHITexture 总览](texture.md) - 返回类总览

View File

@@ -0,0 +1,22 @@
# RHITexture::SetName
```cpp
virtual void SetName(const std::string& name) = 0;
```
设置纹理名称(用于调试)。
**参数:**
- `name` - 新名称
**复杂度:** O(1)
**示例:**
```cpp
texture->SetName("DiffuseMap");
```
## 相关文档
- [RHITexture 总览](texture.md) - 返回类总览

View File

@@ -0,0 +1,22 @@
# RHITexture::SetState
```cpp
virtual void SetState(ResourceStates state) = 0;
```
设置资源状态。
**参数:**
- `state` - 新的资源状态
**复杂度:** O(1)
**示例:**
```cpp
texture->SetState(ResourceStates::PixelShaderResource);
```
## 相关文档
- [RHITexture 总览](texture.md) - 返回类总览

View File

@@ -0,0 +1,13 @@
# RHITexture::Shutdown
```cpp
virtual void Shutdown() = 0;
```
释放纹理资源。
**复杂度:** O(1)
## 相关文档
- [RHITexture 总览](texture.md) - 返回类总览

View File

@@ -0,0 +1,82 @@
# RHITexture
**命名空间**: `XCEngine::RHI`
**类型**: `class` (abstract)
**描述**: GPU 纹理资源抽象接口,用于管理 1D、2D、3D 纹理和立方体贴图等 GPU 资源。
## 公共方法
### 属性访问
| 方法 | 文档 |
|------|------|
| `GetWidth` | [详细文档](get-width.md) |
| `GetHeight` | [详细文档](get-height.md) |
| `GetDepth` | [详细文档](get-depth.md) |
| `GetMipLevels` | [详细文档](get-mip-levels.md) |
| `GetFormat` | [详细文档](get-format.md) |
| `GetTextureType` | [详细文档](get-texture-type.md) |
### 状态管理
| 方法 | 文档 |
|------|------|
| `GetState` | [详细文档](../buffer/get-state.md) |
| `SetState` | [详细文档](../buffer/set-state.md) |
### 生命周期
| 方法 | 文档 |
|------|------|
| `Shutdown` | [详细文档](../../threading/task-system/shutdown.md) |
### 其他
| 方法 | 文档 |
|------|------|
| `GetNativeHandle` | [详细文档](../buffer/get-native-handle.md) |
| `GetName` | [详细文档](../buffer/get-name.md) |
| `SetName` | [详细文档](../buffer/set-name.md) |
## 纹理类型 (TextureType)
| 枚举值 | 描述 |
|--------|------|
| `TextureType::Texture1D` | 1D 纹理 |
| `TextureType::Texture2D` | 2D 纹理 |
| `TextureType::Texture2DArray` | 2D 纹理数组 |
| `TextureType::Texture3D` | 3D 纹理(体积纹理) |
| `TextureType::TextureCube` | 立方体贴图 |
| `TextureType::TextureCubeArray` | 立方体贴图数组 |
## 纹理格式 (Format)
| 格式 | 描述 |
|------|------|
| `Format::R8G8B8A8_UNorm` | 四通道 8 位归一化 |
| `Format::R16G16B16A16_Float` | 四通道 16 位浮点 |
| `Format::D32_Float` | 32 位深度 |
| `Format::BC1_UNorm` | BC1 压缩 (DXT1) |
| `Format::BC7_UNorm` | BC7 高质量压缩 |
## 使用示例
```cpp
TextureDesc desc;
desc.width = 1024;
desc.height = 1024;
desc.format = (uint32_t)Format::R8G8B8A8_UNorm;
desc.textureType = (uint32_t)TextureType::Texture2D;
RHITexture* texture = device->CreateTexture(desc);
texture->SetState(ResourceStates::PixelShaderResource);
texture->Shutdown();
```
## 相关文档
- [../rhi/rhi.md](../rhi.md) - RHI 模块总览
- [RHIDevice](../device/device.md) - 创建设备
- [RHIBuffer](../buffer/buffer.md) - 缓冲区资源