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:
30
docs/api/rhi/opengl/shader/compile-compute.md
Normal file
30
docs/api/rhi/opengl/shader/compile-compute.md
Normal file
@@ -0,0 +1,30 @@
|
||||
# OpenGLShader::CompileCompute
|
||||
|
||||
```cpp
|
||||
bool CompileCompute(const char* computeSource);
|
||||
```
|
||||
|
||||
从源代码编译计算着色器。
|
||||
|
||||
**参数:**
|
||||
- `computeSource` - 计算着色器源代码
|
||||
|
||||
**返回:** 成功返回 `true`,失败返回 `false`
|
||||
|
||||
**线程安全:** ❌
|
||||
|
||||
**示例:**
|
||||
|
||||
```cpp
|
||||
const char* cs = R"(
|
||||
#version 430 core
|
||||
layout(local_size_x = 16, local_size_y = 16) in;
|
||||
void main() { /* compute logic */ }
|
||||
)";
|
||||
shader->CompileCompute(cs);
|
||||
```
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [OpenGLShader 总览](shader.md) - 返回类总览
|
||||
- [Compile (VS+FS)](compile-vs-fs.md) - 图形着色器版本
|
||||
25
docs/api/rhi/opengl/shader/compile-from-file-vs-fs.md
Normal file
25
docs/api/rhi/opengl/shader/compile-from-file-vs-fs.md
Normal file
@@ -0,0 +1,25 @@
|
||||
# OpenGLShader::CompileFromFile (VS+FS)
|
||||
|
||||
```cpp
|
||||
bool CompileFromFile(const char* vertexPath, const char* fragmentPath);
|
||||
```
|
||||
|
||||
从文件编译顶点着色器和片段着色器。
|
||||
|
||||
**参数:**
|
||||
- `vertexPath` - 顶点着色器文件路径
|
||||
- `fragmentPath` - 片段着色器文件路径
|
||||
|
||||
**返回:** 成功返回 `true`,失败返回 `false`
|
||||
|
||||
**示例:**
|
||||
|
||||
```cpp
|
||||
shader->CompileFromFile("shaders/vertex.glsl", "shaders/fragment.glsl");
|
||||
shader->Use();
|
||||
```
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [OpenGLShader 总览](shader.md) - 返回类总览
|
||||
- [CompileFromFile (VS+GS+FS)](compile-from-file-vs-gs-fs.md) - 带几何着色器版本
|
||||
26
docs/api/rhi/opengl/shader/compile-from-file-vs-gs-fs.md
Normal file
26
docs/api/rhi/opengl/shader/compile-from-file-vs-gs-fs.md
Normal file
@@ -0,0 +1,26 @@
|
||||
# OpenGLShader::CompileFromFile (VS+GS+FS)
|
||||
|
||||
```cpp
|
||||
bool CompileFromFile(const char* vertexPath, const char* fragmentPath, const char* geometryPath);
|
||||
```
|
||||
|
||||
从文件编译顶点着色器、几何着色器和片段着色器。
|
||||
|
||||
**参数:**
|
||||
- `vertexPath` - 顶点着色器文件路径
|
||||
- `fragmentPath` - 片段着色器文件路径
|
||||
- `geometryPath` - 几何着色器文件路径
|
||||
|
||||
**返回:** 成功返回 `true`,失败返回 `false`
|
||||
|
||||
**示例:**
|
||||
|
||||
```cpp
|
||||
shader->CompileFromFile("shaders/vertex.glsl", "shaders/fragment.glsl", "shaders/geometry.glsl");
|
||||
shader->Use();
|
||||
```
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [OpenGLShader 总览](shader.md) - 返回类总览
|
||||
- [CompileFromFile (VS+FS)](compile-from-file-vs-fs.md) - 不带几何着色器版本
|
||||
34
docs/api/rhi/opengl/shader/compile-vs-fs.md
Normal file
34
docs/api/rhi/opengl/shader/compile-vs-fs.md
Normal file
@@ -0,0 +1,34 @@
|
||||
# OpenGLShader::Compile (VS+FS)
|
||||
|
||||
```cpp
|
||||
bool Compile(const char* vertexSource, const char* fragmentSource);
|
||||
```
|
||||
|
||||
从源代码编译顶点着色器和片段着色器。
|
||||
|
||||
**参数:**
|
||||
- `vertexSource` - 顶点着色器源代码
|
||||
- `fragmentSource` - 片段着色器源代码
|
||||
|
||||
**返回:** 成功返回 `true`,失败返回 `false`
|
||||
|
||||
**示例:**
|
||||
|
||||
```cpp
|
||||
const char* vs = R"(
|
||||
#version 330 core
|
||||
void main() { gl_Position = vec4(0.0); }
|
||||
)";
|
||||
const char* fs = R"(
|
||||
#version 330 core
|
||||
out vec4 color;
|
||||
void main() { color = vec4(1.0); }
|
||||
)";
|
||||
shader->Compile(vs, fs);
|
||||
shader->Use();
|
||||
```
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [OpenGLShader 总览](shader.md) - 返回类总览
|
||||
- [CompileCompute](compile-compute.md) - 计算着色器版本
|
||||
23
docs/api/rhi/opengl/shader/get-id.md
Normal file
23
docs/api/rhi/opengl/shader/get-id.md
Normal file
@@ -0,0 +1,23 @@
|
||||
# OpenGLShader::GetID
|
||||
|
||||
```cpp
|
||||
unsigned int GetID() const;
|
||||
```
|
||||
|
||||
获取 OpenGL 着色器程序 ID。
|
||||
|
||||
**返回:** OpenGL 程序对象 ID
|
||||
|
||||
**线程安全:** ❌
|
||||
|
||||
**示例:**
|
||||
|
||||
```cpp
|
||||
unsigned int programId = shader->GetID();
|
||||
glUseProgram(programId);
|
||||
```
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [OpenGLShader 总览](shader.md) - 返回类总览
|
||||
- [GetNativeHandle](../../buffer/get-native-handle.md) - 原生句柄
|
||||
27
docs/api/rhi/opengl/shader/get-uniform-location.md
Normal file
27
docs/api/rhi/opengl/shader/get-uniform-location.md
Normal file
@@ -0,0 +1,27 @@
|
||||
# OpenGLShader::GetUniformLocation
|
||||
|
||||
```cpp
|
||||
int GetUniformLocation(const char* name) const;
|
||||
```
|
||||
|
||||
获取 Uniform 变量的位置索引。
|
||||
|
||||
**参数:**
|
||||
- `name` - Uniform 变量名称
|
||||
|
||||
**返回:** Uniform 位置索引,失败返回 -1
|
||||
|
||||
**线程安全:** ❌
|
||||
|
||||
**示例:**
|
||||
|
||||
```cpp
|
||||
int loc = shader->GetUniformLocation("modelMatrix");
|
||||
if (loc != -1) {
|
||||
glUniformMatrix4fv(loc, 1, GL_FALSE, &modelMatrix[0][0]);
|
||||
}
|
||||
```
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [OpenGLShader 总览](shader.md) - 返回类总览
|
||||
26
docs/api/rhi/opengl/shader/set-float-array.md
Normal file
26
docs/api/rhi/opengl/shader/set-float-array.md
Normal file
@@ -0,0 +1,26 @@
|
||||
# OpenGLShader::SetFloatArray
|
||||
|
||||
```cpp
|
||||
void SetFloatArray(const char* name, const float* values, unsigned int count);
|
||||
```
|
||||
|
||||
设置浮点数数组 Uniform 变量。
|
||||
|
||||
**参数:**
|
||||
- `name` - Uniform 变量名称
|
||||
- `values` - 浮点数数组指针
|
||||
- `count` - 数组元素数量
|
||||
|
||||
**线程安全:** ❌
|
||||
|
||||
**示例:**
|
||||
|
||||
```cpp
|
||||
float weights[] = { 0.25f, 0.25f, 0.25f, 0.25f };
|
||||
shader->SetFloatArray("vertexWeights", weights, 4);
|
||||
```
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [OpenGLShader 总览](shader.md) - 返回类总览
|
||||
- [SetFloat](../../shader/set-float.md) - 单个浮点数版本
|
||||
26
docs/api/rhi/opengl/shader/set-int-array.md
Normal file
26
docs/api/rhi/opengl/shader/set-int-array.md
Normal file
@@ -0,0 +1,26 @@
|
||||
# OpenGLShader::SetIntArray
|
||||
|
||||
```cpp
|
||||
void SetIntArray(const char* name, const int* values, unsigned int count);
|
||||
```
|
||||
|
||||
设置整数数组 Uniform 变量。
|
||||
|
||||
**参数:**
|
||||
- `name` - Uniform 变量名称
|
||||
- `values` - 整数数组指针
|
||||
- `count` - 数组元素数量
|
||||
|
||||
**线程安全:** ❌
|
||||
|
||||
**示例:**
|
||||
|
||||
```cpp
|
||||
int indices[] = { 0, 1, 2, 3 };
|
||||
shader->SetIntArray("boneIndices", indices, 4);
|
||||
```
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [OpenGLShader 总览](shader.md) - 返回类总览
|
||||
- [SetInt](../../shader/set-int.md) - 单个整数版本
|
||||
36
docs/api/rhi/opengl/shader/shader.md
Normal file
36
docs/api/rhi/opengl/shader/shader.md
Normal file
@@ -0,0 +1,36 @@
|
||||
# OpenGLShader
|
||||
|
||||
**命名空间**: `XCEngine::RHI`
|
||||
|
||||
**描述**: OpenGL 着色器实现,继承自 `RHIShader`。
|
||||
|
||||
## 方法列表
|
||||
|
||||
| 方法 | 文档 |
|
||||
|------|------|
|
||||
| `CompileFromFile` | [详细文档](../../shader/compile-from-file.md) |
|
||||
| `Compile` | [详细文档](../../shader/compile.md) |
|
||||
| `CompileFromFile` (VS+FS) | [详细文档](compile-from-file-vs-fs.md) |
|
||||
| `CompileFromFile` (VS+GS+FS) | [详细文档](compile-from-file-vs-gs-fs.md) |
|
||||
| `Compile` (VS+FS) | [详细文档](compile-vs-fs.md) |
|
||||
| `CompileCompute` | [详细文档](compile-compute.md) |
|
||||
| `Shutdown` | [详细文档](../../../threading/task-system/shutdown.md) |
|
||||
| `Use` | [详细文档](use.md) |
|
||||
| `Bind` / `Unbind` | [详细文档](../../shader/bind.md) |
|
||||
| `SetInt` | [详细文档](../../shader/set-int.md) |
|
||||
| `SetIntArray` | [详细文档](set-int-array.md) |
|
||||
| `SetFloat` | [详细文档](../../shader/set-float.md) |
|
||||
| `SetFloatArray` | [详细文档](set-float-array.md) |
|
||||
| `SetVec3` | [详细文档](../../shader/set-vec3.md) |
|
||||
| `SetVec4` | [详细文档](../../shader/set-vec4.md) |
|
||||
| `SetMat4` | [详细文档](../../shader/set-mat4.md) |
|
||||
| `GetUniformLocation` | [详细文档](get-uniform-location.md) |
|
||||
| `GetID` | [详细文档](get-id.md) |
|
||||
| `GetNativeHandle` | [详细文档](../../buffer/get-native-handle.md) |
|
||||
| `IsValid` | [详细文档](../../shader/is-valid.md) |
|
||||
| `GetType` | [详细文档](../../shader/get-type.md) |
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [OpenGL 后端总览](../overview.md)
|
||||
- [RHIShader](../../shader/shader.md) - 抽象着色器接口
|
||||
21
docs/api/rhi/opengl/shader/use.md
Normal file
21
docs/api/rhi/opengl/shader/use.md
Normal file
@@ -0,0 +1,21 @@
|
||||
# OpenGLShader::Use
|
||||
|
||||
```cpp
|
||||
void Use() const;
|
||||
```
|
||||
|
||||
激活并使用当前着色器程序。
|
||||
|
||||
**线程安全:** ❌
|
||||
|
||||
**示例:**
|
||||
|
||||
```cpp
|
||||
shader->Use();
|
||||
// 渲染操作使用此着色器
|
||||
```
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [OpenGLShader 总览](shader.md) - 返回类总览
|
||||
- [Bind/Unbind](../../shader/bind.md) - 基类绑定接口
|
||||
Reference in New Issue
Block a user