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