ClanLib
2.3.7
|
Texture grouping class. More...
#include <texture_group.h>
Public Types | |
Enumerations | |
enum | TextureAllocationPolicy { create_new_texture, search_previous_textures } |
Texture allocation policy. More... | |
Public Member Functions | |
Construction | |
CL_TextureGroup () | |
Constructs a null instance. More... | |
CL_TextureGroup (const CL_Size &texture_sizes) | |
Constructs a texture group. More... | |
~CL_TextureGroup () | |
Attributes | |
bool | is_null () const |
Returns true if this object is invalid. More... | |
void | throw_if_null () const |
Throw an exception if this object is invalid. 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... | |
int | get_texture_count () const |
Returns the amount of textures used by group. More... | |
TextureAllocationPolicy | get_texture_allocation_policy () const |
Returns the texture allocation policy. More... | |
CL_Size | get_texture_sizes () const |
Returns the size of the textures used by this texture group. More... | |
std::vector< CL_Texture > | get_textures () const |
Returns the textures. More... | |
Operations | |
CL_Subtexture | add (CL_GraphicContext &context, const CL_Size &size) |
Allocate space for another sub texture. More... | |
void | remove (CL_Subtexture &subtexture) |
Deallocate space, from a previously allocated texture. More... | |
void | set_texture_allocation_policy (TextureAllocationPolicy policy) |
Set the texture allocation policy. More... | |
void | insert_texture (CL_Texture &texture, const CL_Rect &texture_rect) |
Insert an existing texture into the texture group. More... | |
Texture grouping class.
CL_TextureGroup::CL_TextureGroup | ( | ) |
Constructs a null instance.
CL_TextureGroup::CL_TextureGroup | ( | const CL_Size & | texture_sizes) |
Constructs a texture group.
CL_TextureGroup::~CL_TextureGroup | ( | ) |
CL_Subtexture CL_TextureGroup::add | ( | CL_GraphicContext & | context, |
const CL_Size & | size | ||
) |
Allocate space for another sub texture.
int CL_TextureGroup::get_subtexture_count | ( | ) | const |
Returns the amount of sub-textures allocated in group.
int CL_TextureGroup::get_subtexture_count | ( | unsigned int | texture_index) | const |
Returns the amount of sub-textures for a specific texture index.
TextureAllocationPolicy CL_TextureGroup::get_texture_allocation_policy | ( | ) | const |
Returns the texture allocation policy.
int CL_TextureGroup::get_texture_count | ( | ) | const |
Returns the amount of textures used by group.
CL_Size CL_TextureGroup::get_texture_sizes | ( | ) | const |
Returns the size of the textures used by this texture group.
std::vector<CL_Texture> CL_TextureGroup::get_textures | ( | ) | const |
Returns the textures.
void CL_TextureGroup::insert_texture | ( | CL_Texture & | texture, |
const CL_Rect & | texture_rect | ||
) |
Insert an existing texture into the texture group.
texture | = Texture to insert |
texture_rect | = Free space within the texture that the texture group can use |
|
inline |
Returns true if this object is invalid.
void CL_TextureGroup::remove | ( | CL_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 CL_TextureGroup::set_texture_allocation_policy | ( | TextureAllocationPolicy | policy) |
Set the texture allocation policy.
void CL_TextureGroup::throw_if_null | ( | ) | const |
Throw an exception if this object is invalid.