32 lines
719 B
Markdown
32 lines
719 B
Markdown
# Texture::GetMipLevels
|
|
|
|
```cpp
|
|
Core::uint32 GetMipLevels() const
|
|
```
|
|
|
|
获取 Mipmap 级别数。Mipmap 是纹理的多级渐远表示,用于在不同距离时提供合适的细节级别。
|
|
|
|
**参数:** 无
|
|
|
|
**返回:** Mipmap 级别数
|
|
|
|
**线程安全:** ✅
|
|
|
|
**示例:**
|
|
|
|
```cpp
|
|
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
|
|
```
|
|
|
|
## 相关文档
|
|
|
|
- [Texture 总览](texture.md) - 返回类总览
|
|
- [GenerateMipmaps](generatemipmaps.md) - 生成 Mipmap 链 |