Add the ability to scale th statistics graphs

This commit is contained in:
Alexander Bock
2024-06-26 21:12:09 -04:00
parent fcba068aca
commit 78e7c7e321
5 changed files with 25 additions and 1 deletions
+3
View File
@@ -992,6 +992,9 @@ void setSgctDelegateFunctions() {
return mousePosition;
};
sgctDelegate.setStatisticsGraphScale = [](float scale) {
sgct::Engine::instance().setStatsGraphScale(scale);
};
}
std::string setWindowConfigPresetForGui(const std::string& labelFromCfgFile,
@@ -124,6 +124,8 @@ struct WindowDelegate {
glm::vec2 (*mousePositionViewportRelative)(const glm::vec2& mousePosition) =
[](const glm::vec2&) { return glm::vec2(0); };
void (*setStatisticsGraphScale)(float scale) = [](float) {};
};
} // namespace openspace
@@ -187,6 +187,7 @@ private:
properties::IntListProperty _screenshotWindowIds;
properties::BoolProperty _applyWarping;
properties::BoolProperty _showStatistics;
properties::FloatProperty _statisticsScale;
properties::BoolProperty _screenshotUseDate;
properties::BoolProperty _showFrameInformation;
properties::BoolProperty _disableMasterRendering;
+18
View File
@@ -146,6 +146,15 @@ namespace {
openspace::properties::Property::Visibility::AdvancedUser
};
constexpr openspace::properties::Property::PropertyInfo StatisticsScaleInfo = {
"StatisticsScale",
"Statistics Scale",
"This value is scaling the statatistics window by the provided amount. For flat "
"projections this is rarely necessary, but it is important when using a setup "
"where the cornders of the image are masked out.",
openspace::properties::Property::Visibility::AdvancedUser
};
constexpr openspace::properties::Property::PropertyInfo ScreenshotUseDateInfo = {
"ScreenshotUseDate",
"Screenshot Folder uses Date",
@@ -313,6 +322,7 @@ RenderEngine::RenderEngine()
, _screenshotWindowIds(ScreenshotWindowIdsInfo)
, _applyWarping(ApplyWarpingInfo, false)
, _showStatistics(ShowStatisticsInfo, false)
, _statisticsScale(StatisticsScaleInfo, 1.f, 0.f, 1.f)
, _screenshotUseDate(ScreenshotUseDateInfo, false)
, _showFrameInformation(ShowFrameNumberInfo, false)
, _disableMasterRendering(DisableMasterInfo, false)
@@ -387,9 +397,17 @@ RenderEngine::RenderEngine()
_showStatistics.onChange([this]() {
global::windowDelegate->showStatistics(_showStatistics);
// We need to reset the scale as it is not updated when the statistics window is
// not currently shown
global::windowDelegate->setStatisticsGraphScale(_statisticsScale);
});
addProperty(_showStatistics);
_statisticsScale.onChange([this]() {
global::windowDelegate->setStatisticsGraphScale(_statisticsScale);
});
addProperty(_statisticsScale);
_screenshotUseDate.onChange([this]() {
// If there is no screenshot folder, don't bother with handling the change
if (!FileSys.hasRegisteredToken("${STARTUP_SCREENSHOT}")) {