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

Public Member Functions

 MaterialCollection (const MaterialCollection &copy)
 
void add_material (Material *node_material)
 Adds a new Material to the collection. More...
 
void add_materials_from (const MaterialCollection &other)
 Adds all the Materials indicated in the other collection to this material. More...
 
void clear ()
 Removes all Materials from the collection. More...
 
Materialfind_material (const string &name) const
 Returns the material in the collection with the indicated name, if any, or NULL if no material has that name. More...
 
Materialget_material (int index) const
 Returns the nth Material in the collection. More...
 
int get_num_materials () const
 Returns the number of Materials in the collection. More...
 
bool has_material (Material *material) const
 Returns true if the indicated Material appears in this collection, false otherwise. More...
 
MaterialCollection operator+ (const MaterialCollection &other) const
 Returns a MaterialCollection representing the concatenation of the two lists. More...
 
void operator+= (const MaterialCollection &other)
 Appends the other list onto the end of this one. More...
 
void operator= (const MaterialCollection &copy)
 
Materialoperator[] (int index) const
 Returns the nth Material in the collection. More...
 
void output (ostream &out) const
 Writes a brief one-line description of the MaterialCollection to the indicated output stream. More...
 
void remove_duplicate_materials ()
 Removes any duplicate entries of the same Materials on this collection. More...
 
bool remove_material (Material *node_material)
 Removes the indicated Material from the collection. More...
 
void remove_materials_from (const MaterialCollection &other)
 Removes from this collection all of the Materials listed in the other collection. More...
 
int size () const
 Returns the number of materials in the collection. More...
 
void write (ostream &out, int indent_level=0) const
 Writes a complete multi-line description of the MaterialCollection to the indicated output stream. More...
 

Detailed Description

Definition at line 26 of file materialCollection.h.

Member Function Documentation

◆ add_material()

void MaterialCollection::add_material ( Material node_material)

Adds a new Material to the collection.

Definition at line 55 of file materialCollection.cxx.

References remove_material().

Referenced by NodePath::find_all_materials().

◆ add_materials_from()

void MaterialCollection::add_materials_from ( const MaterialCollection other)

Adds all the Materials indicated in the other collection to this material.

The other materials are simply appended to the end of the materials in this list; duplicates are not automatically removed.

Definition at line 115 of file materialCollection.cxx.

References get_material(), get_num_materials(), and remove_materials_from().

Referenced by operator+=(), and remove_material().

◆ clear()

void MaterialCollection::clear ( )

Removes all Materials from the collection.

Definition at line 193 of file materialCollection.cxx.

References find_material().

Referenced by has_material().

◆ find_material()

Material * MaterialCollection::find_material ( const string &  name) const

Returns the material in the collection with the indicated name, if any, or NULL if no material has that name.

Definition at line 205 of file materialCollection.cxx.

References MaterialAttrib::get_material(), and get_num_materials().

Referenced by clear().

◆ get_material()

Material * MaterialCollection::get_material ( int  index) const

Returns the nth Material in the collection.

Definition at line 232 of file materialCollection.cxx.

References operator[]().

Referenced by add_materials_from(), and get_num_materials().

◆ get_num_materials()

int MaterialCollection::get_num_materials ( ) const

Returns the number of Materials in the collection.

Definition at line 222 of file materialCollection.cxx.

References get_material().

Referenced by add_materials_from(), and find_material().

◆ has_material()

bool MaterialCollection::has_material ( Material material) const

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

Definition at line 178 of file materialCollection.cxx.

References clear(), and MaterialAttrib::get_material().

Referenced by remove_duplicate_materials(), and remove_materials_from().

◆ operator+()

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

Returns a MaterialCollection representing the concatenation of the two lists.

Definition at line 42 of file materialCollection.I.

Referenced by operator+=().

◆ operator+=()

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

Appends the other list onto the end of this one.

Definition at line 31 of file materialCollection.I.

References add_materials_from(), and operator+().

◆ operator[]()

Material * MaterialCollection::operator[] ( int  index) const

Returns the nth Material in the collection.

This is the same as get_material(), but it may be a more convenient way to access it.

Definition at line 246 of file materialCollection.cxx.

References size().

Referenced by get_material().

◆ output()

void MaterialCollection::output ( ostream &  out) const

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

Definition at line 270 of file materialCollection.cxx.

References write().

Referenced by size().

◆ remove_duplicate_materials()

void MaterialCollection::remove_duplicate_materials ( )

Removes any duplicate entries of the same Materials on this collection.

If a Material appears multiple times, the first appearance is retained; subsequent appearances are removed.

Definition at line 151 of file materialCollection.cxx.

References MaterialAttrib::get_material(), and has_material().

Referenced by remove_materials_from().

◆ remove_material()

bool MaterialCollection::remove_material ( Material node_material)

Removes the indicated Material from the collection.

Returns true if the material was removed, false if it was not a member of the collection.

Definition at line 78 of file materialCollection.cxx.

References add_materials_from().

Referenced by add_material().

◆ remove_materials_from()

void MaterialCollection::remove_materials_from ( const MaterialCollection other)

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

Definition at line 130 of file materialCollection.cxx.

References MaterialAttrib::get_material(), has_material(), and remove_duplicate_materials().

Referenced by add_materials_from().

◆ size()

int MaterialCollection::size ( ) const

Returns the number of materials in the collection.

This is the same thing as get_num_materials().

Definition at line 259 of file materialCollection.cxx.

References output().

Referenced by operator[]().

◆ write()

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

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

Definition at line 285 of file materialCollection.cxx.

References MaterialAttrib::get_material().

Referenced by output().


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