make follow-rotation mode an absolute value

instead of proportional to interaction sphere of anchor node.
can be overridden by a node if one so wishes.
This commit is contained in:
Joakim Kilby
2024-02-02 10:23:16 +01:00
parent 0169c0ea3e
commit 5c1946d4f2
3 changed files with 25 additions and 1 deletions

View File

@@ -136,6 +136,8 @@ public:
double reachFactor() const;
double approachFactor() const;
double followRotationDistance() const;
bool supportsDirectInteraction() const;
SceneGraphNode* childNode(const std::string& id);
@@ -212,6 +214,7 @@ private:
properties::DoubleProperty _screenSizeRadius;
properties::FloatProperty _visibilityDistance;
properties::BoolProperty _supportsDirectInteraction;
properties::DoubleProperty _followRotationDistance;
// This variable is used for the rate-limiting of the screenspace positions (if they
// are calculated when _computeScreenSpaceValues is true)

View File

@@ -497,7 +497,7 @@ OrbitalNavigator::OrbitalNavigator()
, _retargetAnchor(RetargetAnchorInfo)
, _retargetAim(RetargetAimInfo)
, _followAnchorNodeRotation(FollowAnchorNodeInfo, true)
, _followAnchorNodeRotationDistance(FollowAnchorNodeDistanceInfo, 5.f, 0.f, 20.f)
, _followAnchorNodeRotationDistance(FollowAnchorNodeDistanceInfo, 5.f, 0.f, 20000.f)
, _disableZoom(DisableZoomInfo, false)
, _disableRoll(DisableRollInfo, false)
, _mouseSensitivity(MouseSensitivityInfo, 15.f, 1.f, 50.f)

View File

@@ -217,6 +217,16 @@ namespace {
openspace::properties::Property::Visibility::AdvancedUser
};
constexpr openspace::properties::Property::PropertyInfo FollowRotationDistanceInfo =
{
"FollowRotationDistance",
"Follow Rotation Distance",
"Distance within which the orbital navigator will follow along this nodes"
"rotation. A value less than zero means that the navigator will never follow"
"along with the nodes rotation.",
openspace::properties::Property::Visibility::AdvancedUser
};
struct [[codegen::Dictionary(SceneGraphNode)]] Parameters {
// The identifier of this scene graph node. This name must be unique among all
// scene graph nodes that are loaded in a specific scene. If a duplicate is
@@ -246,6 +256,9 @@ namespace {
// [[codegen::verbatim(SupportsDirectInteractionInfo.description)]]
std::optional<bool> supportsDirectInteraction;
// [[codegen::verbatim(FollowRotationDistanceInfo.description)]]
std::optional<double> followRotationDistance;
struct Transform {
// This node describes a translation that is applied to the scene graph node
// and all its children. Depending on the 'Type' of the translation, this can
@@ -401,6 +414,8 @@ ghoul::mm_unique_ptr<SceneGraphNode> SceneGraphNode::createFromDictionary(
result->_approachFactor = p.approachFactor.value_or(result->_approachFactor);
result->_reachFactor = p.reachFactor.value_or(result->_reachFactor);
result->_followRotationDistance = p.followRotationDistance.value_or(result->_followRotationDistance);
if (p.transform.has_value()) {
ZoneScopedN("Transform");
@@ -564,6 +579,7 @@ SceneGraphNode::SceneGraphNode()
, _visibilityDistance(VisibilityDistanceInfo, 6e10f)
, _supportsDirectInteraction(SupportsDirectInteractionInfo, false)
, _showDebugSphere(ShowDebugSphereInfo, false)
, _followRotationDistance(FollowRotationDistanceInfo, -1.0, -1.0)
{
addProperty(_computeScreenSpaceValues);
addProperty(_screenSpacePosition);
@@ -1293,6 +1309,11 @@ double SceneGraphNode::approachFactor() const {
return _approachFactor;
}
double SceneGraphNode::followRotationDistance() const
{
return _followRotationDistance;
}
bool SceneGraphNode::supportsDirectInteraction() const {
return _supportsDirectInteraction;
}