All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
HdEmbreeBufferSampler Class Reference

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
 

Detailed Description

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 95 of file sampler.h.

Constructor & Destructor Documentation

HdEmbreeBufferSampler ( HdVtBufferSource const &  buffer)
inline

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
bufferThe buffer being sampled.

Definition at line 101 of file sampler.h.

Member Function Documentation

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
indexThe element index to sample.
valueThe memory to write the value to (only written on success).
dataTypeThe HdTupleType describing element values.
Returns
True if the value was successfully sampled.

The documentation for this class was generated from the following file: