14#ifndef EGGTEXTURECOLLECTION_H
15#define EGGTEXTURECOLLECTION_H
30class EXPCL_PANDA_EGG EggTextureCollection {
37 typedef pmap<PT_EggTexture, int> Textures;
38 typedef vector_PT_EggTexture OrderedTextures;
41 typedef OrderedTextures::const_iterator iterator;
42 typedef iterator const_iterator;
43 typedef OrderedTextures::size_type size_type;
45 typedef pmap<PT_EggTexture, PT_EggTexture > TextureReplacement;
50 EggTextureCollection();
51 EggTextureCollection(
const EggTextureCollection ©);
52 EggTextureCollection &operator = (
const EggTextureCollection ©);
53 ~EggTextureCollection();
75 const TextureReplacement &replace);
84 INLINE iterator begin()
const;
85 INLINE iterator end()
const;
86 INLINE
bool empty()
const;
89 INLINE
EggTexture *operator [](size_type n)
const;
90 INLINE size_type
size()
const;
108 OrderedTextures _ordered_textures;
A base class for nodes in the hierarchy that are not leaf nodes.
A base class for things that may be directly added into the egg hierarchy.
bool add_texture(EggTexture *texture)
Explicitly adds a new texture to the collection.
bool is_empty() const
Returns true if there are no EggTexures in the collection, false otherwise.
EggTexture * find_tref(const std::string &tref_name) const
Returns the texture with the indicated TRef name, or NULL if no texture matches.
void sort_by_tref()
Sorts all the textures into alphabetical order by TRef name.
get_texture
Returns the nth EggTexture in the collection.
int find_used_textures(EggNode *node)
Walks the egg hierarchy beginning at the indicated node, looking for textures that are referenced by ...
EggTexture * find_filename(const Filename &filename) const
Returns the texture with the indicated filename, or NULL if no texture matches.
int collapse_equivalent_textures(int eq, EggGroupNode *node)
Walks through the collection and collapses together any separate textures that are equivalent accordi...
static void replace_textures(EggGroupNode *node, const TextureReplacement &replace)
Walks the egg hierarchy, changing out any reference to a texture appearing on the left side of the ma...
void clear()
Removes all textures from the collection.
int extract_textures(EggGroupNode *node)
Walks the egg hierarchy beginning at the indicated node, and removes any EggTextures encountered in t...
void uniquify_trefs()
Guarantees that each texture in the collection has a unique TRef name.
EggGroupNode::iterator insert_textures(EggGroupNode *node)
Adds a series of EggTexture nodes to the beginning of the indicated node to reflect each of the textu...
void remove_unused_textures(EggNode *node)
Removes any textures from the collection that aren't referenced by any primitives in the indicated eg...
void sort_by_basename()
Sorts all the textures into alphabetical order by the basename part (including extension) of the file...
size_type size() const
Returns the number of EggTextures in the collection.
EggTexture * create_unique_texture(const EggTexture ©, int eq)
Creates a new texture if there is not already one equivalent (according to eq, see EggTexture::is_equ...
get_num_textures
Returns the number of EggTextures in the collection.
bool remove_texture(EggTexture *texture)
Explicitly removes a texture from the collection.
Defines a texture map that may be applied to geometry.
The name of a file, such as a texture file or an Egg file.
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.