A utility class that knows how to sample an element from a type-tagged buffer (like HdVtBufferSource). More...
Public Member Functions | |
HdEmbreeBufferSampler (HdVtBufferSource const &buffer) | |
The constructor takes a reference to a buffer source. More... | |
bool | Sample (int index, void *value, HdTupleType dataType) const |
Sample the buffer at element index index , and write the sample to value . More... | |
template<typename T > | |
bool | Sample (int index, T *value) const |
A utility class that knows how to sample an element from a type-tagged buffer (like HdVtBufferSource).
This class provides templated accessors to let the caller directly get the final sample type; it also does bounds checks and type checks.
|
inline |
bool Sample | ( | int | index, |
void * | value, | ||
HdTupleType | dataType | ||
) | const |
Sample the buffer at element index index
, and write the sample to value
.
Interpret value
as having arity numComponents
, each of type componentType
. These parameters may not match the datatype declaration of the underlying buffer, in which case Sample returns false. Sample also returns false if index
is out of bounds.
For example, to sample data as GfVec3, dataType
would be HdTupleType { HdTypeFloatVec3, 1 }.
index | The element index to sample. |
value | The memory to write the value to (only written on success). |
dataType | The HdTupleType describing element values. |