Manages a list of Texture objects, as returned by TexturePool::find_all_textures(). More...
#include "textureCollection.h"
Public Member Functions | |
TextureCollection (const TextureCollection ©) | |
void | add_texture (Texture *texture) |
Adds a new Texture to the collection. More... | |
void | add_textures_from (const TextureCollection &other) |
Adds all the Textures indicated in the other collection to this texture. More... | |
void | append (Texture *texture) |
Adds a new Texture to the collection. More... | |
void | clear () |
Removes all Textures from the collection. More... | |
void | extend (const TextureCollection &other) |
Appends the other list onto the end of this one. More... | |
Texture * | find_texture (const std::string &name) const |
Returns the texture in the collection with the indicated name, if any, or NULL if no texture has that name. More... | |
int | get_num_textures () const |
Texture * | get_texture (int index) const |
bool | has_texture (Texture *texture) const |
Returns true if the indicated Texture appears in this collection, false otherwise. More... | |
Texture * | operator [] (int index) const |
Returns the nth Texture in the collection. More... | |
TextureCollection | operator+ (const TextureCollection &other) const |
Returns a TextureCollection representing the concatenation of the two lists. More... | |
void | operator+= (const TextureCollection &other) |
Appends the other list onto the end of this one. More... | |
void | operator= (const TextureCollection ©) |
void | output (std::ostream &out) const |
Writes a brief one-line description of the TextureCollection to the indicated output stream. More... | |
void | remove_duplicate_textures () |
Removes any duplicate entries of the same Textures on this collection. More... | |
bool | remove_texture (Texture *texture) |
Removes the indicated Texture from the collection. More... | |
void | remove_textures_from (const TextureCollection &other) |
Removes from this collection all of the Textures listed in the other collection. More... | |
void | reserve (size_t num) |
This is a hint to Panda to allocate enough memory to hold the given number of NodePaths, if you know ahead of time how many you will be adding. More... | |
int | size () const |
Returns the number of textures in the collection. More... | |
void | write (std::ostream &out, int indent_level=0) const |
Writes a complete multi-line description of the TextureCollection to the indicated output stream. More... | |
Public Attributes | |
get_num_textures | |
Returns the number of Textures in the collection. More... | |
get_texture | |
Returns the nth Texture in the collection. More... | |
Manages a list of Texture objects, as returned by TexturePool::find_all_textures().
Definition at line 25 of file textureCollection.h.
void TextureCollection::add_texture | ( | Texture * | texture | ) |
Adds a new Texture to the collection.
Definition at line 45 of file textureCollection.cxx.
Referenced by append().
void TextureCollection::add_textures_from | ( | const TextureCollection & | other | ) |
Adds all the Textures indicated in the other collection to this texture.
The other textures are simply appended to the end of the textures in this list; duplicates are not automatically removed.
Definition at line 97 of file textureCollection.cxx.
References get_num_textures.
Referenced by operator+=().
|
inline |
Adds a new Texture to the collection.
This method duplicates the add_texture() method; it is provided to satisfy Python's naming convention.
Definition at line 45 of file textureCollection.I.
References add_texture().
void TextureCollection::clear | ( | ) |
Removes all Textures from the collection.
Definition at line 166 of file textureCollection.cxx.
|
inline |
Appends the other list onto the end of this one.
This method duplicates the += operator; it is provided to satisfy Python's naming convention.
Definition at line 54 of file textureCollection.I.
References operator+=().
Texture * TextureCollection::find_texture | ( | const std::string & | name | ) | const |
Returns the texture in the collection with the indicated name, if any, or NULL if no texture has that name.
Definition at line 184 of file textureCollection.cxx.
References get_num_textures.
bool TextureCollection::has_texture | ( | Texture * | texture | ) | const |
Returns true if the indicated Texture appears in this collection, false otherwise.
Definition at line 153 of file textureCollection.cxx.
Texture * TextureCollection::operator [] | ( | int | index | ) | const |
Returns the nth Texture in the collection.
This is the same as get_texture(), but it may be a more convenient way to access it.
Definition at line 218 of file textureCollection.cxx.
|
inline |
Returns a TextureCollection representing the concatenation of the two lists.
Definition at line 34 of file textureCollection.I.
|
inline |
Appends the other list onto the end of this one.
Definition at line 25 of file textureCollection.I.
References add_textures_from().
Referenced by extend().
void TextureCollection::output | ( | std::ostream & | out | ) | const |
Writes a brief one-line description of the TextureCollection to the indicated output stream.
Definition at line 238 of file textureCollection.cxx.
References get_num_textures.
void TextureCollection::remove_duplicate_textures | ( | ) |
Removes any duplicate entries of the same Textures on this collection.
If a Texture appears multiple times, the first appearance is retained; subsequent appearances are removed.
Definition at line 128 of file textureCollection.cxx.
References get_num_textures.
bool TextureCollection::remove_texture | ( | Texture * | texture | ) |
Removes the indicated Texture from the collection.
Returns true if the texture was removed, false if it was not a member of the collection.
Definition at line 64 of file textureCollection.cxx.
void TextureCollection::remove_textures_from | ( | const TextureCollection & | other | ) |
Removes from this collection all of the Textures listed in the other collection.
Definition at line 110 of file textureCollection.cxx.
References get_num_textures.
void TextureCollection::reserve | ( | size_t | num | ) |
This is a hint to Panda to allocate enough memory to hold the given number of NodePaths, if you know ahead of time how many you will be adding.
Definition at line 175 of file textureCollection.cxx.
int TextureCollection::size | ( | ) | const |
Returns the number of textures in the collection.
This is the same thing as get_num_textures().
Definition at line 229 of file textureCollection.cxx.
void TextureCollection::write | ( | std::ostream & | out, |
int | indent_level = 0 |
||
) | const |
Writes a complete multi-line description of the TextureCollection to the indicated output stream.
Definition at line 251 of file textureCollection.cxx.
int TextureCollection::get_num_textures |
Returns the number of Textures in the collection.
Definition at line 50 of file textureCollection.h.
Referenced by add_textures_from(), find_texture(), output(), remove_duplicate_textures(), and remove_textures_from().
Texture * TextureCollection::get_texture |
Returns the nth Texture in the collection.
Definition at line 50 of file textureCollection.h.