Texture grouping class. More...

#include <texture_group.h>

Public Types

enum  TextureAllocationPolicy { create_new_texture, search_previous_textures }
 Texture allocation policy. More...
 

Public Member Functions

 TextureGroup ()
 Constructs a null instance. More...
 
 TextureGroup (const Size &texture_sizes)
 Constructs a texture group. More...
 
 ~TextureGroup ()
 
Subtexture add (GraphicContext &context, const Size &size)
 Allocate space for another sub texture. More...
 
int get_subtexture_count () const
 Returns the amount of sub-textures allocated in group. More...
 
int get_subtexture_count (unsigned int texture_index) const
 Returns the amount of sub-textures for a specific texture index. More...
 
TextureAllocationPolicy get_texture_allocation_policy () const
 Returns the texture allocation policy. More...
 
int get_texture_count () const
 Returns the amount of textures used by group. More...
 
Size get_texture_sizes () const
 Returns the size of the textures used by this texture group. More...
 
std::vector< Texture2Dget_textures () const
 Returns the textures. More...
 
void insert_texture (Texture2D &texture, const Rect &texture_rect)
 Insert an existing texture into the texture group. More...
 
bool is_null () const
 Returns true if this object is invalid. More...
 
 operator bool () const
 
void remove (Subtexture &subtexture)
 Deallocate space, from a previously allocated texture. More...
 
void set_texture_allocation_policy (TextureAllocationPolicy policy)
 Set the texture allocation policy. More...
 
void throw_if_null () const
 Throw an exception if this object is invalid. More...
 

Detailed Description

Texture grouping class.

Constructor & Destructor Documentation

clan::TextureGroup::TextureGroup ( )

Constructs a null instance.

clan::TextureGroup::TextureGroup ( const Size texture_sizes)

Constructs a texture group.

clan::TextureGroup::~TextureGroup ( )

Member Function Documentation

Subtexture clan::TextureGroup::add ( GraphicContext context,
const Size size 
)

Allocate space for another sub texture.

int clan::TextureGroup::get_subtexture_count ( ) const

Returns the amount of sub-textures allocated in group.

int clan::TextureGroup::get_subtexture_count ( unsigned int  texture_index) const

Returns the amount of sub-textures for a specific texture index.

TextureAllocationPolicy clan::TextureGroup::get_texture_allocation_policy ( ) const

Returns the texture allocation policy.

int clan::TextureGroup::get_texture_count ( ) const

Returns the amount of textures used by group.

Size clan::TextureGroup::get_texture_sizes ( ) const

Returns the size of the textures used by this texture group.

std::vector<Texture2D> clan::TextureGroup::get_textures ( ) const

Returns the textures.

void clan::TextureGroup::insert_texture ( Texture2D texture,
const Rect texture_rect 
)

Insert an existing texture into the texture group.

Parameters
texture= Texture to insert
texture_rect= Free space within the texture that the texture group can use
bool clan::TextureGroup::is_null ( ) const
inline

Returns true if this object is invalid.

clan::TextureGroup::operator bool ( ) const
inlineexplicit
void clan::TextureGroup::remove ( Subtexture subtexture)

Deallocate space, from a previously allocated texture.

Warning - It is advised to set TextureAllocationPolicy to search_previous_textures if using this function. Also be aware of texture fragmentation. Empty textures are not removed.

void clan::TextureGroup::set_texture_allocation_policy ( TextureAllocationPolicy  policy)

Set the texture allocation policy.

void clan::TextureGroup::throw_if_null ( ) const

Throw an exception if this object is invalid.


The documentation for this class was generated from the following file: