Mipmap

Mipmapped images. Supports non power-of-two textures. Size of the i+1-th mipmap is { (width)/2, (height)/2 } The mipmap owns each of its levels.

Constructors

this
this()

Creates empty

this
this(int maxLevel, int w, int h)

Set number of levels and size maxLevel = 0 => only one image maxLevel = 1 => one image + one 2x downsampled mipmap etc...

this
this(int maxLevel, OwnedImage!COLOR level0)

Creates a Mipmap out of a flat OwnedImage. This takes ownership of the given image, which is now owned by the Mipmap.

Destructor

A destructor is present on this object, but not explicitly documented in the source.

Members

Functions

generateLevel
void generateLevel(int level, Quality quality, box2i updateRect)

Regenerates one level updateRect expressed in level i-th coordinates

generateMipmaps
void generateMipmaps(Quality quality)

Regenerates the whole upper levels.

generateNextLevel
box2i generateNextLevel(Quality quality, box2i updateRectPreviousLevel, int level)

Regenerates a single mipmap level based on changes in the provided rectangle (expressed in level 0 coordinates). updateRect expressed in level 0 coordinates In general if you have several subparts of mipmaps to update, make sure a level is fully completed before computing the next one.

height
int height()
linearMipmapSample
auto linearMipmapSample(float level, float x, float y)

Interpolates a color between mipmap levels. Floating-point level, spatial linear interpolation. x and y are in base level coordinates (top-left pixel is on (0.5, 0.5) coordinates). Clamped to borders.

linearSample
auto linearSample(int level, float x, float y)

Interpolates a color. Integer level, spatial linear interpolation. x and y are in base level coordinates (top-left pixel is on (0.5, 0.5) coordinates). Clamped to borders.

numLevels
int numLevels()
width
int width()

Meta