|
This class implements the HdEmbreePrimvarSampler interface for primvars on subdiv meshes with "vertex" interpolation mode. More...
#include <meshSamplers.h>
Public Member Functions | |
HdEmbreeSubdivVertexSampler (TfToken const &name, VtValue const &value, RTCScene meshScene, unsigned meshId, HdEmbreeRTCBufferAllocator *allocator) | |
Constructor. | |
virtual | ~HdEmbreeSubdivVertexSampler () |
Destructor. Frees the embree user vertex buffer. | |
virtual bool | Sample (unsigned int element, float u, float v, void *value, HdTupleType dataType) const |
Sample the primvar at an (element, u, v) location. | |
Public Member Functions inherited from HdEmbreePrimvarSampler | |
HdEmbreePrimvarSampler ()=default | |
Default constructor. | |
virtual | ~HdEmbreePrimvarSampler ()=default |
Default destructor. | |
virtual bool | Sample (unsigned int element, float u, float v, void *value, HdTupleType dataType) const =0 |
Sample the primvar at element index index and local basis coordinates u and v , writing the sample to value . | |
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] }. | |
This class implements the HdEmbreePrimvarSampler interface for primvars on subdiv meshes with "vertex" interpolation mode.
This means the buffer has one item per vertex, and the result of sampling is a reconstruction using the subdivision scheme basis weights. It uses embree's user vertex buffers and rtcInterpolate API to accomplish the sampling.
Definition at line 270 of file meshSamplers.h.
HdEmbreeSubdivVertexSampler | ( | TfToken const & | name, |
VtValue const & | value, | ||
RTCScene | meshScene, | ||
unsigned | meshId, | ||
HdEmbreeRTCBufferAllocator * | allocator | ||
) |
Constructor.
Allocates an embree user vertex buffer, and uploads the primvar data. Only float-based types (float, GfVec3f, GfMatrix4f) are allowed, and embree has an exhaustible number of user vertex buffers (16 at last count).
name | The name of the primvar. |
value | The buffer data for the primvar. |
meshScene | The owning mesh's embree prototype scene. |
meshId | The owning mesh's geometry id in the prototype scene. |
allocator | A mesh-global object that tracks buffer usage. |
|
virtual |
Destructor. Frees the embree user vertex buffer.
|
virtual |
Sample the primvar at an (element, u, v) location.
This implementation delegates to rtcInterpolate(). Only float-based types (float, GfVec3f, GfMatrix4f) are allowed.
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.