diff --git a/panda/src/pgraph/cullBinManager.I b/panda/src/pgraph/cullBinManager.I index 439210fa06..dc2de63987 100644 --- a/panda/src/pgraph/cullBinManager.I +++ b/panda/src/pgraph/cullBinManager.I @@ -80,7 +80,6 @@ get_bin(int n) const { // Access: Published // Description: Returns the name of the bin with the indicated // bin_index (where bin_index was retrieved by get_bin() - // or find_bin()). The bin's name may not be changed // during the life of the bin. //////////////////////////////////////////////////////////////////// diff --git a/panda/src/pgraph/cullBinManager.cxx b/panda/src/pgraph/cullBinManager.cxx index f9127aaa61..b3a6b62aea 100644 --- a/panda/src/pgraph/cullBinManager.cxx +++ b/panda/src/pgraph/cullBinManager.cxx @@ -175,6 +175,24 @@ find_bin(const string &name) const { return -1; } +//////////////////////////////////////////////////////////////////// +// Function: CullBinManager::write +// Access: Published +// Description: +//////////////////////////////////////////////////////////////////// +void CullBinManager:: +write(ostream &out) const { + if (!_bins_are_sorted) { + ((CullBinManager *)this)->do_sort_bins(); + } + SortedBins::const_iterator sbi; + for (sbi = _sorted_bins.begin(); sbi != _sorted_bins.end(); ++sbi) { + int bin_index = (*sbi); + out << get_bin_name(bin_index) << ", " << get_bin_type(bin_index) + << ", " << get_bin_sort(bin_index) << "\n"; + } +} + //////////////////////////////////////////////////////////////////// // Function: CullBinManager::get_global_ptr // Access: Published, Static @@ -334,3 +352,32 @@ parse_bin_type(const string &bin_type) { return BT_invalid; } } + +//////////////////////////////////////////////////////////////////// +// Function: CullBinManager::BinType output operator +// Description: +//////////////////////////////////////////////////////////////////// +ostream & +operator << (ostream &out, CullBinManager::BinType bin_type) { + switch (bin_type) { + case CullBinManager::BT_invalid: + return out << "invalid"; + + case CullBinManager::BT_unsorted: + return out << "unsorted"; + + case CullBinManager::BT_state_sorted: + return out << "state_sorted"; + + case CullBinManager::BT_back_to_front: + return out << "back_to_front"; + + case CullBinManager::BT_front_to_back: + return out << "front_to_back"; + + case CullBinManager::BT_fixed: + return out << "fixed"; + } + + return out << "**invalid BinType(" << (int)bin_type << ")**"; +} diff --git a/panda/src/pgraph/cullBinManager.h b/panda/src/pgraph/cullBinManager.h index f4cc88513d..f2d1360d0e 100644 --- a/panda/src/pgraph/cullBinManager.h +++ b/panda/src/pgraph/cullBinManager.h @@ -62,6 +62,8 @@ PUBLISHED: INLINE int get_bin_sort(int bin_index) const; INLINE void set_bin_sort(int bin_index, int sort); + void write(ostream &out) const; + static CullBinManager *get_global_ptr(); public: @@ -102,6 +104,9 @@ private: friend class SortBins; }; +EXPCL_PANDA ostream & +operator << (ostream &out, CullBinManager::BinType bin_type); + #include "cullBinManager.I" #endif