int Depth { get; set; }

book_4_sparkGenerated
code_blocksInput

Description

The Depth property of the Texture class represents the depth of a 3D texture in pixels. For 2D texture arrays, it indicates the slice count, and for cubemaps, it is set to 6, representing the six faces of the cube.

Usage

Use the Depth property to determine the depth or slice count of a texture. This is particularly useful when working with 3D textures, texture arrays, or cubemaps, where understanding the depth or number of slices is crucial for correct texture manipulation and rendering.

Example

// Example of accessing the Depth property
Texture myTexture = new Texture();
int textureDepth = myTexture.Depth;

// Use the depth value
if (textureDepth == 6)
{
    Console.WriteLine("This is a cubemap texture.");
}
else
{
    Console.WriteLine($"Texture depth: {textureDepth}");
}