24 #ifndef PXR_IMAGING_PLUGIN_HD_EMBREE_SAMPLER_H 25 #define PXR_IMAGING_PLUGIN_HD_EMBREE_SAMPLER_H 30 #include "pxr/imaging/hd/enums.h" 31 #include "pxr/imaging/hd/vtBufferSource.h" 45 PXR_NAMESPACE_OPEN_SCOPE
62 #define TYPE_HELPER(T,type)\ 63 template<> inline HdTupleType \ 64 HdEmbreeTypeHelper::GetTupleType<T>() { return HdTupleType{type, 1}; } 66 TYPE_HELPER(
bool, HdTypeBool)
67 TYPE_HELPER(
char, HdTypeInt8)
68 TYPE_HELPER(
short, HdTypeInt16)
69 TYPE_HELPER(
unsigned short, HdTypeUInt16)
70 TYPE_HELPER(
int, HdTypeInt32)
71 TYPE_HELPER(
GfVec2i, HdTypeInt32Vec2)
72 TYPE_HELPER(
GfVec3i, HdTypeInt32Vec3)
73 TYPE_HELPER(
GfVec4i, HdTypeInt32Vec4)
74 TYPE_HELPER(
unsigned int, HdTypeUInt32)
75 TYPE_HELPER(
float, HdTypeFloat)
76 TYPE_HELPER(
GfVec2f, HdTypeFloatVec2)
77 TYPE_HELPER(
GfVec3f, HdTypeFloatVec3)
78 TYPE_HELPER(
GfVec4f, HdTypeFloatVec4)
79 TYPE_HELPER(
double, HdTypeDouble)
80 TYPE_HELPER(
GfVec2d, HdTypeDoubleVec2)
81 TYPE_HELPER(
GfVec3d, HdTypeDoubleVec3)
82 TYPE_HELPER(
GfVec4d, HdTypeDoubleVec4)
85 TYPE_HELPER(
GfQuath, HdTypeHalfFloatVec4)
121 template<
typename T>
bool Sample(
int index, T* value)
const {
122 return Sample(index, static_cast<void*>(value),
123 HdEmbreeTypeHelper::GetTupleType<T>());
159 virtual bool Sample(
unsigned int element,
float u,
float v,
void* value,
163 template<
typename T>
bool Sample(
unsigned int element,
float u,
float v,
165 return Sample(element, u, v, static_cast<void*>(value),
166 HdEmbreeTypeHelper::GetTupleType<T>());
178 static bool _Interpolate(
void* out,
void** samples,
float* weights,
182 PXR_NAMESPACE_CLOSE_SCOPE
184 #endif // PXR_IMAGING_PLUGIN_HD_EMBREE_SAMPLER_H Basic type: a quaternion, a complex number with a real coefficient and three imaginary coefficients,...
Basic type for a vector of 4 int components.
Stores a 4x4 matrix of float elements.
bool Sample(int index, void *value, HdTupleType dataType) const
Sample the buffer at element index index, and write the sample to value.
static HdTupleType GetTupleType()
Return the HdTupleType corresponding to the given C++ type.
Basic type for a vector of 2 int components.
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 ...
A utility class that helps map between C++ types and Hd type tags.
HdEmbreeBufferSampler(HdVtBufferSource const &buffer)
The constructor takes a reference to a buffer source.
HdTupleType represents zero, one, or more values of the same HdType.
Basic type for a vector of 3 float components.
An abstract base class that knows how to sample a primvar signal given a ray hit coordinate: an <elem...
Basic type for a vector of 4 double components.
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 { samp...
Basic type for a vector of 2 double components.
Stores a 4x4 matrix of double elements.
Basic type for a vector of 3 int components.
virtual ~HdEmbreePrimvarSampler()=default
Default destructor.
Basic type for a vector of 4 float components.
Basic type for a vector of 2 float components.
Basic type for a vector of 3 double components.
A utility class that knows how to sample an element from a type-tagged buffer (like HdVtBufferSource)...
HdEmbreePrimvarSampler()=default
Default constructor.
An implementation of HdBufferSource where the source data value is a VtValue.
char PrimvarTypeContainer[sizeof(GfMatrix4d)]
Define a type that can hold one sample of any primvar.