Skip to content

Commit

Permalink
Add (back) an option to disable polar subdivision restriction
Browse files Browse the repository at this point in the history
  • Loading branch information
gwaldron committed Jan 9, 2025
1 parent 6fa787c commit 5d57539
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
5 changes: 5 additions & 0 deletions src/osgEarth/TerrainOptions
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ namespace osgEarth
OE_OPTION(bool, visible, true);
OE_OPTION(bool, createTilesAsync, true);
OE_OPTION(bool, createTilesGrouped, true);
OE_OPTION(bool, restrictPolarSubdivision, true);

virtual Config getConfig() const;
private:
Expand Down Expand Up @@ -254,6 +255,10 @@ namespace osgEarth
void setCreateTilesGrouped(const bool& value);
const bool& getCreateTilesGrouped() const;

//! Whether to stop a geocentric mesh from subdividing all the way at the poles.
void setRestrictPolarSubdivision(const bool& value);
const bool& getRestrictPolarSubdivision() const;

//! @deprecated
//! Scale factor for background loading priority of terrain tiles.
//! Default = 1.0. Make it higher to prioritize terrain loading over
Expand Down
4 changes: 3 additions & 1 deletion src/osgEarth/TerrainOptions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@ TerrainOptions::getConfig() const
//conf.set("screen_space_error", screenSpaceError()); // don't serialize me, i'm set by the MapNode
conf.set("max_texture_size", maxTextureSize());
conf.set("visible", visible());

conf.set("create_tiles_async", createTilesAsync());
conf.set("create_tiles_grouped", createTilesGrouped());
conf.set("restrict_polar_subdivision", restrictPolarSubdivision());

conf.set("expiration_range", minExpiryRange()); // legacy
conf.set("expiration_threshold", minResidentTiles()); // legacy
Expand Down Expand Up @@ -134,6 +134,7 @@ TerrainOptions::fromConfig(const Config& conf)

conf.get("create_tiles_async", createTilesAsync());
conf.get("create_tiles_grouped", createTilesGrouped());
conf.get("restrict_polar_subdivision", restrictPolarSubdivision());

conf.get("expiration_range", minExpiryRange()); // legacy
conf.get("expiration_threshold", minResidentTiles()); // legacy
Expand Down Expand Up @@ -217,6 +218,7 @@ OE_OPTION_IMPL(TerrainOptionsAPI, unsigned, MaxTextureSize, maxTextureSize);
OE_OPTION_IMPL(TerrainOptionsAPI, bool, Visible, visible);
OE_OPTION_IMPL(TerrainOptionsAPI, bool, CreateTilesAsync, createTilesAsync);
OE_OPTION_IMPL(TerrainOptionsAPI, bool, CreateTilesGrouped, createTilesGrouped);
OE_OPTION_IMPL(TerrainOptionsAPI, bool, RestrictPolarSubdivision, restrictPolarSubdivision);

bool
TerrainOptionsAPI::getGPUTessellation() const
Expand Down
2 changes: 1 addition & 1 deletion src/osgEarthDrivers/engine_rex/RexTerrainEngineNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ RexTerrainEngineNode::onSetMap()
maxLOD,
_map->getProfile(),
options.getMinTileRangeFactor(),
true); // restrict polar subdivision for geographic maps
options.getRestrictPolarSubdivision());

TerrainResources* res = getResources();
for (unsigned lod = 0; lod <= maxLOD; ++lod)
Expand Down

0 comments on commit 5d57539

Please sign in to comment.