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

779 B

Texture::GetDepth

Core::uint32 GetDepth() const

获取纹理深度。对于 3D 纹理返回体积深度,对于 2D 纹理返回 1。

参数:

返回: 纹理深度(像素)

线程安全:

示例:

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

相关文档