From 4c1a1fc57b3147966bdc3188f2f803b9c3a0eab4 Mon Sep 17 00:00:00 2001 From: Alexander Bock Date: Mon, 16 Jun 2025 14:44:20 +0200 Subject: [PATCH] Update SGCT repository - Make it possible to offset the statistics window --- apps/OpenSpace/ext/sgct | 2 +- apps/OpenSpace/main.cpp | 3 +++ include/openspace/engine/windowdelegate.h | 1 + modules/debugging/debuggingmodule.cpp | 24 +++++++++++++++++++++-- modules/debugging/debuggingmodule.h | 2 ++ 5 files changed, 29 insertions(+), 3 deletions(-) diff --git a/apps/OpenSpace/ext/sgct b/apps/OpenSpace/ext/sgct index 37a9673a1e..1f9a78408b 160000 --- a/apps/OpenSpace/ext/sgct +++ b/apps/OpenSpace/ext/sgct @@ -1 +1 @@ -Subproject commit 37a9673a1e12494d71e8d20117060d392402d1af +Subproject commit 1f9a78408b7aff9af50f5582a2b1a3932f61864f diff --git a/apps/OpenSpace/main.cpp b/apps/OpenSpace/main.cpp index 65dde147e3..53f25245e2 100644 --- a/apps/OpenSpace/main.cpp +++ b/apps/OpenSpace/main.cpp @@ -1082,6 +1082,9 @@ void setSgctDelegateFunctions() { sgctDelegate.setStatisticsGraphScale = [](float scale) { sgct::Engine::instance().setStatsGraphScale(scale); }; + sgctDelegate.setStatisticsGraphOffset = [](glm::vec2 offset) { + sgct::Engine::instance().setStatsGraphOffset(sgct::vec2{ offset.x, offset.y }); + }; sgctDelegate.setMouseCursor = [](WindowDelegate::Cursor mouse) { static std::unordered_map Cursors = { { diff --git a/include/openspace/engine/windowdelegate.h b/include/openspace/engine/windowdelegate.h index 8a9cd1bf65..b71809cd4f 100644 --- a/include/openspace/engine/windowdelegate.h +++ b/include/openspace/engine/windowdelegate.h @@ -131,6 +131,7 @@ struct WindowDelegate { [](const glm::vec2&) { return glm::vec2(0); }; void (*setStatisticsGraphScale)(float scale) = [](float) {}; + void (*setStatisticsGraphOffset)(glm::vec2 offset) = [](glm::vec2) {}; void (*setMouseCursor)(Cursor cursor) = [](Cursor) {}; }; diff --git a/modules/debugging/debuggingmodule.cpp b/modules/debugging/debuggingmodule.cpp index 55df018e7e..5c8f24d1a5 100644 --- a/modules/debugging/debuggingmodule.cpp +++ b/modules/debugging/debuggingmodule.cpp @@ -62,9 +62,18 @@ namespace { constexpr openspace::properties::Property::PropertyInfo StatisticsScaleInfo = { "StatisticsScale", "Statistics Scale", - "This value is scaling the statatistics window by the provided amount. For flat " + "This value is scaling the statistics 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.", + "where the corners of the image are masked out.", + openspace::properties::Property::Visibility::AdvancedUser + }; + + constexpr openspace::properties::Property::PropertyInfo StatisticsOffsetInfo = { + "StatisticsOffset", + "Statistics Offset", + "This value is offsetting the center of the statistics window by the provided " + "amount. For flat projections this is rarely necessary, but it is important when " + "using a setup the center of the image is distorted in some form.", openspace::properties::Property::Visibility::AdvancedUser }; @@ -83,6 +92,12 @@ DebuggingModule::DebuggingModule() : OpenSpaceModule(Name) , _showStatistics(ShowStatisticsInfo, false) , _statisticsScale(StatisticsScaleInfo, 1.f, 0.f, 1.f) + , _statisticsOffset( + StatisticsOffsetInfo, + glm::vec2(0.f), + glm::vec2(-2.f), + glm::vec2(2.f) + ) , _showFrameInformation(ShowFrameNumberInfo, false) { _showStatistics.onChange([this]() { @@ -98,6 +113,11 @@ DebuggingModule::DebuggingModule() }); addProperty(_statisticsScale); + _statisticsOffset.onChange([this]() { + global::windowDelegate->setStatisticsGraphOffset(_statisticsOffset); + }); + addProperty(_statisticsOffset); + addProperty(_showFrameInformation); global::callback::render->push_back([this]() { diff --git a/modules/debugging/debuggingmodule.h b/modules/debugging/debuggingmodule.h index 1e7dfbfe69..cf513196a5 100644 --- a/modules/debugging/debuggingmodule.h +++ b/modules/debugging/debuggingmodule.h @@ -29,6 +29,7 @@ #include #include +#include #include namespace openspace { @@ -50,6 +51,7 @@ protected: private: properties::BoolProperty _showStatistics; properties::FloatProperty _statisticsScale; + properties::Vec2Property _statisticsOffset; properties::BoolProperty _showFrameInformation; std::shared_ptr _fontFrameInfo;