Files
XCEngine/docs/api/resources/mesh/is-use-32bit-index.md

41 lines
840 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Mesh::IsUse32BitIndex
```cpp
bool IsUse32BitIndex() const;
```
检查网格是否使用 32 位索引格式。如果返回 false则表示使用 16 位索引格式。
**参数:**
**返回:** `bool` - true 表示使用 32 位索引false 表示使用 16 位索引
**异常:**
**线程安全:**
**复杂度:** O(1)
**示例:**
```cpp
#include "XCEngine/Resources/Mesh.h"
using namespace XCEngine::Resources;
Mesh mesh;
mesh.SetIndexData(..., 6, true); // 32 位索引
if (mesh.IsUse32BitIndex()) {
// 使用 32 位索引访问
const uint32_t* indices = static_cast<const uint32_t*>(mesh.GetIndexData());
} else {
// 使用 16 位索引访问
const uint16_t* indices = static_cast<const uint16_t*>(mesh.GetIndexData());
}
```
## 相关文档
- [类总览](mesh.md) - 返回类总览