25#ifndef PXR_BASE_TS_EVALUATOR_H
26#define PXR_BASE_TS_EVALUATOR_H
29#include "pxr/base/ts/evalCache.h"
30#include "pxr/base/ts/spline.h"
31#include "pxr/base/ts/types.h"
37PXR_NAMESPACE_OPEN_SCOPE
59 T
Eval(
const TsTime &time, TsSide side=TsRight)
const;
65 std::vector<std::shared_ptr<Ts_EvalCache<T> > > _segments;
82 if (spline.
size() > 1) {
87 if (kf.GetKnotType() == TsKnotBezier) {
96 _segments.reserve(spline.size() - 1);
106 if (iAfterTime == spline.end()) {
110 std::shared_ptr<Ts_EvalCache<T> > segmentCache =
111 Ts_EvalCache<T>::New(*splItr, *iAfterTime);
114 _segments.push_back(segmentCache);
128 if (!_segments.empty() && side == TsRight) {
132 if (time >= _spline.begin()->GetTime() &&
133 time <= _spline.rbegin()->GetTime()) {
137 if (
TF_VERIFY(sample != _spline.end())) {
144 size_t idx = sample - _spline.begin();
145 if (sample->GetTime() > time &&
TF_VERIFY(idx > 0)) {
151 return _segments[idx]->TypedEval(time);
158 if (!_spline.empty()) {
159 return _spline.Eval(time).template Get<T>();
163 return TsTraits<T>::zero;
166PXR_NAMESPACE_CLOSE_SCOPE
Opaque interface to a spline for evaluations using cached segments.
T Eval(const TsTime &time, TsSide side=TsRight) const
Evaluates the spline at the given time.
TsEvaluator()
Default constructor; falls back to empty spline.
Specifies the value of an TsSpline object at a particular point in time.
Represents a spline value object.
TS_API size_t size() const
\group Container API
TsKeyFrameMap::const_iterator const_iterator
Our iterators are simply iterators into the contained TsKeyFrameMap We only expose const iterators be...
#define TF_FOR_ALL(iter, c)
Macro for iterating over a container.
#define TF_VERIFY(cond, format,...)
Checks a condition and reports an error if it evaluates false.
#define TRACE_FUNCTION()
Records a timestamp when constructed and a timespan event when destructed, using the name of the func...