mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-03-07 21:08:33 -06:00
Woops, stick to the same parameter for position and orientation
It broke the look at rotation :D
This commit is contained in:
@@ -116,7 +116,7 @@ double Path::speedAtTime(double time) const {
|
||||
CameraPose Path::interpolatedPose(double distance) const {
|
||||
const double relativeDistance = distance / pathLength();
|
||||
CameraPose cs;
|
||||
cs.position = _curve->positionAt(distance);
|
||||
cs.position = _curve->positionAt(relativeDistance);
|
||||
cs.rotation = interpolateRotation(relativeDistance);
|
||||
return cs;
|
||||
}
|
||||
@@ -151,7 +151,7 @@ glm::dquat Path::interpolateRotation(double t) const {
|
||||
const double tScaled = ghoul::cubicEaseInOut((t - t1) / (t2 - t1));
|
||||
lookAtPos = ghoul::interpolateLinear(tScaled, startNodePos, endNodePos);
|
||||
}
|
||||
else if (t2 < t) {
|
||||
else if (t > t2) {
|
||||
// Compute a position in front of the camera at the end orientation
|
||||
const double inFrontDistance = glm::distance(endPos, endNodePos);
|
||||
const glm::dvec3 viewDir = helpers::viewDirection(_end.rotation());
|
||||
|
||||
@@ -45,8 +45,8 @@ const double PathCurve::length() const {
|
||||
return _totalLength;
|
||||
}
|
||||
|
||||
glm::dvec3 PathCurve::positionAt(double length) {
|
||||
const double u = curveParameter(length);
|
||||
glm::dvec3 PathCurve::positionAt(double relativeDistance) {
|
||||
const double u = curveParameter(relativeDistance * _totalLength);
|
||||
return interpolate(u);
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ public:
|
||||
virtual ~PathCurve() = 0;
|
||||
|
||||
const double length() const;
|
||||
glm::dvec3 positionAt(double length);
|
||||
glm::dvec3 positionAt(double relativeDistance);
|
||||
|
||||
// Compute curve parameter u that matches the input arc length s
|
||||
double curveParameter(double s);
|
||||
|
||||
Reference in New Issue
Block a user