Panda3D
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | 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.
 
void add_textures_from (const TextureCollection &other)
 Adds all the Textures indicated in the other collection to this texture.
 
void append (Texture *texture)
 Adds a new Texture to the collection.
 
void clear ()
 Removes all Textures from the collection.
 
void extend (const TextureCollection &other)
 Appends the other list onto the end of this one.
 
Texturefind_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.
 
int get_num_textures () const
 
Textureget_texture (int index) const
 
bool has_texture (Texture *texture) const
 Returns true if the indicated Texture appears in this collection, false otherwise.
 
TextureCollection operator+ (const TextureCollection &other) const
 Returns a TextureCollection representing the concatenation of the two lists.
 
void operator+= (const TextureCollection &other)
 Appends the other list onto the end of this one.
 
void operator= (const TextureCollection &copy)
 
Textureoperator[] (int index) const
 Returns the nth Texture in the collection.
 
void output (std::ostream &out) const
 Writes a brief one-line description of the TextureCollection to the indicated output stream.
 
void remove_duplicate_textures ()
 Removes any duplicate entries of the same Textures on this collection.
 
bool remove_texture (Texture *texture)
 Removes the indicated Texture from the collection.
 
void remove_textures_from (const TextureCollection &other)
 Removes from this collection all of the Textures listed in the other collection.
 
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.
 
int size () const
 Returns the number of textures in the collection.
 
void write (std::ostream &out, int indent_level=0) const
 Writes a complete multi-line description of the TextureCollection to the indicated output stream.
 

Public Attributes

 get_num_textures
 Returns the number of Textures in the collection.
 
 get_texture
 Returns the nth Texture in the collection.
 

Detailed Description

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

Definition at line 25 of file textureCollection.h.

Constructor & Destructor Documentation

◆ TextureCollection() [1/2]

TextureCollection::TextureCollection ( )

Definition at line 20 of file textureCollection.cxx.

◆ TextureCollection() [2/2]

TextureCollection::TextureCollection ( const TextureCollection & copy)

Definition at line 27 of file textureCollection.cxx.

◆ ~TextureCollection()

TextureCollection::~TextureCollection ( )
inline

Definition at line 17 of file textureCollection.I.

Member Function Documentation

◆ add_texture()

void TextureCollection::add_texture ( Texture * texture)

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

References add_texture(), get_num_textures, and get_texture.

Referenced by operator+=().

◆ 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 44 of file textureCollection.I.

References add_texture().

◆ clear()

void TextureCollection::clear ( )

Removes all Textures from the collection.

Definition at line 165 of file textureCollection.cxx.

◆ 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 53 of file textureCollection.I.

References operator+=().

◆ find_texture()

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

References get_num_textures, and get_texture.

◆ has_texture()

bool TextureCollection::has_texture ( Texture * texture) const

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

Definition at line 152 of file textureCollection.cxx.

References get_num_textures, and get_texture.

Referenced by 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 33 of file textureCollection.I.

◆ operator+=()

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

Appends the other list onto the end of this one.

Definition at line 24 of file textureCollection.I.

References add_textures_from().

Referenced by extend().

◆ operator=()

void TextureCollection::operator= ( const TextureCollection & copy)

Definition at line 36 of file textureCollection.cxx.

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

◆ output()

void TextureCollection::output ( std::ostream & out) const

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

Definition at line 237 of file textureCollection.cxx.

References get_num_textures.

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

References get_num_textures, and get_texture.

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

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

References get_num_textures, get_texture, and has_texture().

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

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

◆ write()

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

References get_num_textures, get_texture, and indent().

Member Data Documentation

◆ get_num_textures

int TextureCollection::get_num_textures

Returns the number of Textures in the collection.

Definition at line 50 of file textureCollection.h.

Referenced by StaticTextFont::StaticTextFont(), add_textures_from(), find_texture(), has_texture(), output(), remove_duplicate_textures(), remove_textures_from(), and write().

◆ get_texture

Texture * TextureCollection::get_texture

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