docs: update resources API docs

This commit is contained in:
2026-03-20 02:35:35 +08:00
parent fd792b7df1
commit ea756c0177
314 changed files with 9439 additions and 1360 deletions

View File

@@ -0,0 +1,52 @@
# Mesh::AddSection
```cpp
void AddSection(const MeshSection& section);
```
添加一个网格分段Submesh。网格分段用于将一个网格分割成多个部分每个部分可以有不同的材质。
**参数:**
- `section` - 网格分段结构,包含顶点和索引范围以及材质 ID
**返回:**
**异常:**
**线程安全:**
**复杂度:** O(1) 均摊
**示例:**
```cpp
#include "XCEngine/Resources/Mesh.h"
using namespace XCEngine::Resources;
Mesh mesh;
mesh.SetVertexData(...);
mesh.SetIndexData(...);
// 添加第一个分段(使用材质 0
MeshSection section1;
section1.baseVertex = 0;
section1.vertexCount = 4;
section1.startIndex = 0;
section1.indexCount = 6;
section1.materialID = 0;
mesh.AddSection(section1);
// 添加第二个分段(使用材质 1
MeshSection section2;
section2.baseVertex = 4;
section2.vertexCount = 4;
section2.startIndex = 6;
section2.indexCount = 6;
section2.materialID = 1;
mesh.AddSection(section2);
```
## 相关文档
- [类总览](mesh.md) - 返回类总览