Add bool property to toggle follow anchor node rotation (#1839)

And make property title formatting more consistent

closes #1822
This commit is contained in:
Emma Broman
2022-01-18 14:08:26 +01:00
committed by GitHub
parent 2ed8113047
commit c89599ab64
2 changed files with 24 additions and 12 deletions

View File

@@ -148,6 +148,7 @@ private:
// Reset camera direction to the aim node.
properties::TriggerProperty _retargetAim;
properties::BoolProperty _followAnchorNodeRotation;
properties::FloatProperty _followAnchorNodeRotationDistance;
properties::FloatProperty _minimumAllowedDistance;

View File

@@ -134,24 +134,33 @@ namespace {
};
constexpr openspace::properties::Property::PropertyInfo FollowAnchorNodeInfo = {
"FollowAnchorNodeRotation",
"Follow Anchor Node Rotation",
"If true, the camera will rotate with the current achor node if within a "
"certain distance from it. When this happens, the object will appear fixed in "
"relation to the camera. The distance at which the change happens is controlled "
"through another property."
};
constexpr openspace::properties::Property::PropertyInfo
FollowAnchorNodeDistanceInfo = {
"FollowAnchorNodeRotationDistance",
"Follow anchor node rotation distance",
"Follow Anchor Node Rotation Distance",
"A factor used to determine the distance at which the camera starts rotating "
"with the anchor node. When this happends, a the object will appear fixed in "
"relation to the camera. The actual distance will be computed by multiplying "
"with the anchor node. The actual distance will be computed by multiplying "
"this factor with the approximate radius of the node."
};
constexpr openspace::properties::Property::PropertyInfo MinimumDistanceInfo = {
"MinimumAllowedDistance",
"Minimum allowed distance",
"Minimum Allowed Distance",
"Limits how close the camera can get to an object. The distance is given in "
"meters above the surface."
};
constexpr openspace::properties::Property::PropertyInfo VelocityZoomControlInfo = {
"VelocityZoomControl",
"Velocity zoom control",
"Velocity Zoom Control",
"Controls the velocity of the camera motion when zooming in to the focus node "
"on a linear flight. The higher the value the faster the camera will move "
"towards the focus."
@@ -180,7 +189,7 @@ namespace {
constexpr openspace::properties::Property::PropertyInfo
StereoInterpolationTimeInfo = {
"StereoInterpolationTime",
"Stereo interpolation time",
"Stereo Interpolation Time",
"The time to interpolate to a new stereoscopic depth "
"when the anchor node is changed, in seconds."
};
@@ -188,7 +197,7 @@ namespace {
constexpr openspace::properties::Property::PropertyInfo
RetargetInterpolationTimeInfo = {
"RetargetAnchorInterpolationTime",
"Retarget interpolation time",
"Retarget Interpolation Time",
"The time to interpolate the camera rotation "
"when the anchor or aim node is changed, in seconds."
};
@@ -196,13 +205,13 @@ namespace {
constexpr openspace::properties::Property::PropertyInfo
FollowRotationInterpTimeInfo = {
"FollowRotationInterpolationTime",
"Follow rotation interpolation time",
"Follow Rotation Interpolation Time",
"The interpolation time when toggling following focus node rotation."
};
constexpr openspace::properties::Property::PropertyInfo InvertMouseButtons = {
"InvertMouseButtons",
"Invert left and right mouse buttons",
"Invert Left and Right Mouse Buttons",
"If this value is 'false', the left mouse button causes the camera to rotate "
"around the object and the right mouse button causes the zooming motion. If this "
"value is 'true', these two functionalities are reversed."
@@ -229,7 +238,7 @@ namespace {
constexpr openspace::properties::Property::PropertyInfo
StereoscopicDepthOfFocusSurfaceInfo = {
"StereoscopicDepthOfFocusSurface",
"Stereoscopic depth of the surface in focus",
"Stereoscopic Depth of the Surface in Focus",
"Set the stereoscopically perceived distance (in meters) to the closest "
"point out of the surface of the anchor and the center of the aim node. "
"Only used if UseAdaptiveStereoscopicDepthInfo is set to true."
@@ -331,7 +340,8 @@ OrbitalNavigator::OrbitalNavigator()
, _aim(AimInfo)
, _retargetAnchor(RetargetAnchorInfo)
, _retargetAim(RetargetAimInfo)
, _followAnchorNodeRotationDistance(FollowAnchorNodeInfo, 5.f, 0.f, 20.f)
, _followAnchorNodeRotation(FollowAnchorNodeInfo, true)
, _followAnchorNodeRotationDistance(FollowAnchorNodeDistanceInfo, 5.f, 0.f, 20.f)
, _minimumAllowedDistance(MinimumDistanceInfo, 10.0f, 0.0f, 10000.f)
, _mouseSensitivity(MouseSensitivityInfo, 15.f, 1.f, 50.f)
, _joystickSensitivity(JoystickSensitivityInfo, 10.f, 1.0f, 50.f)
@@ -491,6 +501,7 @@ OrbitalNavigator::OrbitalNavigator()
addProperty(_aim);
addProperty(_retargetAnchor);
addProperty(_retargetAim);
addProperty(_followAnchorNodeRotation);
addProperty(_followAnchorNodeRotationDistance);
addProperty(_minimumAllowedDistance);
@@ -954,7 +965,7 @@ void OrbitalNavigator::setRetargetInterpolationTime(float durationInSeconds) {
bool OrbitalNavigator::shouldFollowAnchorRotation(const glm::dvec3& cameraPosition) const
{
if (!_anchorNode) {
if (!_anchorNode || !_followAnchorNodeRotation) {
return false;
}