Description
The GenerateMipMaps
method in the Sandbox.Graphics
class is used to generate mipmaps for a given texture. Mipmaps are pre-calculated, optimized sequences of images that accompany a main texture, each of which is a progressively lower resolution representation of the original texture. This method allows you to specify the downsampling method, the initial mip level, and the number of mip levels to generate.
Usage
To use the GenerateMipMaps
method, you need to provide the following parameters:
texture
: The Sandbox.Texture
object for which mipmaps are to be generated.
downsampleMethod
: The method of downsampling to use, specified as a Sandbox.Graphics.DownsampleMethod
enum value.
initialMip
: An integer specifying the initial mip level from which to start generating mipmaps.
numMips
: An integer specifying the number of mip levels to generate.
This method is static and can be called directly on the Sandbox.Graphics
class.
Example
// Example of using GenerateMipMaps
// Assume 'texture' is a valid Sandbox.Texture object
Sandbox.Texture texture = GetTexture();
// Choose a downsample method
Sandbox.Graphics.DownsampleMethod downsampleMethod = Sandbox.Graphics.DownsampleMethod.Linear;
// Specify the initial mip level and number of mip levels to generate
int initialMip = 0;
int numMips = 4;
// Generate mipmaps for the texture
Sandbox.Graphics.GenerateMipMaps(texture, downsampleMethod, initialMip, numMips);