Files
XCEngine/docs/api/resources/texture/getmiplevels.md

719 B

Texture::GetMipLevels

Core::uint32 GetMipLevels() const

获取 Mipmap 级别数。Mipmap 是纹理的多级渐远表示,用于在不同距离时提供合适的细节级别。

参数:

返回: Mipmap 级别数

线程安全:

示例:

Texture tex;
tex.Create(1024, 1024, 1, 1, 
    TextureType::Texture2D, 
    TextureFormat::RGBA8_UNORM, 
    nullptr, 0);
Core::uint32 mips = tex.GetMipLevels(); // 返回 1

tex.GenerateMipmaps(); // 如果实现生成多级 mipmap
Core::uint32 mipsAfter = tex.GetMipLevels(); // 可能返回 > 1

相关文档