TextureBuilder WithDepthFormat()

book_4_sparkGenerated
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 compatible with the current rendering context, particularly when dealing with depth-based effects or operations.

Usage

To use the WithDepthFormat method, call it on an instance of TextureBuilder during the texture configuration process. This method is part of a fluent interface, allowing you to chain multiple configuration methods together to build a texture with specific properties.

Example

// Example of using WithDepthFormat in a texture building process
TextureBuilder builder = new TextureBuilder();
Texture texture = builder
    .WithSize(1024, 1024) // Set the size of the texture
    .WithDepthFormat()    // Use the screen's depth format
    .Create("MyTexture", false, data, data.Length);