fix: improve doc link navigation and tree display
- Fix link resolution with proper relative/absolute path handling - Improve link styling with underline decoration - Hide leaf nodes from tree, only show directories - Fix log file path for packaged app
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) - 单个整数版本
|
||||
33
docs/api/rhi/opengl/shader/shader.md
Normal file
33
docs/api/rhi/opengl/shader/shader.md
Normal file
@@ -0,0 +1,33 @@
|
||||
# OpenGLShader
|
||||
|
||||
**命名空间**: `XCEngine::RHI`
|
||||
|
||||
**描述**: OpenGL 着色器实现,继承自 `RHIShader`。
|
||||
|
||||
## 公共方法
|
||||
|
||||
| 方法 | 描述 |
|
||||
|------|------|
|
||||
| [`CompileFromFile`](../../shader/compile-from-file.md) | 从文件编译着色器 |
|
||||
| [`Compile`](../../shader/compile.md) | 从源码编译着色器 |
|
||||
| [`Shutdown`](../../../threading/task-system/shutdown.md) | 关闭着色器 |
|
||||
| [`Use`](use.md) | 使用着色器 |
|
||||
| [`Bind`](../../shader/bind.md) | 绑定着色器 |
|
||||
| [`Unbind`](../../shader/unbind.md) | 解绑着色器 |
|
||||
| [`SetInt`](../../shader/set-int.md) | 设置整数 uniform |
|
||||
| [`SetIntArray`](set-int-array.md) | 设置整数数组 uniform |
|
||||
| [`SetFloat`](../../shader/set-float.md) | 设置浮点数 uniform |
|
||||
| [`SetFloatArray`](set-float-array.md) | 设置浮点数数组 uniform |
|
||||
| [`SetVec3`](../../shader/set-vec3.md) | 设置 vec3 uniform |
|
||||
| [`SetVec4`](../../shader/set-vec4.md) | 设置 vec4 uniform |
|
||||
| [`SetMat4`](../../shader/set-mat4.md) | 设置 mat4 uniform |
|
||||
| [`GetUniformLocation`](get-uniform-location.md) | 获取 uniform 位置 |
|
||||
| [`GetID`](get-id.md) | 获取着色器 ID |
|
||||
| [`GetNativeHandle`](../../buffer/get-native-handle.md) | 获取原生句柄 |
|
||||
| [`IsValid`](../../shader/is-valid.md) | 检查是否有效 |
|
||||
| [`GetType`](../../command-queue/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