video.texturepage

Generic, API-independent texture page.

struct TexturePage(TexturePacker,TextureBackend);

Texture page with customizable texture packer and API specific backend.

TexturePacker packer_;

Texture packer, handles allocation of texture space.

TextureBackend backend_;

Texture backend, hides graphics API details.

Vector2u size_;

Size of the page in pixels.

ColorFormat format_;

Color format of the page.

this(const Vector2u size, const ColorFormat format);

Construct a GLTexturePage.

Parameters:
Vector2u size Dimensions of the page in pixels.
ColorFormat format Color format of the page.
bool insertTexture(ref const Image image, out Rectu pageArea);

Try to insert an image to this page and use it as a texture.

Parameters:
Image image Image to insert.
Rectu pageArea Area taken by the texture on the page will be returned here.
Floating-point texture coordinates can be calculated by dividing pageArea by texture page size.
Returns:
True on success, false on failure.
void start();

Use this page to draw textured geometry from now on.

void removeTexture(ref const Rectu bounds);

Remove texture with specified bounds from this page.

const pure bool empty();

Determine if this page is empty (i.e. there are no textures on it).

const pure Vector2u size();

Get size of the page in pixels.

const pure ColorFormat format();

Get the color format of the page.

const string info();

Return a string containing information about the page.

Format of this string might change, it is used strictly for debugging purposes and not meant to be parsed.

Returns:
String with information about the page.