From 28929da82228583e2467f2d20e1ee14268147d2e Mon Sep 17 00:00:00 2001 From: Mathis Brossier Date: Sat, 14 Jun 2025 16:12:44 +0200 Subject: [PATCH] Miscellaneous changes (#3708) * Add fov input for fisheye projections in launcher * Updated gitignore to ignore more necessary files * Fixed typos * Replace `add_definitions` with `add_compile_options` in CMakeLists for /MP /bigobj, which are not preprocessor defs * Fixes in TuioEar: add `override`; replace erroneous `unique_lock` with `lock_guard`; minor refactor --------- Co-authored-by: Alexander Bock --- .gitignore | 6 +++ CMakeLists.txt | 2 +- .../launcher/include/sgctedit/windowcontrol.h | 3 +- .../src/sgctedit/displaywindowunion.cpp | 6 ++- .../launcher/src/sgctedit/windowcontrol.cpp | 21 +++++++-- include/openspace/engine/syncengine.h | 2 +- .../base/rendering/screenspaceframebuffer.h | 2 +- modules/touch/include/tuioear.h | 24 +++++----- modules/touch/src/tuioear.cpp | 45 +++++++++---------- modules/touch/touchmodule.cpp | 2 +- 10 files changed, 66 insertions(+), 47 deletions(-) diff --git a/.gitignore b/.gitignore index 46e1be12b5..730e80592f 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ *.dir *.idea/ .build-vs/ +.cache/ .cproject .project .vs/ @@ -13,6 +14,7 @@ CMakeFiles CMakeLists.txt.user cmake-build-* cmake_install.cmake +compile_commands.json install_manifest.txt Makefile @@ -33,11 +35,15 @@ Thumbs.db /user/ /sync/ /temp/ +GPUCache/ + # Customization is not supposed to be committed customization.lua + # The COMMIT info is generated everytime CMake is run COMMIT.md *_codegen.cpp + # SkyBrowser Module downloaded data /modules/skybrowser/wwtimagedata doc diff --git a/CMakeLists.txt b/CMakeLists.txt index 8ea6a5662a..2863dc30b1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -72,7 +72,7 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/bin) if (MSVC) # Force all builds to be multi-threaded and increase number of sections in obj files - add_definitions(/MP /bigobj) + add_compile_options(/MP /bigobj) endif () ########################################################################################## diff --git a/apps/OpenSpace/ext/launcher/include/sgctedit/windowcontrol.h b/apps/OpenSpace/ext/launcher/include/sgctedit/windowcontrol.h index a60b0fe86f..cc53ebc80c 100644 --- a/apps/OpenSpace/ext/launcher/include/sgctedit/windowcontrol.h +++ b/apps/OpenSpace/ext/launcher/include/sgctedit/windowcontrol.h @@ -130,7 +130,7 @@ public: * combobox index * \tilt The tilt of the fisheye in degrees */ - void setProjectionFisheye(int quality, float tilt); + void setProjectionFisheye(int quality, float tilt, float fov); /** * Sets the window's projection type to spherical mirror, with the accompanying @@ -235,6 +235,7 @@ private: QWidget* widget = nullptr; QComboBox* quality = nullptr; QDoubleSpinBox* tilt = nullptr; + QDoubleSpinBox* fov = nullptr; } _fisheye; struct { diff --git a/apps/OpenSpace/ext/launcher/src/sgctedit/displaywindowunion.cpp b/apps/OpenSpace/ext/launcher/src/sgctedit/displaywindowunion.cpp index 5d69a00042..6981cdd60a 100644 --- a/apps/OpenSpace/ext/launcher/src/sgctedit/displaywindowunion.cpp +++ b/apps/OpenSpace/ext/launcher/src/sgctedit/displaywindowunion.cpp @@ -194,7 +194,11 @@ void DisplayWindowUnion::initialize(const std::vector& monitorSizeList, }, [&](const sgct::config::FisheyeProjection& p) { if (p.quality.has_value()) { - wCtrl->setProjectionFisheye(*p.quality, p.tilt.value_or(0.f)); + wCtrl->setProjectionFisheye( + *p.quality, + p.tilt.value_or(0.f), + p.fov.value_or(180.0) + ); } }, [&](const sgct::config::PlanarProjection& p) { diff --git a/apps/OpenSpace/ext/launcher/src/sgctedit/windowcontrol.cpp b/apps/OpenSpace/ext/launcher/src/sgctedit/windowcontrol.cpp index 5dfdc3f8ae..de4c3a18e8 100644 --- a/apps/OpenSpace/ext/launcher/src/sgctedit/windowcontrol.cpp +++ b/apps/OpenSpace/ext/launcher/src/sgctedit/windowcontrol.cpp @@ -498,6 +498,7 @@ QWidget* WindowControl::createFisheyeWidget() { // | { Informational text } | Row 0 // | Quality * [DDDDD>] | Row 1 // | Tilt * [oooooo] | Row 2 + // | FOV * [oooooo] | Row 3 // *------------*-----------* QWidget* widget = new QWidget; @@ -540,6 +541,18 @@ QWidget* WindowControl::createFisheyeWidget() { _fisheye.tilt->setMaximum(180.0); layout->addWidget(_fisheye.tilt, 2, 1); + QLabel* labelFov = new QLabel("FOV"); + const QString fovTip = "Set the fisheye/dome field-of-view angle used in the fisheye " + "renderer."; + labelFov->setToolTip(fovTip); + layout->addWidget(labelFov, 3, 0); + + _fisheye.fov = new QDoubleSpinBox; + _fisheye.fov->setToolTip(fovTip); + _fisheye.fov->setMinimum(0.0); + _fisheye.fov->setMaximum(360.0); + layout->addWidget(_fisheye.fov, 3, 1); + return widget; } @@ -743,6 +756,7 @@ void WindowControl::resetToDefaults() { _cylindrical.heightOffset->setValue(DefaultHeightOffset); _fisheye.quality->setCurrentIndex(2); _fisheye.tilt->setValue(0.0); + _fisheye.fov->setValue(180.0); _sphericalMirror.quality->setCurrentIndex(2); _cylindrical.quality->setCurrentIndex(2); _equirectangular.quality->setCurrentIndex(2); @@ -823,9 +837,9 @@ void WindowControl::generateWindowInformation(sgct::config::Window& window) cons switch (static_cast(_projectionType->currentIndex())) { case ProjectionIndices::Fisheye: vp.projection = sgct::config::FisheyeProjection { - .fov = 180.f, + .fov = static_cast(_fisheye.fov->value()), .quality = Quality[_fisheye.quality->currentIndex()].first, - .tilt = static_cast(_fisheye.tilt->value()) + .tilt = static_cast(_fisheye.tilt->value()), }; break; case ProjectionIndices::SphericalMirror: @@ -881,9 +895,10 @@ void WindowControl::setProjectionPlanar(float hfov, float vfov) { _projectionType->setCurrentIndex(static_cast(ProjectionIndices::Planar)); } -void WindowControl::setProjectionFisheye(int quality, float tilt) { +void WindowControl::setProjectionFisheye(int quality, float tilt, float fov) { _fisheye.quality->setCurrentIndex(indexForQuality(quality)); _fisheye.tilt->setValue(tilt); + _fisheye.fov->setValue(fov); _projectionType->setCurrentIndex(static_cast(ProjectionIndices::Fisheye)); } diff --git a/include/openspace/engine/syncengine.h b/include/openspace/engine/syncengine.h index d4516bfb43..d26907f22e 100644 --- a/include/openspace/engine/syncengine.h +++ b/include/openspace/engine/syncengine.h @@ -37,7 +37,7 @@ class Syncable; /** * Manages a collection of `Syncable`s and ensures they are synchronized over SGCT nodes. - * Encoding/Decoding order is handles internally. + * Encoding/Decoding order is handled internally. */ class SyncEngine { public: diff --git a/modules/base/rendering/screenspaceframebuffer.h b/modules/base/rendering/screenspaceframebuffer.h index 87294fa72d..ec0c7be83d 100644 --- a/modules/base/rendering/screenspaceframebuffer.h +++ b/modules/base/rendering/screenspaceframebuffer.h @@ -40,7 +40,7 @@ namespace documentation { struct Documentation; } /** * Creates a texture by rendering to a framebuffer, this is then used on a screen space - * plane. This class lets you ass renderfunctions that should render to a framebuffer with + * plane. This class lets you add renderfunctions that should render to a framebuffer with * an attached texture. The texture is then used on a screen space plane that works both * in fisheye and flat screens. */ diff --git a/modules/touch/include/tuioear.h b/modules/touch/include/tuioear.h index f7b5441a44..a2db75f503 100644 --- a/modules/touch/include/tuioear.h +++ b/modules/touch/include/tuioear.h @@ -44,10 +44,8 @@ #include #include -#include #include #include -#include #include namespace openspace { @@ -60,24 +58,24 @@ public: /** * Callback functions, listens to the TUIO server. */ - void addTuioObject(TUIO::TuioObject *tobj); - void updateTuioObject(TUIO::TuioObject *tobj); - void removeTuioObject(TUIO::TuioObject *tobj); + void addTuioObject(TUIO::TuioObject* tobj) override; + void updateTuioObject(TUIO::TuioObject* tobj) override; + void removeTuioObject(TUIO::TuioObject* tobj) override; - void addTuioCursor(TUIO::TuioCursor *tcur); - void updateTuioCursor(TUIO::TuioCursor *tcur); - void removeTuioCursor(TUIO::TuioCursor *tcur); + void addTuioCursor(TUIO::TuioCursor* tcur) override; + void updateTuioCursor(TUIO::TuioCursor* tcur) override; + void removeTuioCursor(TUIO::TuioCursor* tcur) override; - void addTuioBlob(TUIO::TuioBlob *tblb); - void updateTuioBlob(TUIO::TuioBlob *tblb); - void removeTuioBlob(TUIO::TuioBlob *tblb); + void addTuioBlob(TUIO::TuioBlob* tblb) override; + void updateTuioBlob(TUIO::TuioBlob* tblb) override; + void removeTuioBlob(TUIO::TuioBlob* tblb) override; - void refresh(TUIO::TuioTime frameTime); + void refresh(TUIO::TuioTime frameTime) override; /** * Lock-swap the containers of this listener. */ - std::vector takeInput(); + std::vector takeInputs(); std::vector takeRemovals(); private: diff --git a/modules/touch/src/tuioear.cpp b/modules/touch/src/tuioear.cpp index de92a990dc..9173ff0295 100644 --- a/modules/touch/src/tuioear.cpp +++ b/modules/touch/src/tuioear.cpp @@ -29,9 +29,22 @@ #include #include #include +#include using namespace TUIO; +namespace { + openspace::TouchInput touchInput(TuioCursor* tcur) { + return openspace::TouchInput( + static_cast(tcur->getTuioSourceID()), + static_cast(tcur->getCursorID()), + tcur->getX(), + tcur->getY(), + static_cast(tcur->getTuioTime().getTotalMilliseconds()) / 1000.0 + ); + } +} // namespace + namespace openspace { void TuioEar::addTuioObject(TuioObject*) {} @@ -41,37 +54,19 @@ void TuioEar::updateTuioObject(TuioObject*) {} void TuioEar::removeTuioObject(TuioObject*) {} void TuioEar::addTuioCursor(TuioCursor* tcur) { - std::unique_lock lock(_mx); - _inputList.emplace_back( - static_cast(tcur->getTuioSourceID()), - static_cast(tcur->getCursorID()), - tcur->getX(), - tcur->getY(), - static_cast(tcur->getTuioTime().getTotalMilliseconds()) / 1000.0 - ); + std::lock_guard lock(_mx); + _inputList.push_back(touchInput(tcur)); } void TuioEar::updateTuioCursor(TuioCursor* tcur) { - std::unique_lock lock(_mx); - _inputList.emplace_back( - static_cast(tcur->getTuioSourceID()), - static_cast(tcur->getCursorID()), - tcur->getX(), - tcur->getY(), - static_cast(tcur->getTuioTime().getTotalMilliseconds()) / 1000.0 - ); + std::lock_guard lock(_mx); + _inputList.push_back(touchInput(tcur)); } // save id to be removed and remove it in clearInput void TuioEar::removeTuioCursor(TuioCursor* tcur) { - std::unique_lock lock(_mx); - _removalList.emplace_back( - static_cast(tcur->getTuioSourceID()), - static_cast(tcur->getCursorID()), - tcur->getX(), - tcur->getY(), - static_cast(tcur->getTuioTime().getTotalMilliseconds()) / 1000.0 - ); + std::lock_guard lock(_mx); + _removalList.push_back(touchInput(tcur)); } void TuioEar::addTuioBlob(TuioBlob*) {} @@ -82,7 +77,7 @@ void TuioEar::removeTuioBlob(TuioBlob*) {} void TuioEar::refresh(TuioTime) {} // about every 15ms -std::vector TuioEar::takeInput() { +std::vector TuioEar::takeInputs() { std::vector outputList; { std::lock_guard lock(_mx); diff --git a/modules/touch/touchmodule.cpp b/modules/touch/touchmodule.cpp index 2b4c7b09a3..5832054dc5 100644 --- a/modules/touch/touchmodule.cpp +++ b/modules/touch/touchmodule.cpp @@ -201,7 +201,7 @@ void TouchModule::internalInitialize(const ghoul::Dictionary&) { bool TouchModule::processNewInput() { // Get new input from listener - std::vector earInputs = _ear->takeInput(); + std::vector earInputs = _ear->takeInputs(); std::vector earRemovals = _ear->takeRemovals(); for (const TouchInput& input : earInputs) {