Panda3D
|
00001 // Filename: materialCollection.h 00002 // Created by: drose (16Mar02) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) Carnegie Mellon University. All rights reserved. 00008 // 00009 // All use of this software is subject to the terms of the revised BSD 00010 // license. You should have received a copy of this license along 00011 // with this source code in a file named "LICENSE." 00012 // 00013 //////////////////////////////////////////////////////////////////// 00014 00015 #ifndef MATERIALCOLLECTION_H 00016 #define MATERIALCOLLECTION_H 00017 00018 #include "pandabase.h" 00019 #include "pointerToArray.h" 00020 #include "material.h" 00021 00022 //////////////////////////////////////////////////////////////////// 00023 // Class : MaterialCollection 00024 // Description : 00025 //////////////////////////////////////////////////////////////////// 00026 class EXPCL_PANDA_PGRAPH MaterialCollection { 00027 PUBLISHED: 00028 MaterialCollection(); 00029 MaterialCollection(const MaterialCollection ©); 00030 void operator = (const MaterialCollection ©); 00031 INLINE ~MaterialCollection(); 00032 00033 void add_material(Material *node_material); 00034 bool remove_material(Material *node_material); 00035 void add_materials_from(const MaterialCollection &other); 00036 void remove_materials_from(const MaterialCollection &other); 00037 void remove_duplicate_materials(); 00038 bool has_material(Material *material) const; 00039 void clear(); 00040 00041 Material *find_material(const string &name) const; 00042 00043 int get_num_materials() const; 00044 Material *get_material(int index) const; 00045 Material *operator [] (int index) const; 00046 int size() const; 00047 INLINE void operator += (const MaterialCollection &other); 00048 INLINE MaterialCollection operator + (const MaterialCollection &other) const; 00049 00050 void output(ostream &out) const; 00051 void write(ostream &out, int indent_level = 0) const; 00052 00053 private: 00054 typedef PTA(PT(Material)) Materials; 00055 Materials _materials; 00056 }; 00057 00058 INLINE ostream &operator << (ostream &out, const MaterialCollection &col) { 00059 col.output(out); 00060 return out; 00061 } 00062 00063 #include "materialCollection.I" 00064 00065 #endif 00066 00067