37 lines
779 B
Markdown
37 lines
779 B
Markdown
# Texture::GetDepth
|
|
|
|
```cpp
|
|
Core::uint32 GetDepth() const
|
|
```
|
|
|
|
获取纹理深度。对于 3D 纹理返回体积深度,对于 2D 纹理返回 1。
|
|
|
|
**参数:** 无
|
|
|
|
**返回:** 纹理深度(像素)
|
|
|
|
**线程安全:** ✅
|
|
|
|
**示例:**
|
|
|
|
```cpp
|
|
Texture tex2D;
|
|
tex2D.Create(1024, 1024, 1, 1,
|
|
TextureType::Texture2D,
|
|
TextureFormat::RGBA8_UNORM,
|
|
nullptr, 0);
|
|
Core::uint32 depth2D = tex2D.GetDepth(); // 返回 1
|
|
|
|
Texture tex3D;
|
|
tex3D.Create(64, 64, 32, 1,
|
|
TextureType::Texture3D,
|
|
TextureFormat::RGBA8_UNORM,
|
|
nullptr, 0);
|
|
Core::uint32 depth3D = tex3D.GetDepth(); // 返回 32
|
|
```
|
|
|
|
## 相关文档
|
|
|
|
- [Texture 总览](texture.md) - 返回类总览
|
|
- [GetWidth](getwidth.md) - 获取纹理宽度
|
|
- [GetHeight](getheight.md) - 获取纹理高度 |