Files
XCEngine/docs/api/resources/mesh/get-sections.md

41 lines
709 B
Markdown

# Mesh::GetSections
```cpp
const Containers::Array<MeshSection>& GetSections() const;
```
获取网格的所有分段信息。
**参数:**
**返回:** `const Containers::Array<MeshSection>&` - 分段数组的只读引用
**异常:**
**线程安全:**
**复杂度:** O(1)
**示例:**
```cpp
#include "XCEngine/Resources/Mesh.h"
using namespace XCEngine::Resources;
Mesh mesh;
mesh.SetVertexData(...);
mesh.SetIndexData(...);
mesh.AddSection(...);
const auto& sections = mesh.GetSections();
for (size_t i = 0; i < sections.Size(); ++i) {
const MeshSection& section = sections[i];
// 处理每个分段
}
```
## 相关文档
- [类总览](mesh.md) - 返回类总览