TextureBuilder WithDepthFormat()

robot_2Generated
code_blocksInput

Description

The WithDepthFormat method of the TextureBuilder class configures the texture to use the same depth format as the screen or framebuffer. This is useful when you want to ensure that the texture's depth format is consistent with the rendering target, which can be important for operations that rely on depth information, such as shadow mapping or depth testing.

Usage

To use the WithDepthFormat method, first create an instance of TextureBuilder. Then, call the WithDepthFormat method on this instance to set the depth format. This method returns the TextureBuilder instance, allowing for method chaining to configure additional properties of the texture.

Example

// Example of using WithDepthFormat
TextureBuilder textureBuilder = new TextureBuilder();
textureBuilder = textureBuilder.WithDepthFormat();

// Continue configuring the texture as needed
textureBuilder = textureBuilder.WithSize(1024, 768);

// Finally, create the texture
Texture texture = textureBuilder.Create("MyTexture", false, data, data.Length);