Panda3D
 All Classes Functions Variables Enumerations
textureCollection.h
00001 // Filename: textureCollection.h
00002 // Created by:  drose (16Mar02)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) Carnegie Mellon University.  All rights reserved.
00008 //
00009 // All use of this software is subject to the terms of the revised BSD
00010 // license.  You should have received a copy of this license along
00011 // with this source code in a file named "LICENSE."
00012 //
00013 ////////////////////////////////////////////////////////////////////
00014 
00015 #ifndef TEXTURECOLLECTION_H
00016 #define TEXTURECOLLECTION_H
00017 
00018 #include "pandabase.h"
00019 #include "pointerToArray.h"
00020 #include "texture.h"
00021 
00022 ////////////////////////////////////////////////////////////////////
00023 //       Class : TextureCollection
00024 // Description : Manages a list of Texture objects, as returned by
00025 //               TexturePool::find_all_textures().
00026 ////////////////////////////////////////////////////////////////////
00027 class EXPCL_PANDA_GOBJ TextureCollection {
00028 PUBLISHED:
00029   TextureCollection();
00030   TextureCollection(const TextureCollection &copy);
00031   void operator = (const TextureCollection &copy);
00032   INLINE ~TextureCollection();
00033 
00034 #ifdef HAVE_PYTHON
00035   TextureCollection(PyObject *self, PyObject *sequence);
00036   PyObject *__reduce__(PyObject *self) const;
00037 #endif
00038 
00039   void add_texture(Texture *texture);
00040   bool remove_texture(Texture *texture);
00041   void add_textures_from(const TextureCollection &other);
00042   void remove_textures_from(const TextureCollection &other);
00043   void remove_duplicate_textures();
00044   bool has_texture(Texture *texture) const;
00045   void clear();
00046 
00047   Texture *find_texture(const string &name) const;
00048 
00049   int get_num_textures() const;
00050   Texture *get_texture(int index) const;
00051   MAKE_SEQ(get_textures, get_num_textures, get_texture);
00052   Texture *operator [] (int index) const;
00053   int size() const;
00054   INLINE void operator += (const TextureCollection &other);
00055   INLINE TextureCollection operator + (const TextureCollection &other) const;
00056 
00057   // Method names to satisfy Python's conventions.
00058   INLINE void append(Texture *texture);
00059   INLINE void extend(const TextureCollection &other);
00060 
00061   void output(ostream &out) const;
00062   void write(ostream &out, int indent_level = 0) const;
00063 
00064 private:
00065   typedef PTA(PT(Texture)) Textures;
00066   Textures _textures;
00067 };
00068 
00069 INLINE ostream &operator << (ostream &out, const TextureCollection &col) {
00070   col.output(out);
00071   return out;
00072 }
00073 
00074 #include "textureCollection.I"
00075 
00076 #endif
00077 
00078 
 All Classes Functions Variables Enumerations