Skip to content

Commit

Permalink
Added terrain engine expiration options to TerrainGUI.
Browse files Browse the repository at this point in the history
Removed unused code
  • Loading branch information
jasonbeverage committed Nov 19, 2024
1 parent 4e1439a commit fe72a70
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 9 deletions.
7 changes: 2 additions & 5 deletions src/osgEarthDrivers/engine_rex/EngineContext
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,7 @@ namespace osgEarth { namespace REX

const TerrainOptionsAPI& options() const { return _options; }

ProgressCallback* progress() const { return _progress.get(); }

double getExpirationRange2() const { return _expirationRange2; }
ProgressCallback* progress() const { return _progress.get(); }

ModifyBoundingBoxCallback* getModifyBBoxCallback() const { return _bboxCB.get(); }

Expand All @@ -104,8 +102,7 @@ namespace osgEarth { namespace REX
const SelectionInfo& _selectionInfo;
osg::Timer_t _tick;
int _tilesLastCull;
osg::ref_ptr<ProgressCallback> _progress;
double _expirationRange2;
osg::ref_ptr<ProgressCallback> _progress;
osg::ref_ptr<ModifyBoundingBoxCallback> _bboxCB;
const FrameClock* _clock;
osg::ref_ptr<TextureArena> _textures;
Expand Down
1 change: 0 additions & 1 deletion src/osgEarthDrivers/engine_rex/EngineContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ EngineContext::EngineContext(
_tilesLastCull(0),
_clock(clock)
{
_expirationRange2 = _options.getMinExpiryRange() * _options.getMinExpiryRange();
_bboxCB = new ModifyBoundingBoxCallback(this);

// create a bindless texture arena and set it to automatically
Expand Down
37 changes: 34 additions & 3 deletions src/osgEarthImGui/TerrainGUI
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ namespace osgEarth
return;
}

static unsigned u32_one = 1;

auto options = _mapNode->getTerrainOptions();

if (ImGuiLTable::Begin("terraingui"))
Expand Down Expand Up @@ -111,8 +113,7 @@ namespace osgEarth
visible_cb->setVisible(terrain_visible);
}

static int max_max_lod = -1;
static unsigned u32_one = 1;
static int max_max_lod = -1;
unsigned max_lod = options.getMaxLOD();
if (max_max_lod < 0) max_max_lod = max_lod;
if (ImGuiLTable::InputScalar("Max LOD", ImGuiDataType_U32, &max_lod, &u32_one, nullptr, "%u"))
Expand Down Expand Up @@ -152,6 +153,36 @@ namespace osgEarth
engine->dirtyTerrainOptions();
}

// Expiration options
ImGui::Separator();
unsigned int minExpiryFrames = options.getMinExpiryFrames();
if (ImGuiLTable::InputScalar("Min Expiry Frames", ImGuiDataType_U32, &minExpiryFrames, &u32_one, nullptr, "%u"))
{
options.setMinExpiryFrames(minExpiryFrames);
engine->dirtyTerrainOptions();
}

float minExpiryTime = options.getMinExpiryTime();
if (ImGuiLTable::InputFloat("Min Expiry Time", &minExpiryTime))
{
options.setMinExpiryTime(minExpiryTime);
engine->dirtyTerrainOptions();
}

float minExpiryRange = options.getMinExpiryRange();
if (ImGuiLTable::InputFloat("Min Expiry Range", &minExpiryRange))
{
options.setMinExpiryRange(minExpiryRange);
engine->dirtyTerrainOptions();
}

unsigned int maxTilesToUnloadPerFrame = options.getMaxTilesToUnloadPerFrame();
if (ImGuiLTable::InputScalar("Max Tiles to Unload", ImGuiDataType_U32, &maxTilesToUnloadPerFrame, &u32_one, nullptr, "%u"))
{
options.setMaxTilesToUnloadPerFrame(maxTilesToUnloadPerFrame);
engine->dirtyTerrainOptions();
}

if (GLUtils::useNVGL())
{
unsigned maxTex = options.getMaxTextureSize();
Expand Down Expand Up @@ -269,7 +300,7 @@ namespace osgEarth
_sample = _sampler->getSample(mp);
_ax = _x, _ay = _y;
}
}
}

ImGui::Separator();

Expand Down

0 comments on commit fe72a70

Please sign in to comment.