video.binarytexturepacker

Binary tree based texture packer.

struct BinaryTexturePacker;

Binary tree based texture packer. Handles allocation of texture page space.

To fit a texture, space is subdivided vertically/horizontally to create an area fitting texture width/height, try to fit the texture to that area, if it doesn't fit, subdivide again, repeat.

this(const(Vector2!(uint)) size);

Construct BinaryTexturePacker.

Parameters:
const(Vector2!(uint)) size Size of texture area for the packer to manage.
bool allocateSpace(const Vector2u size, out Rectu texArea);

Try to allocate space for a texture with given size.

Parameters:
Vector2u size Size of texture space to allocate.
Rectu texArea Area taken by the texture will be returned here.
Returns:
True if successful, false otherwise.
void freeSpace(ref const Rectu area);

Free space taken by a texture.

Parameters:
Rectu area Area of the texture to free.
const pure @property bool empty();

Determine if this BinaryTexturePacker is empty.

const @property string info();

Return a string containing information about the packer.