Loading...
Searching...
No Matches
computedDataSource.h
Go to the documentation of this file.
1//
2// Copyright 2026 Pixar
3//
4// Licensed under the terms set forth in the LICENSE.txt file available at
5// https://openusd.org/license.
6//
7#ifndef PXR_USD_IMAGING_USD_EXEC_IMAGING_COMPUTED_DATA_SOURCE_H
8#define PXR_USD_IMAGING_USD_EXEC_IMAGING_COMPUTED_DATA_SOURCE_H
9
11
12#include "pxr/pxr.h"
13
14#include "pxr/usdImaging/usdExecImaging/api.h"
17
18#include "pxr/base/vt/value.h"
19#include "pxr/imaging/hd/dataSource.h"
20
21#include <utility>
22
23PXR_NAMESPACE_OPEN_SCOPE
24
25
33{
34public:
35 using Time = HdSampledDataSource::Time;
36
37 USDEXECIMAGING_API
39 UsdExecImagingRequestAccessorSharedPtr requestAccessor,
40 UsdExecImagingValueKey valueKey);
41
42 USDEXECIMAGING_API
43 VtValue GetValue(Time shutterOffset) const;
44
45 USDEXECIMAGING_API
46 bool GetContributingSampleTimesForInterval(
47 Time startTime,
48 Time endTime,
49 std::vector<Time> * outSampleTimes) const;
50
51private:
52 UsdExecImagingRequestAccessorSharedPtr _requestAccessor;
53 UsdExecImagingValueKey _valueKey;
54};
55
62{
63public:
64 HD_DECLARE_DATASOURCE(UsdExecImagingComputedSampledDataSource)
65
66 USDEXECIMAGING_API
68
69 VtValue GetValue(Time shutterOffset) override {
70 return _impl.GetValue(shutterOffset);
71 }
72
74 Time startTime,
75 Time endTime,
76 std::vector<Time> *outSampleTimes) override {
77 return _impl.GetContributingSampleTimesForInterval(
78 startTime, endTime, outSampleTimes);
79 }
80
81private:
83 UsdExecImagingRequestAccessorSharedPtr requestAccessor,
85 : _impl(std::move(requestAccessor), std::move(valueKey))
86 {}
87
88private:
90};
91
97template <class ValueType>
99 : public HdTypedSampledDataSource<ValueType>
100{
101public:
102 HD_DECLARE_DATASOURCE(
104
105 using Time = HdSampledDataSource::Time;
106
107 VtValue GetValue(Time shutterOffset) override {
108 return _impl.GetValue(shutterOffset);
109 }
110
111 ValueType GetTypedValue(Time shutterOffset) override {
112 return _impl.GetValue(shutterOffset).template Get<ValueType>();
113 }
114
116 Time startTime,
117 Time endTime,
118 std::vector<Time> *outSampleTimes) override {
119 return _impl.GetContributingSampleTimesForInterval(
120 startTime, endTime, outSampleTimes);
121 }
122
123private:
125 UsdExecImagingRequestAccessorSharedPtr requestAccessor,
126 UsdExecImagingValueKey valueKey)
127 : _impl(std::move(requestAccessor), std::move(valueKey))
128 {}
129
130private:
132};
133
134PXR_NAMESPACE_CLOSE_SCOPE
135
136#endif
A datasource representing time-sampled values.
Definition dataSource.h:154
A datasource representing a concretely-typed sampled value.
Definition dataSource.h:200
Common implementation for data sources that produce exec-computed values.
An HdSampledDataSource that produces exec-computed values.
bool GetContributingSampleTimesForInterval(Time startTime, Time endTime, std::vector< Time > *outSampleTimes) override
Given a shutter window of interest (startTime and endTime relative to the current frame),...
VtValue GetValue(Time shutterOffset) override
Returns the value of this data source at frame-relative time shutterOffset.
An HdTypedSampledDataSource that produces exec-computed values.
bool GetContributingSampleTimesForInterval(Time startTime, Time endTime, std::vector< Time > *outSampleTimes) override
Given a shutter window of interest (startTime and endTime relative to the current frame),...
VtValue GetValue(Time shutterOffset) override
Returns the value of this data source at frame-relative time shutterOffset.
ValueType GetTypedValue(Time shutterOffset) override
Returns the value of this data source at frame-relative time shutterOffset, as type T.
Identifies a value that is computed by exec.
Definition valueKey.h:27
Provides a container which may hold any type, and provides introspection and iteration over array typ...
Definition value.h:90
STL namespace.