mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-03 18:19:38 -06:00
Added exponential zoom for faster zoom with increased distance from focus node
This commit is contained in:
@@ -172,6 +172,7 @@ private:
|
||||
properties::FloatProperty _rollAngleThreshold;
|
||||
properties::FloatProperty _orbitSpeedThreshold;
|
||||
properties::FloatProperty _spinSensitivity;
|
||||
properties::FloatProperty _zoomSensitivity;
|
||||
properties::FloatProperty _inputStillThreshold;
|
||||
properties::FloatProperty _centroidStillThreshold;
|
||||
properties::FloatProperty _interpretPan;
|
||||
|
||||
@@ -142,6 +142,12 @@ namespace {
|
||||
"" // @TODO Missing documentation
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo ZoomSensitivityInfo = {
|
||||
"ZoomSensitivity",
|
||||
"Sensitivity of exponential zooming in relation to distance from focus node",
|
||||
"" // @TODO Missing documentation
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo InputSensitivityInfo = {
|
||||
"InputSensitivity",
|
||||
"Threshold for interpreting input as still",
|
||||
@@ -203,6 +209,7 @@ TouchInteraction::TouchInteraction()
|
||||
, _rollAngleThreshold(RollThresholdInfo, 0.025f, 0.f, 0.05f)
|
||||
, _orbitSpeedThreshold(OrbitSpinningThreshold, 0.005f, 0.f, 0.01f)
|
||||
, _spinSensitivity(SpinningSensitivityInfo, 1.f, 0.f, 2.f)
|
||||
, _zoomSensitivity(ZoomSensitivityInfo, 1.04f, 1.0f, 1.1f)
|
||||
, _inputStillThreshold(InputSensitivityInfo, 0.0005f, 0.f, 0.001f)
|
||||
// used to void wrongly interpreted roll interactions
|
||||
, _centroidStillThreshold(StationaryCentroidInfo, 0.0018f, 0.f, 0.01f)
|
||||
@@ -260,6 +267,7 @@ TouchInteraction::TouchInteraction()
|
||||
addProperty(_rollAngleThreshold);
|
||||
addProperty(_orbitSpeedThreshold);
|
||||
addProperty(_spinSensitivity);
|
||||
addProperty(_zoomSensitivity);
|
||||
addProperty(_inputStillThreshold);
|
||||
addProperty(_centroidStillThreshold);
|
||||
addProperty(_interpretPan);
|
||||
@@ -947,8 +955,8 @@ void TouchInteraction::computeVelocities(const std::vector<TuioCursor>& list,
|
||||
) / lastProcessed.size();
|
||||
|
||||
double zoomFactor = (distance - lastDistance) *
|
||||
(glm::distance(_camera->positionVec3(), _camera->focusPositionVec3()) -
|
||||
_focusNode->boundingSphere());
|
||||
pow((glm::distance(_camera->positionVec3(), _camera->focusPositionVec3()) -
|
||||
_focusNode->boundingSphere()), (float)_zoomSensitivity);
|
||||
_vel.zoom += zoomFactor * _sensitivity.zoom *
|
||||
std::max(_touchScreenSize.value() * 0.1, 1.0);
|
||||
break;
|
||||
@@ -1257,6 +1265,7 @@ void TouchInteraction::resetToDefault() {
|
||||
_rollAngleThreshold.set(0.025f);
|
||||
_orbitSpeedThreshold.set(0.005f);
|
||||
_spinSensitivity.set(1.0f);
|
||||
_zoomSensitivity.set(10.f);
|
||||
_inputStillThreshold.set(0.0005f);
|
||||
_centroidStillThreshold.set(0.0018f);
|
||||
_interpretPan.set(0.015f);
|
||||
|
||||
Reference in New Issue
Block a user