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

Detailed Description

Definition at line 24 of file materialCollection.h.

Constructor & Destructor Documentation

◆ MaterialCollection() [1/2]

MaterialCollection::MaterialCollection ( )

Definition at line 21 of file materialCollection.cxx.

◆ MaterialCollection() [2/2]

MaterialCollection::MaterialCollection ( const MaterialCollection & copy)

Definition at line 28 of file materialCollection.cxx.

◆ ~MaterialCollection()

MaterialCollection::~MaterialCollection ( )
inline

Definition at line 17 of file materialCollection.I.

Member Function Documentation

◆ add_material()

void MaterialCollection::add_material ( Material * node_material)

Adds a new Material to the collection.

Definition at line 45 of file materialCollection.cxx.

Referenced by add_materials_from(), NodePath::find_all_materials(), and 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 97 of file materialCollection.cxx.

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

Referenced by operator+=().

◆ clear()

void MaterialCollection::clear ( )

Removes all Materials from the collection.

Definition at line 166 of file materialCollection.cxx.

◆ find_material()

Material * MaterialCollection::find_material ( const std::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 175 of file materialCollection.cxx.

References get_material(), and get_num_materials().

◆ get_material()

Material * MaterialCollection::get_material ( int index) const

Returns the nth Material in the collection.

Definition at line 198 of file materialCollection.cxx.

Referenced by add_materials_from(), find_material(), has_material(), remove_duplicate_materials(), remove_materials_from(), and write().

◆ get_num_materials()

int MaterialCollection::get_num_materials ( ) const

Returns the number of Materials in the collection.

Definition at line 190 of file materialCollection.cxx.

Referenced by add_materials_from(), find_material(), has_material(), output(), remove_duplicate_materials(), remove_materials_from(), and write().

◆ has_material()

bool MaterialCollection::has_material ( Material * material) const

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

Definition at line 153 of file materialCollection.cxx.

References get_material(), and get_num_materials().

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

◆ operator+=()

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

Appends the other list onto the end of this one.

Definition at line 24 of file materialCollection.I.

References add_materials_from().

◆ operator=()

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

Definition at line 37 of file materialCollection.cxx.

◆ 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 209 of file materialCollection.cxx.

◆ output()

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

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

Definition at line 229 of file materialCollection.cxx.

References get_num_materials().

◆ 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 128 of file materialCollection.cxx.

References get_material(), and get_num_materials().

◆ 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 64 of file materialCollection.cxx.

◆ 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 110 of file materialCollection.cxx.

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

◆ 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 220 of file materialCollection.cxx.

◆ write()

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

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

Definition at line 242 of file materialCollection.cxx.

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


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