Disable view extrapolation
This commit is contained in:
@@ -27,7 +27,7 @@
|
|||||||
#include <list>
|
#include <list>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
|
|
||||||
template <typename Derived, typename Data, bool extrapolate = false, size_t MaxSamples = 10>
|
template <typename Derived, typename Data, XrDuration extrapolation = 0, size_t MaxSamples = 10>
|
||||||
class history
|
class history
|
||||||
{
|
{
|
||||||
struct TimedData : public Data
|
struct TimedData : public Data
|
||||||
@@ -127,10 +127,11 @@ public:
|
|||||||
|
|
||||||
if (data.front().at_timestamp_ns > at_timestamp_ns)
|
if (data.front().at_timestamp_ns > at_timestamp_ns)
|
||||||
{
|
{
|
||||||
if constexpr (extrapolate)
|
if constexpr (extrapolation)
|
||||||
{
|
{
|
||||||
auto second = data.begin();
|
auto second = data.begin();
|
||||||
auto first = second++;
|
auto first = second++;
|
||||||
|
at_timestamp_ns = std::max(at_timestamp_ns, data.front().at_timestamp_ns - extrapolation);
|
||||||
return {ex, Derived::extrapolate(*first, *second, first->at_timestamp_ns, second->at_timestamp_ns, at_timestamp_ns)};
|
return {ex, Derived::extrapolate(*first, *second, first->at_timestamp_ns, second->at_timestamp_ns, at_timestamp_ns)};
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -147,10 +148,11 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if constexpr (extrapolate)
|
if constexpr (extrapolation)
|
||||||
{
|
{
|
||||||
auto prev = data.rbegin();
|
auto prev = data.rbegin();
|
||||||
auto last = prev++;
|
auto last = prev++;
|
||||||
|
at_timestamp_ns = std::min(at_timestamp_ns, data.back().at_timestamp_ns + extrapolation);
|
||||||
return {ex, Derived::extrapolate(*prev, *last, prev->at_timestamp_ns, last->at_timestamp_ns, at_timestamp_ns)};
|
return {ex, Derived::extrapolate(*prev, *last, prev->at_timestamp_ns, last->at_timestamp_ns, at_timestamp_ns)};
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ struct tracked_views
|
|||||||
std::array<xrt_fov, 2> fovs;
|
std::array<xrt_fov, 2> fovs;
|
||||||
};
|
};
|
||||||
|
|
||||||
class view_list : public history<view_list, tracked_views, true>
|
class view_list : public history<view_list, tracked_views>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static tracked_views interpolate(const tracked_views & a, const tracked_views & b, float t);
|
static tracked_views interpolate(const tracked_views & a, const tracked_views & b, float t);
|
||||||
|
|||||||
Reference in New Issue
Block a user