14#ifndef EGGMATERIALCOLLECTION_H
15#define EGGMATERIALCOLLECTION_H
30class EXPCL_PANDA_EGG EggMaterialCollection {
37 typedef pmap<PT_EggMaterial, int> Materials;
38 typedef vector_PT_EggMaterial OrderedMaterials;
41 typedef OrderedMaterials::const_iterator iterator;
42 typedef iterator const_iterator;
43 typedef OrderedMaterials::size_type size_type;
45 typedef pmap<PT_EggMaterial, PT_EggMaterial > MaterialReplacement;
50 EggMaterialCollection();
51 EggMaterialCollection(
const EggMaterialCollection ©);
52 EggMaterialCollection &operator = (
const EggMaterialCollection ©);
53 ~EggMaterialCollection();
70 const MaterialReplacement &replace);
78 INLINE iterator begin()
const;
79 INLINE iterator end()
const;
80 INLINE
bool empty()
const;
81 INLINE size_type size()
const;
97 OrderedMaterials _ordered_materials;
A base class for nodes in the hierarchy that are not leaf nodes.
bool add_material(EggMaterial *material)
Explicitly adds a new material to the collection.
static void replace_materials(EggGroupNode *node, const MaterialReplacement &replace)
Walks the egg hierarchy, changing out any reference to a material appearing on the left side of the m...
void uniquify_mrefs()
Guarantees that each material in the collection has a unique MRef name.
int find_used_materials(EggNode *node)
Walks the egg hierarchy beginning at the indicated node, looking for materials that are referenced by...
int collapse_equivalent_materials(int eq, EggGroupNode *node)
Walks through the collection and collapses together any separate materials that are equivalent accord...
int extract_materials(EggGroupNode *node)
Walks the egg hierarchy beginning at the indicated node, and removes any EggMaterials encountered in ...
EggGroupNode::iterator insert_materials(EggGroupNode *node)
Adds a series of EggMaterial nodes to the beginning of the indicated node to reflect each of the mate...
bool remove_material(EggMaterial *material)
Explicitly removes a material from the collection.
void sort_by_mref()
Sorts all the materials into alphabetical order by MRef name.
EggMaterial * create_unique_material(const EggMaterial ©, int eq)
Creates a new material if there is not already one equivalent (according to eq, see EggMaterial::is_e...
void clear()
Removes all materials from the collection.
EggMaterial * find_mref(const std::string &mref_name) const
Returns the material with the indicated MRef name, or NULL if no material matches.
void remove_unused_materials(EggNode *node)
Removes any materials from the collection that aren't referenced by any primitives in the indicated e...
A base class for things that may be directly added into the egg hierarchy.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.