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

840 B
Raw Blame History

Mesh::IsUse32BitIndex

bool IsUse32BitIndex() const;

检查网格是否使用 32 位索引格式。如果返回 false则表示使用 16 位索引格式。

参数:

返回: bool - true 表示使用 32 位索引false 表示使用 16 位索引

异常:

线程安全:

复杂度: O(1)

示例:

#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());
}

相关文档