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 <alexander.bock@liu.se>
This commit is contained in:
Mathis Brossier
2025-06-14 16:12:44 +02:00
committed by GitHub
parent 430a93ddda
commit 28929da822
10 changed files with 66 additions and 47 deletions

6
.gitignore vendored
View File

@@ -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

View File

@@ -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 ()
##########################################################################################

View File

@@ -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 {

View File

@@ -194,7 +194,11 @@ void DisplayWindowUnion::initialize(const std::vector<QRect>& 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) {

View File

@@ -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<ProjectionIndices>(_projectionType->currentIndex())) {
case ProjectionIndices::Fisheye:
vp.projection = sgct::config::FisheyeProjection {
.fov = 180.f,
.fov = static_cast<float>(_fisheye.fov->value()),
.quality = Quality[_fisheye.quality->currentIndex()].first,
.tilt = static_cast<float>(_fisheye.tilt->value())
.tilt = static_cast<float>(_fisheye.tilt->value()),
};
break;
case ProjectionIndices::SphericalMirror:
@@ -881,9 +895,10 @@ void WindowControl::setProjectionPlanar(float hfov, float vfov) {
_projectionType->setCurrentIndex(static_cast<int>(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<int>(ProjectionIndices::Fisheye));
}

View File

@@ -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:

View File

@@ -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.
*/

View File

@@ -44,10 +44,8 @@
#include <openspace/util/touch.h>
#include <ghoul/glm.h>
#include <algorithm>
#include <math.h>
#include <mutex>
#include <numeric>
#include <vector>
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<TouchInput> takeInput();
std::vector<TouchInput> takeInputs();
std::vector<TouchInput> takeRemovals();
private:

View File

@@ -29,9 +29,22 @@
#include <openspace/rendering/renderengine.h>
#include <openspace/rendering/screenspacerenderable.h>
#include <ghoul/logging/logmanager.h>
#include <mutex>
using namespace TUIO;
namespace {
openspace::TouchInput touchInput(TuioCursor* tcur) {
return openspace::TouchInput(
static_cast<size_t>(tcur->getTuioSourceID()),
static_cast<size_t>(tcur->getCursorID()),
tcur->getX(),
tcur->getY(),
static_cast<double>(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<size_t>(tcur->getTuioSourceID()),
static_cast<size_t>(tcur->getCursorID()),
tcur->getX(),
tcur->getY(),
static_cast<double>(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<size_t>(tcur->getTuioSourceID()),
static_cast<size_t>(tcur->getCursorID()),
tcur->getX(),
tcur->getY(),
static_cast<double>(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<size_t>(tcur->getTuioSourceID()),
static_cast<size_t>(tcur->getCursorID()),
tcur->getX(),
tcur->getY(),
static_cast<double>(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<TouchInput> TuioEar::takeInput() {
std::vector<TouchInput> TuioEar::takeInputs() {
std::vector<TouchInput> outputList;
{
std::lock_guard lock(_mx);

View File

@@ -201,7 +201,7 @@ void TouchModule::internalInitialize(const ghoul::Dictionary&) {
bool TouchModule::processNewInput() {
// Get new input from listener
std::vector<TouchInput> earInputs = _ear->takeInput();
std::vector<TouchInput> earInputs = _ear->takeInputs();
std::vector<TouchInput> earRemovals = _ear->takeRemovals();
for (const TouchInput& input : earInputs) {