A utility class that knows how to sample an element from a type-tagged buffer (like HdVtBufferSource).
More...
#include <sampler.h>
|
| | HdEmbreeBufferSampler (HdVtBufferSource const &buffer) |
| | The constructor takes a reference to a buffer source.
|
| |
| bool | Sample (int index, void *value, HdTupleType dataType) const |
| | Sample the buffer at element index index, and write the sample to value.
|
| |
| 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.
Definition at line 79 of file sampler.h.
◆ HdEmbreeBufferSampler()
The constructor takes a reference to a buffer source.
The data is owned externally; the caller is responsible for ensuring the buffer is alive while Sample() is being called.
- Parameters
-
| buffer | The buffer being sampled. |
Definition at line 85 of file sampler.h.
◆ Sample() [1/2]
template<typename T >
| bool Sample |
( |
int | index, |
|
|
T * | value ) const |
|
inline |
◆ Sample() [2/2]
| 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 }.
- Parameters
-
| index | The element index to sample. |
| value | The memory to write the value to (only written on success). |
| dataType | The HdTupleType describing element values. |
- Returns
- True if the value was successfully sampled.
The documentation for this class was generated from the following file: