mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-02-11 22:20:47 -06:00
Update Solarbrowsing branch to compile on latest master
Also includes some additional minor changes from the original feature/solarbrowsing branch
This commit is contained in:
@@ -72,7 +72,9 @@ public:
|
||||
void removeKeyframesBetween(double begin, double end, bool inclusiveBegin = false,
|
||||
bool inclusiveEnd = false);
|
||||
size_t nKeyframes() const;
|
||||
Keyframe<T>* firstKeyframeAfter(double timestamp, bool inclusive = false);
|
||||
const Keyframe<T>* firstKeyframeAfter(double timestamp, bool inclusive = false) const;
|
||||
Keyframe<T>* lastKeyframeBefore(double timestamp, bool inclusive = false);
|
||||
const Keyframe<T>* lastKeyframeBefore(double timestamp, bool inclusive = false) const;
|
||||
|
||||
const std::deque<Keyframe<T>>& keyframes() const;
|
||||
|
||||
@@ -168,6 +168,34 @@ size_t Timeline<T>::nKeyframes() const {
|
||||
return _keyframes.size();
|
||||
}
|
||||
|
||||
|
||||
template <typename T>
|
||||
Keyframe<T>* Timeline<T>::firstKeyframeAfter(double timestamp, bool inclusive)
|
||||
{
|
||||
typename std::deque<Keyframe<T>>::iterator it;
|
||||
if (inclusive) {
|
||||
it = std::lower_bound(
|
||||
_keyframes.begin(),
|
||||
_keyframes.end(),
|
||||
timestamp,
|
||||
&compareKeyframeTimeWithTime
|
||||
);
|
||||
}
|
||||
else {
|
||||
it = std::upper_bound(
|
||||
_keyframes.begin(),
|
||||
_keyframes.end(),
|
||||
timestamp,
|
||||
&compareTimeWithKeyframeTime
|
||||
);
|
||||
}
|
||||
|
||||
if (it == _keyframes.end()) {
|
||||
return nullptr;
|
||||
}
|
||||
return &(*it);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
const Keyframe<T>* Timeline<T>::firstKeyframeAfter(double timestamp, bool inclusive) const
|
||||
{
|
||||
@@ -195,6 +223,34 @@ const Keyframe<T>* Timeline<T>::firstKeyframeAfter(double timestamp, bool inclus
|
||||
return &(*it);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
Keyframe<T>* Timeline<T>::lastKeyframeBefore(double timestamp, bool inclusive)
|
||||
{
|
||||
typename std::deque<Keyframe<T>>::iterator it;
|
||||
if (inclusive) {
|
||||
it = std::upper_bound(
|
||||
_keyframes.begin(),
|
||||
_keyframes.end(),
|
||||
timestamp,
|
||||
&compareTimeWithKeyframeTime
|
||||
);
|
||||
}
|
||||
else {
|
||||
it = std::lower_bound(
|
||||
_keyframes.begin(),
|
||||
_keyframes.end(),
|
||||
timestamp,
|
||||
&compareKeyframeTimeWithTime
|
||||
);
|
||||
}
|
||||
|
||||
if (it == _keyframes.begin()) {
|
||||
return nullptr;
|
||||
}
|
||||
it--;
|
||||
return &(*it);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
const Keyframe<T>* Timeline<T>::lastKeyframeBefore(double timestamp, bool inclusive) const
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user