39 lines
983 B
Markdown
39 lines
983 B
Markdown
|
|
# MeshSection
|
||
|
|
|
||
|
|
**命名空间**: `XCEngine::Resources`
|
||
|
|
|
||
|
|
**类型**: `struct`
|
||
|
|
|
||
|
|
**描述**: 网格分段结构体,用于描述网格的一部分,支持多材质渲染。
|
||
|
|
|
||
|
|
## 概述
|
||
|
|
|
||
|
|
MeshSection 定义了网格的一个连续区域,每个区域可以有不同的材质。网格分段包含顶点和索引范围信息,以及关联的材质 ID。
|
||
|
|
|
||
|
|
## 成员变量
|
||
|
|
|
||
|
|
| 变量 | 类型 | 描述 |
|
||
|
|
|------|------|------|
|
||
|
|
| `baseVertex` | `Core::uint32` | 基准顶点偏移 |
|
||
|
|
| `vertexCount` | `Core::uint32` | 顶点数量 |
|
||
|
|
| `startIndex` | `Core::uint32` | 起始索引 |
|
||
|
|
| `indexCount` | `Core::uint32` | 索引数量 |
|
||
|
|
| `materialID` | `Core::uint32` | 材质 ID |
|
||
|
|
|
||
|
|
## 使用示例
|
||
|
|
|
||
|
|
```cpp
|
||
|
|
MeshSection section;
|
||
|
|
section.baseVertex = 0;
|
||
|
|
section.vertexCount = 4;
|
||
|
|
section.startIndex = 0;
|
||
|
|
section.indexCount = 6;
|
||
|
|
section.materialID = 0;
|
||
|
|
mesh.AddSection(section);
|
||
|
|
```
|
||
|
|
|
||
|
|
## 相关文档
|
||
|
|
|
||
|
|
- [Mesh 类总览](mesh.md) - 返回类总览
|
||
|
|
- [AddSection](./addsection.md) - 添加网格分段
|