mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-04-22 19:29:04 -05:00
Add strict test for whitespace at end of line
More work on coding style
This commit is contained in:
@@ -72,7 +72,7 @@ public:
|
||||
std::vector<glm::dvec3> selectedPoints;
|
||||
std::vector<glm::dvec2> screenPoints;
|
||||
int nDOF;
|
||||
glm::dvec2(*castToNDC)(glm::dvec3, Camera&, SceneGraphNode*);
|
||||
glm::dvec2(*castToNDC)(const glm::dvec3&, Camera&, SceneGraphNode*);
|
||||
double(*distToMinimize)(double* par, int x, void* fdata, LMstat* lmstat);
|
||||
Camera* camera;
|
||||
SceneGraphNode* node;
|
||||
@@ -86,12 +86,12 @@ public:
|
||||
* 3 Continues if GUI isn't on
|
||||
* 4 If the node in focus is large enough and all contact points have selected it,
|
||||
* calls directControl() function for direct-manipulation
|
||||
* 5 Updates std::vector<SelectedBody> _selected (only if LMA successfully
|
||||
* 5 Updates std::vector<SelectedBody> _selected (only if LMA successfully
|
||||
* converged, avoids interaction to snap on LMA fails)
|
||||
* 6 If directControl() wasn't called this frame, interpret the incoming
|
||||
* 6 If directControl() wasn't called this frame, interpret the incoming
|
||||
* list and decide what type of interaction this frame should do
|
||||
* 7 Compute the new total velocities after interaction
|
||||
* 8 Evaluate if directControl should be called next frame- true if all contact points
|
||||
* 8 Evaluate if directControl should be called next frame- true if all contact points
|
||||
* select the same node and said node is larger than _nodeRadiusThreshold
|
||||
*/
|
||||
void updateStateFromInput(const std::vector<TUIO::TuioCursor>& list,
|
||||
@@ -100,10 +100,10 @@ public:
|
||||
// Calculates the new camera state with velocities and time since last frame
|
||||
void step(double dt);
|
||||
|
||||
// Used to save LMA data for one frame if the user chose to
|
||||
// Used to save LMA data for one frame if the user chose to
|
||||
void unitTest();
|
||||
|
||||
// Called each frame we have no new input, used to reset data
|
||||
// Called each frame we have no new input, used to reset data
|
||||
void resetAfterInput();
|
||||
|
||||
// Sets _tap to true, called if tap occured current frame (called from touchmodule)
|
||||
@@ -125,7 +125,7 @@ private:
|
||||
bool guiMode(const std::vector<TUIO::TuioCursor>& list);
|
||||
|
||||
/* Function that calculates the new camera state such that it minimizes the L2 error
|
||||
* in screenspace
|
||||
* in screenspace
|
||||
* between contact points and surface coordinates projected to clip space using LMA
|
||||
*/
|
||||
void directControl(const std::vector<TUIO::TuioCursor>& list);
|
||||
@@ -136,7 +136,7 @@ private:
|
||||
*/
|
||||
void findSelectedNode(const std::vector<TUIO::TuioCursor>& list);
|
||||
|
||||
/* Returns an int (ROT = 0, PINCH, PAN, ROLL, PICK) for what interaction to be used,
|
||||
/* Returns an int (ROT = 0, PINCH, PAN, ROLL, PICK) for what interaction to be used,
|
||||
* depending on what input was gotten
|
||||
*/
|
||||
int interpretInteraction(const std::vector<TUIO::TuioCursor>& list,
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -34,18 +34,46 @@
|
||||
namespace {
|
||||
const std::string _loggerCat = "TouchMarker";
|
||||
const int MAX_FINGERS = 20;
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo VisibilityInfo = {
|
||||
"Visibility",
|
||||
"Toggle visibility of markers",
|
||||
"" // @TODO Missing documentation
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo RadiusInfo = {
|
||||
"Size",
|
||||
"Marker radius",
|
||||
"" // @TODO Missing documentation
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo TransparencyInfo = {
|
||||
"Transparency",
|
||||
"Marker transparency",
|
||||
"" // @TODO Missing documentation
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo ThicknessInfo = {
|
||||
"Thickness",
|
||||
"Marker thickness",
|
||||
"" // @TODO Missing documentation
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo ColorInfo = {
|
||||
"MarkerColor", "Marker color", "" // @TODO Missing documentation
|
||||
};
|
||||
} // namespace
|
||||
|
||||
namespace openspace {
|
||||
|
||||
TouchMarker::TouchMarker()
|
||||
: properties::PropertyOwner({ "TouchMarker" })
|
||||
, _visible({ "TouchMarkers visible", "Toggle visibility of markers", "" }, true) // @TODO Missing documentation
|
||||
, _radiusSize({ "Marker size", "Marker radius", "" }, 30.f, 0.f, 100.f) // @TODO Missing documentation
|
||||
, _transparency({ "Transparency of marker", "Marker transparency", "" }, 0.8f, 0.f, 1.f) // @TODO Missing documentation
|
||||
, _thickness({ "Thickness of marker", "Marker thickness", "" }, 2.f, 0.f, 4.f) // @TODO Missing documentation
|
||||
, _visible(VisibilityInfo, true)
|
||||
, _radiusSize(RadiusInfo, 30.f, 0.f, 100.f)
|
||||
, _transparency(TransparencyInfo, 0.8f, 0.f, 1.f)
|
||||
, _thickness(ThicknessInfo, 2.f, 0.f, 4.f )
|
||||
, _color(
|
||||
{ "MarkerColor", "Marker color", "" }, // @TODO Missing documentation
|
||||
ColorInfo,
|
||||
glm::vec3(204.f / 255.f, 51.f / 255.f, 51.f / 255.f),
|
||||
glm::vec3(0.f),
|
||||
glm::vec3(1.f)
|
||||
|
||||
@@ -44,7 +44,8 @@ void TuioEar::removeTuioObject(TuioObject*) { }
|
||||
void TuioEar::addTuioCursor(TuioCursor* tcur) {
|
||||
_mx.lock();
|
||||
_tap = false;
|
||||
// find same id in _list if it exists in _removeList (new input with same ID as a previously stored)
|
||||
// find same id in _list if it exists in _removeList (new input with same ID as a
|
||||
// previously stored)
|
||||
int i = tcur->getSessionID();
|
||||
std::vector<int>::iterator foundID = std::find_if(
|
||||
_removeList.begin(),
|
||||
@@ -93,7 +94,10 @@ void TuioEar::removeTuioCursor(TuioCursor* tcur) {
|
||||
}
|
||||
dist /= tcur->getPath().size();
|
||||
|
||||
double heldTime = tcur->getPath().back().getTuioTime().getTotalMilliseconds() - tcur->getPath().front().getTuioTime().getTotalMilliseconds();
|
||||
double heldTime =
|
||||
tcur->getPath().back().getTuioTime().getTotalMilliseconds() -
|
||||
tcur->getPath().front().getTuioTime().getTotalMilliseconds();
|
||||
|
||||
if (heldTime < 180 && dist < 0.0004 && _list.size() == 1 && _removeList.size() == 1) {
|
||||
_tapCo = TuioCursor(*tcur);
|
||||
_tap = true;
|
||||
|
||||
@@ -46,7 +46,8 @@ bool TouchModule::hasNewInput() {
|
||||
// Get new input from listener
|
||||
listOfContactPoints = ear.getInput();
|
||||
ear.clearInput();
|
||||
touch.touchActive(!listOfContactPoints.empty()); // Set touch property to active (to void mouse input, mainly for mtdev bridges)
|
||||
// Set touch property to active (to void mouse input, mainly for mtdev bridges)
|
||||
touch.touchActive(!listOfContactPoints.empty());
|
||||
|
||||
// Erase old input id's that no longer exists
|
||||
lastProcessed.erase(
|
||||
@@ -73,14 +74,25 @@ bool TouchModule::hasNewInput() {
|
||||
}
|
||||
|
||||
// Return true if we got new input
|
||||
if (listOfContactPoints.size() == lastProcessed.size() && !listOfContactPoints.empty()) {
|
||||
if (listOfContactPoints.size() == lastProcessed.size() &&
|
||||
!listOfContactPoints.empty())
|
||||
{
|
||||
bool newInput = true;
|
||||
// go through list and check if the last registrered time is newer than the one in lastProcessed (last frame)
|
||||
std::for_each(lastProcessed.begin(), lastProcessed.end(), [this, &newInput](Point& p) {
|
||||
std::vector<TuioCursor>::iterator cursor = std::find_if(listOfContactPoints.begin(), listOfContactPoints.end(),
|
||||
[&p](const TuioCursor& c) { return c.getSessionID() == p.first; });
|
||||
// go through list and check if the last registrered time is newer than the one in
|
||||
// lastProcessed (last frame)
|
||||
std::for_each(
|
||||
lastProcessed.begin(),
|
||||
lastProcessed.end(),
|
||||
[this, &newInput](Point& p) {
|
||||
std::vector<TuioCursor>::iterator cursor = std::find_if(
|
||||
listOfContactPoints.begin(),
|
||||
listOfContactPoints.end(),
|
||||
[&p](const TuioCursor& c) { return c.getSessionID() == p.first; }
|
||||
);
|
||||
double now = cursor->getPath().back().getTuioTime().getTotalMilliseconds();
|
||||
if (!cursor->isMoving()) { // if current cursor isn't moving, we want to interpret that as new input for interaction purposes
|
||||
if (!cursor->isMoving()) {
|
||||
// if current cursor isn't moving, we want to interpret that as new input
|
||||
// for interaction purposes
|
||||
newInput = true;
|
||||
}
|
||||
else if (p.second.getTuioTime().getTotalMilliseconds() == now) {
|
||||
@@ -134,16 +146,20 @@ TouchModule::TouchModule()
|
||||
for (const TuioCursor& c : listOfContactPoints) {
|
||||
lastProcessed.emplace_back(c.getSessionID(), c.getPath().back());
|
||||
}
|
||||
touch.unitTest(); // used to save data from solver, only calculated for one frame when user chooses in GUI
|
||||
touch.step(OsEng.windowWrapper().deltaTime()); // calculate the new camera state for this frame
|
||||
// used to save data from solver, only calculated for one frame when user chooses
|
||||
// in GUI
|
||||
touch.unitTest();
|
||||
// calculate the new camera state for this frame
|
||||
touch.step(OsEng.windowWrapper().deltaTime());
|
||||
}
|
||||
);
|
||||
|
||||
OsEng.registerModuleCallback(
|
||||
OpenSpaceEngine::CallbackOption::Render,
|
||||
[&]() {
|
||||
markers.render(listOfContactPoints); // render markers, customizable through the GUI
|
||||
}
|
||||
// render markers, customizable through the GUI
|
||||
markers.render(listOfContactPoints);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user