24 #ifndef PXR_IMAGING_HD_RETAINEDDATASOURCE_H
25 #define PXR_IMAGING_HD_RETAINEDDATASOURCE_H
57 const HdDataSourceBaseHandle *
values);
62 const HdDataSourceBaseHandle &value1);
67 const HdDataSourceBaseHandle &value1,
69 const HdDataSourceBaseHandle &value2);
74 const HdDataSourceBaseHandle &value1,
76 const HdDataSourceBaseHandle &value2,
78 const HdDataSourceBaseHandle &value3);
83 const HdDataSourceBaseHandle &value1,
85 const HdDataSourceBaseHandle &value2,
87 const HdDataSourceBaseHandle &value3,
89 const HdDataSourceBaseHandle &value4);
94 const HdDataSourceBaseHandle &value1,
96 const HdDataSourceBaseHandle &value2,
98 const HdDataSourceBaseHandle &value3,
100 const HdDataSourceBaseHandle &value4,
102 const HdDataSourceBaseHandle &value5);
107 const HdDataSourceBaseHandle &value1,
109 const HdDataSourceBaseHandle &value2,
111 const HdDataSourceBaseHandle &value3,
113 const HdDataSourceBaseHandle &value4,
115 const HdDataSourceBaseHandle &value5,
117 const HdDataSourceBaseHandle &value6);
140 std::vector<HdSampledDataSource::Time> *outSampleTimes)
override
163 template <
typename T>
176 std::vector<HdSampledDataSource::Time> *outSampleTimes)
override
199 template <
typename T>
218 template <
typename T>
232 std::vector<HdSampledDataSource::Time> *outSampleTimes)
override;
242 typedef std::pair<HdSampledDataSource::Time, T> _SamplePair;
246 template <
typename T>
252 _sampledValues.reserve(count);
256 for (
size_t i = 0; i <
count; ++i) {
257 _sampledValues.emplace_back(sampleTimes[i], sampleValues[i]);
261 template <
typename T>
266 std::vector<HdSampledDataSource::Time> *outSampleTimes)
268 if (_sampledValues.size() < 2) {
272 if (outSampleTimes) {
273 outSampleTimes->clear();
276 outSampleTimes->reserve(_sampledValues.size());
278 for (
const auto & iter : _sampledValues) {
279 outSampleTimes->push_back(iter.first);
286 template <
typename T>
291 if (_sampledValues.empty()) {
297 for (
size_t i = 0, e = _sampledValues.size(); i < e; ++i) {
301 if (sampleTime > shutterOffset) {
305 return _sampledValues[i].second;
310 sampleTime - shutterOffset;
313 if (delta < epsilon) {
314 return _sampledValues[i].second;
321 shutterOffset - _sampledValues[i - 1].first;
323 if (previousDelta <= delta) {
324 return _sampledValues[i - 1].second;
326 return _sampledValues[i].second;
330 if (fabs(sampleTime - shutterOffset) < epsilon) {
331 return _sampledValues[i].second;
337 return _sampledValues.back().second;
357 const HdDataSourceBaseHandle *
values);
363 HdDataSourceBaseHandle
GetElement(
size_t element)
override;
376 HdSampledDataSourceHandle
382 HdDataSourceBaseHandle
388 HdContainerDataSourceHandle
393 #endif // PXR_IMAGING_HD_RETAINEDDATASOURCE_H
T GetTypedValue(HdSampledDataSource::Time shutterOffset) override
VtValue GetValue(HdSampledDataSource::Time shutterOffset) override
HD_API HdRetainedSmallVectorDataSource(size_t count, const HdDataSourceBaseHandle *values)
HD_DECLARE_DATASOURCE(HdRetainedTypedMultisampledDataSource< T >)
static HD_API Handle New()
HD_DECLARE_DATASOURCE_ABSTRACT(HdRetainedContainerDataSource)
HD_API HdDataSourceBaseHandle GetElement(size_t element) override
HD_DECLARE_DATASOURCE_ABSTRACT(HdRetainedTypedSampledDataSource< T >)
HD_DECLARE_DATASOURCE(HdRetainedSampledDataSource)
VtValue GetValue(HdSampledDataSource::Time shutterOffset) override
HD_DECLARE_DATASOURCE(HdRetainedSmallVectorDataSource)
bool GetContributingSampleTimesForInterval(HdSampledDataSource::Time startTime, HdSampledDataSource::Time endTime, std::vector< HdSampledDataSource::Time > *outSampleTimes) override
HD_API HdDataSourceBaseHandle HdMakeStaticCopy(HdDataSourceBaseHandle const &ds)
static HdRetainedTypedSampledDataSource< T >::Handle New(const T &value)
HD_DECLARE_DATASOURCE_HANDLES(HdRetainedContainerDataSource)
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
HD_API HdSampledDataSourceHandle HdCreateTypedRetainedDataSource(VtValue const &v)
GLenum GLsizei GLsizei GLint * values
HD_API size_t GetNumElements() override
HdRetainedTypedMultisampledDataSource(size_t count, HdSampledDataSource::Time *sampleTimes, T *sampleValues)
#define PXR_NAMESPACE_CLOSE_SCOPE
bool GetContributingSampleTimesForInterval(HdSampledDataSource::Time startTime, HdSampledDataSource::Time endTime, std::vector< HdSampledDataSource::Time > *outSampleTimes) override
VtValue GetValue(HdSampledDataSource::Time shutterOffset) override
bool GetContributingSampleTimesForInterval(HdSampledDataSource::Time startTime, HdSampledDataSource::Time endTime, std::vector< HdSampledDataSource::Time > *outSampleTimes) override
HdRetainedSampledDataSource(VtValue value)
HdRetainedTypedSampledDataSource(const T &value)
T GetTypedValue(HdSampledDataSource::Time shutterOffset) override