Pārlūkot izejas kodu

add more dbg switches

cxgeorge 24 gadi atpakaļ
vecāks
revīzija
58531a9576

+ 13 - 6
panda/src/gobj/LOD.cxx

@@ -105,12 +105,19 @@ compute_child(const LPoint3f &cam_pos, const LPoint3f &center) const {
       break;
   }
 
-  // since lowest level LOD is lev 0, must invert the meaning of
-  // so minimum_LOD_number 0 will screen out no LODs, and increasing it
-  // will screen out successively higher levels
-  int max_allowed_LOD_number = (_switch_vector.size()-1) - minimum_LOD_number;
-  if(child > max_allowed_LOD_number) {
-      child = max_allowed_LOD_number;
+  if(debug_LOD_mode) {
+      //not ifndef NDEBUG'ing this out since need it at Opt4 for perf measurements
+      if(select_LOD_number>0) {
+          return select_LOD_number;
+      }
+
+      // since lowest level LOD is lev 0, must invert the meaning of
+      // so minimum_LOD_number 0 will screen out no LODs, and increasing it
+      // will screen out successively higher levels
+      int max_allowed_LOD_number = (_switch_vector.size()-1) - minimum_LOD_number;
+      if(child > max_allowed_LOD_number) {
+          child = max_allowed_LOD_number;
+      }
   }
 
   return child;

+ 6 - 0
panda/src/gobj/config_gobj.cxx

@@ -105,6 +105,12 @@ BamTextureMode bam_texture_mode;
 // texture file, which will presumably only be loaded once.
 const string fake_texture_image = config_gobj.GetString("fake-texture-image", "");
 
+// must be set to true for LOD_number debugging items to work
+const bool debug_LOD_mode = config_gobj.GetBool("debug-LOD-mode", false);
+
+// if this is >0, select_child always returns this LOD number
+const int select_LOD_number = config_gobj.GetInt("select-LOD-number", -1);
+
 // this controls the LOD child number returned by compute_child
 // use it to force the LOD alg to not select the highest level(s) of LOD
 // minimum_LOD_number=0 will screen out no LODs, and increasing it

+ 2 - 0
panda/src/gobj/config_gobj.h

@@ -42,6 +42,8 @@ enum BamTextureMode {
 extern EXPCL_PANDA BamTextureMode bam_texture_mode;
 extern EXPCL_PANDA const string fake_texture_image;
 
+extern EXPCL_PANDA const bool debug_number_mode;
+extern EXPCL_PANDA const int select_LOD_number;
 extern EXPCL_PANDA const int minimum_LOD_number;
 
 #endif