Revert "Better handle interpolation when setting interpolation time to 0"

This reverts commit 8cf5f96392.
This commit is contained in:
Alexander Bock
2020-12-11 12:30:05 +01:00
parent 37761dde2a
commit 778b4e61b3
3 changed files with 4 additions and 22 deletions

View File

@@ -51,7 +51,6 @@ public:
private:
std::function<T(float)> _transferFunction;
bool _isInterpolating = false;
float _t = 1.f;
float _interpolationTime = 1.f;
float _scaledDeltaTime = 0.f;

View File

@@ -34,28 +34,16 @@ Interpolator<T>::Interpolator()
template <typename T>
void Interpolator<T>::start() {
_t = 0.f;
_isInterpolating = true;
}
template <typename T>
void Interpolator<T>::end() {
_t = 1.f;
_isInterpolating = false;
}
template <typename T>
void Interpolator<T>::setDeltaTime(float deltaTime) {
if (_interpolationTime > 0.f) {
_scaledDeltaTime = deltaTime / _interpolationTime;
}
else {
if (deltaTime > 0.f) {
_scaledDeltaTime = 1.f;
}
else {
_scaledDeltaTime = -1.f;
}
}
_scaledDeltaTime = deltaTime / _interpolationTime;
}
template <typename T>
@@ -71,7 +59,7 @@ void Interpolator<T>::setInterpolationTime(float interpolationTime) {
template <typename T>
void Interpolator<T>::step() {
_t += _scaledDeltaTime;
_t = glm::clamp(_t, 0.f, 1.f);
_t = glm::clamp(_t, 0.0f, 1.0f);
}
template <typename T>
@@ -86,7 +74,7 @@ T Interpolator<T>::value() const {
template <typename T>
bool Interpolator<T>::isInterpolating() const {
return _isInterpolating;
return (_t < 1.f) && (_t >= 0.f);
}
} // namespace openspace::interaction