Browse Source

more config variable polish

David Rose 15 years ago
parent
commit
71e686ab5a

+ 25 - 1
panda/src/speedtree/config_speedtree.cxx

@@ -169,7 +169,7 @@ ConfigVariableInt speedtree_shadow_map_resolution
 ConfigVariableDouble speedtree_cascading_shadow_splits
 ("speedtree-cascading-shadow-splits", "200 400 600",
  PRC_DESC("Specifies the shadow split distance, in spatial units, for "
-	  "each of shadow map to be rendered.  The number of values also "
+	  "each shadow map to be rendered.  The number of values also "
 	  "implies the number of shadow maps, to a maximum value compiled "
 	  "within SpeedTree (typically 4)."));
 
@@ -189,6 +189,30 @@ ConfigVariableBool speedtree_frond_rippling
 ("speedtree-frond-rippling", true,
  PRC_DESC("True to allow fronds to respond to the global wind."));
 
+ConfigVariableInt speedtree_terrain_num_lods
+("speedtree-terrain-num-lods", 5,
+ PRC_DESC("Specifies the number of different LOD stages to use in "
+	  "rendering terrain.  Each stage has 75% few polygons than the "
+	  "stage before.  Increasing this number decreases the total "
+	  "number of polygons onscreen, at the cost of visual quality of "
+	  "distant terrain."));
+
+ConfigVariableInt speedtree_terrain_resolution
+("speedtree-terrain-resolution", 33,
+ PRC_DESC("Specifies the number of vertices per edge of each terrain grid "
+	  "cell at the highest LOD.  This must be a power of two plus 1."));
+	  
+ConfigVariableInt speedtree_terrain_cell_size
+("speedtree-terrain-cell-size", 800,
+ PRC_DESC("Specifies the size in spatial units of one edge of a terrain "
+	  "grid cell.  This effects culling and resolution, but has nothing "
+	  "to do with the scale of the heightmap or other maps."));
+
+ConfigVariableDouble speedtree_shadow_fade
+("speedtree-shadow-fade", 0.25,
+ PRC_DESC("Specifies the rate at which shadows fade to transparency in the "
+	  "distance."));
+
 ConfigVariableBool speedtree_show_overlays
 ("speedtree-show-overlays", false,
  PRC_DESC("True to draw onscreen overlays showing the generated "

+ 4 - 0
panda/src/speedtree/config_speedtree.h

@@ -60,7 +60,11 @@ extern ConfigVariableBool speedtree_smooth_shadows;
 extern ConfigVariableBool speedtree_show_shadow_splits_on_terrain;
 extern ConfigVariableBool speedtree_wind_enabled;
 extern ConfigVariableBool speedtree_frond_rippling;
+extern ConfigVariableInt speedtree_terrain_num_lods;
+extern ConfigVariableInt speedtree_terrain_resolution;
+extern ConfigVariableInt speedtree_terrain_cell_size;
 
+extern ConfigVariableDouble speedtree_shadow_fade;
 extern ConfigVariableBool speedtree_show_overlays;
 
 extern ConfigVariableInt speedtree_max_num_visible_cells;

+ 1 - 6
panda/src/speedtree/speedTreeNode.cxx

@@ -975,10 +975,9 @@ cull_callback(CullTraverser *trav, CullTraverserData &data) {
   for (int smi = 0; smi < (int)_shadow_infos.size(); ++smi) {
     updated_splits[smi] = _shadow_infos[smi]._shadow_split;
   };
-  static const float shadow_fade = 0.25;
 
   _forest_render.SetCascadedShadowMapDistances(updated_splits, lens->get_far());
-  _forest_render.SetShadowFadePercentage(shadow_fade);
+  _forest_render.SetShadowFadePercentage(speedtree_shadow_fade);
 
   if (!_needs_repopulate) {
     // Don't bother culling now unless we're correctly fully
@@ -1622,10 +1621,6 @@ setup_for_render(GraphicsStateGuardian *gsg) {
 
     if (has_terrain()) {
       // Now initialize the terrain.
-      static const int speedtree_terrain_num_lods = 5;  // number of LOD stages
-      static const int speedtree_terrain_resolution = 33; // num vertices per edge of grid cell at highest LOD, must be power-of-two-plus-1
-      static const float speedtree_terrain_cell_size = 800.0f;  // spatial size of one edge of grid cell
-      
       if (!_terrain_render.Init(speedtree_terrain_num_lods, 
 				speedtree_terrain_resolution,
 				speedtree_terrain_cell_size,