41 lines
840 B
Markdown
41 lines
840 B
Markdown
# 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) - 返回类总览
|