more config variable polish

This commit is contained in:
David Rose 2010-10-13 23:18:33 +00:00
parent 267114bd09
commit 71e686ab5a
3 changed files with 30 additions and 7 deletions

View File

@ -169,7 +169,7 @@ ConfigVariableInt speedtree_shadow_map_resolution
ConfigVariableDouble speedtree_cascading_shadow_splits ConfigVariableDouble speedtree_cascading_shadow_splits
("speedtree-cascading-shadow-splits", "200 400 600", ("speedtree-cascading-shadow-splits", "200 400 600",
PRC_DESC("Specifies the shadow split distance, in spatial units, for " 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 " "implies the number of shadow maps, to a maximum value compiled "
"within SpeedTree (typically 4).")); "within SpeedTree (typically 4)."));
@ -189,6 +189,30 @@ ConfigVariableBool speedtree_frond_rippling
("speedtree-frond-rippling", true, ("speedtree-frond-rippling", true,
PRC_DESC("True to allow fronds to respond to the global wind.")); 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 ConfigVariableBool speedtree_show_overlays
("speedtree-show-overlays", false, ("speedtree-show-overlays", false,
PRC_DESC("True to draw onscreen overlays showing the generated " PRC_DESC("True to draw onscreen overlays showing the generated "

View File

@ -60,7 +60,11 @@ extern ConfigVariableBool speedtree_smooth_shadows;
extern ConfigVariableBool speedtree_show_shadow_splits_on_terrain; extern ConfigVariableBool speedtree_show_shadow_splits_on_terrain;
extern ConfigVariableBool speedtree_wind_enabled; extern ConfigVariableBool speedtree_wind_enabled;
extern ConfigVariableBool speedtree_frond_rippling; 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 ConfigVariableBool speedtree_show_overlays;
extern ConfigVariableInt speedtree_max_num_visible_cells; extern ConfigVariableInt speedtree_max_num_visible_cells;

View File

@ -975,10 +975,9 @@ cull_callback(CullTraverser *trav, CullTraverserData &data) {
for (int smi = 0; smi < (int)_shadow_infos.size(); ++smi) { for (int smi = 0; smi < (int)_shadow_infos.size(); ++smi) {
updated_splits[smi] = _shadow_infos[smi]._shadow_split; 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.SetCascadedShadowMapDistances(updated_splits, lens->get_far());
_forest_render.SetShadowFadePercentage(shadow_fade); _forest_render.SetShadowFadePercentage(speedtree_shadow_fade);
if (!_needs_repopulate) { if (!_needs_repopulate) {
// Don't bother culling now unless we're correctly fully // Don't bother culling now unless we're correctly fully
@ -1622,10 +1621,6 @@ setup_for_render(GraphicsStateGuardian *gsg) {
if (has_terrain()) { if (has_terrain()) {
// Now initialize the 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, if (!_terrain_render.Init(speedtree_terrain_num_lods,
speedtree_terrain_resolution, speedtree_terrain_resolution,
speedtree_terrain_cell_size, speedtree_terrain_cell_size,