Panda3D
materialCollection.h
1 // Filename: materialCollection.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 MATERIALCOLLECTION_H
16 #define MATERIALCOLLECTION_H
17 
18 #include "pandabase.h"
19 #include "pointerToArray.h"
20 #include "material.h"
21 
22 ////////////////////////////////////////////////////////////////////
23 // Class : MaterialCollection
24 // Description :
25 ////////////////////////////////////////////////////////////////////
26 class EXPCL_PANDA_PGRAPH MaterialCollection {
27 PUBLISHED:
30  void operator = (const MaterialCollection &copy);
31  INLINE ~MaterialCollection();
32 
33  void add_material(Material *node_material);
34  bool remove_material(Material *node_material);
35  void add_materials_from(const MaterialCollection &other);
36  void remove_materials_from(const MaterialCollection &other);
37  void remove_duplicate_materials();
38  bool has_material(Material *material) const;
39  void clear();
40 
41  Material *find_material(const string &name) const;
42 
43  int get_num_materials() const;
44  Material *get_material(int index) const;
45  Material *operator [] (int index) const;
46  int size() const;
47  INLINE void operator += (const MaterialCollection &other);
48  INLINE MaterialCollection operator + (const MaterialCollection &other) const;
49 
50  void output(ostream &out) const;
51  void write(ostream &out, int indent_level = 0) const;
52 
53 private:
54  typedef PTA(PT(Material)) Materials;
55  Materials _materials;
56 };
57 
58 INLINE ostream &operator << (ostream &out, const MaterialCollection &col) {
59  col.output(out);
60  return out;
61 }
62 
63 #include "materialCollection.I"
64 
65 #endif
66 
67 
void output(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:34