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

This class implements the HdEmbreePrimvarSampler interface for primvars on triangle meshes with "vertex" or "varying" interpolation modes. More...

+ Inheritance diagram for HdEmbreeTriangleVertexSampler:

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...
 

Detailed Description

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.

Constructor & Destructor Documentation

HdEmbreeTriangleVertexSampler ( TfToken const &  name,
VtValue const &  value,
VtVec3iArray const &  indices 
)
inline

Constructor.

Parameters
nameThe name of the primvar.
valueThe buffer data for the primvar.
indicesA map from triangle index to vertex indices in the triangulated geometry.

Definition at line 175 of file meshSamplers.h.

Member Function Documentation

virtual bool Sample ( unsigned int  element,
float  u,
float  v,
void *  value,
HdTupleType  dataType 
) const
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

Parameters
elementThe element index to sample.
uThe u coordinate to sample.
vThe v coordinate 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.

Implements HdEmbreePrimvarSampler.


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