Panda3D
materialCollection.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 materialCollection.h
10  * @author drose
11  * @date 2002-03-16
12  */
13 
14 #ifndef MATERIALCOLLECTION_H
15 #define MATERIALCOLLECTION_H
16 
17 #include "pandabase.h"
18 #include "pointerToArray.h"
19 #include "material.h"
20 
21 /**
22  *
23  */
24 class EXPCL_PANDA_PGRAPH MaterialCollection {
25 PUBLISHED:
28  void operator = (const MaterialCollection &copy);
29  INLINE ~MaterialCollection();
30 
31  void add_material(Material *node_material);
32  bool remove_material(Material *node_material);
33  void add_materials_from(const MaterialCollection &other);
34  void remove_materials_from(const MaterialCollection &other);
35  void remove_duplicate_materials();
36  bool has_material(Material *material) const;
37  void clear();
38 
39  Material *find_material(const std::string &name) const;
40 
41  int get_num_materials() const;
42  Material *get_material(int index) const;
43  Material *operator [] (int index) const;
44  int size() const;
45  INLINE void operator += (const MaterialCollection &other);
46  INLINE MaterialCollection operator + (const MaterialCollection &other) const;
47 
48  void output(std::ostream &out) const;
49  void write(std::ostream &out, int indent_level = 0) const;
50 
51 private:
52  typedef PTA(PT(Material)) Materials;
53  Materials _materials;
54 };
55 
56 INLINE std::ostream &operator << (std::ostream &out, const MaterialCollection &col) {
57  col.output(out);
58  return out;
59 }
60 
61 #include "materialCollection.I"
62 
63 #endif
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void output(std::ostream &out) const
Writes a brief one-line description of the MaterialCollection to the indicated output stream.
Defines the way an object appears in the presence of lighting.
Definition: material.h:43
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.