Panda3D
 All Classes Functions Variables Enumerations
textureCollection.h
1 // Filename: textureCollection.h
2 // Created by: drose (16Mar02)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #ifndef TEXTURECOLLECTION_H
16 #define TEXTURECOLLECTION_H
17 
18 #include "pandabase.h"
19 #include "pointerToArray.h"
20 #include "texture.h"
21 
22 ////////////////////////////////////////////////////////////////////
23 // Class : TextureCollection
24 // Description : Manages a list of Texture objects, as returned by
25 // TexturePool::find_all_textures().
26 ////////////////////////////////////////////////////////////////////
27 class EXPCL_PANDA_GOBJ TextureCollection {
28 PUBLISHED:
31  void operator = (const TextureCollection &copy);
32  INLINE ~TextureCollection();
33 
34 #ifdef HAVE_PYTHON
35  EXTENSION(TextureCollection(PyObject *self, PyObject *sequence));
36  EXTENSION(PyObject *__reduce__(PyObject *self) const);
37 #endif
38 
39  void add_texture(Texture *texture);
40  bool remove_texture(Texture *texture);
41  void add_textures_from(const TextureCollection &other);
42  void remove_textures_from(const TextureCollection &other);
43  void remove_duplicate_textures();
44  bool has_texture(Texture *texture) const;
45  void clear();
46  void reserve(size_t num);
47 
48  Texture *find_texture(const string &name) const;
49 
50  int get_num_textures() const;
51  Texture *get_texture(int index) const;
52  MAKE_SEQ(get_textures, get_num_textures, get_texture);
53  Texture *operator [] (int index) const;
54  int size() const;
55  INLINE void operator += (const TextureCollection &other);
56  INLINE TextureCollection operator + (const TextureCollection &other) const;
57 
58  // Method names to satisfy Python's conventions.
59  INLINE void append(Texture *texture);
60  INLINE void extend(const TextureCollection &other);
61 
62  void output(ostream &out) const;
63  void write(ostream &out, int indent_level = 0) const;
64 
65 private:
66  typedef PTA(PT(Texture)) Textures;
67  Textures _textures;
68 };
69 
70 INLINE ostream &operator << (ostream &out, const TextureCollection &col) {
71  col.output(out);
72  return out;
73 }
74 
75 #include "textureCollection.I"
76 
77 #endif
Represents a texture object, which is typically a single 2-d image but may also represent a 1-d or 3-...
Definition: texture.h:75
void output(ostream &out) const
Writes a brief one-line description of the TextureCollection to the indicated output stream...
Manages a list of Texture objects, as returned by TexturePool::find_all_textures().