Description
The WithMips
method is part of the TextureBuilder
class in the Sandbox namespace. This method allows you to specify the number of mipmap levels for a texture being built. Mipmaps are pre-calculated, optimized sequences of images, each of which is a progressively lower resolution representation of the same image. They are used to increase rendering speed and reduce aliasing artifacts.
Usage
To use the WithMips
method, call it on an instance of TextureBuilder
and pass the desired number of mipmap levels as an integer parameter. This method returns the TextureBuilder
instance, allowing for method chaining.
Example
// Example of using WithMips method
TextureBuilder builder = new TextureBuilder();
builder.WithSize(256, 256) // Set the size of the texture
.WithFormat(ImageFormat.RGBA8) // Set the format of the texture
.WithMips(4); // Set the number of mipmap levels to 4
// Continue building the texture as needed
Texture texture = builder.Create("MyTexture", false, data, data.Length);