mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-05 19:19:39 -06:00
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:
@@ -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.
|
||||
*/
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user