mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-04-29 23:39:26 -05:00
Fix warnings and coding style issues
This commit is contained in:
@@ -146,15 +146,19 @@ namespace {
|
||||
"" // @TODO Missing documentation
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo ZoomSensitivityDistanceThresholdInfo = {
|
||||
static const openspace::properties::Property::PropertyInfo
|
||||
ZoomSensitivityDistanceThresholdInfo = {
|
||||
"ZoomSensitivityDistanceThreshold",
|
||||
"Threshold of distance to target node for whether or not to use exponential zooming",
|
||||
"Threshold of distance to target node for whether or not to use exponential "
|
||||
"zooming",
|
||||
"" // @TODO Missing documentation
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo ZoomBoundarySphereMultiplierInfo = {
|
||||
static const openspace::properties::Property::PropertyInfo
|
||||
ZoomBoundarySphereMultiplierInfo = {
|
||||
"ZoomBoundarySphereMultiplier",
|
||||
"Multiplies a node's boundary sphere by this in order to limit zoom & prevent surface collision",
|
||||
"Multiplies a node's boundary sphere by this in order to limit zoom & prevent "
|
||||
"surface collision",
|
||||
"" // @TODO Missing documentation
|
||||
};
|
||||
|
||||
@@ -226,7 +230,12 @@ TouchInteraction::TouchInteraction()
|
||||
, _orbitSpeedThreshold(OrbitSpinningThreshold, 0.005f, 0.f, 0.01f)
|
||||
, _spinSensitivity(SpinningSensitivityInfo, 1.f, 0.f, 2.f)
|
||||
, _zoomSensitivity(ZoomSensitivityInfo, 1.025f, 1.0f, 1.1f)
|
||||
, _zoomSensitivityDistanceThreshold(ZoomSensitivityDistanceThresholdInfo, 0.05, 0.01, 0.25)
|
||||
, _zoomSensitivityDistanceThreshold(
|
||||
ZoomSensitivityDistanceThresholdInfo,
|
||||
0.05,
|
||||
0.01,
|
||||
0.25
|
||||
)
|
||||
, _zoomBoundarySphereMultiplier(ZoomBoundarySphereMultiplierInfo, 1.001, 1.0, 1.01)
|
||||
, _inputStillThreshold(InputSensitivityInfo, 0.0005f, 0.f, 0.001f)
|
||||
// used to void wrongly interpreted roll interactions
|
||||
@@ -252,8 +261,8 @@ TouchInteraction::TouchInteraction()
|
||||
0.f,
|
||||
1.f
|
||||
)
|
||||
, _ignoreGui(
|
||||
{ "Ignore GUI", "Disable GUI touch interaction", "" }, // @TODO Missing documentation
|
||||
, _ignoreGui( // @TODO Missing documentation
|
||||
{ "Ignore GUI", "Disable GUI touch interaction", "" },
|
||||
false
|
||||
)
|
||||
, _vel{ glm::dvec2(0.0), 0.0, 0.0, glm::dvec2(0.0) }
|
||||
@@ -582,9 +591,15 @@ void TouchInteraction::directControl(const std::vector<TuioCursor>& list) {
|
||||
[&sb](const TuioCursor& c) { return c.getSessionID() == sb.id; }
|
||||
);
|
||||
if (c != list.end()) {
|
||||
screenPoints.push_back(glm::dvec2(2 * (c->getX() - 0.5), -2 * (c->getY() - 0.5))); // normalized -1 to 1 coordinates on screen
|
||||
// normalized -1 to 1 coordinates on screen
|
||||
screenPoints.push_back(
|
||||
glm::dvec2(2 * (c->getX() - 0.5), -2 * (c->getY() - 0.5))
|
||||
);
|
||||
} else {
|
||||
OsEng.moduleEngine().module<ImGUIModule>()->touchInput = { 1, glm::dvec2(0.0, 0.0), 1 };
|
||||
OsEng.moduleEngine().module<ImGUIModule>()->touchInput = {
|
||||
1,
|
||||
glm::dvec2(0.0, 0.0), 1
|
||||
};
|
||||
resetAfterInput();
|
||||
return;
|
||||
}
|
||||
@@ -891,7 +906,10 @@ int TouchInteraction::interpretInteraction(const std::vector<TuioCursor>& list,
|
||||
}
|
||||
);
|
||||
|
||||
double normalizedCentroidDistance = glm::distance(_centroid, lastCentroid) / list.size();
|
||||
double normalizedCentroidDistance = glm::distance(
|
||||
_centroid,
|
||||
lastCentroid
|
||||
) / list.size();
|
||||
#ifdef TOUCH_DEBUG_PROPERTIES
|
||||
_debugProperties.normalizedCentroidDistance = normalizedCentroidDistance;
|
||||
_debugProperties.rollOn = rollOn;
|
||||
@@ -935,17 +953,22 @@ void TouchInteraction::computeVelocities(const std::vector<TuioCursor>& list,
|
||||
|
||||
#ifdef TOUCH_DEBUG_PROPERTIES
|
||||
const std::map<int, std::string> interactionNames = {
|
||||
{ROT, "Rotation"},
|
||||
{PINCH, "Pinch"},
|
||||
{PAN, "Pan"},
|
||||
{ROLL, "Roll"},
|
||||
{PICK, "Pick"}
|
||||
{ ROT, "Rotation" },
|
||||
{ PINCH, "Pinch" },
|
||||
{ PAN, "Pan" },
|
||||
{ ROLL, "Roll" },
|
||||
{ PICK, "Pick" }
|
||||
};
|
||||
_debugProperties.interpretedInteraction = interactionNames.at(action);
|
||||
|
||||
if (pinchConsecCt > 0 && action != PINCH) {
|
||||
if( pinchConsecCt > 3 )
|
||||
LINFO("PINCH_gesture_ended_with " << pinchConsecZoomFactor << " drag_distance_and " << pinchConsecCt << " counts.");
|
||||
if (pinchConsecCt > 3) {
|
||||
LDEBUG(fmt::format(
|
||||
"PINCH gesture ended with {} drag distance and {} counts",
|
||||
pinchConsecZoomFactor,
|
||||
pinchConsecCt
|
||||
));
|
||||
}
|
||||
pinchConsecCt = 0;
|
||||
pinchConsecZoomFactor = 0.0;
|
||||
}
|
||||
@@ -988,13 +1011,16 @@ void TouchInteraction::computeVelocities(const std::vector<TuioCursor>& list,
|
||||
glm::dvec3 centerPos = _focusNode->worldPosition();
|
||||
glm::dvec3 currDistanceToFocusNode = camPos - centerPos;
|
||||
|
||||
double distanceFromFocusSurface = length(currDistanceToFocusNode) - _focusNode->boundingSphere();
|
||||
double distanceFromFocusSurface =
|
||||
length(currDistanceToFocusNode) - _focusNode->boundingSphere();
|
||||
double zoomFactor = (distance - lastDistance);
|
||||
#ifdef TOUCH_DEBUG_PROPERTIES
|
||||
pinchConsecCt++;
|
||||
pinchConsecZoomFactor += zoomFactor;
|
||||
#endif
|
||||
if ((length(currDistanceToFocusNode) / distanceFromFocusSurface) > _zoomSensitivityDistanceThreshold) {
|
||||
if ((length(currDistanceToFocusNode) / distanceFromFocusSurface) >
|
||||
_zoomSensitivityDistanceThreshold)
|
||||
{
|
||||
zoomFactor *= pow(
|
||||
distanceFromFocusSurface,
|
||||
static_cast<float>(_zoomSensitivity)
|
||||
@@ -1184,10 +1210,14 @@ void TouchInteraction::step(double dt) {
|
||||
|
||||
#ifdef TOUCH_DEBUG_PROPERTIES
|
||||
//Show velocity status every N frames
|
||||
/*if (++stepVelUpdate >= 60) {
|
||||
if (++stepVelUpdate >= 60) {
|
||||
stepVelUpdate = 0;
|
||||
LINFO("DistToFocusNode " << length(centerToCamera) << " stepZoomVelUpdate " << _vel.zoom);
|
||||
}*/
|
||||
LINFO(fmt::format(
|
||||
"DistToFocusNode {} stepZoomVelUpdate {}",
|
||||
length(centerToCamera),
|
||||
_vel.zoom
|
||||
));
|
||||
}
|
||||
#endif
|
||||
|
||||
_tap = false;
|
||||
|
||||
Reference in New Issue
Block a user