Loading...
Searching...
No Matches
HdEmbreePrimvarSampler Class Referenceabstract

An abstract base class that knows how to sample a primvar signal given a ray hit coordinate: an <element, u, v> tuple. More...

#include <sampler.h>

+ Inheritance diagram for HdEmbreePrimvarSampler:

Public Member Functions

 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
 

Static Protected Member Functions

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

Detailed Description

An abstract base class that knows how to sample a primvar signal given a ray hit coordinate: an <element, u, v> tuple.

It provides templated accessors, but derived classes are responsible for implementing appropriate sampling or interpolation modes.

Definition at line 136 of file sampler.h.

Constructor & Destructor Documentation

◆ HdEmbreePrimvarSampler()

Default constructor.

◆ ~HdEmbreePrimvarSampler()

virtual ~HdEmbreePrimvarSampler ( )
virtualdefault

Default destructor.

Member Function Documentation

◆ _Interpolate()

static bool _Interpolate ( void *  out,
void **  samples,
float *  weights,
size_t  sampleCount,
HdTupleType  dataType 
)
staticprotected

Utility function for derived classes: combine multiple samples with blend weights: out = sum_i { samples[i] * weights[i] }.

Parameters
outThe memory to write the output to (only written on success).
samplesThe array of sample pointers (length sampleCount).
weightsThe array of sample weights (length sampleCount).
sampleCountThe number of samples to combine.
dataTypeThe HdTupleType describing element values.
Returns
True if the samples were successfully combined.

◆ Sample() [1/2]

bool Sample ( unsigned int  element,
float  u,
float  v,
T *  value 
) const
inline

Definition at line 163 of file sampler.h.

◆ Sample() [2/2]

virtual bool Sample ( unsigned int  element,
float  u,
float  v,
void *  value,
HdTupleType  dataType 
) const
pure virtual

Sample the primvar at element index index and local basis coordinates u and v, writing 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.

Derived classes are responsible for implementing sampling logic for their particular interpolation modes. Sample returns true if a value was successfully retrieved.

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.

Implemented in HdEmbreeConstantSampler, HdEmbreeUniformSampler, HdEmbreeTriangleVertexSampler, HdEmbreeTriangleFaceVaryingSampler, and HdEmbreeSubdivVertexSampler.


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