mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-03-14 01:10:11 -05:00
minor refactor
This commit is contained in:
@@ -26,6 +26,7 @@
|
||||
|
||||
#include <modules/autonavigation/helperfunctions.h>
|
||||
#include <modules/autonavigation/instruction.h>
|
||||
#include <modules/autonavigation/pathcurves.h>
|
||||
#include <modules/autonavigation/pathspecification.h>
|
||||
#include <openspace/engine/globals.h>
|
||||
#include <openspace/engine/windowdelegate.h>
|
||||
|
||||
@@ -74,7 +74,7 @@ std::vector<glm::dvec3> PathCurve::getPoints() {
|
||||
return _points;
|
||||
}
|
||||
|
||||
Bezier3Curve::Bezier3Curve(CameraState& start, CameraState& end) {
|
||||
Bezier3Curve::Bezier3Curve(const CameraState& start, const CameraState& end) {
|
||||
glm::dvec3 startNodePos = sceneGraphNode(start.referenceNode)->worldPosition();
|
||||
glm::dvec3 endNodePos = sceneGraphNode(end.referenceNode)->worldPosition();
|
||||
double startNodeRadius = sceneGraphNode(start.referenceNode)->boundingSphere();
|
||||
@@ -202,7 +202,7 @@ void Bezier3Curve::initParameterIntervals() {
|
||||
_parameterIntervals.swap(newIntervals);
|
||||
}
|
||||
|
||||
LinearCurve::LinearCurve(CameraState& start, CameraState& end) {
|
||||
LinearCurve::LinearCurve(const CameraState& start, const CameraState& end) {
|
||||
_points.push_back(start.position);
|
||||
_points.push_back(end.position);
|
||||
_length = glm::distance(end.position, start.position);
|
||||
|
||||
@@ -31,7 +31,12 @@
|
||||
|
||||
namespace openspace::autonavigation {
|
||||
|
||||
// OBS! Path curves has curve parameter in range [0,1]
|
||||
enum CurveType {
|
||||
Bezier3,
|
||||
Linear,
|
||||
Pause // OBS! Temporary special case for handling pauses
|
||||
};
|
||||
|
||||
class PathCurve {
|
||||
public:
|
||||
virtual ~PathCurve() = 0;
|
||||
@@ -50,11 +55,12 @@ protected:
|
||||
|
||||
// the total length of the curve (approximated)
|
||||
double _length;
|
||||
|
||||
};
|
||||
|
||||
class Bezier3Curve : public PathCurve {
|
||||
public:
|
||||
Bezier3Curve(CameraState& start, CameraState& end);
|
||||
Bezier3Curve(const CameraState& start, const CameraState& end);
|
||||
glm::dvec3 positionAt(double u);
|
||||
|
||||
private:
|
||||
@@ -66,7 +72,7 @@ private:
|
||||
|
||||
class LinearCurve : public PathCurve {
|
||||
public:
|
||||
LinearCurve(CameraState& start, CameraState& end);
|
||||
LinearCurve(const CameraState& start, const CameraState& end);
|
||||
glm::dvec3 positionAt(double u);
|
||||
|
||||
};
|
||||
|
||||
@@ -26,20 +26,12 @@
|
||||
#define __OPENSPACE_MODULE___PATHSEGMENT___H__
|
||||
|
||||
#include <modules/autonavigation/camerastate.h>
|
||||
#include <modules/autonavigation/pathcurves.h>
|
||||
#include <ghoul/glm.h>
|
||||
#include <vector>
|
||||
|
||||
namespace openspace::autonavigation {
|
||||
|
||||
// TODO: place this enum somewhere else
|
||||
enum CurveType {
|
||||
Bezier3,
|
||||
Linear,
|
||||
Pause // OBS! Temporary special case for handling pauses
|
||||
};
|
||||
|
||||
class PathCurve;
|
||||
|
||||
class PathSegment {
|
||||
public:
|
||||
PathSegment(CameraState start, CameraState end, double startTime, CurveType type);
|
||||
|
||||
Reference in New Issue
Block a user