mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-03-12 16:28:36 -05:00
And yet more (remove some setting that was used for testing)
This commit is contained in:
@@ -56,14 +56,6 @@ namespace {
|
||||
"If disabled, roll is removed from the interpolation of camera orientation."
|
||||
};
|
||||
|
||||
constexpr openspace::properties::Property::PropertyInfo StopAtTargetsPerDefaultInfo = {
|
||||
"StopAtTargetsPerDefault",
|
||||
"Stop At Targets Per Default",
|
||||
"Applied during path creation. If enabled, stops are automatically added "
|
||||
"between the path segments. The user must then choose to continue the path "
|
||||
"after reaching a target"
|
||||
};
|
||||
|
||||
constexpr openspace::properties::Property::PropertyInfo DefaultStopBehaviorInfo = {
|
||||
"DefaultStopBehavior",
|
||||
"Default Stop Behavior",
|
||||
@@ -85,28 +77,6 @@ namespace {
|
||||
"when avoiding collisions."
|
||||
};
|
||||
|
||||
constexpr openspace::properties::Property::PropertyInfo DefaultPositionOffsetAngleInfo = {
|
||||
"DefaultPositionOffsetAngle",
|
||||
"Default Position Offset Angle",
|
||||
"Used for creating a default position at a target node. The angle (in degrees) "
|
||||
"specifies the deviation from the line connecting the target node and the sun, "
|
||||
"in the direction of the camera position at the start of the path."
|
||||
};
|
||||
|
||||
constexpr openspace::properties::Property::PropertyInfo PickClosestTargetPosInfo = {
|
||||
"PickClosestTargetPosition",
|
||||
"Pick Closest Target Position",
|
||||
"If this flag is set to two the target position for a node based motion is "
|
||||
"computed along the line from the previous camera position."
|
||||
};
|
||||
|
||||
constexpr openspace::properties::Property::PropertyInfo IntegrationResolutionInfo = {
|
||||
"IntegrationResolution",
|
||||
"Path Integration Resolution",
|
||||
"The number of steps used to integrate along the spline curve every frame. A "
|
||||
"larger number increases the precision, at the cost of reduced efficiency."
|
||||
};
|
||||
|
||||
constexpr openspace::properties::Property::PropertyInfo SpeedScaleInfo = {
|
||||
"SpeedScale",
|
||||
"Speed Scale",
|
||||
@@ -130,9 +100,6 @@ AutoNavigationHandler::AutoNavigationHandler()
|
||||
)
|
||||
, _applyStopBehaviorWhenIdle(ApplyStopBehaviorWhenIdleInfo, false)
|
||||
, _relevantNodeTags(RelevantNodeTagsInfo)
|
||||
, _defaultPositionOffsetAngle(DefaultPositionOffsetAngleInfo, 30.f, -90.f, 90.f)
|
||||
, _pickClosestTargetPosition(PickClosestTargetPosInfo, false)
|
||||
, _integrationResolutionPerFrame(IntegrationResolutionInfo, 100, 10, 500)
|
||||
, _speedScale(SpeedScaleInfo, 1.f, 0.01f, 2.f)
|
||||
{
|
||||
addPropertySubOwner(_atNodeNavigator);
|
||||
@@ -145,6 +112,9 @@ AutoNavigationHandler::AutoNavigationHandler()
|
||||
addProperty(_defaultCurveOption);
|
||||
|
||||
addProperty(_includeRoll);
|
||||
addProperty(_speedScale);
|
||||
|
||||
addProperty(_applyStopBehaviorWhenIdle);
|
||||
|
||||
// Must be listed in the same order as in enum definition
|
||||
_stopBehavior.addOptions({
|
||||
@@ -159,8 +129,6 @@ AutoNavigationHandler::AutoNavigationHandler()
|
||||
});
|
||||
addProperty(_stopBehavior);
|
||||
|
||||
addProperty(_applyStopBehaviorWhenIdle);
|
||||
|
||||
// Add the relevant tags
|
||||
_relevantNodeTags = std::vector<std::string>{
|
||||
"planet_solarSystem",
|
||||
@@ -168,11 +136,6 @@ AutoNavigationHandler::AutoNavigationHandler()
|
||||
};;
|
||||
_relevantNodeTags.onChange([this]() { _relevantNodes = findRelevantNodes(); });
|
||||
addProperty(_relevantNodeTags);
|
||||
|
||||
addProperty(_defaultPositionOffsetAngle);
|
||||
addProperty(_pickClosestTargetPosition);
|
||||
addProperty(_integrationResolutionPerFrame);
|
||||
addProperty(_speedScale);
|
||||
}
|
||||
|
||||
AutoNavigationHandler::~AutoNavigationHandler() {} // NOLINT
|
||||
@@ -189,10 +152,6 @@ const std::vector<SceneGraphNode*>& AutoNavigationHandler::relevantNodes() const
|
||||
return _relevantNodes;
|
||||
}
|
||||
|
||||
int AutoNavigationHandler::integrationResolutionPerFrame() const {
|
||||
return _integrationResolutionPerFrame;
|
||||
}
|
||||
|
||||
double AutoNavigationHandler::speedScale() const {
|
||||
return _speedScale;
|
||||
}
|
||||
@@ -212,10 +171,6 @@ bool AutoNavigationHandler::hasFinished() const {
|
||||
void AutoNavigationHandler::updateCamera(double deltaTime) {
|
||||
ghoul_assert(camera() != nullptr, "Camera must not be nullptr");
|
||||
|
||||
if (noCurrentPath()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!_isPlaying) {
|
||||
// For testing, apply at node behavior when idle
|
||||
// @TODO: Determine how this should work instead
|
||||
@@ -225,6 +180,10 @@ void AutoNavigationHandler::updateCamera(double deltaTime) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (noCurrentPath()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// If for some reason the time is no longer paused, pause it again
|
||||
if (!global::timeManager->isPaused()) {
|
||||
global::timeManager->setPause(true);
|
||||
@@ -331,9 +290,7 @@ void AutoNavigationHandler::startPath() {
|
||||
// }
|
||||
//
|
||||
// LINFO("Continuing path...");
|
||||
//
|
||||
// // recompute start camera state for the upcoming path segment,
|
||||
// _currentPath.segments[_currentSegmentIndex].setStartPoint(wayPointFromCamera());
|
||||
// _isPlaying = true;
|
||||
//}
|
||||
|
||||
void AutoNavigationHandler::abortPath() {
|
||||
@@ -509,17 +466,15 @@ Waypoint AutoNavigationHandler::computeDefaultWaypoint(const PathInstruction& in
|
||||
// the solar system, and not stay in the orbital plane
|
||||
stepDirection = glm::dvec3(0.0, 0.0, 1.0);
|
||||
}
|
||||
else if (_pickClosestTargetPosition) {
|
||||
stepDirection = glm::normalize(prevPos - nodePos);
|
||||
}
|
||||
else {
|
||||
// Go to a point that is being lit up by the sun, slightly offsetted from sun
|
||||
// direction
|
||||
const glm::dvec3 targetToPrev = prevPos - nodePos;
|
||||
const glm::dvec3 targetToSun = sunPos - nodePos;
|
||||
|
||||
constexpr const float defaultPositionOffsetAngle = -30.f; // degrees
|
||||
constexpr const float angle = glm::radians(defaultPositionOffsetAngle);
|
||||
const glm::dvec3 axis = glm::normalize(glm::cross(targetToPrev, targetToSun));
|
||||
const float angle = glm::radians(-1.f * _defaultPositionOffsetAngle);
|
||||
const glm::dquat offsetRotation = angleAxis(static_cast<double>(angle), axis);
|
||||
|
||||
stepDirection = glm::normalize(offsetRotation * targetToSun);
|
||||
|
||||
@@ -40,7 +40,6 @@ namespace openspace::autonavigation {
|
||||
|
||||
struct Waypoint;
|
||||
struct PathInstruction;
|
||||
struct TargetNodeInstruction;
|
||||
|
||||
class AutoNavigationHandler : public properties::PropertyOwner {
|
||||
public:
|
||||
@@ -51,7 +50,6 @@ public:
|
||||
Camera* camera() const;
|
||||
const SceneGraphNode* anchor() const;
|
||||
const std::vector<SceneGraphNode*>& relevantNodes() const;
|
||||
int integrationResolutionPerFrame() const;
|
||||
double speedScale() const;
|
||||
|
||||
bool noCurrentPath() const;
|
||||
@@ -76,8 +74,6 @@ private:
|
||||
Waypoint waypointFromCamera();
|
||||
void removeRollRotation(CameraPose& pose, double deltaTime);
|
||||
|
||||
void addSegment(const PathInstruction& ins);
|
||||
|
||||
SceneGraphNode* findNodeNearTarget(const SceneGraphNode* node);
|
||||
Waypoint computeDefaultWaypoint(const PathInstruction& ins);
|
||||
|
||||
@@ -85,13 +81,14 @@ private:
|
||||
|
||||
std::unique_ptr<Path> _currentPath = nullptr;
|
||||
|
||||
AtNodeNavigator _atNodeNavigator; // responsible for navigation during stops
|
||||
AtNodeNavigator _atNodeNavigator;
|
||||
bool _isPlaying = false;
|
||||
|
||||
std::vector<SceneGraphNode*> _relevantNodes;
|
||||
|
||||
properties::OptionProperty _defaultCurveOption;
|
||||
properties::BoolProperty _includeRoll;
|
||||
properties::FloatProperty _speedScale;
|
||||
|
||||
// for testing pause behaviors.
|
||||
// TODO: remove later, if it causes problems with regular navigation
|
||||
@@ -99,10 +96,6 @@ private:
|
||||
properties::OptionProperty _stopBehavior;
|
||||
|
||||
properties::StringListProperty _relevantNodeTags;
|
||||
properties::FloatProperty _defaultPositionOffsetAngle;
|
||||
properties::BoolProperty _pickClosestTargetPosition;
|
||||
properties::IntProperty _integrationResolutionPerFrame;
|
||||
properties::FloatProperty _speedScale;
|
||||
};
|
||||
|
||||
} // namespace openspace::autonavigation
|
||||
|
||||
@@ -34,8 +34,9 @@ namespace {
|
||||
constexpr const openspace::properties::Property::PropertyInfo MinBoundingSphereInfo = {
|
||||
"MinimalValidBoundingSphere",
|
||||
"Minimal Valid Bounding Sphere",
|
||||
"The minimal allowed value for a bounding sphere. Used for computation of target "
|
||||
"positions and path generation, to avoid issues when there is no bounding sphere."
|
||||
"The minimal allowed value for a bounding sphere, in meters. Used for "
|
||||
"computation of target positions and path generation, to avoid issues when "
|
||||
"there is no bounding sphere."
|
||||
};
|
||||
} // namespace
|
||||
|
||||
|
||||
@@ -104,7 +104,7 @@ AvoidCollisionCurve::AvoidCollisionCurve(const Waypoint& start, const Waypoint&
|
||||
// Create extra points to avoid collision
|
||||
removeCollisions();
|
||||
|
||||
_nSegments = _points.size() - 3;
|
||||
_nSegments = static_cast<int>(_points.size() - 3);
|
||||
|
||||
initParameterIntervals();
|
||||
}
|
||||
|
||||
@@ -85,14 +85,12 @@ std::vector<glm::dvec3> Path::controlPoints() const {
|
||||
}
|
||||
|
||||
CameraPose Path::traversePath(double dt) {
|
||||
AutoNavigationModule* module = global::moduleEngine->module<AutoNavigationModule>();
|
||||
AutoNavigationHandler& handler = module->AutoNavigationHandler();
|
||||
const int nSteps = handler.integrationResolutionPerFrame();
|
||||
const int resolution = 50;
|
||||
|
||||
double displacement = helpers::simpsonsRule(
|
||||
_progressedTime,
|
||||
_progressedTime + dt,
|
||||
nSteps,
|
||||
resolution,
|
||||
[this](double t) { return speedAtTime(t); }
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user