Panda3D
Public Member Functions | List of all members
TextureCollection Class Reference

Manages a list of Texture objects, as returned by TexturePool::find_all_textures(). More...

#include "textureCollection.h"

Public Member Functions

 TextureCollection (const TextureCollection &copy)
 
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...
 
Texturefind_texture (const 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
 Returns the number of Textures in the collection. More...
 
Textureget_texture (int index) const
 Returns the nth Texture in the collection. More...
 
bool has_texture (Texture *texture) const
 Returns true if the indicated Texture appears in this collection, false otherwise. More...
 
 MAKE_SEQ (get_textures, get_num_textures, get_texture)
 
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 &copy)
 
Textureoperator[] (int index) const
 Returns the nth Texture in the collection. More...
 
void output (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 (ostream &out, int indent_level=0) const
 Writes a complete multi-line description of the TextureCollection to the indicated output stream. More...
 

Detailed Description

Manages a list of Texture objects, as returned by TexturePool::find_all_textures().

Definition at line 27 of file textureCollection.h.

Member Function Documentation

◆ add_texture()

void TextureCollection::add_texture ( Texture texture)

Adds a new Texture to the collection.

Definition at line 58 of file textureCollection.cxx.

References remove_texture().

Referenced by append(), NodePath::find_all_textures(), TexturePool::get_global_ptr(), and SpriteParticleRenderer::make_copy().

◆ add_textures_from()

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 118 of file textureCollection.cxx.

References get_num_textures(), get_texture(), and remove_textures_from().

Referenced by SpriteParticleRenderer::make_copy(), operator+=(), and remove_texture().

◆ append()

void TextureCollection::append ( Texture texture)
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 56 of file textureCollection.I.

References add_texture(), and extend().

Referenced by operator+().

◆ clear()

void TextureCollection::clear ( )

Removes all Textures from the collection.

Definition at line 196 of file textureCollection.cxx.

References reserve().

Referenced by has_texture(), and SpriteParticleRenderer::make_copy().

◆ extend()

void TextureCollection::extend ( const TextureCollection other)
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 68 of file textureCollection.I.

References operator+=().

Referenced by append().

◆ find_texture()

Texture * TextureCollection::find_texture ( const 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 220 of file textureCollection.cxx.

References get_num_textures().

Referenced by reserve().

◆ get_num_textures()

int TextureCollection::get_num_textures ( ) const

Returns the number of Textures in the collection.

Definition at line 237 of file textureCollection.cxx.

References get_texture().

Referenced by add_textures_from(), find_texture(), SpriteParticleRenderer::make_copy(), and StaticTextFont::StaticTextFont().

◆ get_texture()

Texture * TextureCollection::get_texture ( int  index) const

Returns the nth Texture in the collection.

Definition at line 247 of file textureCollection.cxx.

References operator[]().

Referenced by add_textures_from(), get_num_textures(), and StaticTextFont::StaticTextFont().

◆ has_texture()

bool TextureCollection::has_texture ( Texture texture) const

Returns true if the indicated Texture appears in this collection, false otherwise.

Definition at line 181 of file textureCollection.cxx.

References clear().

Referenced by remove_duplicate_textures(), and remove_textures_from().

◆ operator+()

TextureCollection TextureCollection::operator+ ( const TextureCollection other) const
inline

Returns a TextureCollection representing the concatenation of the two lists.

Definition at line 42 of file textureCollection.I.

References append().

Referenced by operator+=().

◆ operator+=()

void TextureCollection::operator+= ( const TextureCollection other)
inline

Appends the other list onto the end of this one.

Definition at line 31 of file textureCollection.I.

References add_textures_from(), and operator+().

Referenced by extend().

◆ operator[]()

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 261 of file textureCollection.cxx.

References size().

Referenced by get_texture().

◆ output()

void TextureCollection::output ( ostream &  out) const

Writes a brief one-line description of the TextureCollection to the indicated output stream.

Definition at line 285 of file textureCollection.cxx.

References write().

Referenced by size().

◆ remove_duplicate_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 154 of file textureCollection.cxx.

References has_texture().

Referenced by remove_textures_from().

◆ remove_texture()

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 81 of file textureCollection.cxx.

References add_textures_from().

Referenced by add_texture().

◆ remove_textures_from()

void TextureCollection::remove_textures_from ( const TextureCollection other)

Removes from this collection all of the Textures listed in the other collection.

Definition at line 133 of file textureCollection.cxx.

References has_texture(), and remove_duplicate_textures().

Referenced by add_textures_from().

◆ reserve()

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 208 of file textureCollection.cxx.

References find_texture().

Referenced by clear().

◆ size()

int TextureCollection::size ( ) const

Returns the number of textures in the collection.

This is the same thing as get_num_textures().

Definition at line 274 of file textureCollection.cxx.

References output().

Referenced by operator[]().

◆ write()

void TextureCollection::write ( ostream &  out,
int  indent_level = 0 
) const

Writes a complete multi-line description of the TextureCollection to the indicated output stream.

Definition at line 300 of file textureCollection.cxx.

Referenced by output().


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