ソースを参照

verbose output for CullBinManager

David Rose 20 年 前
コミット
9601c8c2cb

+ 0 - 1
panda/src/pgraph/cullBinManager.I

@@ -80,7 +80,6 @@ get_bin(int n) const {
 //       Access: Published
 //       Access: Published
 //  Description: Returns the name of the bin with the indicated
 //  Description: Returns the name of the bin with the indicated
 //               bin_index (where bin_index was retrieved by get_bin()
 //               bin_index (where bin_index was retrieved by get_bin()
-
 //               or find_bin()).  The bin's name may not be changed
 //               or find_bin()).  The bin's name may not be changed
 //               during the life of the bin.
 //               during the life of the bin.
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////

+ 47 - 0
panda/src/pgraph/cullBinManager.cxx

@@ -175,6 +175,24 @@ find_bin(const string &name) const {
   return -1;
   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
 //     Function: CullBinManager::get_global_ptr
 //       Access: Published, Static
 //       Access: Published, Static
@@ -334,3 +352,32 @@ parse_bin_type(const string &bin_type) {
     return BT_invalid;
     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 << ")**";
+}

+ 5 - 0
panda/src/pgraph/cullBinManager.h

@@ -62,6 +62,8 @@ PUBLISHED:
   INLINE int get_bin_sort(int bin_index) const;
   INLINE int get_bin_sort(int bin_index) const;
   INLINE void set_bin_sort(int bin_index, int sort);
   INLINE void set_bin_sort(int bin_index, int sort);
 
 
+  void write(ostream &out) const;
+
   static CullBinManager *get_global_ptr();
   static CullBinManager *get_global_ptr();
 
 
 public:
 public:
@@ -102,6 +104,9 @@ private:
   friend class SortBins;
   friend class SortBins;
 };
 };
 
 
+EXPCL_PANDA ostream &
+operator << (ostream &out, CullBinManager::BinType bin_type);
+
 #include "cullBinManager.I"
 #include "cullBinManager.I"
 
 
 #endif
 #endif