7 #ifndef PXR_USD_SDF_COMPOSE_TIME_SAMPLE_SERIES_H
8 #define PXR_USD_SDF_COMPOSE_TIME_SAMPLE_SERIES_H
43 class GetTimeFn,
class GetValueFn,
44 class ComposeFn,
class OutputFn,
48 Iter strongBegin, Iter strongEnd,
49 Iter weakBegin, Iter weakEnd,
50 GetTimeFn
const &getTime,
52 ComposeFn
const &composeFn,
53 OutputFn
const &outputFn,
57 if (weakBegin == weakEnd) {
58 while (strongBegin != strongEnd) {
59 outputFn(
getValue(strongBegin), getTime(strongBegin));
64 if (strongBegin == strongEnd) {
65 while (weakBegin != weakEnd) {
66 outputFn(
getValue(weakBegin), getTime(weakBegin));
72 auto held = [&getTime, ×Equal](Iter iter, Iter
begin, Iter
end,
74 return iter == end || (!timesEqual(
80 constexpr
double inf = std::numeric_limits<double>::infinity();
82 Iter strongIter = strongBegin;
83 Iter weakIter = weakBegin;
85 while (strongIter != strongEnd || weakIter != weakEnd) {
86 const double strongTime =
87 strongIter == strongEnd ? inf : getTime(strongIter);
88 const double weakTime =
89 weakIter == weakEnd ? inf : getTime(weakIter);
90 if (strongTime <= weakTime) {
91 if (
auto composed = composeFn(
93 getValue(held(weakIter, weakBegin, weakEnd,
95 outputFn(std::move(*composed), strongTime);
98 outputFn(
getValue(strongIter), strongTime);
102 if (
auto composed = composeFn(
103 getValue(held(strongIter, strongBegin, strongEnd,
106 outputFn(std::move(*composed), weakTime);
116 if (strongIter == strongEnd) {
119 else if (weakIter == weakEnd) {
123 if (timesEqual(strongTime, weakTime)) {
124 ++strongIter, ++weakIter;
126 else if (strongTime < weakTime) {
138 #endif // PXR_USD_SDF_COMPOSE_TIME_SAMPLE_SERIES_H
GT_API const UT_StringHolder time
#define PXR_NAMESPACE_OPEN_SCOPE
__hostdev__ float getValue(uint32_t i) const
PcpNodeRef_ChildrenIterator begin(const PcpNodeRef::child_const_range &r)
Support for range-based for loops for PcpNodeRef children ranges.
void SdfComposeTimeSampleSeries(Iter strongBegin, Iter strongEnd, Iter weakBegin, Iter weakEnd, GetTimeFn const &getTime, GetValueFn const &getValue, ComposeFn const &composeFn, OutputFn const &outputFn, TimesEqualFn const ×Equal=Sdf_timesEqualDefaultFn)
bool GfIsClose(GfColor const &c1, GfColor const &c2, double tolerance)
#define PXR_NAMESPACE_CLOSE_SCOPE
PXR_NAMESPACE_OPEN_SCOPE auto Sdf_timesEqualDefaultFn