44 lines
834 B
Markdown
44 lines
834 B
Markdown
|
|
# Mesh::GetVertexAttributes
|
||
|
|
|
||
|
|
```cpp
|
||
|
|
VertexAttribute GetVertexAttributes() const;
|
||
|
|
```
|
||
|
|
|
||
|
|
获取网格的顶点属性标志,表示网格包含哪些顶点数据通道。
|
||
|
|
|
||
|
|
**参数:** 无
|
||
|
|
|
||
|
|
**返回:** `VertexAttribute` - 顶点属性标志,可通过按位与检查特定属性
|
||
|
|
|
||
|
|
**异常:** 无
|
||
|
|
|
||
|
|
**线程安全:** ✅
|
||
|
|
|
||
|
|
**复杂度:** O(1)
|
||
|
|
|
||
|
|
**示例:**
|
||
|
|
|
||
|
|
```cpp
|
||
|
|
#include "XCEngine/Resources/Mesh.h"
|
||
|
|
|
||
|
|
using namespace XCEngine::Resources;
|
||
|
|
|
||
|
|
Mesh mesh;
|
||
|
|
mesh.SetVertexData(
|
||
|
|
...,
|
||
|
|
VertexAttribute::Position | VertexAttribute::Normal | VertexAttribute::UV0
|
||
|
|
);
|
||
|
|
|
||
|
|
VertexAttribute attrs = mesh.GetVertexAttributes();
|
||
|
|
if (attrs & VertexAttribute::Normal) {
|
||
|
|
// 网格包含法线数据
|
||
|
|
}
|
||
|
|
if (attrs & VertexAttribute::UV0) {
|
||
|
|
// 网格包含第一组 UV 坐标
|
||
|
|
}
|
||
|
|
```
|
||
|
|
|
||
|
|
## 相关文档
|
||
|
|
|
||
|
|
- [类总览](mesh.md) - 返回类总览
|