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:
27 TextureCollection();
28 TextureCollection(const TextureCollection &copy);
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);
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().
get_num_textures
Returns the number of Textures in the collection.
void extend(const TextureCollection &other)
Appends the other list onto the end of this one.
void add_texture(Texture *texture)
Adds a new Texture to the collection.
void remove_duplicate_textures()
Removes any duplicate entries of the same Textures on this collection.
int size() const
Returns the number of textures in the collection.
bool has_texture(Texture *texture) const
Returns true if the indicated Texture appears in this collection, false otherwise.
bool remove_texture(Texture *texture)
Removes the indicated Texture from the collection.
void append(Texture *texture)
Adds a new Texture to the collection.
void add_textures_from(const TextureCollection &other)
Adds all the Textures indicated in the other collection to this texture.
void remove_textures_from(const TextureCollection &other)
Removes from this collection all of the Textures listed in the other collection.
void reserve(size_t num)
This is a hint to Panda to allocate enough memory to hold the given number of NodePaths,...
void write(std::ostream &out, int indent_level=0) const
Writes a complete multi-line description of the TextureCollection to the indicated output stream.
void clear()
Removes all Textures from the collection.
Texture * find_texture(const std::string &name) const
Returns the texture in the collection with the indicated name, if any, or NULL if no texture has that...
void output(std::ostream &out) const
Writes a brief one-line description of the TextureCollection to the indicated output stream.
get_texture
Returns the nth Texture in the collection.
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.