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:
Andreas Engberg
2025-12-03 10:48:30 +01:00
parent ee0fe58535
commit febd298556
44 changed files with 6779 additions and 0 deletions

View File

@@ -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;

View File

@@ -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
{