This class implements the HdEmbreePrimvarSampler interface for primvars on triangle meshes with "vertex" or "varying" interpolation modes. More...
Public Member Functions | |
HdEmbreeTriangleVertexSampler (TfToken const &name, VtValue const &value, VtVec3iArray const &indices) | |
Constructor. More... | |
virtual bool | Sample (unsigned int element, float u, float v, void *value, HdTupleType dataType) const |
Sample the primvar at an (element, u, v) location. More... | |
Public Member Functions inherited from HdEmbreePrimvarSampler | |
HdEmbreePrimvarSampler ()=default | |
Default constructor. More... | |
virtual | ~HdEmbreePrimvarSampler ()=default |
Default destructor. More... | |
template<typename T > | |
bool | Sample (unsigned int element, float u, float v, T *value) const |
Additional Inherited Members | |
Static Protected Member Functions inherited from HdEmbreePrimvarSampler | |
static bool | _Interpolate (void *out, void **samples, float *weights, size_t sampleCount, HdTupleType dataType) |
Utility function for derived classes: combine multiple samples with blend weights: out = sum_i { samples [i] * weights [i] }. More... | |
This class implements the HdEmbreePrimvarSampler interface for primvars on triangle meshes with "vertex" or "varying" interpolation modes.
This means the buffer has one item per vertex, and the result of sampling is a barycentric interpolation of the hit face vertices. This class requires the triangulated mesh topology, to map from the triangle index (in "element") to the triangle vertices.
Definition at line 168 of file meshSamplers.h.
|
inline |
Constructor.
name | The name of the primvar. |
value | The buffer data for the primvar. |
indices | A map from triangle index to vertex indices in the triangulated geometry. |
Definition at line 175 of file meshSamplers.h.
|
virtual |
Sample the primvar at an (element, u, v) location.
For vertex primvars, the vertex indices of the triangle are stored in _indices[element][0-2]. After fetching the primvar value for each of the three vertices, they are interpolated as follows, per Embree specification: t_uv = (1-u-v)*t0 + u*t1 + v*t2
element | The element index to sample. |
u | The u coordinate to sample. |
v | The v coordinate to sample. |
value | The memory to write the value to (only written on success). |
dataType | The HdTupleType describing element values. |
Implements HdEmbreePrimvarSampler.